]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: iris: Fix buffer preparation failure during resolution change
authorDikshita Agarwal <quic_dikshita@quicinc.com>
Fri, 9 May 2025 08:38:59 +0000 (14:08 +0530)
committerHans Verkuil <hverkuil@xs4all.nl>
Thu, 3 Jul 2025 09:02:44 +0000 (11:02 +0200)
When the resolution changes, the driver internally updates the width and
height, but the client continue to queue buffers with the older
resolution until the last flag is received. This results in a mismatch
when the buffers are prepared, causing failure due to outdated size.

Introduce a check to prevent size validation during buffer preparation
if a resolution reconfiguration is in progress, to handle this.

Cc: stable@vger.kernel.org
Fixes: 17f2a485ca67 ("media: iris: implement vb2 ops for buf_queue and firmware response")
Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Tested-by: Vikash Garodia <quic_vgarodia@quicinc.com> # on sa8775p-ride
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/platform/qcom/iris/iris_vb2.c

index cdf11feb590b5cb7804db3fcde7282fb1f9f1a1e..b3bde10eb6d2f05696e14fe0e7c44de013bec39e 100644 (file)
@@ -259,13 +259,14 @@ int iris_vb2_buf_prepare(struct vb2_buffer *vb)
                        return -EINVAL;
        }
 
-       if (vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE &&
-           vb2_plane_size(vb, 0) < iris_get_buffer_size(inst, BUF_OUTPUT))
-               return -EINVAL;
-       if (vb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE &&
-           vb2_plane_size(vb, 0) < iris_get_buffer_size(inst, BUF_INPUT))
-               return -EINVAL;
-
+       if (!(inst->sub_state & IRIS_INST_SUB_DRC)) {
+               if (vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE &&
+                   vb2_plane_size(vb, 0) < iris_get_buffer_size(inst, BUF_OUTPUT))
+                       return -EINVAL;
+               if (vb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE &&
+                   vb2_plane_size(vb, 0) < iris_get_buffer_size(inst, BUF_INPUT))
+                       return -EINVAL;
+       }
        return 0;
 }