[PATCH v3 3/5] media: verisilicon: Report fixed JPEG colorimetry on the encoder

From: Arun Iyengar via B4 Relay

Date: Thu Nov 26 2026 - 12:01:30 EST


From: Arun Iyengar <aiyengar1990@xxxxxxxxx>

The JPEG encoder accepts any colorimetry and reports
V4L2_COLORSPACE_JPEG on the raw queue, which v4l2-compliance rejects:

fail: v4l2-test-formats.cpp(892): fmt_raw.g_colorspace() != V4L2_COLORSPACE_SRGB

JPEG colorimetry is fixed and the hardware does not convert, so report
sRGB with full range BT.601 Y'CbCr on both queues.

Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Signed-off-by: Arun Iyengar <aiyengar1990@xxxxxxxxx>
---
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 88b1cf66b713..b91c0ef9b6a3 100644
--- a/drivers/media/platform/verisilicon/hantro_v4l2.c
+++ b/drivers/media/platform/verisilicon/hantro_v4l2.c
@@ -396,6 +396,14 @@ static int hantro_try_fmt(const struct hantro_ctx *ctx,
pix_mp->width * pix_mp->height * fmt->max_depth;
}

+ if (ctx->is_encoder && vpu_fmt->codec_mode == HANTRO_MODE_JPEG_ENC) {
+ /* JPEG colorimetry is fixed; the hardware does not convert. */
+ 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