Skip to contentSkip to conversation

media: vicodec: allow en/decoder cmd w/o CAPTURE

PATCH New Deborah Brouwer 1 participant 1 message Nov 9, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: vicodec: allow en/decoder cmd w/o CAPTURE

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.

Reported by: Nicolas Dufresne <[email protected]>

---
 drivers/media/test-drivers/vicodec/vicodec-core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/media/test-drivers/vicodec/vicodec-core.c +2 -4
index 6f0e20df74e9..cdb38688e920 100644
@@ -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);
@@ -1244,8 +1243,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);
Signature · 1 line
2.41.0