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>,
Heiko Stuebner <heiko@sntech.de>,
Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
Hans Verkuil <hverkuil@kernel.org>,
Boris Brezillon <boris.brezillon@collabora.com>,
Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Cc: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Sergei Khomenkov <shomenkow@gmail.com>,
Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v2 5/7] media: verisilicon: Report fixed JPEG colorimetry on the encoder
Date: Thu, 12 Nov 2026 08:31:27 +0000 [thread overview]
Message-ID: <20261112-hantro-jpeg-enc-fixes-v2-5-de03e643c75d@gmail.com> (raw)
In-Reply-To: <20261112-hantro-jpeg-enc-fixes-v2-0-de03e643c75d@gmail.com>
From: Arun Iyengar <aiyengar1990@gmail.com>
The driver reports V4L2_COLORSPACE_JPEG with default encoding,
quantization and transfer function on both queues, and lets the
application set any colorimetry, which is then copied to the other
queue. For the JPEG encoder this is wrong on the raw side:
V4L2_COLORSPACE_JPEG is only a shorthand for the colorimetry of the
JPEG data, and the raw frames should describe the actual samples. It
also makes v4l2-compliance fail on the encoder:
fail: v4l2-test-formats.cpp(892): fmt_raw.g_colorspace() != V4L2_COLORSPACE_SRGB
test VIDIOC_S_FMT: FAIL
The colorimetry of JPEG is fixed and the hardware doesn't convert the
samples. When the coded format is JPEG, report sRGB primaries and
transfer function with full range BT.601 Y'CbCr on both queues, as the
mtk-jpeg and imx-jpeg drivers do, and ignore what the application asks
for. Other coded formats keep propagating the colorimetry set by
the application, which they signal in the bitstream.
Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_v4l2.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/media/platform/verisilicon/hantro_v4l2.c b/drivers/media/platform/verisilicon/hantro_v4l2.c
index e9d91504fab2..11bce0cdf4b3 100644
--- a/drivers/media/platform/verisilicon/hantro_v4l2.c
+++ b/drivers/media/platform/verisilicon/hantro_v4l2.c
@@ -407,6 +407,19 @@ static int hantro_try_fmt(const struct hantro_ctx *ctx,
*sizeimage = max_size;
}
+ if (ctx->is_encoder && vpu_fmt->codec_mode == HANTRO_MODE_JPEG_ENC) {
+ /*
+ * The colorimetry of JPEG is fixed: full range BT.601
+ * Y'CbCr with sRGB primaries and transfer function. The
+ * hardware doesn't convert the samples, so the raw frames
+ * must use it too.
+ */
+ pix_mp->colorspace = V4L2_COLORSPACE_SRGB;
+ pix_mp->ycbcr_enc = V4L2_YCBCR_ENC_601;
+ pix_mp->xfer_func = V4L2_XFER_FUNC_SRGB;
+ pix_mp->quantization = V4L2_QUANTIZATION_FULL_RANGE;
+ }
+
return 0;
}
--
2.55.0
next prev parent reply other threads:[~2026-11-12 8:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 8:31 [PATCH v2 0/7] media: verisilicon: Fix the JPEG encoder format handling Arun Iyengar via B4 Relay
2026-11-12 8:31 ` [PATCH v2 1/7] media: verisilicon: Keep the encoder CAPTURE format while buffers exist Arun Iyengar via B4 Relay
2026-11-12 8:31 ` [PATCH v2 2/7] media: verisilicon: Enforce a minimum CAPTURE sizeimage for the encoder Arun Iyengar via B4 Relay
2026-11-12 8:31 ` [PATCH v2 3/7] media: verisilicon: Keep the encoder coded size in sync with OUTPUT Arun Iyengar via B4 Relay
2026-11-12 8:31 ` [PATCH v2 4/7] media: verisilicon: Refuse JPEG encode jobs with inconsistent geometry Arun Iyengar via B4 Relay
2026-11-12 8:31 ` Arun Iyengar via B4 Relay [this message]
2026-11-12 8:31 ` [PATCH v2 6/7] media: verisilicon: Don't reset the encoder raw format while OUTPUT buffers exist Arun Iyengar via B4 Relay
2026-11-12 8:31 ` [PATCH v2 7/7] media: verisilicon: rockchip: Limit the JPEG encoder to 8176x8176 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=20261112-hantro-jpeg-enc-fixes-v2-5-de03e643c75d@gmail.com \
--to=devnull+aiyengar1990.gmail.com@kernel.org \
--cc=aiyengar1990@gmail.com \
--cc=andrzej.p@collabora.com \
--cc=benjamin.gaignard@collabora.com \
--cc=boris.brezillon@collabora.com \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=heiko@sntech.de \
--cc=hverkuil@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--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=shomenkow@gmail.com \
/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®