media: pisp_be: Set the field of OUTPUT buffers
PATCH 1/1 media: pisp_be: Set the field of OUTPUT buffers
The driver has no buf_out_validate() callback, so an OUTPUT buffer queued with field V4L2_FIELD_ANY keeps that value, while the V4L2 spec requires the driver to set a valid field on queued OUTPUT buffers. v4l2-compliance -s fails on all three image input nodes:
fail: v4l2-test-buffers.cpp(240): g_field() == V4L2_FIELD_ANY
fail: v4l2-test-buffers.cpp(1608): buf.qbuf(node) test MMAP (no poll, REQBUFS): FAIL
The Back End only processes progressive frames, and its formats already report V4L2_FIELD_NONE. Add a buf_out_validate() callback that sets the field to V4L2_FIELD_NONE, as cedrus and hantro do.
Tested on a Raspberry Pi 5 (Raspberry Pi OS kernel 6.18.39, with this change applied to its pisp_be module):
- after queueing an OUTPUT buffer with V4L2_FIELD_ANY, QBUF and QUERYBUF return V4L2_FIELD_ANY before and V4L2_FIELD_NONE after on video20, video21 and video22
- v4l2-compliance -m (without -s) passes 400/400 before and after
- with -s, the MMAP tests no longer fail at QBUF. They then wait for a frame that never comes, because the Back End only runs a job when the config and output nodes stream too, so the full -s run can't be used as a pass/fail result on this device
This change and its description were written with the help of an AI coding assistant (Claude); the testing above was done on real hardware.
--- drivers/media/platform/raspberrypi/pisp_be/pisp_be.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/media/platform/raspberrypi/pisp_be/pisp_be.c +11 -0
@@ -847,6 +847,16 @@ static int pispbe_node_buffer_prepare(struct vb2_buffer *vb)return 0 ; } +static int pispbe_node_buf_out_validate (struct vb2_buffer *vb) +{ +struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); + +/* The hardware only processes progressive frames. */ + vbuf->field =V4L2_FIELD_NONE ; + +return 0 ; +} +static void pispbe_node_buffer_queue (struct vb2_buffer *buf) { struct vb2_v4l2_buffer *vbuf =
@@ -958,6 +968,7 @@ static void pispbe_node_stop_streaming(struct vb2_queue *q)static const struct vb2_ops pispbe_node_queue_ops = { .queue_setup = pispbe_node_queue_setup, + .buf_out_validate = pispbe_node_buf_out_validate, .buf_prepare = pispbe_node_buffer_prepare, .buf_queue = pispbe_node_buffer_queue, .start_streaming = pispbe_node_start_streaming,
Signature · 1 line
2.51.1.windows.1