diff mbox series

[v2] media: rockchip: rga: fix field in OUTPUT buffers

Message ID 20240528-rk3568-rga-v2-1-c8052f5af10c@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series [v2] media: rockchip: rga: fix field in OUTPUT buffers | expand

Commit Message

Michael Tretter Aug. 9, 2024, 4:06 p.m. UTC
Returned buffers shouldn't contain V4L2_FIELD_ANY as field. Set the
field to V4L2_FIELD_NONE, if it isn't set.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
Fix the Streaming ioctl tests reported by v4l2-compliance for the
Rockchip RGA driver.

The remaining Patch 1 fixes the field of the returned buffers. Other
patches from the series have already been applied.
---
Changes in v2:
- Drop already applied Patch 2
- Remove v4l2_err() to avoid spamming the log with invalid user input
- Link to v1: https://lore.kernel.org/r/20240528-rk3568-rga-v1-0-b946e55d9d37@pengutronix.de
---
 drivers/media/platform/rockchip/rga/rga-buf.c | 7 +++++++
 1 file changed, 7 insertions(+)


---
base-commit: 812765cd69540b1e3ed5f02e25ccb9904f6a82f7
change-id: 20240528-rk3568-rga-fff1dd0c2c75

Best regards,
diff mbox series

Patch

diff --git a/drivers/media/platform/rockchip/rga/rga-buf.c b/drivers/media/platform/rockchip/rga/rga-buf.c
index 70808049d2e8..9e87ac79e8c6 100644
--- a/drivers/media/platform/rockchip/rga/rga-buf.c
+++ b/drivers/media/platform/rockchip/rga/rga-buf.c
@@ -119,6 +119,13 @@  static int rga_buf_prepare(struct vb2_buffer *vb)
 	if (IS_ERR(f))
 		return PTR_ERR(f);
 
+	if (V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type)) {
+		if (vbuf->field == V4L2_FIELD_ANY)
+			vbuf->field = V4L2_FIELD_NONE;
+		if (vbuf->field != V4L2_FIELD_NONE)
+			return -EINVAL;
+	}
+
 	for (i = 0; i < vb->num_planes; i++) {
 		vb2_set_plane_payload(vb, i, f->pix.plane_fmt[i].sizeimage);