media: venus: venc,vdec: Return EBUSY on S_FMT while streaming
authorStanimir Varbanov <stanimir.varbanov@linaro.org>
Sat, 18 Apr 2020 09:06:22 +0000 (11:06 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 5 May 2020 11:07:47 +0000 (13:07 +0200)
According to the v4l spec s_fmt must return EBUSY while the
particular queue is streaming. Add such check in encoder and
decoder s_fmt methods.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/qcom/venus/vdec.c
drivers/media/platform/qcom/venus/venc.c

index 527944c..7c4c483 100644 (file)
@@ -276,6 +276,14 @@ static int vdec_s_fmt(struct file *file, void *fh, struct v4l2_format *f)
        const struct venus_format *fmt;
        struct v4l2_format format;
        u32 pixfmt_out = 0, pixfmt_cap = 0;
+       struct vb2_queue *q;
+
+       q = v4l2_m2m_get_vq(inst->m2m_ctx, f->type);
+       if (!q)
+               return -EINVAL;
+
+       if (vb2_is_busy(q))
+               return -EBUSY;
 
        orig_pixmp = *pixmp;
 
index 3d8431d..feed648 100644 (file)
@@ -357,6 +357,14 @@ static int venc_s_fmt(struct file *file, void *fh, struct v4l2_format *f)
        const struct venus_format *fmt;
        struct v4l2_format format;
        u32 pixfmt_out = 0, pixfmt_cap = 0;
+       struct vb2_queue *q;
+
+       q = v4l2_m2m_get_vq(inst->m2m_ctx, f->type);
+       if (!q)
+               return -EINVAL;
+
+       if (vb2_is_busy(q))
+               return -EBUSY;
 
        orig_pixmp = *pixmp;