Linux kernel staging patches
 help / color / mirror / Atom feed
From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: Maxime Ripard <mripard@kernel.org>,
	 Paul Kocialkowski <paulk@sys-base.io>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Chen-Yu Tsai <wens@kernel.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	 Samuel Holland <samuel@sholland.org>,
	Hans Verkuil <hverkuil@kernel.org>
Cc: linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
	 linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev,  linux-kernel@vger.kernel.org,
	Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v2 2/2] media: cedrus: report only the picture as capture payload
Date: Sat, 28 Nov 2026 17:35:53 +0000	[thread overview]
Message-ID: <20261128-b4-cedrus-generic-fixes-v2-2-af8472be660b@gmail.com> (raw)
In-Reply-To: <20261128-b4-cedrus-generic-fixes-v2-0-af8472be660b@gmail.com>

From: Arun Iyengar <aiyengar1990@gmail.com>

For 10-bit H.265 the driver appends the low 2 bits of every sample to
the capture buffer and counts them in sizeimage (extra_cap_size).
buf_prepare reports the whole sizeimage as bytesused, so userspace that
copies the payload gets the private plane as part of the picture.

Report only the picture; sizeimage stays the allocation size.

Fixes: 65429ba82572 ("media: cedrus: h265: Support decoding 10-bit frames")
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/staging/media/sunxi/cedrus/cedrus_video.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
index 9b2d24e77fdb..b7e0cbe548e6 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
@@ -511,8 +511,15 @@ static int cedrus_buf_prepare(struct vb2_buffer *vb)
 	 * (for OUTPUT buffers, if userspace passes 0 bytesused, v4l2-core sets
 	 * it to buffer length).
 	 */
-	if (V4L2_TYPE_IS_CAPTURE(vq->type))
-		vb2_set_plane_payload(vb, 0, pix_fmt->sizeimage);
+	if (V4L2_TYPE_IS_CAPTURE(vq->type)) {
+		unsigned int payload = pix_fmt->sizeimage;
+
+		if (ctx->current_codec->extra_cap_size)
+			payload -= ctx->current_codec->extra_cap_size(ctx,
+								     pix_fmt);
+
+		vb2_set_plane_payload(vb, 0, payload);
+	}
 
 	return 0;
 }

-- 
2.55.0



      parent reply	other threads:[~2026-11-28 17:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 17:35 [PATCH v2 0/2] media: cedrus: allocation failure and capture payload fixes Arun Iyengar via B4 Relay
2026-11-28 17:35 ` [PATCH v2 1/2] media: cedrus: fail buffer allocations that do not fit with -ENOMEM Arun Iyengar via B4 Relay
2026-11-28 18:30   ` Jernej Škrabec
2026-11-28 17:35 ` Arun Iyengar via B4 Relay [this message]

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=20261128-b4-cedrus-generic-fixes-v2-2-af8472be660b@gmail.com \
    --to=devnull+aiyengar1990.gmail.com@kernel.org \
    --cc=aiyengar1990@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil@kernel.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=mripard@kernel.org \
    --cc=paulk@sys-base.io \
    --cc=samuel@sholland.org \
    --cc=wens@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