mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roy <rongh7426@gmail.com>
To: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	linux-media@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Roy <rongh7426@gmail.com>
Subject: [PATCH] media: pisp_be: Set the field of OUTPUT buffers
Date: Fri, 27 Nov 2026 09:23:08 +0800	[thread overview]
Message-ID: <20261127012308.682831-1-rongh7426@gmail.com> (raw)

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


                 reply	other threads:[~2026-11-27  1:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261127012308.682831-1-rongh7426@gmail.com \
    --to=rongh7426@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=kernel-list@raspberrypi.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®