Skip to content
Snippets Groups Projects
Commit 5be3e20c authored by Philipp Zabel's avatar Philipp Zabel Committed by Nicolas Dufresne
Browse files

media: hantro: relax s_fmt(out) busy error


Setting the output format resets the capture queue, so we return -EBUSY
while the capture queue has buffers allocated. If capture dimensions
and pixel format don't change though, we can allow setting the output
format without reallocating the capture queue.

Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent c0842750
Branches
No related tags found
No related merge requests found
...@@ -368,7 +368,7 @@ vidioc_s_fmt_out_mplane(struct file *file, void *priv, struct v4l2_format *f) ...@@ -368,7 +368,7 @@ vidioc_s_fmt_out_mplane(struct file *file, void *priv, struct v4l2_format *f)
struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp; struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp;
struct hantro_ctx *ctx = fh_to_ctx(priv); struct hantro_ctx *ctx = fh_to_ctx(priv);
struct vb2_queue *vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type); struct vb2_queue *vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type);
const struct hantro_fmt *formats; const struct hantro_fmt *raw_vpu_fmt, *formats;
unsigned int num_fmts; unsigned int num_fmts;
int ret; int ret;
...@@ -394,8 +394,16 @@ vidioc_s_fmt_out_mplane(struct file *file, void *priv, struct v4l2_format *f) ...@@ -394,8 +394,16 @@ vidioc_s_fmt_out_mplane(struct file *file, void *priv, struct v4l2_format *f)
*/ */
peer_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, peer_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx,
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
if (vb2_is_busy(peer_vq)) if (vb2_is_busy(peer_vq)) {
formats = hantro_get_formats(ctx, &num_fmts);
raw_vpu_fmt = hantro_get_default_fmt(formats, num_fmts,
false);
if (ctx->dst_fmt.width != pix_mp->width ||
ctx->dst_fmt.height != pix_mp->height ||
ctx->dst_fmt.pixelformat != raw_vpu_fmt->fourcc)
return -EBUSY; return -EBUSY;
}
} else { } else {
/* /*
* The encoder doesn't admit a format change if * The encoder doesn't admit a format change if
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment