From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: Nicolas Dufresne <nicolas.dufresne@collabora.com>,
Benjamin Gaignard <benjamin.gaignard@collabora.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Andrzej Pietrasiewicz <andrzej.p@collabora.com>,
Hans Verkuil <hverkuil@kernel.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Cc: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
linux-kernel@vger.kernel.org,
Arun Iyengar <aiyengar1990@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH 3/4] media: verisilicon: Keep the CAPTURE format at the stream's bit depth
Date: Sat, 14 Nov 2026 00:14:14 +0000 [thread overview]
Message-ID: <20261114-hantro-fixes-v1-3-abb78264801e@gmail.com> (raw)
In-Reply-To: <20261114-hantro-fixes-v1-0-abb78264801e@gmail.com>
From: Arun Iyengar <aiyengar1990@gmail.com>
ENUM_FMT on the CAPTURE queue of a decoder lists only the formats that
match the bit depth of the stream, but S_FMT and TRY_FMT accept any of
them, so userspace can select an 8-bit format for a 10-bit stream and
the decoder writes 10-bit pictures into buffers sized for 8 bits.
Replace a format of the wrong depth with the default one for the depth,
as for an unknown format.
Found by Sashiko in its review of hantro-dec-size-check v1.
Fixes: 8d03c2ab881b ("media: hantro: Support format filtering by depth")
Cc: stable@vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_v4l2.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/media/platform/verisilicon/hantro_v4l2.c b/drivers/media/platform/verisilicon/hantro_v4l2.c
index 2baab4cf3bbf..362fbc747eea 100644
--- a/drivers/media/platform/verisilicon/hantro_v4l2.c
+++ b/drivers/media/platform/verisilicon/hantro_v4l2.c
@@ -342,6 +342,14 @@ static int hantro_try_fmt(const struct hantro_ctx *ctx,
pix_mp->pixelformat = fmt->fourcc;
}
+ if (!coded && !ctx->is_encoder &&
+ !hantro_check_depth_match(fmt, ctx->bit_depth)) {
+ fmt = hantro_get_default_fmt(ctx, false, ctx->bit_depth, ctx->need_postproc);
+ if (!fmt)
+ return -EINVAL;
+ pix_mp->pixelformat = fmt->fourcc;
+ }
+
if (coded) {
pix_mp->num_planes = 1;
vpu_fmt = fmt;
--
2.55.0
next prev parent reply other threads:[~2026-11-14 0:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 0:14 [PATCH 0/4] media: verisilicon: Keep the CAPTURE format in line with the decoder Arun Iyengar via B4 Relay
2026-11-14 0:14 ` [PATCH 1/4] media: verisilicon: Size the VP8 segment map for the largest frame Arun Iyengar via B4 Relay
2026-11-14 0:14 ` [PATCH 2/4] media: verisilicon: Set need_postproc before resetting the CAPTURE format Arun Iyengar via B4 Relay
2026-11-14 0:14 ` Arun Iyengar via B4 Relay [this message]
2026-11-14 0:14 ` [PATCH 4/4] media: verisilicon: Set the bit depth again when its control is rewritten Arun Iyengar via B4 Relay
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=20261114-hantro-fixes-v1-3-abb78264801e@gmail.com \
--to=devnull+aiyengar1990.gmail.com@kernel.org \
--cc=aiyengar1990@gmail.com \
--cc=andrzej.p@collabora.com \
--cc=benjamin.gaignard@collabora.com \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=hverkuil@kernel.org \
--cc=jernej.skrabec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mchehab@kernel.org \
--cc=nicolas.dufresne@collabora.com \
--cc=p.zabel@pengutronix.de \
--cc=stable@vger.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®