Skip to content

Commit 7d7b387

Browse files
FROMGIT: media: iris: remove v4l2_m2m_ioctl_{de,en}coder_cmd API usage during STOP handling
Currently v4l2_m2m_ioctl_{de,enc}coder_cmd is being invoked during STOP command handling. However, this is not required as the iris driver has its own drain and stop handling mechanism in place. Using the m2m command API in this context leads to incorrect behavior, where the LAST flag is prematurely attached to a capture buffer, when there are no buffers in m2m source queue. But, in this scenario even though the source buffers are returned to client, hardware might still need to process the pending capture buffers. Attaching LAST flag prematurely can result in the capture buffer being removed from the destination queue before the hardware has finished processing it, causing issues when the buffer is eventually returned by the hardware. To prevent this, remove the m2m API usage in stop handling. Link: https://lore.kernel.org/linux-media/[email protected]/ Fixes: d091007 ("media: iris: add support for drain sequence") Fixes: 75db90a ("media: iris: Add support for drain sequence in encoder video device") Reviewed-by: Vikash Garodia <[email protected]> Signed-off-by: Dikshita Agarwal <[email protected]>
1 parent 7d67edc commit 7d7b387

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/media/platform/qcom/iris/iris_vidc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,10 @@ static int iris_dec_cmd(struct file *filp, void *fh,
572572

573573
mutex_lock(&inst->lock);
574574

575-
ret = v4l2_m2m_ioctl_decoder_cmd(filp, fh, dec);
576-
if (ret)
575+
if (dec->cmd != V4L2_DEC_CMD_STOP && dec->cmd != V4L2_DEC_CMD_START) {
576+
ret = -EINVAL;
577577
goto unlock;
578+
}
578579

579580
if (inst->state == IRIS_INST_DEINIT)
580581
goto unlock;
@@ -605,9 +606,10 @@ static int iris_enc_cmd(struct file *filp, void *fh,
605606

606607
mutex_lock(&inst->lock);
607608

608-
ret = v4l2_m2m_ioctl_encoder_cmd(filp, fh, enc);
609-
if (ret)
609+
if (enc->cmd != V4L2_ENC_CMD_STOP && enc->cmd != V4L2_ENC_CMD_START) {
610+
ret = -EINVAL;
610611
goto unlock;
612+
}
611613

612614
if (inst->state == IRIS_INST_DEINIT)
613615
goto unlock;

0 commit comments

Comments
 (0)