[PATCH v4 5/6] media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats

From: Neil Armstrong

Date: Thu May 21 2026 - 05:32:34 EST


The 10bit pixel format can be only used when the decoder identifies the
stream as decoding into 10bit pixel format buffers, so update the
find_format helper to filter the formats and only allow the proper
formats when setting or trying a capture format.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
Signed-off-by: Neil Armstrong <neil.armstrong@xxxxxxxxxx>
---
drivers/media/platform/qcom/iris/iris_platform_common.h | 1 +
drivers/media/platform/qcom/iris/iris_vdec.c | 10 ++++++++++
2 files changed, 11 insertions(+)

diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/drivers/media/platform/qcom/iris/iris_platform_common.h
index 6a108173be35..7595e21277b0 100644
--- a/drivers/media/platform/qcom/iris/iris_platform_common.h
+++ b/drivers/media/platform/qcom/iris/iris_platform_common.h
@@ -17,6 +17,7 @@ struct iris_inst;

#define REGISTER_BIT_DEPTH(luma, chroma) ((luma) << 16 | (chroma))
#define BIT_DEPTH_8 REGISTER_BIT_DEPTH(8, 8)
+#define BIT_DEPTH_10 REGISTER_BIT_DEPTH(10, 10)
#define CODED_FRAMES_PROGRESSIVE 0x0
#define DEFAULT_MAX_HOST_BUF_COUNT 64
#define DEFAULT_MAX_HOST_BURST_BUF_COUNT 256
diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c
index 3846d73b4d23..f1366a1865c1 100644
--- a/drivers/media/platform/qcom/iris/iris_vdec.c
+++ b/drivers/media/platform/qcom/iris/iris_vdec.c
@@ -105,6 +105,16 @@ find_format(struct iris_inst *inst, u32 pixfmt, u32 type)
if (i == size || fmt[i].type != type)
return NULL;

+ if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
+ if (iris_fmt_is_8bit(fmt[i].pixfmt) &&
+ inst->fw_caps[BIT_DEPTH].value == BIT_DEPTH_10)
+ return NULL;
+
+ if (iris_fmt_is_10bit(fmt[i].pixfmt) &&
+ inst->fw_caps[BIT_DEPTH].value != BIT_DEPTH_10)
+ return NULL;
+ }
+
return &fmt[i];
}


--
2.34.1