v4l2-compliance fails the format ioctls on the decoder because the capture and output colour fields are left at V4L2_COLORSPACE_DEFAULT: fail: v4l2-test-formats.cpp(414): !colorspace fail: v4l2-test-formats.cpp(537): testColorspace(...) A decoder cannot know the stream's colours before it parses a frame, but the format still has to round-trip a valid, self-consistent set. Default to BT.709 limited range and keep the value when the client passes V4L2_COLORSPACE_DEFAULT back on S_FMT/TRY_FMT, so G_FMT -> S_FMT stays idempotent. The description parsed from the bitstream is still reported through the source-change path once it is known. Tested on a Snapdragon 8 Elite (SM8750) tablet with vpu35 firmware: v4l2-compliance -d /dev/video17 loses the eight format/colour failures and decoding is unchanged (H.264 and HEVC both decode with framemd5 identical to the software decoder). This is v2 of 2/3 of the series. Two patches are withdrawn: - 1/3 "media: iris: report a platform bus_info prefix" is a duplicate of commit 1facae9bc3c1 ("media: iris: Fix bus_info prefix in VIDIOC_QUERYCAP", Vishnu Reddy, 2026-09-29, Fixes: 94ef75095d5e, Cc: stable@vger.kernel.org), which is already in mainline. My tree predates it, which is why I still saw the failure; sorry for the noise, please drop 1/3. - 3/3 "media: iris: seed the crop rectangle when only CAPTURE is formatted" does not apply to mainline anymore: in v7.4-rc3 iris_vdec_s_fmt() seeds inst->crop from the user format in both switch branches (iris_vdec.c:271-274 and :309-312), so a CAPTURE-only S_FMT no longer leaves a 0x0 crop. Dropped. AI assistance was used to prepare this change; I reviewed every line, and all measurements above are mine. The *_DEFAULT initialisers themselves predate this: they came with 38fc8beaba55 ("media: iris: implement reqbuf ioctl with vb2_queue_setup"), which brought iris_vdec.c in. The ioctl path that stores and returns them untouched is b530b95de22c, so that is the tag below. Fixes: b530b95de22c ("media: iris: implement s_fmt, g_fmt and try_fmt ioctls") Cc: stable@vger.kernel.org Signed-off-by: Qianhui Xu --- drivers/media/platform/qcom/iris/iris_vdec.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c index 0dd33ff447bb..2238ef1a2794 100644 --- a/drivers/media/platform/qcom/iris/iris_vdec.c +++ b/drivers/media/platform/qcom/iris/iris_vdec.c @@ -37,6 +37,10 @@ int iris_vdec_inst_init(struct iris_inst *inst) f->fmt.pix_mp.plane_fmt[0].bytesperline = 0; f->fmt.pix_mp.plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_INPUT); f->fmt.pix_mp.field = V4L2_FIELD_NONE; + f->fmt.pix_mp.colorspace = V4L2_COLORSPACE_REC709; + f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_709; + f->fmt.pix_mp.ycbcr_enc = V4L2_YCBCR_ENC_709; + f->fmt.pix_mp.quantization = V4L2_QUANTIZATION_LIM_RANGE; inst->buffers[BUF_INPUT].min_count = iris_vpu_buf_count(inst, BUF_INPUT); inst->buffers[BUF_INPUT].size = f->fmt.pix_mp.plane_fmt[0].sizeimage; @@ -49,10 +53,10 @@ int iris_vdec_inst_init(struct iris_inst *inst) f->fmt.pix_mp.plane_fmt[0].bytesperline = ALIGN(DEFAULT_WIDTH, 128); f->fmt.pix_mp.plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_OUTPUT); f->fmt.pix_mp.field = V4L2_FIELD_NONE; - f->fmt.pix_mp.colorspace = V4L2_COLORSPACE_DEFAULT; - f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_DEFAULT; - f->fmt.pix_mp.ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; - f->fmt.pix_mp.quantization = V4L2_QUANTIZATION_DEFAULT; + f->fmt.pix_mp.colorspace = V4L2_COLORSPACE_REC709; + f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_709; + f->fmt.pix_mp.ycbcr_enc = V4L2_YCBCR_ENC_709; + f->fmt.pix_mp.quantization = V4L2_QUANTIZATION_LIM_RANGE; inst->buffers[BUF_OUTPUT].min_count = iris_vpu_buf_count(inst, BUF_OUTPUT); inst->buffers[BUF_OUTPUT].size = f->fmt.pix_mp.plane_fmt[0].sizeimage; inst->frame_rate = MAXIMUM_FPS; @@ -207,6 +211,19 @@ int iris_vdec_try_fmt(struct iris_inst *inst, struct v4l2_format *f) if (pixmp->field == V4L2_FIELD_ANY) pixmp->field = V4L2_FIELD_NONE; + /* + * A decoder cannot know the colour description of the stream before it + * has parsed a frame, but the format has to be self-consistent and + * must round-trip: keep the defaults when the client passes + * V4L2_COLORSPACE_DEFAULT back instead of clearing them. + */ + if (pixmp->colorspace == V4L2_COLORSPACE_DEFAULT) { + pixmp->colorspace = V4L2_COLORSPACE_REC709; + pixmp->xfer_func = V4L2_XFER_FUNC_709; + pixmp->ycbcr_enc = V4L2_YCBCR_ENC_709; + pixmp->quantization = V4L2_QUANTIZATION_LIM_RANGE; + } + pixmp->num_planes = 1; return 0; -- 2.53.0