Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: pisp_be: Set the field of OUTPUT buffers
@ 2026-11-27  1:23 Roy
  0 siblings, 0 replies; only message in thread
From: Roy @ 2026-11-27  1:23 UTC (permalink / raw)
  To: Jacopo Mondi
  Cc: Raspberry Pi Kernel Maintenance, Mauro Carvalho Chehab,
	Florian Fainelli, Broadcom internal kernel review list,
	linux-media, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	Roy

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.

Fixes: 12187bd5d4f8 ("media: raspberrypi: Add support for PiSP BE")
Signed-off-by: Roy <rongh7426@gmail.com>
---
 drivers/media/platform/raspberrypi/pisp_be/pisp_be.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
index 8fb7230..95c4f7d 100644
--- a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
+++ b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
@@ -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,
-- 
2.51.1.windows.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-27  1:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27  1:23 [PATCH] media: pisp_be: Set the field of OUTPUT buffers Roy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox