summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2018-04-27 12:19:16 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-05-09 16:22:52 -0400
commit0f8529fd07f423786d5b83183ad3256424a176fa (patch)
treea27962fcbcf001311de29177dc760d6b2e40b8d7 /drivers/media
parent6dc8c1159ceae9c4101ebaa5d785847de14f35f3 (diff)
downloadop-kernel-dev-0f8529fd07f423786d5b83183ad3256424a176fa.zip
op-kernel-dev-0f8529fd07f423786d5b83183ad3256424a176fa.tar.gz
media: coda: do not try to propagate format if capture queue busy
The driver helpfully resets the capture queue format and selection rectangle whenever output format is changed. This only works while the capture queue is not busy. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/coda/coda-common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index 40632df..d3e22c1 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -787,6 +787,7 @@ static int coda_s_fmt_vid_out(struct file *file, void *priv,
{
struct coda_ctx *ctx = fh_to_ctx(priv);
struct v4l2_format f_cap;
+ struct vb2_queue *dst_vq;
int ret;
ret = coda_try_fmt_vid_out(file, priv, f);
@@ -802,6 +803,19 @@ static int coda_s_fmt_vid_out(struct file *file, void *priv,
ctx->ycbcr_enc = f->fmt.pix.ycbcr_enc;
ctx->quantization = f->fmt.pix.quantization;
+ dst_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
+ if (!dst_vq)
+ return -EINVAL;
+
+ /*
+ * Setting the capture queue format is not possible while the capture
+ * queue is still busy. This is not an error, but the user will have to
+ * make sure themselves that the capture format is set correctly before
+ * starting the output queue again.
+ */
+ if (vb2_is_busy(dst_vq))
+ return 0;
+
memset(&f_cap, 0, sizeof(f_cap));
f_cap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
coda_g_fmt(file, priv, &f_cap);
OpenPOWER on IntegriCloud