media: vicodec: allow en/decoder cmd w/o CAPTURE
authorDeborah Brouwer <deborah.brouwer@collabora.com>
Thu, 9 Nov 2023 18:48:38 +0000 (10:48 -0800)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Sun, 25 Aug 2024 06:15:24 +0000 (08:15 +0200)
Vicodec will ignore en/decoder commands if the CAPTURE queue is not
streaming. But this prevents CMD_STOP from being used during a dynamic
resolution change to mark the last source buffer. Since CMD_STOP is
ignored, but doesn’t fail, there is no warning that the command needs to
be resent, and CAPTURE will continue to attempt to dequeue buffers
waiting, futilely, for one with V4L2_BUF_FLAG_LAST.

Fix this problem by carrying out en/decoder commands even if CAPTURE is
not streaming.

Fixes: d17589afa9706 vicodec: improve handling of ENC_CMD_STOP/START
Reported by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/test-drivers/vicodec/vicodec-core.c

index 3e011fe62ae11c723aa9b7bd5f3c87e9f779c157..846e90c062910e8cc58c581a32c0d401972444a0 100644 (file)
@@ -1215,8 +1215,7 @@ static int vicodec_encoder_cmd(struct file *file, void *fh,
        if (ret < 0)
                return ret;
 
-       if (!vb2_is_streaming(&ctx->fh.m2m_ctx->cap_q_ctx.q) ||
-           !vb2_is_streaming(&ctx->fh.m2m_ctx->out_q_ctx.q))
+       if (!vb2_is_streaming(&ctx->fh.m2m_ctx->out_q_ctx.q))
                return 0;
 
        ret = v4l2_m2m_ioctl_encoder_cmd(file, fh, ec);
@@ -1250,8 +1249,7 @@ static int vicodec_decoder_cmd(struct file *file, void *fh,
        if (ret < 0)
                return ret;
 
-       if (!vb2_is_streaming(&ctx->fh.m2m_ctx->cap_q_ctx.q) ||
-           !vb2_is_streaming(&ctx->fh.m2m_ctx->out_q_ctx.q))
+       if (!vb2_is_streaming(&ctx->fh.m2m_ctx->out_q_ctx.q))
                return 0;
 
        ret = v4l2_m2m_ioctl_decoder_cmd(file, fh, dc);