* [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats
@ 2026-04-08 16:43 Neil Armstrong
2026-04-08 16:43 ` [PATCH RFC 1/7] media: qcom: iris: add QC10C & P010 buffer size calculations Neil Armstrong
` (7 more replies)
0 siblings, 8 replies; 34+ messages in thread
From: Neil Armstrong @ 2026-04-08 16:43 UTC (permalink / raw)
To: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar,
Bryan O'Donoghue, Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, linux-kernel, Neil Armstrong
This adds the plumbing to support decoding HEVC and AV1
streams into 10bit pixel formats, linear and compressed.
This has only been tested on SM8650 with HEVC, and was inspired by
Venus and the downstream vidc driver for the buffer
calculations and HFI messages.
I was unable to get 10bit decoding working with Gstreamer
and ffmpeg, but v4l2-ctl works with:
v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=P010 --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.P010
v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=Q10C --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.QC10
The non-10bit decoding still works as before.
With Big_Buck_Bunny_1080_10s_30MB reencoded in 10-bit profile
and tranformed in v4l2 header format with [1]:
ffmpeg -i Big_Buck_Bunny_1080_10s_30MB.h264 -pix_fmt yuv420p10le -c:v libx265 -crf 28 -x265-params profile=main10 Big_Buck_Bunny_1080_10s_30MB_main10.h265
/path/to/mkhdr.sh Big_Buck_Bunny_1080_10s_30MB_main10.h265 raw Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr
The frames correctness has been verified buy displaying them
via Vulkan DMA_BUF import, including QC10C and QC08C.
The support is probably incomplete for other platforms and
I'm unsure what's required to conform to the V4L2 M2M stateless
spec, especially since AFAIK the decoder doesn't support
decoding 10bit streams in 8bit pixel format, thus the RFC state.
Review is welcome !
[1] https://github.com/superna9999/pyv4l2compliance
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
Neil Armstrong (7):
media: qcom: iris: add QC10C & P010 buffer size calculations
media: qcom: iris: gen2: add support for 10bit decoding
media: qcom: iris: add helpers for 8bit and 10bit formats
media: qcom: iris: vdec: update size and stride calculations for 10bit formats
media: qcom: iris: vdec: forbid g_fmt while waiting for first source change
media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats
media: qcom: iris: vdec: allow decoding into 10bit format
drivers/media/platform/qcom/iris/iris_buffer.c | 81 +++++++++++++++++++++-
.../platform/qcom/iris/iris_hfi_gen2_command.c | 71 ++++++++++++++++++-
.../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 +
.../platform/qcom/iris/iris_hfi_gen2_response.c | 35 ++++++++--
drivers/media/platform/qcom/iris/iris_instance.h | 2 +
.../platform/qcom/iris/iris_platform_common.h | 1 +
.../media/platform/qcom/iris/iris_platform_gen2.c | 3 +-
drivers/media/platform/qcom/iris/iris_state.c | 6 ++
drivers/media/platform/qcom/iris/iris_state.h | 1 +
drivers/media/platform/qcom/iris/iris_utils.c | 16 ++++-
drivers/media/platform/qcom/iris/iris_utils.h | 2 +
drivers/media/platform/qcom/iris/iris_vdec.c | 70 +++++++++++++++++--
drivers/media/platform/qcom/iris/iris_vidc.c | 14 +++-
13 files changed, 285 insertions(+), 18 deletions(-)
---
base-commit: f3e6330d7fe42b204af05a2dbc68b379e0ad179e
change-id: 20260408-topic-sm8x50-iris-10bit-decoding-074c3ac7975c
Best regards,
--
Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 34+ messages in thread* [PATCH RFC 1/7] media: qcom: iris: add QC10C & P010 buffer size calculations 2026-04-08 16:43 [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats Neil Armstrong @ 2026-04-08 16:43 ` Neil Armstrong 2026-04-08 23:59 ` Dmitry Baryshkov 2026-04-17 6:47 ` Dikshita Agarwal 2026-04-08 16:43 ` [PATCH RFC 2/7] media: qcom: iris: gen2: add support for 10bit decoding Neil Armstrong ` (6 subsequent siblings) 7 siblings, 2 replies; 34+ messages in thread From: Neil Armstrong @ 2026-04-08 16:43 UTC (permalink / raw) To: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel, Neil Armstrong The P010 (YUV format with 16-bits per pixel with interleaved UV) and QC10C (P010 compressed mode similar to QC08C) requires specific buffer calculations to allocate the right buffer size for DPB frames and frames consumed by userspace. Similar to 8bit, the 10bit DPB frames uses QC10C format. Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> --- drivers/media/platform/qcom/iris/iris_buffer.c | 81 +++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/iris/iris_buffer.c b/drivers/media/platform/qcom/iris/iris_buffer.c index 9151f43bc6b9..a0e31bff8f26 100644 --- a/drivers/media/platform/qcom/iris/iris_buffer.c +++ b/drivers/media/platform/qcom/iris/iris_buffer.c @@ -15,7 +15,9 @@ #define MAX_WIDTH 4096 #define MAX_HEIGHT 2304 #define Y_STRIDE_ALIGN 128 +#define Y_STRIDE_ALIGN_P010 256 #define UV_STRIDE_ALIGN 128 +#define UV_STRIDE_ALIGN_P010 256 #define Y_SCANLINE_ALIGN 32 #define UV_SCANLINE_ALIGN 16 #define UV_SCANLINE_ALIGN_QC08C 32 @@ -80,6 +82,26 @@ static u32 iris_yuv_buffer_size_nv12(struct iris_inst *inst) return ALIGN(y_plane + uv_plane, PIXELS_4K); } +static u32 iris_yuv_buffer_size_p010(struct iris_inst *inst) +{ + u32 y_plane, uv_plane, y_stride, uv_stride, y_scanlines, uv_scanlines; + struct v4l2_format *f; + + if (inst->domain == DECODER) + f = inst->fmt_dst; + else + f = inst->fmt_src; + + y_stride = ALIGN(f->fmt.pix_mp.width * 2, Y_STRIDE_ALIGN_P010); + uv_stride = ALIGN(f->fmt.pix_mp.width * 2, UV_STRIDE_ALIGN_P010); + y_scanlines = ALIGN(f->fmt.pix_mp.height, Y_SCANLINE_ALIGN); + uv_scanlines = ALIGN((f->fmt.pix_mp.height + 1) >> 1, UV_SCANLINE_ALIGN); + y_plane = y_stride * y_scanlines; + uv_plane = uv_stride * uv_scanlines; + + return ALIGN(y_plane + uv_plane, PIXELS_4K); +} + /* * QC08C: * Compressed Macro-tile format for NV12. @@ -204,6 +226,55 @@ static u32 iris_yuv_buffer_size_qc08c(struct iris_inst *inst) return ALIGN(y_meta_plane + y_plane + uv_meta_plane + uv_plane, PIXELS_4K); } +/* + * QC10C: + * Compressed Macro-tile format for TP10. + */ +static u32 iris_yuv_buffer_size_qc10c(struct iris_inst *inst) +{ + u32 y_stride, y_buf_height; + u32 uv_stride, uv_buf_height; + u32 y_md_stride, y_md_height; + u32 uv_md_stride, uv_md_height; + u32 y_data_size, uv_data_size; + u32 y_md_size, uv_md_size; + struct v4l2_format *f = NULL; + + if (inst->domain == DECODER) + f = inst->fmt_dst; + else + f = inst->fmt_src; + + y_stride = ALIGN(ALIGN(f->fmt.pix_mp.width, 192) * 4 / 3, + Y_STRIDE_ALIGN_P010); + y_buf_height = ALIGN(f->fmt.pix_mp.height, UV_SCANLINE_ALIGN); + + y_data_size = ALIGN(y_stride * y_buf_height, PIXELS_4K); + + uv_stride = ALIGN(ALIGN(f->fmt.pix_mp.width, 192) * 4 / 3, + UV_STRIDE_ALIGN_P010); + uv_buf_height = ALIGN((f->fmt.pix_mp.height + 1) / 2, + UV_SCANLINE_ALIGN); + + uv_data_size = ALIGN(uv_stride * uv_buf_height, PIXELS_4K); + + y_md_stride = ALIGN(DIV_ROUND_UP(f->fmt.pix_mp.width, 48), + META_STRIDE_ALIGNED); + y_md_height = ALIGN(DIV_ROUND_UP(f->fmt.pix_mp.height, 4), + META_SCANLINE_ALIGNED); + + y_md_size = ALIGN(y_md_stride * y_md_height, PIXELS_4K); + + uv_md_stride = ALIGN(DIV_ROUND_UP((f->fmt.pix_mp.width + 1) / 2, 24), + META_STRIDE_ALIGNED); + uv_md_height = ALIGN(DIV_ROUND_UP((f->fmt.pix_mp.height + 1) / 2, 4), + META_SCANLINE_ALIGNED); + + uv_md_size = ALIGN(uv_md_stride * uv_md_height, PIXELS_4K); + + return y_data_size + uv_data_size + y_md_size + uv_md_size; +} + static u32 iris_dec_bitstream_buffer_size(struct iris_inst *inst) { struct platform_inst_caps *caps = inst->core->iris_platform_data->inst_caps; @@ -268,10 +339,18 @@ int iris_get_buffer_size(struct iris_inst *inst, case BUF_OUTPUT: if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC08C) return iris_yuv_buffer_size_qc08c(inst); + else if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C) + return iris_yuv_buffer_size_qc10c(inst); + else if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_P010) + return iris_yuv_buffer_size_p010(inst); else return iris_yuv_buffer_size_nv12(inst); case BUF_DPB: - return iris_yuv_buffer_size_qc08c(inst); + if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C || + inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_P010) + return iris_yuv_buffer_size_qc10c(inst); + else + return iris_yuv_buffer_size_qc08c(inst); default: return 0; } -- 2.34.1 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 1/7] media: qcom: iris: add QC10C & P010 buffer size calculations 2026-04-08 16:43 ` [PATCH RFC 1/7] media: qcom: iris: add QC10C & P010 buffer size calculations Neil Armstrong @ 2026-04-08 23:59 ` Dmitry Baryshkov 2026-04-09 7:25 ` Neil Armstrong 2026-04-17 6:47 ` Dikshita Agarwal 1 sibling, 1 reply; 34+ messages in thread From: Dmitry Baryshkov @ 2026-04-08 23:59 UTC (permalink / raw) To: Neil Armstrong Cc: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel On Wed, Apr 08, 2026 at 06:43:54PM +0200, Neil Armstrong wrote: > The P010 (YUV format with 16-bits per pixel with interleaved UV) 10-bit, but with 16-bit alignment > and QC10C (P010 compressed mode similar to QC08C) requires specific > buffer calculations to allocate the right buffer size for DPB frames > and frames consumed by userspace. > > Similar to 8bit, the 10bit DPB frames uses QC10C format. > > Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> > --- > drivers/media/platform/qcom/iris/iris_buffer.c | 81 +++++++++++++++++++++++++- > 1 file changed, 80 insertions(+), 1 deletion(-) > @@ -204,6 +226,55 @@ static u32 iris_yuv_buffer_size_qc08c(struct iris_inst *inst) > return ALIGN(y_meta_plane + y_plane + uv_meta_plane + uv_plane, PIXELS_4K); > } > > +/* > + * QC10C: > + * Compressed Macro-tile format for TP10. UBWC-compressed format > + */ -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 1/7] media: qcom: iris: add QC10C & P010 buffer size calculations 2026-04-08 23:59 ` Dmitry Baryshkov @ 2026-04-09 7:25 ` Neil Armstrong 2026-04-11 16:13 ` Dmitry Baryshkov 0 siblings, 1 reply; 34+ messages in thread From: Neil Armstrong @ 2026-04-09 7:25 UTC (permalink / raw) To: Dmitry Baryshkov Cc: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel On 4/9/26 01:59, Dmitry Baryshkov wrote: > On Wed, Apr 08, 2026 at 06:43:54PM +0200, Neil Armstrong wrote: >> The P010 (YUV format with 16-bits per pixel with interleaved UV) > > 10-bit, but with 16-bit alignment Ack > >> and QC10C (P010 compressed mode similar to QC08C) requires specific >> buffer calculations to allocate the right buffer size for DPB frames >> and frames consumed by userspace. >> >> Similar to 8bit, the 10bit DPB frames uses QC10C format. >> >> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> >> --- >> drivers/media/platform/qcom/iris/iris_buffer.c | 81 +++++++++++++++++++++++++- >> 1 file changed, 80 insertions(+), 1 deletion(-) > >> @@ -204,6 +226,55 @@ static u32 iris_yuv_buffer_size_qc08c(struct iris_inst *inst) >> return ALIGN(y_meta_plane + y_plane + uv_meta_plane + uv_plane, PIXELS_4K); >> } >> >> +/* >> + * QC10C: >> + * Compressed Macro-tile format for TP10. > > UBWC-compressed format I literally took the head comment of the QC08C buffer size function and replaced 8 by 10... > >> + */ > ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 1/7] media: qcom: iris: add QC10C & P010 buffer size calculations 2026-04-09 7:25 ` Neil Armstrong @ 2026-04-11 16:13 ` Dmitry Baryshkov 0 siblings, 0 replies; 34+ messages in thread From: Dmitry Baryshkov @ 2026-04-11 16:13 UTC (permalink / raw) To: Neil Armstrong Cc: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel On Thu, Apr 09, 2026 at 09:25:04AM +0200, Neil Armstrong wrote: > On 4/9/26 01:59, Dmitry Baryshkov wrote: > > On Wed, Apr 08, 2026 at 06:43:54PM +0200, Neil Armstrong wrote: > > > @@ -204,6 +226,55 @@ static u32 iris_yuv_buffer_size_qc08c(struct iris_inst *inst) > > > return ALIGN(y_meta_plane + y_plane + uv_meta_plane + uv_plane, PIXELS_4K); > > > } > > > +/* > > > + * QC10C: > > > + * Compressed Macro-tile format for TP10. > > > > UBWC-compressed format > > I literally took the head comment of the QC08C buffer size function and replaced 8 by 10... You can be better than the previous authors :-) > > > > > > + */ > > > -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 1/7] media: qcom: iris: add QC10C & P010 buffer size calculations 2026-04-08 16:43 ` [PATCH RFC 1/7] media: qcom: iris: add QC10C & P010 buffer size calculations Neil Armstrong 2026-04-08 23:59 ` Dmitry Baryshkov @ 2026-04-17 6:47 ` Dikshita Agarwal 2026-04-17 8:03 ` Neil Armstrong 1 sibling, 1 reply; 34+ messages in thread From: Dikshita Agarwal @ 2026-04-17 6:47 UTC (permalink / raw) To: Neil Armstrong, Vikash Garodia, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel On 4/8/2026 10:13 PM, Neil Armstrong wrote: > The P010 (YUV format with 16-bits per pixel with interleaved UV) > and QC10C (P010 compressed mode similar to QC08C) requires specific > buffer calculations to allocate the right buffer size for DPB frames > and frames consumed by userspace. > > Similar to 8bit, the 10bit DPB frames uses QC10C format. > > Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> > --- > drivers/media/platform/qcom/iris/iris_buffer.c | 81 +++++++++++++++++++++++++- > 1 file changed, 80 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/qcom/iris/iris_buffer.c b/drivers/media/platform/qcom/iris/iris_buffer.c > index 9151f43bc6b9..a0e31bff8f26 100644 > --- a/drivers/media/platform/qcom/iris/iris_buffer.c > +++ b/drivers/media/platform/qcom/iris/iris_buffer.c > @@ -15,7 +15,9 @@ > #define MAX_WIDTH 4096 > #define MAX_HEIGHT 2304 > #define Y_STRIDE_ALIGN 128 > +#define Y_STRIDE_ALIGN_P010 256 > #define UV_STRIDE_ALIGN 128 > +#define UV_STRIDE_ALIGN_P010 256 > #define Y_SCANLINE_ALIGN 32 > #define UV_SCANLINE_ALIGN 16 > #define UV_SCANLINE_ALIGN_QC08C 32 > @@ -80,6 +82,26 @@ static u32 iris_yuv_buffer_size_nv12(struct iris_inst *inst) > return ALIGN(y_plane + uv_plane, PIXELS_4K); > } > > +static u32 iris_yuv_buffer_size_p010(struct iris_inst *inst) > +{ > + u32 y_plane, uv_plane, y_stride, uv_stride, y_scanlines, uv_scanlines; > + struct v4l2_format *f; > + > + if (inst->domain == DECODER) > + f = inst->fmt_dst; > + else > + f = inst->fmt_src; > + > + y_stride = ALIGN(f->fmt.pix_mp.width * 2, Y_STRIDE_ALIGN_P010); > + uv_stride = ALIGN(f->fmt.pix_mp.width * 2, UV_STRIDE_ALIGN_P010); > + y_scanlines = ALIGN(f->fmt.pix_mp.height, Y_SCANLINE_ALIGN); > + uv_scanlines = ALIGN((f->fmt.pix_mp.height + 1) >> 1, UV_SCANLINE_ALIGN); > + y_plane = y_stride * y_scanlines; > + uv_plane = uv_stride * uv_scanlines; > + > + return ALIGN(y_plane + uv_plane, PIXELS_4K); > +} > + > /* > * QC08C: > * Compressed Macro-tile format for NV12. > @@ -204,6 +226,55 @@ static u32 iris_yuv_buffer_size_qc08c(struct iris_inst *inst) > return ALIGN(y_meta_plane + y_plane + uv_meta_plane + uv_plane, PIXELS_4K); > } > > +/* > + * QC10C: > + * Compressed Macro-tile format for TP10. > + */ > +static u32 iris_yuv_buffer_size_qc10c(struct iris_inst *inst) > +{ > + u32 y_stride, y_buf_height; > + u32 uv_stride, uv_buf_height; > + u32 y_md_stride, y_md_height; > + u32 uv_md_stride, uv_md_height; > + u32 y_data_size, uv_data_size; > + u32 y_md_size, uv_md_size; > + struct v4l2_format *f = NULL; > + > + if (inst->domain == DECODER) > + f = inst->fmt_dst; > + else > + f = inst->fmt_src; > + > + y_stride = ALIGN(ALIGN(f->fmt.pix_mp.width, 192) * 4 / 3, > + Y_STRIDE_ALIGN_P010); Y_STRIDE_ALIGN_P010 is being used for both P010 and QC10C, lets keep it Y_STRIDE_ALIGN_10_BIT ? or something similar ? > + y_buf_height = ALIGN(f->fmt.pix_mp.height, UV_SCANLINE_ALIGN); why not call it y_scanlines only? > + > + y_data_size = ALIGN(y_stride * y_buf_height, PIXELS_4K); s/y_data_size/y_plane ? > + > + uv_stride = ALIGN(ALIGN(f->fmt.pix_mp.width, 192) * 4 / 3, > + UV_STRIDE_ALIGN_P010); > + uv_buf_height = ALIGN((f->fmt.pix_mp.height + 1) / 2, > + UV_SCANLINE_ALIGN); s/uv_buf_height/uv_scanline? > + > + uv_data_size = ALIGN(uv_stride * uv_buf_height, PIXELS_4K); s/uv_data_size/uv_plane? Pls keep all these names consistent with other functions, applies to below variables as well. Thanks, Dikshita > + > + y_md_stride = ALIGN(DIV_ROUND_UP(f->fmt.pix_mp.width, 48), > + META_STRIDE_ALIGNED); > + y_md_height = ALIGN(DIV_ROUND_UP(f->fmt.pix_mp.height, 4), > + META_SCANLINE_ALIGNED); > + > + y_md_size = ALIGN(y_md_stride * y_md_height, PIXELS_4K); > + > + uv_md_stride = ALIGN(DIV_ROUND_UP((f->fmt.pix_mp.width + 1) / 2, 24), > + META_STRIDE_ALIGNED); > + uv_md_height = ALIGN(DIV_ROUND_UP((f->fmt.pix_mp.height + 1) / 2, 4), > + META_SCANLINE_ALIGNED); > + > + uv_md_size = ALIGN(uv_md_stride * uv_md_height, PIXELS_4K); > + > + return y_data_size + uv_data_size + y_md_size + uv_md_size; > +} > + > static u32 iris_dec_bitstream_buffer_size(struct iris_inst *inst) > { > struct platform_inst_caps *caps = inst->core->iris_platform_data->inst_caps; > @@ -268,10 +339,18 @@ int iris_get_buffer_size(struct iris_inst *inst, > case BUF_OUTPUT: > if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC08C) > return iris_yuv_buffer_size_qc08c(inst); > + else if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C) > + return iris_yuv_buffer_size_qc10c(inst); > + else if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_P010) > + return iris_yuv_buffer_size_p010(inst); > else > return iris_yuv_buffer_size_nv12(inst); > case BUF_DPB: > - return iris_yuv_buffer_size_qc08c(inst); > + if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C || > + inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_P010) Please introduce one API, is_10bit_format and use that here instead. Thanks, Dikshita > + return iris_yuv_buffer_size_qc10c(inst); > + else > + return iris_yuv_buffer_size_qc08c(inst); > default: > return 0; > } > ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 1/7] media: qcom: iris: add QC10C & P010 buffer size calculations 2026-04-17 6:47 ` Dikshita Agarwal @ 2026-04-17 8:03 ` Neil Armstrong 0 siblings, 0 replies; 34+ messages in thread From: Neil Armstrong @ 2026-04-17 8:03 UTC (permalink / raw) To: Dikshita Agarwal, Vikash Garodia, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel On 4/17/26 08:47, Dikshita Agarwal wrote: > > > On 4/8/2026 10:13 PM, Neil Armstrong wrote: >> The P010 (YUV format with 16-bits per pixel with interleaved UV) >> and QC10C (P010 compressed mode similar to QC08C) requires specific >> buffer calculations to allocate the right buffer size for DPB frames >> and frames consumed by userspace. >> >> Similar to 8bit, the 10bit DPB frames uses QC10C format. >> >> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> >> --- >> drivers/media/platform/qcom/iris/iris_buffer.c | 81 +++++++++++++++++++++++++- >> 1 file changed, 80 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/media/platform/qcom/iris/iris_buffer.c b/drivers/media/platform/qcom/iris/iris_buffer.c >> index 9151f43bc6b9..a0e31bff8f26 100644 >> --- a/drivers/media/platform/qcom/iris/iris_buffer.c >> +++ b/drivers/media/platform/qcom/iris/iris_buffer.c >> @@ -15,7 +15,9 @@ >> #define MAX_WIDTH 4096 >> #define MAX_HEIGHT 2304 >> #define Y_STRIDE_ALIGN 128 >> +#define Y_STRIDE_ALIGN_P010 256 >> #define UV_STRIDE_ALIGN 128 >> +#define UV_STRIDE_ALIGN_P010 256 >> #define Y_SCANLINE_ALIGN 32 >> #define UV_SCANLINE_ALIGN 16 >> #define UV_SCANLINE_ALIGN_QC08C 32 >> @@ -80,6 +82,26 @@ static u32 iris_yuv_buffer_size_nv12(struct iris_inst *inst) >> return ALIGN(y_plane + uv_plane, PIXELS_4K); >> } >> >> +static u32 iris_yuv_buffer_size_p010(struct iris_inst *inst) >> +{ >> + u32 y_plane, uv_plane, y_stride, uv_stride, y_scanlines, uv_scanlines; >> + struct v4l2_format *f; >> + >> + if (inst->domain == DECODER) >> + f = inst->fmt_dst; >> + else >> + f = inst->fmt_src; >> + >> + y_stride = ALIGN(f->fmt.pix_mp.width * 2, Y_STRIDE_ALIGN_P010); >> + uv_stride = ALIGN(f->fmt.pix_mp.width * 2, UV_STRIDE_ALIGN_P010); >> + y_scanlines = ALIGN(f->fmt.pix_mp.height, Y_SCANLINE_ALIGN); >> + uv_scanlines = ALIGN((f->fmt.pix_mp.height + 1) >> 1, UV_SCANLINE_ALIGN); >> + y_plane = y_stride * y_scanlines; >> + uv_plane = uv_stride * uv_scanlines; >> + >> + return ALIGN(y_plane + uv_plane, PIXELS_4K); >> +} >> + >> /* >> * QC08C: >> * Compressed Macro-tile format for NV12. >> @@ -204,6 +226,55 @@ static u32 iris_yuv_buffer_size_qc08c(struct iris_inst *inst) >> return ALIGN(y_meta_plane + y_plane + uv_meta_plane + uv_plane, PIXELS_4K); >> } >> >> +/* >> + * QC10C: >> + * Compressed Macro-tile format for TP10. >> + */ >> +static u32 iris_yuv_buffer_size_qc10c(struct iris_inst *inst) >> +{ >> + u32 y_stride, y_buf_height; >> + u32 uv_stride, uv_buf_height; >> + u32 y_md_stride, y_md_height; >> + u32 uv_md_stride, uv_md_height; >> + u32 y_data_size, uv_data_size; >> + u32 y_md_size, uv_md_size; >> + struct v4l2_format *f = NULL; >> + >> + if (inst->domain == DECODER) >> + f = inst->fmt_dst; >> + else >> + f = inst->fmt_src; >> + >> + y_stride = ALIGN(ALIGN(f->fmt.pix_mp.width, 192) * 4 / 3, >> + Y_STRIDE_ALIGN_P010); > > Y_STRIDE_ALIGN_P010 is being used for both P010 and QC10C, lets keep it > Y_STRIDE_ALIGN_10_BIT ? or something similar ? > >> + y_buf_height = ALIGN(f->fmt.pix_mp.height, UV_SCANLINE_ALIGN); > > why not call it y_scanlines only? > >> + >> + y_data_size = ALIGN(y_stride * y_buf_height, PIXELS_4K); > > s/y_data_size/y_plane ? > >> + >> + uv_stride = ALIGN(ALIGN(f->fmt.pix_mp.width, 192) * 4 / 3, >> + UV_STRIDE_ALIGN_P010); >> + uv_buf_height = ALIGN((f->fmt.pix_mp.height + 1) / 2, >> + UV_SCANLINE_ALIGN); > > s/uv_buf_height/uv_scanline? > >> + >> + uv_data_size = ALIGN(uv_stride * uv_buf_height, PIXELS_4K); > > s/uv_data_size/uv_plane? > > Pls keep all these names consistent with other functions, applies to below > variables as well. > > > Thanks, > Dikshita > >> + >> + y_md_stride = ALIGN(DIV_ROUND_UP(f->fmt.pix_mp.width, 48), >> + META_STRIDE_ALIGNED); >> + y_md_height = ALIGN(DIV_ROUND_UP(f->fmt.pix_mp.height, 4), >> + META_SCANLINE_ALIGNED); >> + >> + y_md_size = ALIGN(y_md_stride * y_md_height, PIXELS_4K); >> + >> + uv_md_stride = ALIGN(DIV_ROUND_UP((f->fmt.pix_mp.width + 1) / 2, 24), >> + META_STRIDE_ALIGNED); >> + uv_md_height = ALIGN(DIV_ROUND_UP((f->fmt.pix_mp.height + 1) / 2, 4), >> + META_SCANLINE_ALIGNED); >> + >> + uv_md_size = ALIGN(uv_md_stride * uv_md_height, PIXELS_4K); >> + >> + return y_data_size + uv_data_size + y_md_size + uv_md_size; >> +} >> + >> static u32 iris_dec_bitstream_buffer_size(struct iris_inst *inst) >> { >> struct platform_inst_caps *caps = inst->core->iris_platform_data->inst_caps; >> @@ -268,10 +339,18 @@ int iris_get_buffer_size(struct iris_inst *inst, >> case BUF_OUTPUT: >> if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC08C) >> return iris_yuv_buffer_size_qc08c(inst); >> + else if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C) >> + return iris_yuv_buffer_size_qc10c(inst); >> + else if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_P010) >> + return iris_yuv_buffer_size_p010(inst); >> else >> return iris_yuv_buffer_size_nv12(inst); >> case BUF_DPB: >> - return iris_yuv_buffer_size_qc08c(inst); >> + if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C || >> + inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_P010) > > Please introduce one API, is_10bit_format and use that here instead. Ack > > Thanks, > Dikshita >> + return iris_yuv_buffer_size_qc10c(inst); >> + else >> + return iris_yuv_buffer_size_qc08c(inst); >> default: >> return 0; >> } >> ^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH RFC 2/7] media: qcom: iris: gen2: add support for 10bit decoding 2026-04-08 16:43 [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats Neil Armstrong 2026-04-08 16:43 ` [PATCH RFC 1/7] media: qcom: iris: add QC10C & P010 buffer size calculations Neil Armstrong @ 2026-04-08 16:43 ` Neil Armstrong 2026-04-17 7:22 ` Dikshita Agarwal 2026-04-08 16:43 ` [PATCH RFC 3/7] media: qcom: iris: add helpers for 8bit and 10bit formats Neil Armstrong ` (5 subsequent siblings) 7 siblings, 1 reply; 34+ messages in thread From: Neil Armstrong @ 2026-04-08 16:43 UTC (permalink / raw) To: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel, Neil Armstrong Add the necessary plumbing into the HFi Gen2 to signal the decoder the right 10bit pixel format and stride when in compressed mode. Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> --- .../platform/qcom/iris/iris_hfi_gen2_command.c | 71 +++++++++++++++++++++- .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + drivers/media/platform/qcom/iris/iris_utils.c | 4 +- 3 files changed, 72 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c index 30bfd90d423b..8e547e390fa3 100644 --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c @@ -481,8 +481,20 @@ static int iris_hfi_gen2_set_colorformat(struct iris_inst *inst, u32 plane) if (inst->domain == DECODER) { pixelformat = inst->fmt_dst->fmt.pix_mp.pixelformat; - hfi_colorformat = pixelformat == V4L2_PIX_FMT_NV12 ? - HFI_COLOR_FMT_NV12 : HFI_COLOR_FMT_NV12_UBWC; + switch (pixelformat) { + case V4L2_PIX_FMT_NV12: + hfi_colorformat = HFI_COLOR_FMT_NV12; + break; + case V4L2_PIX_FMT_QC08C: + hfi_colorformat = HFI_COLOR_FMT_NV12_UBWC; + break; + case V4L2_PIX_FMT_P010: + hfi_colorformat = HFI_COLOR_FMT_P010; + break; + case V4L2_PIX_FMT_QC10C: + hfi_colorformat = HFI_COLOR_FMT_TP10_UBWC; + break; + }; } else { pixelformat = inst->fmt_src->fmt.pix_mp.pixelformat; hfi_colorformat = pixelformat == V4L2_PIX_FMT_NV12 ? @@ -517,7 +529,8 @@ static int iris_hfi_gen2_set_linear_stride_scanline(struct iris_inst *inst, u32 stride_uv = stride_y; scanline_uv = scanline_y / 2; - if (pixelformat != V4L2_PIX_FMT_NV12) + if (pixelformat != V4L2_PIX_FMT_NV12 && + pixelformat != V4L2_PIX_FMT_P010) return 0; payload[0] = stride_y << 16 | scanline_y; @@ -532,6 +545,57 @@ static int iris_hfi_gen2_set_linear_stride_scanline(struct iris_inst *inst, u32 sizeof(u64)); } +static int iris_hfi_gen2_set_ubwc_stride_scanline(struct iris_inst *inst, u32 plane) +{ + u32 meta_stride_y, meta_scanline_y, meta_stride_uv, meta_scanline_uv; + u32 stride_y, scanline_y, stride_uv, scanline_uv; + u32 port = iris_hfi_gen2_get_port(inst, plane); + u32 pixelformat, width, height; + u32 payload[4]; + + pixelformat = inst->fmt_dst->fmt.pix_mp.pixelformat; + width = inst->fmt_dst->fmt.pix_mp.width; + height = inst->fmt_dst->fmt.pix_mp.height; + + switch (pixelformat) { + case V4L2_PIX_FMT_QC08C: + stride_y = ALIGN(width, 128); + scanline_y = ALIGN(height, 32); + stride_uv = ALIGN(width, 128); + scanline_uv = ALIGN((height + 1) >> 1, 32); + meta_stride_y = ALIGN(DIV_ROUND_UP(width, 32), 64); + meta_scanline_y = ALIGN(DIV_ROUND_UP(height, 8), 16); + meta_stride_uv = ALIGN(DIV_ROUND_UP((width + 1) >> 1, 16), 64); + meta_scanline_uv = ALIGN(DIV_ROUND_UP((height + 1) >> 1, 8), 16); + break; + case V4L2_PIX_FMT_QC10C: + stride_y = ALIGN(ALIGN(width, 192) * 4 / 3, 256); + scanline_y = ALIGN(height, 16); + stride_uv = ALIGN(ALIGN(width, 192) * 4 / 3, 256); + scanline_uv = ALIGN((height + 1) >> 1, 16); + meta_stride_y = ALIGN(DIV_ROUND_UP(width, 48), 64); + meta_scanline_y = ALIGN(DIV_ROUND_UP(height, 4), 16); + meta_stride_uv = ALIGN(DIV_ROUND_UP((width + 1) >> 1, 24), 64); + meta_scanline_uv = ALIGN(DIV_ROUND_UP((height + 1) >> 1, 4), 16); + break; + default: + return 0; + } + + payload[0] = stride_y << 16 | scanline_y; + payload[1] = stride_uv << 16 | scanline_uv; + payload[2] = meta_stride_y << 16 | meta_scanline_y; + payload[3] = meta_stride_uv << 16 | meta_scanline_uv; + + return iris_hfi_gen2_session_set_property(inst, + HFI_PROP_UBWC_STRIDE_SCANLINE, + HFI_HOST_FLAGS_NONE, + port, + HFI_PAYLOAD_U32_ARRAY, + &payload[0], + sizeof(u32) * 4); +} + static int iris_hfi_gen2_set_tier(struct iris_inst *inst, u32 plane) { u32 port = iris_hfi_gen2_get_port(inst, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); @@ -620,6 +684,7 @@ static int iris_hfi_gen2_session_set_config_params(struct iris_inst *inst, u32 p {HFI_PROP_OPB_ENABLE, iris_hfi_gen2_set_opb_enable }, {HFI_PROP_COLOR_FORMAT, iris_hfi_gen2_set_colorformat }, {HFI_PROP_LINEAR_STRIDE_SCANLINE, iris_hfi_gen2_set_linear_stride_scanline }, + {HFI_PROP_UBWC_STRIDE_SCANLINE, iris_hfi_gen2_set_ubwc_stride_scanline }, {HFI_PROP_TIER, iris_hfi_gen2_set_tier }, {HFI_PROP_FRAME_RATE, iris_hfi_gen2_set_frame_rate }, {HFI_PROP_AV1_FILM_GRAIN_PRESENT, iris_hfi_gen2_set_film_grain }, diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h b/drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h index cecf771c55dd..68f849232906 100644 --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h @@ -118,6 +118,7 @@ enum hfi_flip { #define HFI_PROP_OPB_ENABLE 0x03000184 #define HFI_PROP_AV1_TILE_ROWS_COLUMNS 0x03000187 #define HFI_PROP_AV1_DRAP_CONFIG 0x03000189 +#define HFI_PROP_UBWC_STRIDE_SCANLINE 0x03000190 #define HFI_PROP_COMV_BUFFER_COUNT 0x03000193 #define HFI_PROP_AV1_UNIFORM_TILE_SPACING 0x03000197 #define HFI_PROP_END 0x03FFFFFF diff --git a/drivers/media/platform/qcom/iris/iris_utils.c b/drivers/media/platform/qcom/iris/iris_utils.c index cfc5b576ec56..26f51a0ccd04 100644 --- a/drivers/media/platform/qcom/iris/iris_utils.c +++ b/drivers/media/platform/qcom/iris/iris_utils.c @@ -35,7 +35,9 @@ int iris_get_mbpf(struct iris_inst *inst) bool iris_split_mode_enabled(struct iris_inst *inst) { return inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_NV12 || - inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC08C; + inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC08C || + inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_P010 || + inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C; } void iris_helper_buffers_done(struct iris_inst *inst, unsigned int type, -- 2.34.1 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 2/7] media: qcom: iris: gen2: add support for 10bit decoding 2026-04-08 16:43 ` [PATCH RFC 2/7] media: qcom: iris: gen2: add support for 10bit decoding Neil Armstrong @ 2026-04-17 7:22 ` Dikshita Agarwal 2026-04-17 8:03 ` Neil Armstrong 0 siblings, 1 reply; 34+ messages in thread From: Dikshita Agarwal @ 2026-04-17 7:22 UTC (permalink / raw) To: Neil Armstrong, Vikash Garodia, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel On 4/8/2026 10:13 PM, Neil Armstrong wrote: > Add the necessary plumbing into the HFi Gen2 to signal the decoder > the right 10bit pixel format and stride when in compressed mode. > > Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> > --- > .../platform/qcom/iris/iris_hfi_gen2_command.c | 71 +++++++++++++++++++++- > .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + > drivers/media/platform/qcom/iris/iris_utils.c | 4 +- > 3 files changed, 72 insertions(+), 4 deletions(-) > > diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c > index 30bfd90d423b..8e547e390fa3 100644 > --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c > +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c > @@ -481,8 +481,20 @@ static int iris_hfi_gen2_set_colorformat(struct iris_inst *inst, u32 plane) > > if (inst->domain == DECODER) { > pixelformat = inst->fmt_dst->fmt.pix_mp.pixelformat; > - hfi_colorformat = pixelformat == V4L2_PIX_FMT_NV12 ? > - HFI_COLOR_FMT_NV12 : HFI_COLOR_FMT_NV12_UBWC; > + switch (pixelformat) { > + case V4L2_PIX_FMT_NV12: > + hfi_colorformat = HFI_COLOR_FMT_NV12; > + break; > + case V4L2_PIX_FMT_QC08C: > + hfi_colorformat = HFI_COLOR_FMT_NV12_UBWC; > + break; > + case V4L2_PIX_FMT_P010: > + hfi_colorformat = HFI_COLOR_FMT_P010; > + break; > + case V4L2_PIX_FMT_QC10C: > + hfi_colorformat = HFI_COLOR_FMT_TP10_UBWC; > + break; > + }; > } else { > pixelformat = inst->fmt_src->fmt.pix_mp.pixelformat; > hfi_colorformat = pixelformat == V4L2_PIX_FMT_NV12 ? > @@ -517,7 +529,8 @@ static int iris_hfi_gen2_set_linear_stride_scanline(struct iris_inst *inst, u32 > stride_uv = stride_y; > scanline_uv = scanline_y / 2; > > - if (pixelformat != V4L2_PIX_FMT_NV12) > + if (pixelformat != V4L2_PIX_FMT_NV12 && > + pixelformat != V4L2_PIX_FMT_P010) > return 0; > > payload[0] = stride_y << 16 | scanline_y; > @@ -532,6 +545,57 @@ static int iris_hfi_gen2_set_linear_stride_scanline(struct iris_inst *inst, u32 > sizeof(u64)); > } > > +static int iris_hfi_gen2_set_ubwc_stride_scanline(struct iris_inst *inst, u32 plane) > +{ > + u32 meta_stride_y, meta_scanline_y, meta_stride_uv, meta_scanline_uv; > + u32 stride_y, scanline_y, stride_uv, scanline_uv; > + u32 port = iris_hfi_gen2_get_port(inst, plane); > + u32 pixelformat, width, height; > + u32 payload[4]; > + > + pixelformat = inst->fmt_dst->fmt.pix_mp.pixelformat; > + width = inst->fmt_dst->fmt.pix_mp.width; > + height = inst->fmt_dst->fmt.pix_mp.height; This HFI is only applicable to AV1, you might see some corruption due to this. Please check. Thanks, Dikshita ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 2/7] media: qcom: iris: gen2: add support for 10bit decoding 2026-04-17 7:22 ` Dikshita Agarwal @ 2026-04-17 8:03 ` Neil Armstrong 0 siblings, 0 replies; 34+ messages in thread From: Neil Armstrong @ 2026-04-17 8:03 UTC (permalink / raw) To: Dikshita Agarwal, Vikash Garodia, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel On 4/17/26 09:22, Dikshita Agarwal wrote: > > > On 4/8/2026 10:13 PM, Neil Armstrong wrote: >> Add the necessary plumbing into the HFi Gen2 to signal the decoder >> the right 10bit pixel format and stride when in compressed mode. >> >> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> >> --- >> .../platform/qcom/iris/iris_hfi_gen2_command.c | 71 +++++++++++++++++++++- >> .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + >> drivers/media/platform/qcom/iris/iris_utils.c | 4 +- >> 3 files changed, 72 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c >> index 30bfd90d423b..8e547e390fa3 100644 >> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c >> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c >> @@ -481,8 +481,20 @@ static int iris_hfi_gen2_set_colorformat(struct iris_inst *inst, u32 plane) >> >> if (inst->domain == DECODER) { >> pixelformat = inst->fmt_dst->fmt.pix_mp.pixelformat; >> - hfi_colorformat = pixelformat == V4L2_PIX_FMT_NV12 ? >> - HFI_COLOR_FMT_NV12 : HFI_COLOR_FMT_NV12_UBWC; >> + switch (pixelformat) { >> + case V4L2_PIX_FMT_NV12: >> + hfi_colorformat = HFI_COLOR_FMT_NV12; >> + break; >> + case V4L2_PIX_FMT_QC08C: >> + hfi_colorformat = HFI_COLOR_FMT_NV12_UBWC; >> + break; >> + case V4L2_PIX_FMT_P010: >> + hfi_colorformat = HFI_COLOR_FMT_P010; >> + break; >> + case V4L2_PIX_FMT_QC10C: >> + hfi_colorformat = HFI_COLOR_FMT_TP10_UBWC; >> + break; >> + }; >> } else { >> pixelformat = inst->fmt_src->fmt.pix_mp.pixelformat; >> hfi_colorformat = pixelformat == V4L2_PIX_FMT_NV12 ? >> @@ -517,7 +529,8 @@ static int iris_hfi_gen2_set_linear_stride_scanline(struct iris_inst *inst, u32 >> stride_uv = stride_y; >> scanline_uv = scanline_y / 2; >> >> - if (pixelformat != V4L2_PIX_FMT_NV12) >> + if (pixelformat != V4L2_PIX_FMT_NV12 && >> + pixelformat != V4L2_PIX_FMT_P010) >> return 0; >> >> payload[0] = stride_y << 16 | scanline_y; >> @@ -532,6 +545,57 @@ static int iris_hfi_gen2_set_linear_stride_scanline(struct iris_inst *inst, u32 >> sizeof(u64)); >> } >> >> +static int iris_hfi_gen2_set_ubwc_stride_scanline(struct iris_inst *inst, u32 plane) >> +{ >> + u32 meta_stride_y, meta_scanline_y, meta_stride_uv, meta_scanline_uv; >> + u32 stride_y, scanline_y, stride_uv, scanline_uv; >> + u32 port = iris_hfi_gen2_get_port(inst, plane); >> + u32 pixelformat, width, height; >> + u32 payload[4]; >> + >> + pixelformat = inst->fmt_dst->fmt.pix_mp.pixelformat; >> + width = inst->fmt_dst->fmt.pix_mp.width; >> + height = inst->fmt_dst->fmt.pix_mp.height; > > This HFI is only applicable to AV1, you might see some corruption due to > this. Please check. This is what I saw looking at donwstream, but I had not implemented this initially but I got some corruption with some different width/height, which was solved adding this command. I guess this in-firmware calculations are not exactly the same the DRM driver expects. Honestly I think it's preferable to sync the stride/scanlines calculations between the driver and the firmware. For example I used the same "ALIGN(width, 192)" for the v2 iris patchset which was wrong because ALIGN only works on Power Of Two number but it still worked because this HFI HFI_PROP_UBWC_STRIDE_SCANLINE command was called with the wrong aligned width. Neil > > Thanks, > Dikshita ^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH RFC 3/7] media: qcom: iris: add helpers for 8bit and 10bit formats 2026-04-08 16:43 [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats Neil Armstrong 2026-04-08 16:43 ` [PATCH RFC 1/7] media: qcom: iris: add QC10C & P010 buffer size calculations Neil Armstrong 2026-04-08 16:43 ` [PATCH RFC 2/7] media: qcom: iris: gen2: add support for 10bit decoding Neil Armstrong @ 2026-04-08 16:43 ` Neil Armstrong 2026-04-17 7:23 ` Dikshita Agarwal 2026-04-08 16:43 ` [PATCH RFC 4/7] media: qcom: iris: vdec: update size and stride calculations for " Neil Armstrong ` (4 subsequent siblings) 7 siblings, 1 reply; 34+ messages in thread From: Neil Armstrong @ 2026-04-08 16:43 UTC (permalink / raw) To: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel, Neil Armstrong To simplify code checking for pixel formats, add helpers to check for 8bit and 10bit formats. Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> --- drivers/media/platform/qcom/iris/iris_utils.c | 12 ++++++++++++ drivers/media/platform/qcom/iris/iris_utils.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/drivers/media/platform/qcom/iris/iris_utils.c b/drivers/media/platform/qcom/iris/iris_utils.c index 26f51a0ccd04..c75dcb8e671e 100644 --- a/drivers/media/platform/qcom/iris/iris_utils.c +++ b/drivers/media/platform/qcom/iris/iris_utils.c @@ -40,6 +40,18 @@ bool iris_split_mode_enabled(struct iris_inst *inst) inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C; } +bool iris_fmt_is_8bit(__u32 pixelformat) +{ + return pixelformat == V4L2_PIX_FMT_NV12 || + pixelformat == V4L2_PIX_FMT_QC08C; +} + +bool iris_fmt_is_10bit(__u32 pixelformat) +{ + return pixelformat == V4L2_PIX_FMT_P010 || + pixelformat == V4L2_PIX_FMT_QC10C; +} + void iris_helper_buffers_done(struct iris_inst *inst, unsigned int type, enum vb2_buffer_state state) { diff --git a/drivers/media/platform/qcom/iris/iris_utils.h b/drivers/media/platform/qcom/iris/iris_utils.h index b5705d156431..35337c5da005 100644 --- a/drivers/media/platform/qcom/iris/iris_utils.h +++ b/drivers/media/platform/qcom/iris/iris_utils.h @@ -45,6 +45,8 @@ bool iris_res_is_less_than(u32 width, u32 height, u32 ref_width, u32 ref_height); int iris_get_mbpf(struct iris_inst *inst); bool iris_split_mode_enabled(struct iris_inst *inst); +bool iris_fmt_is_8bit(__u32 pixelformat); +bool iris_fmt_is_10bit(__u32 pixelformat); struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id); void iris_helper_buffers_done(struct iris_inst *inst, unsigned int type, enum vb2_buffer_state state); -- 2.34.1 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 3/7] media: qcom: iris: add helpers for 8bit and 10bit formats 2026-04-08 16:43 ` [PATCH RFC 3/7] media: qcom: iris: add helpers for 8bit and 10bit formats Neil Armstrong @ 2026-04-17 7:23 ` Dikshita Agarwal 2026-04-17 8:03 ` Neil Armstrong 0 siblings, 1 reply; 34+ messages in thread From: Dikshita Agarwal @ 2026-04-17 7:23 UTC (permalink / raw) To: Neil Armstrong, Vikash Garodia, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel On 4/8/2026 10:13 PM, Neil Armstrong wrote: > To simplify code checking for pixel formats, add helpers to > check for 8bit and 10bit formats. > > Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> > --- > drivers/media/platform/qcom/iris/iris_utils.c | 12 ++++++++++++ > drivers/media/platform/qcom/iris/iris_utils.h | 2 ++ > 2 files changed, 14 insertions(+) > > diff --git a/drivers/media/platform/qcom/iris/iris_utils.c b/drivers/media/platform/qcom/iris/iris_utils.c > index 26f51a0ccd04..c75dcb8e671e 100644 > --- a/drivers/media/platform/qcom/iris/iris_utils.c > +++ b/drivers/media/platform/qcom/iris/iris_utils.c > @@ -40,6 +40,18 @@ bool iris_split_mode_enabled(struct iris_inst *inst) > inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C; > } > > +bool iris_fmt_is_8bit(__u32 pixelformat) > +{ > + return pixelformat == V4L2_PIX_FMT_NV12 || > + pixelformat == V4L2_PIX_FMT_QC08C; > +} > + > +bool iris_fmt_is_10bit(__u32 pixelformat) > +{ > + return pixelformat == V4L2_PIX_FMT_P010 || > + pixelformat == V4L2_PIX_FMT_QC10C; > +} A similar check is required in the current first patch of the series. So you can move this patch earlier in the series? Thanks, Dikshita ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 3/7] media: qcom: iris: add helpers for 8bit and 10bit formats 2026-04-17 7:23 ` Dikshita Agarwal @ 2026-04-17 8:03 ` Neil Armstrong 0 siblings, 0 replies; 34+ messages in thread From: Neil Armstrong @ 2026-04-17 8:03 UTC (permalink / raw) To: Dikshita Agarwal, Vikash Garodia, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel On 4/17/26 09:23, Dikshita Agarwal wrote: > > > On 4/8/2026 10:13 PM, Neil Armstrong wrote: >> To simplify code checking for pixel formats, add helpers to >> check for 8bit and 10bit formats. >> >> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> >> --- >> drivers/media/platform/qcom/iris/iris_utils.c | 12 ++++++++++++ >> drivers/media/platform/qcom/iris/iris_utils.h | 2 ++ >> 2 files changed, 14 insertions(+) >> >> diff --git a/drivers/media/platform/qcom/iris/iris_utils.c b/drivers/media/platform/qcom/iris/iris_utils.c >> index 26f51a0ccd04..c75dcb8e671e 100644 >> --- a/drivers/media/platform/qcom/iris/iris_utils.c >> +++ b/drivers/media/platform/qcom/iris/iris_utils.c >> @@ -40,6 +40,18 @@ bool iris_split_mode_enabled(struct iris_inst *inst) >> inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C; >> } >> >> +bool iris_fmt_is_8bit(__u32 pixelformat) >> +{ >> + return pixelformat == V4L2_PIX_FMT_NV12 || >> + pixelformat == V4L2_PIX_FMT_QC08C; >> +} >> + >> +bool iris_fmt_is_10bit(__u32 pixelformat) >> +{ >> + return pixelformat == V4L2_PIX_FMT_P010 || >> + pixelformat == V4L2_PIX_FMT_QC10C; >> +} > > A similar check is required in the current first patch of the series. So > you can move this patch earlier in the series? Ack > > Thanks, > Dikshita > ^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH RFC 4/7] media: qcom: iris: vdec: update size and stride calculations for 10bit formats 2026-04-08 16:43 [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats Neil Armstrong ` (2 preceding siblings ...) 2026-04-08 16:43 ` [PATCH RFC 3/7] media: qcom: iris: add helpers for 8bit and 10bit formats Neil Armstrong @ 2026-04-08 16:43 ` Neil Armstrong 2026-04-10 10:10 ` Vishnu Reddy 2026-04-08 16:43 ` [PATCH RFC 5/7] media: qcom: iris: vdec: forbid g_fmt while waiting for first source change Neil Armstrong ` (3 subsequent siblings) 7 siblings, 1 reply; 34+ messages in thread From: Neil Armstrong @ 2026-04-08 16:43 UTC (permalink / raw) To: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel, Neil Armstrong Update the gen2 response and vdec s_fmt code to take in account the P010 and QC010 when calculating the width, height and stride. Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> --- .../platform/qcom/iris/iris_hfi_gen2_response.c | 19 ++++++++++++++++--- drivers/media/platform/qcom/iris/iris_vdec.c | 21 ++++++++++++++++++--- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c index 8e19f61bbbf9..d268149191ea 100644 --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c @@ -542,9 +542,22 @@ static void iris_hfi_gen2_read_input_subcr_params(struct iris_inst *inst) pixmp_ip->width = width; pixmp_ip->height = height; - pixmp_op->width = ALIGN(width, 128); - pixmp_op->height = ALIGN(height, 32); - pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128); + pixmp_op->width = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ? + ALIGN(width, 192) : ALIGN(width, 128); + pixmp_op->height = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ? + ALIGN(height, 16) : ALIGN(height, 32); + switch (pixmp_op->pixelformat) { + case V4L2_PIX_FMT_P010: + pixmp_op->plane_fmt[0].bytesperline = ALIGN(width * 2, 256); + break; + case V4L2_PIX_FMT_QC10C: + pixmp_op->plane_fmt[0].bytesperline = ALIGN(ALIGN(width, 192) * 4 / 3, 256); + break; + case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_QC08C: + pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128); + break; + } pixmp_op->plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_OUTPUT); matrix_coeff = subsc_params.color_info & 0xFF; diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c index 719217399a30..ca0518c27834 100644 --- a/drivers/media/platform/qcom/iris/iris_vdec.c +++ b/drivers/media/platform/qcom/iris/iris_vdec.c @@ -272,10 +272,25 @@ int iris_vdec_s_fmt(struct iris_inst *inst, struct v4l2_format *f) fmt = inst->fmt_dst; fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; fmt->fmt.pix_mp.pixelformat = f->fmt.pix_mp.pixelformat; - fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, 128); - fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, 32); + codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? 192 : 128; + fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, codec_align); + codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? 16 : 32; + fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, codec_align); fmt->fmt.pix_mp.num_planes = 1; - fmt->fmt.pix_mp.plane_fmt[0].bytesperline = ALIGN(f->fmt.pix_mp.width, 128); + switch (f->fmt.pix_mp.pixelformat) { + case V4L2_PIX_FMT_P010: + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = + ALIGN(f->fmt.pix_mp.width * 2, 256); + break; + case V4L2_PIX_FMT_QC10C: + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = + ALIGN(f->fmt.pix_mp.width * 4 / 3, 256); + break; + case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_QC08C: + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = f->fmt.pix_mp.width; + break; + } fmt->fmt.pix_mp.plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_OUTPUT); inst->buffers[BUF_OUTPUT].min_count = iris_vpu_buf_count(inst, BUF_OUTPUT); inst->buffers[BUF_OUTPUT].size = fmt->fmt.pix_mp.plane_fmt[0].sizeimage; -- 2.34.1 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 4/7] media: qcom: iris: vdec: update size and stride calculations for 10bit formats 2026-04-08 16:43 ` [PATCH RFC 4/7] media: qcom: iris: vdec: update size and stride calculations for " Neil Armstrong @ 2026-04-10 10:10 ` Vishnu Reddy 2026-04-10 11:59 ` Neil Armstrong 0 siblings, 1 reply; 34+ messages in thread From: Vishnu Reddy @ 2026-04-10 10:10 UTC (permalink / raw) To: Neil Armstrong, Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel On 4/8/2026 10:13 PM, Neil Armstrong wrote: > Update the gen2 response and vdec s_fmt code to take in account > the P010 and QC010 when calculating the width, height and stride. > > Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> > --- > .../platform/qcom/iris/iris_hfi_gen2_response.c | 19 ++++++++++++++++--- > drivers/media/platform/qcom/iris/iris_vdec.c | 21 ++++++++++++++++++--- > 2 files changed, 34 insertions(+), 6 deletions(-) > > diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c > index 8e19f61bbbf9..d268149191ea 100644 > --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c > +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c > @@ -542,9 +542,22 @@ static void iris_hfi_gen2_read_input_subcr_params(struct iris_inst *inst) > pixmp_ip->width = width; > pixmp_ip->height = height; > > - pixmp_op->width = ALIGN(width, 128); > - pixmp_op->height = ALIGN(height, 32); > - pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128); > + pixmp_op->width = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ? > + ALIGN(width, 192) : ALIGN(width, 128); > + pixmp_op->height = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ? > + ALIGN(height, 16) : ALIGN(height, 32); > + switch (pixmp_op->pixelformat) { > + case V4L2_PIX_FMT_P010: > + pixmp_op->plane_fmt[0].bytesperline = ALIGN(width * 2, 256); > + break; > + case V4L2_PIX_FMT_QC10C: > + pixmp_op->plane_fmt[0].bytesperline = ALIGN(ALIGN(width, 192) * 4 / 3, 256); > + break; > + case V4L2_PIX_FMT_NV12: > + case V4L2_PIX_FMT_QC08C: > + pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128); > + break; > + } > pixmp_op->plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_OUTPUT); > > matrix_coeff = subsc_params.color_info & 0xFF; > diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c > index 719217399a30..ca0518c27834 100644 > --- a/drivers/media/platform/qcom/iris/iris_vdec.c > +++ b/drivers/media/platform/qcom/iris/iris_vdec.c > @@ -272,10 +272,25 @@ int iris_vdec_s_fmt(struct iris_inst *inst, struct v4l2_format *f) > fmt = inst->fmt_dst; > fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; > fmt->fmt.pix_mp.pixelformat = f->fmt.pix_mp.pixelformat; > - fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, 128); > - fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, 32); > + codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? 192 : 128; > + fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, codec_align); > + codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? 16 : 32; > + fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, codec_align); > fmt->fmt.pix_mp.num_planes = 1; > - fmt->fmt.pix_mp.plane_fmt[0].bytesperline = ALIGN(f->fmt.pix_mp.width, 128); > + switch (f->fmt.pix_mp.pixelformat) { > + case V4L2_PIX_FMT_P010: > + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = > + ALIGN(f->fmt.pix_mp.width * 2, 256); > + break; > + case V4L2_PIX_FMT_QC10C: > + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = > + ALIGN(f->fmt.pix_mp.width * 4 / 3, 256); > + break; > + case V4L2_PIX_FMT_NV12: > + case V4L2_PIX_FMT_QC08C: > + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = f->fmt.pix_mp.width; In the removed code, bytesperline for NV12 and QC08C was aligned to 128 bytes. In the new code, Is that alignment missed or not required? > + break; > + } > fmt->fmt.pix_mp.plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_OUTPUT); > inst->buffers[BUF_OUTPUT].min_count = iris_vpu_buf_count(inst, BUF_OUTPUT); > inst->buffers[BUF_OUTPUT].size = fmt->fmt.pix_mp.plane_fmt[0].sizeimage; > ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 4/7] media: qcom: iris: vdec: update size and stride calculations for 10bit formats 2026-04-10 10:10 ` Vishnu Reddy @ 2026-04-10 11:59 ` Neil Armstrong 2026-04-10 12:57 ` Vishnu Reddy 2026-04-14 23:39 ` Nicolas Dufresne 0 siblings, 2 replies; 34+ messages in thread From: Neil Armstrong @ 2026-04-10 11:59 UTC (permalink / raw) To: Vishnu Reddy, Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel On 4/10/26 12:10, Vishnu Reddy wrote: > > On 4/8/2026 10:13 PM, Neil Armstrong wrote: >> Update the gen2 response and vdec s_fmt code to take in account >> the P010 and QC010 when calculating the width, height and stride. >> >> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> >> --- >> .../platform/qcom/iris/iris_hfi_gen2_response.c | 19 ++++++++++++++++--- >> drivers/media/platform/qcom/iris/iris_vdec.c | 21 ++++++++++++++++++--- >> 2 files changed, 34 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c >> index 8e19f61bbbf9..d268149191ea 100644 >> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c >> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c >> @@ -542,9 +542,22 @@ static void iris_hfi_gen2_read_input_subcr_params(struct iris_inst *inst) >> pixmp_ip->width = width; >> pixmp_ip->height = height; >> - pixmp_op->width = ALIGN(width, 128); >> - pixmp_op->height = ALIGN(height, 32); >> - pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128); >> + pixmp_op->width = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ? >> + ALIGN(width, 192) : ALIGN(width, 128); >> + pixmp_op->height = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ? >> + ALIGN(height, 16) : ALIGN(height, 32); >> + switch (pixmp_op->pixelformat) { >> + case V4L2_PIX_FMT_P010: >> + pixmp_op->plane_fmt[0].bytesperline = ALIGN(width * 2, 256); >> + break; >> + case V4L2_PIX_FMT_QC10C: >> + pixmp_op->plane_fmt[0].bytesperline = ALIGN(ALIGN(width, 192) * 4 / 3, 256); >> + break; >> + case V4L2_PIX_FMT_NV12: >> + case V4L2_PIX_FMT_QC08C: >> + pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128); >> + break; >> + } >> pixmp_op->plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_OUTPUT); >> matrix_coeff = subsc_params.color_info & 0xFF; >> diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c >> index 719217399a30..ca0518c27834 100644 >> --- a/drivers/media/platform/qcom/iris/iris_vdec.c >> +++ b/drivers/media/platform/qcom/iris/iris_vdec.c >> @@ -272,10 +272,25 @@ int iris_vdec_s_fmt(struct iris_inst *inst, struct v4l2_format *f) >> fmt = inst->fmt_dst; >> fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; >> fmt->fmt.pix_mp.pixelformat = f->fmt.pix_mp.pixelformat; >> - fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, 128); >> - fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, 32); >> + codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? 192 : 128; >> + fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, codec_align); >> + codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? 16 : 32; >> + fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, codec_align); >> fmt->fmt.pix_mp.num_planes = 1; >> - fmt->fmt.pix_mp.plane_fmt[0].bytesperline = ALIGN(f->fmt.pix_mp.width, 128); >> + switch (f->fmt.pix_mp.pixelformat) { >> + case V4L2_PIX_FMT_P010: >> + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = >> + ALIGN(f->fmt.pix_mp.width * 2, 256); >> + break; >> + case V4L2_PIX_FMT_QC10C: >> + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = >> + ALIGN(f->fmt.pix_mp.width * 4 / 3, 256); >> + break; >> + case V4L2_PIX_FMT_NV12: >> + case V4L2_PIX_FMT_QC08C: >> + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = f->fmt.pix_mp.width; > In the removed code, bytesperline for NV12 and QC08C was aligned to 128 bytes. > In the new code, Is that alignment missed or not required? The alignment is done right before: codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? 192 : 128; fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, codec_align); calling ALIGN(f->fmt.pix_mp.width, 128) again is a no-op. Thanks, Neil >> + break; >> + } >> fmt->fmt.pix_mp.plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_OUTPUT); >> inst->buffers[BUF_OUTPUT].min_count = iris_vpu_buf_count(inst, BUF_OUTPUT); >> inst->buffers[BUF_OUTPUT].size = fmt->fmt.pix_mp.plane_fmt[0].sizeimage; >> ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 4/7] media: qcom: iris: vdec: update size and stride calculations for 10bit formats 2026-04-10 11:59 ` Neil Armstrong @ 2026-04-10 12:57 ` Vishnu Reddy 2026-04-10 13:47 ` Neil Armstrong 2026-04-14 23:39 ` Nicolas Dufresne 1 sibling, 1 reply; 34+ messages in thread From: Vishnu Reddy @ 2026-04-10 12:57 UTC (permalink / raw) To: Neil Armstrong, Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel On 4/10/2026 5:29 PM, Neil Armstrong wrote: > On 4/10/26 12:10, Vishnu Reddy wrote: >> >> On 4/8/2026 10:13 PM, Neil Armstrong wrote: >>> Update the gen2 response and vdec s_fmt code to take in account >>> the P010 and QC010 when calculating the width, height and stride. >>> >>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> >>> --- >>> .../platform/qcom/iris/iris_hfi_gen2_response.c | 19 >>> ++++++++++++++++--- >>> drivers/media/platform/qcom/iris/iris_vdec.c | 21 >>> ++++++++++++++++++--- >>> 2 files changed, 34 insertions(+), 6 deletions(-) >>> >>> diff --git >>> a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c >>> b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c >>> index 8e19f61bbbf9..d268149191ea 100644 >>> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c >>> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c >>> @@ -542,9 +542,22 @@ static void >>> iris_hfi_gen2_read_input_subcr_params(struct iris_inst *inst) >>> pixmp_ip->width = width; >>> pixmp_ip->height = height; >>> - pixmp_op->width = ALIGN(width, 128); >>> - pixmp_op->height = ALIGN(height, 32); >>> - pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128); >>> + pixmp_op->width = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ? >>> + ALIGN(width, 192) : ALIGN(width, 128); >>> + pixmp_op->height = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ? >>> + ALIGN(height, 16) : ALIGN(height, 32); >>> + switch (pixmp_op->pixelformat) { >>> + case V4L2_PIX_FMT_P010: >>> + pixmp_op->plane_fmt[0].bytesperline = ALIGN(width * 2, 256); >>> + break; >>> + case V4L2_PIX_FMT_QC10C: >>> + pixmp_op->plane_fmt[0].bytesperline = ALIGN(ALIGN(width, >>> 192) * 4 / 3, 256); >>> + break; >>> + case V4L2_PIX_FMT_NV12: >>> + case V4L2_PIX_FMT_QC08C: >>> + pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128); >>> + break; >>> + } >>> pixmp_op->plane_fmt[0].sizeimage = iris_get_buffer_size(inst, >>> BUF_OUTPUT); >>> matrix_coeff = subsc_params.color_info & 0xFF; >>> diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c >>> b/drivers/media/platform/qcom/iris/iris_vdec.c >>> index 719217399a30..ca0518c27834 100644 >>> --- a/drivers/media/platform/qcom/iris/iris_vdec.c >>> +++ b/drivers/media/platform/qcom/iris/iris_vdec.c >>> @@ -272,10 +272,25 @@ int iris_vdec_s_fmt(struct iris_inst *inst, >>> struct v4l2_format *f) >>> fmt = inst->fmt_dst; >>> fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; >>> fmt->fmt.pix_mp.pixelformat = f->fmt.pix_mp.pixelformat; >>> - fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, 128); >>> - fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, 32); >>> + codec_align = f->fmt.pix_mp.pixelformat == >>> V4L2_PIX_FMT_QC10C ? 192 : 128; >>> + fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, >>> codec_align); >>> + codec_align = f->fmt.pix_mp.pixelformat == >>> V4L2_PIX_FMT_QC10C ? 16 : 32; >>> + fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, >>> codec_align); >>> fmt->fmt.pix_mp.num_planes = 1; >>> - fmt->fmt.pix_mp.plane_fmt[0].bytesperline = >>> ALIGN(f->fmt.pix_mp.width, 128); >>> + switch (f->fmt.pix_mp.pixelformat) { >>> + case V4L2_PIX_FMT_P010: >>> + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = >>> + ALIGN(f->fmt.pix_mp.width * 2, 256); >>> + break; >>> + case V4L2_PIX_FMT_QC10C: >>> + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = >>> + ALIGN(f->fmt.pix_mp.width * 4 / 3, 256); >>> + break; >>> + case V4L2_PIX_FMT_NV12: >>> + case V4L2_PIX_FMT_QC08C: >>> + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = >>> f->fmt.pix_mp.width; >> In the removed code, bytesperline for NV12 and QC08C was aligned to >> 128 bytes. >> In the new code, Is that alignment missed or not required? > > The alignment is done right before: > codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? > 192 : 128; > fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, codec_align); > > calling ALIGN(f->fmt.pix_mp.width, 128) again is a no-op. > Here f->fmt.pix_mp.width is not aligned, fmt->fmt.pix_mp.width is aligned. It should be fmt->fmt.pix_mp.plane_fmt[0].bytesperline = fmt->fmt.pix_mp.width. Thanks, Vishnu Reddy > Thanks, > Neil > >>> + break; >>> + } >>> fmt->fmt.pix_mp.plane_fmt[0].sizeimage = >>> iris_get_buffer_size(inst, BUF_OUTPUT); >>> inst->buffers[BUF_OUTPUT].min_count = >>> iris_vpu_buf_count(inst, BUF_OUTPUT); >>> inst->buffers[BUF_OUTPUT].size = >>> fmt->fmt.pix_mp.plane_fmt[0].sizeimage; >>> > ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 4/7] media: qcom: iris: vdec: update size and stride calculations for 10bit formats 2026-04-10 12:57 ` Vishnu Reddy @ 2026-04-10 13:47 ` Neil Armstrong 0 siblings, 0 replies; 34+ messages in thread From: Neil Armstrong @ 2026-04-10 13:47 UTC (permalink / raw) To: Vishnu Reddy, Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel On 4/10/26 14:57, Vishnu Reddy wrote: > > On 4/10/2026 5:29 PM, Neil Armstrong wrote: >> On 4/10/26 12:10, Vishnu Reddy wrote: >>> >>> On 4/8/2026 10:13 PM, Neil Armstrong wrote: >>>> Update the gen2 response and vdec s_fmt code to take in account >>>> the P010 and QC010 when calculating the width, height and stride. >>>> >>>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> >>>> --- >>>> .../platform/qcom/iris/iris_hfi_gen2_response.c | 19 ++++++++++++++++--- >>>> drivers/media/platform/qcom/iris/iris_vdec.c | 21 ++++++++++++++++++--- >>>> 2 files changed, 34 insertions(+), 6 deletions(-) >>>> >>>> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c >>>> index 8e19f61bbbf9..d268149191ea 100644 >>>> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c >>>> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c >>>> @@ -542,9 +542,22 @@ static void iris_hfi_gen2_read_input_subcr_params(struct iris_inst *inst) >>>> pixmp_ip->width = width; >>>> pixmp_ip->height = height; >>>> - pixmp_op->width = ALIGN(width, 128); >>>> - pixmp_op->height = ALIGN(height, 32); >>>> - pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128); >>>> + pixmp_op->width = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ? >>>> + ALIGN(width, 192) : ALIGN(width, 128); >>>> + pixmp_op->height = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ? >>>> + ALIGN(height, 16) : ALIGN(height, 32); >>>> + switch (pixmp_op->pixelformat) { >>>> + case V4L2_PIX_FMT_P010: >>>> + pixmp_op->plane_fmt[0].bytesperline = ALIGN(width * 2, 256); >>>> + break; >>>> + case V4L2_PIX_FMT_QC10C: >>>> + pixmp_op->plane_fmt[0].bytesperline = ALIGN(ALIGN(width, 192) * 4 / 3, 256); >>>> + break; >>>> + case V4L2_PIX_FMT_NV12: >>>> + case V4L2_PIX_FMT_QC08C: >>>> + pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128); >>>> + break; >>>> + } >>>> pixmp_op->plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_OUTPUT); >>>> matrix_coeff = subsc_params.color_info & 0xFF; >>>> diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c >>>> index 719217399a30..ca0518c27834 100644 >>>> --- a/drivers/media/platform/qcom/iris/iris_vdec.c >>>> +++ b/drivers/media/platform/qcom/iris/iris_vdec.c >>>> @@ -272,10 +272,25 @@ int iris_vdec_s_fmt(struct iris_inst *inst, struct v4l2_format *f) >>>> fmt = inst->fmt_dst; >>>> fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; >>>> fmt->fmt.pix_mp.pixelformat = f->fmt.pix_mp.pixelformat; >>>> - fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, 128); >>>> - fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, 32); >>>> + codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? 192 : 128; >>>> + fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, codec_align); >>>> + codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? 16 : 32; >>>> + fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, codec_align); >>>> fmt->fmt.pix_mp.num_planes = 1; >>>> - fmt->fmt.pix_mp.plane_fmt[0].bytesperline = ALIGN(f->fmt.pix_mp.width, 128); >>>> + switch (f->fmt.pix_mp.pixelformat) { >>>> + case V4L2_PIX_FMT_P010: >>>> + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = >>>> + ALIGN(f->fmt.pix_mp.width * 2, 256); >>>> + break; >>>> + case V4L2_PIX_FMT_QC10C: >>>> + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = >>>> + ALIGN(f->fmt.pix_mp.width * 4 / 3, 256); >>>> + break; >>>> + case V4L2_PIX_FMT_NV12: >>>> + case V4L2_PIX_FMT_QC08C: >>>> + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = f->fmt.pix_mp.width; >>> In the removed code, bytesperline for NV12 and QC08C was aligned to 128 bytes. >>> In the new code, Is that alignment missed or not required? >> >> The alignment is done right before: >> codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? 192 : 128; >> fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, codec_align); >> >> calling ALIGN(f->fmt.pix_mp.width, 128) again is a no-op. >> > Here f->fmt.pix_mp.width is not aligned, fmt->fmt.pix_mp.width is aligned. > It should be fmt->fmt.pix_mp.plane_fmt[0].bytesperline = fmt->fmt.pix_mp.width. Indeed you're right, I did misread... Thanks, Neil > > Thanks, > Vishnu Reddy >> Thanks, >> Neil >> >>>> + break; >>>> + } >>>> fmt->fmt.pix_mp.plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_OUTPUT); >>>> inst->buffers[BUF_OUTPUT].min_count = iris_vpu_buf_count(inst, BUF_OUTPUT); >>>> inst->buffers[BUF_OUTPUT].size = fmt->fmt.pix_mp.plane_fmt[0].sizeimage; >>>> >> ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 4/7] media: qcom: iris: vdec: update size and stride calculations for 10bit formats 2026-04-10 11:59 ` Neil Armstrong 2026-04-10 12:57 ` Vishnu Reddy @ 2026-04-14 23:39 ` Nicolas Dufresne 1 sibling, 0 replies; 34+ messages in thread From: Nicolas Dufresne @ 2026-04-14 23:39 UTC (permalink / raw) To: Neil Armstrong, Vishnu Reddy, Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel [-- Attachment #1: Type: text/plain, Size: 5631 bytes --] Le vendredi 10 avril 2026 à 13:59 +0200, Neil Armstrong a écrit : > On 4/10/26 12:10, Vishnu Reddy wrote: > > > > On 4/8/2026 10:13 PM, Neil Armstrong wrote: > > > Update the gen2 response and vdec s_fmt code to take in account > > > the P010 and QC010 when calculating the width, height and stride. > > > > > > Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> > > > --- > > > .../platform/qcom/iris/iris_hfi_gen2_response.c | 19 > > > ++++++++++++++++--- > > > drivers/media/platform/qcom/iris/iris_vdec.c | 21 > > > ++++++++++++++++++--- > > > 2 files changed, 34 insertions(+), 6 deletions(-) > > > > > > diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c > > > b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c > > > index 8e19f61bbbf9..d268149191ea 100644 > > > --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c > > > +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c > > > @@ -542,9 +542,22 @@ static void > > > iris_hfi_gen2_read_input_subcr_params(struct iris_inst *inst) > > > pixmp_ip->width = width; > > > pixmp_ip->height = height; > > > - pixmp_op->width = ALIGN(width, 128); > > > - pixmp_op->height = ALIGN(height, 32); > > > - pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128); > > > + pixmp_op->width = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ? > > > + ALIGN(width, 192) : ALIGN(width, 128); > > > + pixmp_op->height = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ? > > > + ALIGN(height, 16) : ALIGN(height, 32); > > > + switch (pixmp_op->pixelformat) { > > > + case V4L2_PIX_FMT_P010: > > > + pixmp_op->plane_fmt[0].bytesperline = ALIGN(width * 2, 256); > > > + break; > > > + case V4L2_PIX_FMT_QC10C: > > > + pixmp_op->plane_fmt[0].bytesperline = ALIGN(ALIGN(width, 192) * 4 > > > / 3, 256); > > > + break; > > > + case V4L2_PIX_FMT_NV12: > > > + case V4L2_PIX_FMT_QC08C: > > > + pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128); > > > + break; > > > + } > > > pixmp_op->plane_fmt[0].sizeimage = iris_get_buffer_size(inst, > > > BUF_OUTPUT); > > > matrix_coeff = subsc_params.color_info & 0xFF; > > > diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c > > > b/drivers/media/platform/qcom/iris/iris_vdec.c > > > index 719217399a30..ca0518c27834 100644 > > > --- a/drivers/media/platform/qcom/iris/iris_vdec.c > > > +++ b/drivers/media/platform/qcom/iris/iris_vdec.c > > > @@ -272,10 +272,25 @@ int iris_vdec_s_fmt(struct iris_inst *inst, struct > > > v4l2_format *f) > > > fmt = inst->fmt_dst; > > > fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; > > > fmt->fmt.pix_mp.pixelformat = f->fmt.pix_mp.pixelformat; > > > - fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, 128); > > > - fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, 32); > > > + codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? > > > 192 : 128; > > > + fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, codec_align); > > > + codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? > > > 16 : 32; > > > + fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, > > > codec_align); > > > fmt->fmt.pix_mp.num_planes = 1; > > > - fmt->fmt.pix_mp.plane_fmt[0].bytesperline = ALIGN(f- > > > >fmt.pix_mp.width, 128); > > > + switch (f->fmt.pix_mp.pixelformat) { > > > + case V4L2_PIX_FMT_P010: > > > + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = > > > + ALIGN(f->fmt.pix_mp.width * 2, 256); > > > + break; > > > + case V4L2_PIX_FMT_QC10C: > > > + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = > > > + ALIGN(f->fmt.pix_mp.width * 4 / 3, 256); > > > + break; > > > + case V4L2_PIX_FMT_NV12: > > > + case V4L2_PIX_FMT_QC08C: > > > + fmt->fmt.pix_mp.plane_fmt[0].bytesperline = f- > > > >fmt.pix_mp.width; > > In the removed code, bytesperline for NV12 and QC08C was aligned to 128 > > bytes. > > In the new code, Is that alignment missed or not required? > > The alignment is done right before: > codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? 192 : > 128; > fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, codec_align); > > calling ALIGN(f->fmt.pix_mp.width, 128) again is a no-op. What typically other drivers do is implement a static table that associate a v4l2_frmsize_stepwise to each format, and possibly per HW generation. And then uses v4l2_apply_frmsize_constraints() to apply them generically in their try/s_fmt functions. This make lot cleaner and clearer code then the sate of this driver. Nicolas > > Thanks, > Neil > > > > + break; > > > + } > > > fmt->fmt.pix_mp.plane_fmt[0].sizeimage = > > > iris_get_buffer_size(inst, BUF_OUTPUT); > > > inst->buffers[BUF_OUTPUT].min_count = iris_vpu_buf_count(inst, > > > BUF_OUTPUT); > > > inst->buffers[BUF_OUTPUT].size = fmt- > > > >fmt.pix_mp.plane_fmt[0].sizeimage; > > > > [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH RFC 5/7] media: qcom: iris: vdec: forbid g_fmt while waiting for first source change 2026-04-08 16:43 [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats Neil Armstrong ` (3 preceding siblings ...) 2026-04-08 16:43 ` [PATCH RFC 4/7] media: qcom: iris: vdec: update size and stride calculations for " Neil Armstrong @ 2026-04-08 16:43 ` Neil Armstrong 2026-04-08 16:43 ` [PATCH RFC 6/7] media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats Neil Armstrong ` (2 subsequent siblings) 7 siblings, 0 replies; 34+ messages in thread From: Neil Armstrong @ 2026-04-08 16:43 UTC (permalink / raw) To: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel, Neil Armstrong When decoding is started with only the OUTPUT queue, we're waiting for a source change event from the decoder. During this period, the CAPTURE pixel format is not yet known so return -EINVAL. Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> --- drivers/media/platform/qcom/iris/iris_state.c | 6 ++++++ drivers/media/platform/qcom/iris/iris_state.h | 1 + drivers/media/platform/qcom/iris/iris_vidc.c | 14 +++++++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_state.c b/drivers/media/platform/qcom/iris/iris_state.c index d14472414750..08e51eecf1b3 100644 --- a/drivers/media/platform/qcom/iris/iris_state.c +++ b/drivers/media/platform/qcom/iris/iris_state.c @@ -258,6 +258,12 @@ bool iris_drain_pending(struct iris_inst *inst) inst->sub_state & IRIS_INST_SUB_DRAIN_LAST; } +bool iris_ipsc_pending(struct iris_inst *inst) +{ + return inst->state == IRIS_INST_INPUT_STREAMING && + (inst->sub_state & IRIS_INST_SUB_FIRST_IPSC) == 0; +} + bool iris_allow_cmd(struct iris_inst *inst, u32 cmd) { struct vb2_queue *src_q = v4l2_m2m_get_src_vq(inst->m2m_ctx); diff --git a/drivers/media/platform/qcom/iris/iris_state.h b/drivers/media/platform/qcom/iris/iris_state.h index b09fa54cf17e..761e6c4dc36b 100644 --- a/drivers/media/platform/qcom/iris/iris_state.h +++ b/drivers/media/platform/qcom/iris/iris_state.h @@ -142,5 +142,6 @@ int iris_inst_sub_state_change_pause(struct iris_inst *inst, u32 plane); bool iris_allow_cmd(struct iris_inst *inst, u32 cmd); bool iris_drc_pending(struct iris_inst *inst); bool iris_drain_pending(struct iris_inst *inst); +bool iris_ipsc_pending(struct iris_inst *inst); #endif diff --git a/drivers/media/platform/qcom/iris/iris_vidc.c b/drivers/media/platform/qcom/iris/iris_vidc.c index bd38d84c9cc7..b741cf15beda 100644 --- a/drivers/media/platform/qcom/iris/iris_vidc.c +++ b/drivers/media/platform/qcom/iris/iris_vidc.c @@ -361,11 +361,19 @@ static int iris_g_fmt_vid_mplane(struct file *filp, void *fh, struct v4l2_format int ret = 0; mutex_lock(&inst->lock); + if (V4L2_TYPE_IS_OUTPUT(f->type)) *f = *inst->fmt_src; - else if (V4L2_TYPE_IS_CAPTURE(f->type)) - *f = *inst->fmt_dst; - else + else if (V4L2_TYPE_IS_CAPTURE(f->type)) { + /* + * Do not return any format when waiting for the firmware + * to send an initial source change + */ + if (iris_ipsc_pending(inst)) + ret = -EINVAL; + else + *f = *inst->fmt_dst; + } else ret = -EINVAL; mutex_unlock(&inst->lock); -- 2.34.1 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH RFC 6/7] media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats 2026-04-08 16:43 [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats Neil Armstrong ` (4 preceding siblings ...) 2026-04-08 16:43 ` [PATCH RFC 5/7] media: qcom: iris: vdec: forbid g_fmt while waiting for first source change Neil Armstrong @ 2026-04-08 16:43 ` Neil Armstrong 2026-04-15 6:39 ` Vishnu Reddy 2026-04-08 16:44 ` [PATCH RFC 7/7] media: qcom: iris: vdec: allow decoding into 10bit format Neil Armstrong 2026-04-09 0:02 ` [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats Dmitry Baryshkov 7 siblings, 1 reply; 34+ messages in thread From: Neil Armstrong @ 2026-04-08 16:43 UTC (permalink / raw) To: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel, Neil Armstrong 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 helpers to filter the formats. Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> --- .../platform/qcom/iris/iris_platform_common.h | 1 + drivers/media/platform/qcom/iris/iris_vdec.c | 41 ++++++++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/drivers/media/platform/qcom/iris/iris_platform_common.h index 5a489917580e..cd3509da4b75 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_common.h +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h @@ -18,6 +18,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 ca0518c27834..bfc13c1044c7 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_8) + return NULL; + + if (iris_fmt_is_10bit(fmt[i].pixfmt) && + inst->fw_caps[BIT_DEPTH].value != BIT_DEPTH_10) + return NULL; + } + return &fmt[i]; } @@ -113,6 +123,7 @@ find_format_by_index(struct iris_inst *inst, u32 index, u32 type) { const struct iris_fmt *fmt = NULL; unsigned int size = 0; + unsigned int i, k = 0; switch (type) { case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: @@ -127,10 +138,36 @@ find_format_by_index(struct iris_inst *inst, u32 index, u32 type) return NULL; } - if (index >= size || fmt[index].type != type) + if (index >= size) return NULL; - return &fmt[index]; + if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { + if (fmt[index].type != type) + return NULL; + + return &fmt[index]; + } + + /* Loop over the valid capture formats and return the index */ + for (i = 0; i < size; i++) { + if (fmt[i].type != type) + continue; + + if (iris_fmt_is_8bit(fmt[i].pixfmt) && + inst->fw_caps[BIT_DEPTH].value == BIT_DEPTH_10) + continue; + + if (iris_fmt_is_10bit(fmt[i].pixfmt) && + inst->fw_caps[BIT_DEPTH].value != BIT_DEPTH_10) + continue; + + if (k == index) + return &fmt[i]; + + k++; + } + + return NULL; } int iris_vdec_enum_fmt(struct iris_inst *inst, struct v4l2_fmtdesc *f) -- 2.34.1 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 6/7] media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats 2026-04-08 16:43 ` [PATCH RFC 6/7] media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats Neil Armstrong @ 2026-04-15 6:39 ` Vishnu Reddy 2026-04-15 7:35 ` Neil Armstrong 0 siblings, 1 reply; 34+ messages in thread From: Vishnu Reddy @ 2026-04-15 6:39 UTC (permalink / raw) To: Neil Armstrong, Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel On 4/8/2026 10:13 PM, Neil Armstrong wrote: > 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 helpers to filter the formats. This series breaks the v4l2 compliance tests for the existing platforms. Decoder failed for below: VIDIOC_S_FMT: FAIL Cropping: FAIL Composing: FAIL Encoder streaming tests failed. Please check once. Regards, Vishnu Reddy. > > Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> > --- > .../platform/qcom/iris/iris_platform_common.h | 1 + > drivers/media/platform/qcom/iris/iris_vdec.c | 41 ++++++++++++++++++++-- > 2 files changed, 40 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/drivers/media/platform/qcom/iris/iris_platform_common.h > index 5a489917580e..cd3509da4b75 100644 > --- a/drivers/media/platform/qcom/iris/iris_platform_common.h > +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h > @@ -18,6 +18,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 ca0518c27834..bfc13c1044c7 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_8) > + return NULL; > + > + if (iris_fmt_is_10bit(fmt[i].pixfmt) && > + inst->fw_caps[BIT_DEPTH].value != BIT_DEPTH_10) > + return NULL; > + } > + > return &fmt[i]; > } > > @@ -113,6 +123,7 @@ find_format_by_index(struct iris_inst *inst, u32 index, u32 type) > { > const struct iris_fmt *fmt = NULL; > unsigned int size = 0; > + unsigned int i, k = 0; > > switch (type) { > case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: > @@ -127,10 +138,36 @@ find_format_by_index(struct iris_inst *inst, u32 index, u32 type) > return NULL; > } > > - if (index >= size || fmt[index].type != type) > + if (index >= size) > return NULL; > > - return &fmt[index]; > + if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { > + if (fmt[index].type != type) > + return NULL; > + > + return &fmt[index]; > + } > + > + /* Loop over the valid capture formats and return the index */ > + for (i = 0; i < size; i++) { > + if (fmt[i].type != type) > + continue; > + > + if (iris_fmt_is_8bit(fmt[i].pixfmt) && > + inst->fw_caps[BIT_DEPTH].value == BIT_DEPTH_10) > + continue; > + > + if (iris_fmt_is_10bit(fmt[i].pixfmt) && > + inst->fw_caps[BIT_DEPTH].value != BIT_DEPTH_10) > + continue; > + > + if (k == index) > + return &fmt[i]; > + > + k++; > + } > + > + return NULL; > } > > int iris_vdec_enum_fmt(struct iris_inst *inst, struct v4l2_fmtdesc *f) > ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 6/7] media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats 2026-04-15 6:39 ` Vishnu Reddy @ 2026-04-15 7:35 ` Neil Armstrong 0 siblings, 0 replies; 34+ messages in thread From: Neil Armstrong @ 2026-04-15 7:35 UTC (permalink / raw) To: Vishnu Reddy, Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel Hi, On 4/15/26 08:39, Vishnu Reddy wrote: > > On 4/8/2026 10:13 PM, Neil Armstrong wrote: >> 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 helpers to filter the formats. > > This series breaks the v4l2 compliance tests for the existing platforms. > Decoder failed for below: > VIDIOC_S_FMT: FAIL > Cropping: FAIL > Composing: FAIL > Encoder streaming tests failed. > Please check once. Sure I'll run the test before posting v2. Neil > > Regards, > Vishnu Reddy. > >> >> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> >> --- >> .../platform/qcom/iris/iris_platform_common.h | 1 + >> drivers/media/platform/qcom/iris/iris_vdec.c | 41 ++++++++++++++++++++-- >> 2 files changed, 40 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/drivers/media/platform/qcom/iris/iris_platform_common.h >> index 5a489917580e..cd3509da4b75 100644 >> --- a/drivers/media/platform/qcom/iris/iris_platform_common.h >> +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h >> @@ -18,6 +18,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 ca0518c27834..bfc13c1044c7 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_8) >> + return NULL; >> + >> + if (iris_fmt_is_10bit(fmt[i].pixfmt) && >> + inst->fw_caps[BIT_DEPTH].value != BIT_DEPTH_10) >> + return NULL; >> + } >> + >> return &fmt[i]; >> } >> @@ -113,6 +123,7 @@ find_format_by_index(struct iris_inst *inst, u32 index, u32 type) >> { >> const struct iris_fmt *fmt = NULL; >> unsigned int size = 0; >> + unsigned int i, k = 0; >> switch (type) { >> case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: >> @@ -127,10 +138,36 @@ find_format_by_index(struct iris_inst *inst, u32 index, u32 type) >> return NULL; >> } >> - if (index >= size || fmt[index].type != type) >> + if (index >= size) >> return NULL; >> - return &fmt[index]; >> + if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { >> + if (fmt[index].type != type) >> + return NULL; >> + >> + return &fmt[index]; >> + } >> + >> + /* Loop over the valid capture formats and return the index */ >> + for (i = 0; i < size; i++) { >> + if (fmt[i].type != type) >> + continue; >> + >> + if (iris_fmt_is_8bit(fmt[i].pixfmt) && >> + inst->fw_caps[BIT_DEPTH].value == BIT_DEPTH_10) >> + continue; >> + >> + if (iris_fmt_is_10bit(fmt[i].pixfmt) && >> + inst->fw_caps[BIT_DEPTH].value != BIT_DEPTH_10) >> + continue; >> + >> + if (k == index) >> + return &fmt[i]; >> + >> + k++; >> + } >> + >> + return NULL; >> } >> int iris_vdec_enum_fmt(struct iris_inst *inst, struct v4l2_fmtdesc *f) >> ^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH RFC 7/7] media: qcom: iris: vdec: allow decoding into 10bit format 2026-04-08 16:43 [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats Neil Armstrong ` (5 preceding siblings ...) 2026-04-08 16:43 ` [PATCH RFC 6/7] media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats Neil Armstrong @ 2026-04-08 16:44 ` Neil Armstrong 2026-04-09 0:02 ` [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats Dmitry Baryshkov 7 siblings, 0 replies; 34+ messages in thread From: Neil Armstrong @ 2026-04-08 16:44 UTC (permalink / raw) To: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel, Neil Armstrong Add the necessary bits into the gen2 platforms tables and handlers to allow decoding streams into 10bit pixel formats. Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> --- .../platform/qcom/iris/iris_hfi_gen2_response.c | 20 +++++++++++++++++--- drivers/media/platform/qcom/iris/iris_instance.h | 2 ++ .../media/platform/qcom/iris/iris_platform_gen2.c | 3 ++- drivers/media/platform/qcom/iris/iris_vdec.c | 8 ++++++++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c index d268149191ea..85ad43628ff9 100644 --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c @@ -542,6 +542,15 @@ static void iris_hfi_gen2_read_input_subcr_params(struct iris_inst *inst) pixmp_ip->width = width; pixmp_ip->height = height; + if (subsc_params.bit_depth == BIT_DEPTH_8 && + pixmp_op->pixelformat != V4L2_PIX_FMT_NV12 && + pixmp_op->pixelformat != V4L2_PIX_FMT_QC08C) + pixmp_op->pixelformat = V4L2_PIX_FMT_NV12; + else if (subsc_params.bit_depth == BIT_DEPTH_10 && + pixmp_op->pixelformat != V4L2_PIX_FMT_P010 && + pixmp_op->pixelformat != V4L2_PIX_FMT_QC10C) + pixmp_op->pixelformat = V4L2_PIX_FMT_P010; + pixmp_op->width = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ? ALIGN(width, 192) : ALIGN(width, 128); pixmp_op->height = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ? @@ -551,11 +560,11 @@ static void iris_hfi_gen2_read_input_subcr_params(struct iris_inst *inst) pixmp_op->plane_fmt[0].bytesperline = ALIGN(width * 2, 256); break; case V4L2_PIX_FMT_QC10C: - pixmp_op->plane_fmt[0].bytesperline = ALIGN(ALIGN(width, 192) * 4 / 3, 256); + pixmp_op->plane_fmt[0].bytesperline = ALIGN(pixmp_op->width * 4 / 3, 256); break; case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_QC08C: - pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128); + pixmp_op->plane_fmt[0].bytesperline = pixmp_op->width; break; } pixmp_op->plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_OUTPUT); @@ -623,7 +632,12 @@ static void iris_hfi_gen2_read_input_subcr_params(struct iris_inst *inst) inst->fw_caps[POC].value = subsc_params.pic_order_cnt; inst->fw_caps[TIER].value = subsc_params.tier; - if (subsc_params.bit_depth != BIT_DEPTH_8 || + if (subsc_params.bit_depth == BIT_DEPTH_8) + inst->fw_caps[BIT_DEPTH].value = BIT_DEPTH_8; + else + inst->fw_caps[BIT_DEPTH].value = BIT_DEPTH_10; + + if ((subsc_params.bit_depth != BIT_DEPTH_8 && subsc_params.bit_depth != BIT_DEPTH_10) || !(subsc_params.coded_frames & HFI_BITMASK_FRAME_MBS_ONLY_FLAG)) { dev_err(core->dev, "unsupported content, bit depth: %x, pic_struct = %x\n", subsc_params.bit_depth, subsc_params.coded_frames); diff --git a/drivers/media/platform/qcom/iris/iris_instance.h b/drivers/media/platform/qcom/iris/iris_instance.h index 16965150f427..16424d1e94a6 100644 --- a/drivers/media/platform/qcom/iris/iris_instance.h +++ b/drivers/media/platform/qcom/iris/iris_instance.h @@ -25,6 +25,8 @@ enum iris_fmt_type_out { enum iris_fmt_type_cap { IRIS_FMT_NV12, IRIS_FMT_QC08C, + IRIS_FMT_TP10, + IRIS_FMT_QC10C, }; struct iris_fmt { diff --git a/drivers/media/platform/qcom/iris/iris_platform_gen2.c b/drivers/media/platform/qcom/iris/iris_platform_gen2.c index 5da90d47f9c6..1a80e98fd55c 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_gen2.c +++ b/drivers/media/platform/qcom/iris/iris_platform_gen2.c @@ -287,7 +287,7 @@ static const struct platform_inst_fw_cap inst_fw_cap_sm8550_dec[] = { { .cap_id = BIT_DEPTH, .min = BIT_DEPTH_8, - .max = BIT_DEPTH_8, + .max = BIT_DEPTH_10, .step_or_mask = 1, .value = BIT_DEPTH_8, .hfi_id = HFI_PROP_LUMA_CHROMA_BIT_DEPTH, @@ -866,6 +866,7 @@ static const u32 sm8550_vdec_output_config_params[] = { HFI_PROP_OPB_ENABLE, HFI_PROP_COLOR_FORMAT, HFI_PROP_LINEAR_STRIDE_SCANLINE, + HFI_PROP_UBWC_STRIDE_SCANLINE, }; static const u32 sm8550_venc_output_config_params[] = { diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c index bfc13c1044c7..776504d02aa8 100644 --- a/drivers/media/platform/qcom/iris/iris_vdec.c +++ b/drivers/media/platform/qcom/iris/iris_vdec.c @@ -76,6 +76,14 @@ static const struct iris_fmt iris_vdec_formats_cap[] = { .pixfmt = V4L2_PIX_FMT_QC08C, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, }, + [IRIS_FMT_TP10] = { + .pixfmt = V4L2_PIX_FMT_P010, + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + }, + [IRIS_FMT_QC10C] = { + .pixfmt = V4L2_PIX_FMT_QC10C, + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + }, }; static const struct iris_fmt * -- 2.34.1 ^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats 2026-04-08 16:43 [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats Neil Armstrong ` (6 preceding siblings ...) 2026-04-08 16:44 ` [PATCH RFC 7/7] media: qcom: iris: vdec: allow decoding into 10bit format Neil Armstrong @ 2026-04-09 0:02 ` Dmitry Baryshkov 2026-04-09 1:04 ` Nicolas Dufresne 7 siblings, 1 reply; 34+ messages in thread From: Dmitry Baryshkov @ 2026-04-09 0:02 UTC (permalink / raw) To: Neil Armstrong Cc: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel On Wed, Apr 08, 2026 at 06:43:53PM +0200, Neil Armstrong wrote: > This adds the plumbing to support decoding HEVC and AV1 > streams into 10bit pixel formats, linear and compressed. > > This has only been tested on SM8650 with HEVC, and was inspired by > Venus and the downstream vidc driver for the buffer > calculations and HFI messages. > > I was unable to get 10bit decoding working with Gstreamer > and ffmpeg, but v4l2-ctl works with: Any particular errors? I assume Gstreamer needs to be taught about Q10C. But P010 should (hopefully) work. > v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=P010 --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.P010 > v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=Q10C --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.QC10 > > The non-10bit decoding still works as before. > > With Big_Buck_Bunny_1080_10s_30MB reencoded in 10-bit profile > and tranformed in v4l2 header format with [1]: > ffmpeg -i Big_Buck_Bunny_1080_10s_30MB.h264 -pix_fmt yuv420p10le -c:v libx265 -crf 28 -x265-params profile=main10 Big_Buck_Bunny_1080_10s_30MB_main10.h265 > /path/to/mkhdr.sh Big_Buck_Bunny_1080_10s_30MB_main10.h265 raw Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr > > The frames correctness has been verified buy displaying them > via Vulkan DMA_BUF import, including QC10C and QC08C. > > The support is probably incomplete for other platforms and > I'm unsure what's required to conform to the V4L2 M2M stateless stateful > spec, especially since AFAIK the decoder doesn't support > decoding 10bit streams in 8bit pixel format, thus the RFC state. > Review is welcome ! > > [1] https://github.com/superna9999/pyv4l2compliance > > Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> > --- > Neil Armstrong (7): > media: qcom: iris: add QC10C & P010 buffer size calculations > media: qcom: iris: gen2: add support for 10bit decoding > media: qcom: iris: add helpers for 8bit and 10bit formats > media: qcom: iris: vdec: update size and stride calculations for 10bit formats > media: qcom: iris: vdec: forbid g_fmt while waiting for first source change > media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats > media: qcom: iris: vdec: allow decoding into 10bit format > > drivers/media/platform/qcom/iris/iris_buffer.c | 81 +++++++++++++++++++++- > .../platform/qcom/iris/iris_hfi_gen2_command.c | 71 ++++++++++++++++++- > .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + > .../platform/qcom/iris/iris_hfi_gen2_response.c | 35 ++++++++-- > drivers/media/platform/qcom/iris/iris_instance.h | 2 + > .../platform/qcom/iris/iris_platform_common.h | 1 + > .../media/platform/qcom/iris/iris_platform_gen2.c | 3 +- > drivers/media/platform/qcom/iris/iris_state.c | 6 ++ > drivers/media/platform/qcom/iris/iris_state.h | 1 + > drivers/media/platform/qcom/iris/iris_utils.c | 16 ++++- > drivers/media/platform/qcom/iris/iris_utils.h | 2 + > drivers/media/platform/qcom/iris/iris_vdec.c | 70 +++++++++++++++++-- > drivers/media/platform/qcom/iris/iris_vidc.c | 14 +++- > 13 files changed, 285 insertions(+), 18 deletions(-) > --- > base-commit: f3e6330d7fe42b204af05a2dbc68b379e0ad179e > change-id: 20260408-topic-sm8x50-iris-10bit-decoding-074c3ac7975c > > Best regards, > -- > Neil Armstrong <neil.armstrong@linaro.org> > -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats 2026-04-09 0:02 ` [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats Dmitry Baryshkov @ 2026-04-09 1:04 ` Nicolas Dufresne 2026-04-09 1:40 ` Dmitry Baryshkov 2026-04-09 7:36 ` Neil Armstrong 0 siblings, 2 replies; 34+ messages in thread From: Nicolas Dufresne @ 2026-04-09 1:04 UTC (permalink / raw) To: Dmitry Baryshkov, Neil Armstrong Cc: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel [-- Attachment #1: Type: text/plain, Size: 6260 bytes --] Hi, Le jeudi 09 avril 2026 à 03:02 +0300, Dmitry Baryshkov a écrit : > On Wed, Apr 08, 2026 at 06:43:53PM +0200, Neil Armstrong wrote: > > This adds the plumbing to support decoding HEVC and AV1 > > streams into 10bit pixel formats, linear and compressed. > > > > This has only been tested on SM8650 with HEVC, and was inspired by > > Venus and the downstream vidc driver for the buffer > > calculations and HFI messages. > > > > I was unable to get 10bit decoding working with Gstreamer > > and ffmpeg, but v4l2-ctl works with: > > Any particular errors? I assume Gstreamer needs to be taught about > Q10C. But P010 should (hopefully) work. P010 should work for both Gst and FFMPEG, its probably a user error, or there is a hidden bug in the driver that make it fail, v4l2-ctl is very permissive as it simply dump to disk. You should provide an updated fluster score, so you have to use one of these. For Q10C on GStreamer, it needs mapping [0] and you need some bugfix [1] and another that I will be sending tomorrow. We had never tested video compression with this module before. [0] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8195 [1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/11222 The last issue has to do with: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/38965e2d9c1119674a65dc437ee7e8ec95339f31/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c#L4378 V4L2 format gives us the number of allocation, but not really the number of planes, and we forgot to initialize that number for the "opaque" format case. A tempory fix might be to add this after S_FMT: if (GST_VIDEO_INFO_FORMAT (&info.vinfo) == GST_VIDEO_FORMAT_DMA_DRM) n_v4l_planes = format.fmt.pix_mp.num_planes; Works for AFBC and QC at leat, since both are unambiguously single plane, and so cannot have mplane variants. Let me know how far you get! Please be aware that Robert and I are making these patches based on feedback, we don't have access to any boards capable of decoding to QC compressed formats. > > > v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=P010 --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.P010 > > v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=Q10C --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.QC10 > > > > The non-10bit decoding still works as before. > > > > With Big_Buck_Bunny_1080_10s_30MB reencoded in 10-bit profile > > and tranformed in v4l2 header format with [1]: > > ffmpeg -i Big_Buck_Bunny_1080_10s_30MB.h264 -pix_fmt yuv420p10le -c:v libx265 -crf 28 -x265-params profile=main10 Big_Buck_Bunny_1080_10s_30MB_main10.h265 > > /path/to/mkhdr.sh Big_Buck_Bunny_1080_10s_30MB_main10.h265 raw Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr > > > > The frames correctness has been verified buy displaying them > > via Vulkan DMA_BUF import, including QC10C and QC08C. In GStreamer, once the video4linux plugin issues are fixed, you should be able to display the frames using glimagesink. GL only allow for RGB render, which damages the data, so its not good enough for conformance testing with compression enabled, but usually just doing visual inspection is acceptable. > > > > The support is probably incomplete for other platforms and > > I'm unsure what's required to conform to the V4L2 M2M stateless > > stateful > > > spec, especially since AFAIK the decoder doesn't support > > decoding 10bit streams in 8bit pixel format, thus the RFC state. > > Review is welcome ! Why would your decoder need to support decoding 10bit into 8bit ? This is quite rare and its only possible with post-processed capture buffer. > > > > [1] https://github.com/superna9999/pyv4l2compliance > > > > Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> > > --- > > Neil Armstrong (7): > > media: qcom: iris: add QC10C & P010 buffer size calculations > > media: qcom: iris: gen2: add support for 10bit decoding > > media: qcom: iris: add helpers for 8bit and 10bit formats > > media: qcom: iris: vdec: update size and stride calculations for 10bit formats > > media: qcom: iris: vdec: forbid g_fmt while waiting for first source change The is suspicious, it should just send the previous state until you get the event. Typical use case is for application to set a format based on bitstream parsing, and use that as a guess to try and pre-allocate the buffers. I don't usually review iris code, but I'll give that series some more eyes in the coming days. cheers, Nicolas > > media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats > > media: qcom: iris: vdec: allow decoding into 10bit format > > > > drivers/media/platform/qcom/iris/iris_buffer.c | 81 +++++++++++++++++++++- > > .../platform/qcom/iris/iris_hfi_gen2_command.c | 71 ++++++++++++++++++- > > .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + > > .../platform/qcom/iris/iris_hfi_gen2_response.c | 35 ++++++++-- > > drivers/media/platform/qcom/iris/iris_instance.h | 2 + > > .../platform/qcom/iris/iris_platform_common.h | 1 + > > .../media/platform/qcom/iris/iris_platform_gen2.c | 3 +- > > drivers/media/platform/qcom/iris/iris_state.c | 6 ++ > > drivers/media/platform/qcom/iris/iris_state.h | 1 + > > drivers/media/platform/qcom/iris/iris_utils.c | 16 ++++- > > drivers/media/platform/qcom/iris/iris_utils.h | 2 + > > drivers/media/platform/qcom/iris/iris_vdec.c | 70 +++++++++++++++++-- > > drivers/media/platform/qcom/iris/iris_vidc.c | 14 +++- > > 13 files changed, 285 insertions(+), 18 deletions(-) > > --- > > base-commit: f3e6330d7fe42b204af05a2dbc68b379e0ad179e > > change-id: 20260408-topic-sm8x50-iris-10bit-decoding-074c3ac7975c > > > > Best regards, > > -- > > Neil Armstrong <neil.armstrong@linaro.org> > > [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats 2026-04-09 1:04 ` Nicolas Dufresne @ 2026-04-09 1:40 ` Dmitry Baryshkov 2026-04-09 7:43 ` Neil Armstrong 2026-04-09 7:36 ` Neil Armstrong 1 sibling, 1 reply; 34+ messages in thread From: Dmitry Baryshkov @ 2026-04-09 1:40 UTC (permalink / raw) To: Nicolas Dufresne Cc: Neil Armstrong, Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel On Wed, Apr 08, 2026 at 09:04:02PM -0400, Nicolas Dufresne wrote: > Hi, > > Le jeudi 09 avril 2026 à 03:02 +0300, Dmitry Baryshkov a écrit : > > On Wed, Apr 08, 2026 at 06:43:53PM +0200, Neil Armstrong wrote: > > > This adds the plumbing to support decoding HEVC and AV1 > > > streams into 10bit pixel formats, linear and compressed. > > > > > > This has only been tested on SM8650 with HEVC, and was inspired by > > > Venus and the downstream vidc driver for the buffer > > > calculations and HFI messages. > > > > > > I was unable to get 10bit decoding working with Gstreamer > > > and ffmpeg, but v4l2-ctl works with: > > > > Any particular errors? I assume Gstreamer needs to be taught about > > Q10C. But P010 should (hopefully) work. > > P010 should work for both Gst and FFMPEG, its probably a user error, or there is > a hidden bug in the driver that make it fail, v4l2-ctl is very permissive as it > simply dump to disk. You should provide an updated fluster score, so you have to > use one of these. > > For Q10C on GStreamer, it needs mapping [0] and you need some bugfix [1] and > another that I will be sending tomorrow. We had never tested video compression > with this module before. > > [0] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8195 > [1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/11222 > > The last issue has to do with: > https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/38965e2d9c1119674a65dc437ee7e8ec95339f31/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c#L4378 > > V4L2 format gives us the number of allocation, but not really the number of > planes, and we forgot to initialize that number for the "opaque" format case. A > tempory fix might be to add this after S_FMT: > > if (GST_VIDEO_INFO_FORMAT (&info.vinfo) == GST_VIDEO_FORMAT_DMA_DRM) > n_v4l_planes = format.fmt.pix_mp.num_planes; > > Works for AFBC and QC at leat, since both are unambiguously single plane, and so > cannot have mplane variants. Reading this made me realize another suggestion for Neil: Please check that the data returned by Iris matches the display driver expectations. See the comments in the _dpu_format_populate_addrs_ubwc(). > > Let me know how far you get! Please be aware that Robert and I are making these > patches based on feedback, we don't have access to any boards capable of > decoding to QC compressed formats. > > > > > > v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=P010 --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.P010 > > > v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=Q10C --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.QC10 > > > > > > The non-10bit decoding still works as before. > > > > > > With Big_Buck_Bunny_1080_10s_30MB reencoded in 10-bit profile > > > and tranformed in v4l2 header format with [1]: > > > ffmpeg -i Big_Buck_Bunny_1080_10s_30MB.h264 -pix_fmt yuv420p10le -c:v libx265 -crf 28 -x265-params profile=main10 Big_Buck_Bunny_1080_10s_30MB_main10.h265 > > > /path/to/mkhdr.sh Big_Buck_Bunny_1080_10s_30MB_main10.h265 raw Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr > > > > > > The frames correctness has been verified buy displaying them > > > via Vulkan DMA_BUF import, including QC10C and QC08C. > > In GStreamer, once the video4linux plugin issues are fixed, you should be able > to display the frames using glimagesink. GL only allow for RGB render, which > damages the data, so its not good enough for conformance testing with > compression enabled, but usually just doing visual inspection is acceptable. Nice! Looking forward to testing Q08C aka NV12-UBWC on the display. Maybe I should try rebuilding the plugins with the mentioned patches and provide my r-b or report issues there. -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats 2026-04-09 1:40 ` Dmitry Baryshkov @ 2026-04-09 7:43 ` Neil Armstrong 0 siblings, 0 replies; 34+ messages in thread From: Neil Armstrong @ 2026-04-09 7:43 UTC (permalink / raw) To: Dmitry Baryshkov, Nicolas Dufresne Cc: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel On 4/9/26 03:40, Dmitry Baryshkov wrote: > On Wed, Apr 08, 2026 at 09:04:02PM -0400, Nicolas Dufresne wrote: >> Hi, >> >> Le jeudi 09 avril 2026 à 03:02 +0300, Dmitry Baryshkov a écrit : >>> On Wed, Apr 08, 2026 at 06:43:53PM +0200, Neil Armstrong wrote: >>>> This adds the plumbing to support decoding HEVC and AV1 >>>> streams into 10bit pixel formats, linear and compressed. >>>> >>>> This has only been tested on SM8650 with HEVC, and was inspired by >>>> Venus and the downstream vidc driver for the buffer >>>> calculations and HFI messages. >>>> >>>> I was unable to get 10bit decoding working with Gstreamer >>>> and ffmpeg, but v4l2-ctl works with: >>> >>> Any particular errors? I assume Gstreamer needs to be taught about >>> Q10C. But P010 should (hopefully) work. >> >> P010 should work for both Gst and FFMPEG, its probably a user error, or there is >> a hidden bug in the driver that make it fail, v4l2-ctl is very permissive as it >> simply dump to disk. You should provide an updated fluster score, so you have to >> use one of these. >> >> For Q10C on GStreamer, it needs mapping [0] and you need some bugfix [1] and >> another that I will be sending tomorrow. We had never tested video compression >> with this module before. >> >> [0] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8195 >> [1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/11222 >> >> The last issue has to do with: >> https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/38965e2d9c1119674a65dc437ee7e8ec95339f31/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c#L4378 >> >> V4L2 format gives us the number of allocation, but not really the number of >> planes, and we forgot to initialize that number for the "opaque" format case. A >> tempory fix might be to add this after S_FMT: >> >> if (GST_VIDEO_INFO_FORMAT (&info.vinfo) == GST_VIDEO_FORMAT_DMA_DRM) >> n_v4l_planes = format.fmt.pix_mp.num_planes; >> >> Works for AFBC and QC at leat, since both are unambiguously single plane, and so >> cannot have mplane variants. > > Reading this made me realize another suggestion for Neil: > > Please check that the data returned by Iris matches the display driver > expectations. See the comments in the _dpu_format_populate_addrs_ubwc(). I just checked and they match as I already checked against the venus driver already, which shares the same calculation scheme. I had to add the HFI_PROP_UBWC_STRIDE_SCANLINE command otherwise the firmware would give other alignments and wouldn't display properly with some streams. Neil > >> >> Let me know how far you get! Please be aware that Robert and I are making these >> patches based on feedback, we don't have access to any boards capable of >> decoding to QC compressed formats. >> >>> >>>> v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=P010 --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.P010 >>>> v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=Q10C --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.QC10 >>>> >>>> The non-10bit decoding still works as before. >>>> >>>> With Big_Buck_Bunny_1080_10s_30MB reencoded in 10-bit profile >>>> and tranformed in v4l2 header format with [1]: >>>> ffmpeg -i Big_Buck_Bunny_1080_10s_30MB.h264 -pix_fmt yuv420p10le -c:v libx265 -crf 28 -x265-params profile=main10 Big_Buck_Bunny_1080_10s_30MB_main10.h265 >>>> /path/to/mkhdr.sh Big_Buck_Bunny_1080_10s_30MB_main10.h265 raw Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr >>>> >>>> The frames correctness has been verified buy displaying them >>>> via Vulkan DMA_BUF import, including QC10C and QC08C. >> >> In GStreamer, once the video4linux plugin issues are fixed, you should be able >> to display the frames using glimagesink. GL only allow for RGB render, which >> damages the data, so its not good enough for conformance testing with >> compression enabled, but usually just doing visual inspection is acceptable. > > Nice! Looking forward to testing Q08C aka NV12-UBWC on the display. > Maybe I should try rebuilding the plugins with the mentioned patches and > provide my r-b or report issues there. > > ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats 2026-04-09 1:04 ` Nicolas Dufresne 2026-04-09 1:40 ` Dmitry Baryshkov @ 2026-04-09 7:36 ` Neil Armstrong 2026-04-09 13:19 ` Nicolas Dufresne 1 sibling, 1 reply; 34+ messages in thread From: Neil Armstrong @ 2026-04-09 7:36 UTC (permalink / raw) To: Nicolas Dufresne, Dmitry Baryshkov Cc: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel Hi, On 4/9/26 03:04, Nicolas Dufresne wrote: > Hi, > > Le jeudi 09 avril 2026 à 03:02 +0300, Dmitry Baryshkov a écrit : >> On Wed, Apr 08, 2026 at 06:43:53PM +0200, Neil Armstrong wrote: >>> This adds the plumbing to support decoding HEVC and AV1 >>> streams into 10bit pixel formats, linear and compressed. >>> >>> This has only been tested on SM8650 with HEVC, and was inspired by >>> Venus and the downstream vidc driver for the buffer >>> calculations and HFI messages. >>> >>> I was unable to get 10bit decoding working with Gstreamer >>> and ffmpeg, but v4l2-ctl works with: >> >> Any particular errors? I assume Gstreamer needs to be taught about >> Q10C. But P010 should (hopefully) work. > > P010 should work for both Gst and FFMPEG, its probably a user error, or there is > a hidden bug in the driver that make it fail, v4l2-ctl is very permissive as it > simply dump to disk. You should provide an updated fluster score, so you have to > use one of these. I did run fluster and all main10 fails with Gstreamer and FFmpeg, I tried to manually run the gst and ffmpeg commands with v4l2-tracer and logs but I can't explain the reason, all returns from the driver seems valid but somehow they just error out with: FFmpeg: $ ffmpeg -c:v hevc_v4l2m2m -i Big_Buck_Bunny_1080_10s_30MB_main10.h265 -y -f null - ... [hevc_v4l2m2m @ 0x55c0328aa0] Using device /dev/video-dec0 [hevc_v4l2m2m @ 0x55c0328aa0] driver 'iris_driver' on card 'iris_decoder' in mplane mode [hevc_v4l2m2m @ 0x55c0328aa0] requesting formats: output=HEVC/none capture=NV12/yuv420p10le ... [hevc_v4l2m2m @ 0x55c0328aa0] An invalid frame was output by a decoder. This is a bug, please report it. [vist#0:0/hevc @ 0x55c02dc9b0] [dec:hevc_v4l2m2m @ 0x55c029d510] Decoding error: Internal bug, should not have happened The v4l2 trace shows a normal sequence with the driver returning P010 as G_FMT after the source change event, and the capture planes dequeued but for an unknown reason the buffer is rejected by ffmpeg. Gst: $ gst-launch-1.0 -v -m filesrc location=Big_Buck_Bunny_1080_10s_30MB_main10.h265 ! h265parse ! v4l2h265dec ! tee ! fakevideosink Setting pipeline to PAUSED ... Pipeline is PREROLLING ... ... Got message #37 from element "h265parse0" (latency): no message details ERROR: from element /GstPipeline:pipeline0/GstH265Parse:h265parse0: Internal data stream error. Redistribute latency... Additional debug info: ../gstreamer/subprojects/gstreamer/libs/gst/base/gstbaseparse.c(3702): gst_base_parse_loop (): /GstPipeline:pipeline0/GstH265Parse:h265parse0: streaming stopped, reason not-negotiated (-4) Got message #39 from pad "h265parse0:src" (property-notify): ERROR: pipeline doesn't want to preroll. GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"video/x-h265\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1\,\ chroma-format\=\(string\)4:2:0\,\ bit-depth-luma\=\(uint\)10\,\ bit-depth-chroma\=\(uint\)10\,\ parsed\=\(boolean\)true\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)au\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ profile\=\(string\)main-10\,\ tier\=\(string\)main\,\ level\=\(string\)4"; /GstPipeline:pipeline0/GstH265Parse:h265parse0.GstPad:src: caps = video/x-h265, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)10, bit-depth-chroma=(uint)10, parsed=(boolean)true, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, profile=(string)main-10, tier=(string)main, level=(string)4 ... In this case OUTPUT is not STREAMON and no OUTPUT buffers are queued, so I wonder why this one fails.... My gstreamer and ffmpeg foo is bad and I probably missed something obvious... > > For Q10C on GStreamer, it needs mapping [0] and you need some bugfix [1] and > another that I will be sending tomorrow. We had never tested video compression > with this module before. > > [0] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8195 > [1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/11222 > > The last issue has to do with: > https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/38965e2d9c1119674a65dc437ee7e8ec95339f31/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c#L4378 > > V4L2 format gives us the number of allocation, but not really the number of > planes, and we forgot to initialize that number for the "opaque" format case. A > tempory fix might be to add this after S_FMT: > > if (GST_VIDEO_INFO_FORMAT (&info.vinfo) == GST_VIDEO_FORMAT_DMA_DRM) > n_v4l_planes = format.fmt.pix_mp.num_planes; > > Works for AFBC and QC at leat, since both are unambiguously single plane, and so > cannot have mplane variants. I'll definitely try that ! thanks for the pointers ! > > Let me know how far you get! Please be aware that Robert and I are making these > patches based on feedback, we don't have access to any boards capable of > decoding to QC compressed formats. > >> >>> v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=P010 --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.P010 >>> v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=Q10C --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.QC10 >>> >>> The non-10bit decoding still works as before. >>> >>> With Big_Buck_Bunny_1080_10s_30MB reencoded in 10-bit profile >>> and tranformed in v4l2 header format with [1]: >>> ffmpeg -i Big_Buck_Bunny_1080_10s_30MB.h264 -pix_fmt yuv420p10le -c:v libx265 -crf 28 -x265-params profile=main10 Big_Buck_Bunny_1080_10s_30MB_main10.h265 >>> /path/to/mkhdr.sh Big_Buck_Bunny_1080_10s_30MB_main10.h265 raw Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr >>> >>> The frames correctness has been verified buy displaying them >>> via Vulkan DMA_BUF import, including QC10C and QC08C. > > In GStreamer, once the video4linux plugin issues are fixed, you should be able > to display the frames using glimagesink. GL only allow for RGB render, which > damages the data, so its not good enough for conformance testing with > compression enabled, but usually just doing visual inspection is acceptable. > >>> >>> The support is probably incomplete for other platforms and >>> I'm unsure what's required to conform to the V4L2 M2M stateless >> >> stateful >> >>> spec, especially since AFAIK the decoder doesn't support >>> decoding 10bit streams in 8bit pixel format, thus the RFC state. >>> Review is welcome ! > > Why would your decoder need to support decoding 10bit into 8bit ? This is quite > rare and its only possible with post-processed capture buffer. Yeah it's just a note, the Amlogic one supported outputing main10 in NV12 but only supported 10bit in their compressed format. > >>> >>> [1] https://github.com/superna9999/pyv4l2compliance >>> >>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> >>> --- >>> Neil Armstrong (7): >>> media: qcom: iris: add QC10C & P010 buffer size calculations >>> media: qcom: iris: gen2: add support for 10bit decoding >>> media: qcom: iris: add helpers for 8bit and 10bit formats >>> media: qcom: iris: vdec: update size and stride calculations for 10bit formats >>> media: qcom: iris: vdec: forbid g_fmt while waiting for first source change > > The is suspicious, it should just send the previous state until you get the > event. Typical use case is for application to set a format based on bitstream > parsing, and use that as a guess to try and pre-allocate the buffers. I don't > usually review iris code, but I'll give that series some more eyes in the coming > days. Yeah I wasn't sure, venus does that, same as the vendor driver so I thought it would be good but I'm probably mistaken. > > cheers, > Nicolas Thanks! Neil > >>> media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats >>> media: qcom: iris: vdec: allow decoding into 10bit format >>> >>> drivers/media/platform/qcom/iris/iris_buffer.c | 81 +++++++++++++++++++++- >>> .../platform/qcom/iris/iris_hfi_gen2_command.c | 71 ++++++++++++++++++- >>> .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + >>> .../platform/qcom/iris/iris_hfi_gen2_response.c | 35 ++++++++-- >>> drivers/media/platform/qcom/iris/iris_instance.h | 2 + >>> .../platform/qcom/iris/iris_platform_common.h | 1 + >>> .../media/platform/qcom/iris/iris_platform_gen2.c | 3 +- >>> drivers/media/platform/qcom/iris/iris_state.c | 6 ++ >>> drivers/media/platform/qcom/iris/iris_state.h | 1 + >>> drivers/media/platform/qcom/iris/iris_utils.c | 16 ++++- >>> drivers/media/platform/qcom/iris/iris_utils.h | 2 + >>> drivers/media/platform/qcom/iris/iris_vdec.c | 70 +++++++++++++++++-- >>> drivers/media/platform/qcom/iris/iris_vidc.c | 14 +++- >>> 13 files changed, 285 insertions(+), 18 deletions(-) >>> --- >>> base-commit: f3e6330d7fe42b204af05a2dbc68b379e0ad179e >>> change-id: 20260408-topic-sm8x50-iris-10bit-decoding-074c3ac7975c >>> >>> Best regards, >>> -- >>> Neil Armstrong <neil.armstrong@linaro.org> >>> ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats 2026-04-09 7:36 ` Neil Armstrong @ 2026-04-09 13:19 ` Nicolas Dufresne 2026-04-10 12:00 ` Neil Armstrong 0 siblings, 1 reply; 34+ messages in thread From: Nicolas Dufresne @ 2026-04-09 13:19 UTC (permalink / raw) To: Neil Armstrong, Dmitry Baryshkov Cc: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel [-- Attachment #1: Type: text/plain, Size: 11682 bytes --] Le jeudi 09 avril 2026 à 09:36 +0200, Neil Armstrong a écrit : > Hi, > > On 4/9/26 03:04, Nicolas Dufresne wrote: > > Hi, > > > > Le jeudi 09 avril 2026 à 03:02 +0300, Dmitry Baryshkov a écrit : > > > On Wed, Apr 08, 2026 at 06:43:53PM +0200, Neil Armstrong wrote: > > > > This adds the plumbing to support decoding HEVC and AV1 > > > > streams into 10bit pixel formats, linear and compressed. > > > > > > > > This has only been tested on SM8650 with HEVC, and was inspired by > > > > Venus and the downstream vidc driver for the buffer > > > > calculations and HFI messages. > > > > > > > > I was unable to get 10bit decoding working with Gstreamer > > > > and ffmpeg, but v4l2-ctl works with: > > > > > > Any particular errors? I assume Gstreamer needs to be taught about > > > Q10C. But P010 should (hopefully) work. > > > > P010 should work for both Gst and FFMPEG, its probably a user error, or there is > > a hidden bug in the driver that make it fail, v4l2-ctl is very permissive as it > > simply dump to disk. You should provide an updated fluster score, so you have to > > use one of these. > > I did run fluster and all main10 fails with Gstreamer and FFmpeg, I tried to manually > run the gst and ffmpeg commands with v4l2-tracer and logs but I can't explain the reason, > all returns from the driver seems valid but somehow they just error out with: > > FFmpeg: > $ ffmpeg -c:v hevc_v4l2m2m -i Big_Buck_Bunny_1080_10s_30MB_main10.h265 -y -f null - > ... > [hevc_v4l2m2m @ 0x55c0328aa0] Using device /dev/video-dec0 > [hevc_v4l2m2m @ 0x55c0328aa0] driver 'iris_driver' on card 'iris_decoder' in mplane mode > [hevc_v4l2m2m @ 0x55c0328aa0] requesting formats: output=HEVC/none capture=NV12/yuv420p10le > ... > [hevc_v4l2m2m @ 0x55c0328aa0] An invalid frame was output by a decoder. This is a bug, please report it. > [vist#0:0/hevc @ 0x55c02dc9b0] [dec:hevc_v4l2m2m @ 0x55c029d510] Decoding error: Internal bug, should not have happened > This one needs further investigation for sure. This error can be various things, and it requires going up to the v4l2 code to figure-out: Case 1: if (!frame->buf[0] || frame->format < 0) goto fail; Case 2 if (frame->width <= 0 || frame->height <= 0) goto fail; But a quick look lead me to think it case 1 (frame->format < 0) since I don't see P010 in the format map in ./libavcodec/v4l2_fmt.c (at least in mainline). Its also missing support for any opaque format, in fact I believe the DMABuf/DRM context is only in LibreELEC fork. But overall, it points toward ffmpeg for this error so far. > The v4l2 trace shows a normal sequence with the driver returning P010 as G_FMT after the source change event, > and the capture planes dequeued but for an unknown reason the buffer is rejected by ffmpeg. > > Gst: > $ gst-launch-1.0 -v -m filesrc location=Big_Buck_Bunny_1080_10s_30MB_main10.h265 ! h265parse ! v4l2h265dec ! tee ! fakevideosink > Setting pipeline to PAUSED ... > Pipeline is PREROLLING ... > ... > Got message #37 from element "h265parse0" (latency): no message details > ERROR: from element /GstPipeline:pipeline0/GstH265Parse:h265parse0: Internal data stream error. > Redistribute latency... > Additional debug info: > ../gstreamer/subprojects/gstreamer/libs/gst/base/gstbaseparse.c(3702): gst_base_parse_loop (): /GstPipeline:pipeline0/GstH265Parse:h265parse0: > streaming stopped, reason not-negotiated (-4) > Got message #39 from pad "h265parse0:src" (property-notify): ERROR: pipeline doesn't want to preroll. > GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"video/x-h265\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1\,\ chroma-format\=\(string\)4:2:0\,\ bit-depth-luma\=\(uint\)10\,\ bit-depth-chroma\=\(uint\)10\,\ parsed\=\(boolean\)true\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)au\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ profile\=\(string\)main-10\,\ tier\=\(string\)main\,\ level\=\(string\)4"; > /GstPipeline:pipeline0/GstH265Parse:h265parse0.GstPad:src: caps = video/x-h265, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)10, bit-depth-chroma=(uint)10, parsed=(boolean)true, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, profile=(string)main-10, tier=(string)main, level=(string)4 > ... There is not a lot of details here, but I would start looking into V4L2_CID_MPEG_VIDEO_HEVC_PROFILE and V4L2_CID_MPEG_VIDEO_HEVC_LEVEL implementation. GStreamer (and Chromium too) will refuse to use a decoder that does not advertise the supported profile (though I see there is code for that, maybe its just some bug). > > In this case OUTPUT is not STREAMON and no OUTPUT buffers are queued, so I wonder why this one fails.... > > My gstreamer and ffmpeg foo is bad and I probably missed something obvious... > > You may get a different hint with more traces, just enabling general warnings: export GST_DEBUG=2 Or the full V4L2 traces too: export GST_DEBUG="v4l2*:7,2" I'm sure its just a bug (or two). Happy to help to find it. > > > > > For Q10C on GStreamer, it needs mapping [0] and you need some bugfix [1] and > > another that I will be sending tomorrow. We had never tested video compression > > with this module before. > > > > [0] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8195 > > [1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/11222 > > > > The last issue has to do with: > > https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/38965e2d9c1119674a65dc437ee7e8ec95339f31/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c#L4378 > > > > V4L2 format gives us the number of allocation, but not really the number of > > planes, and we forgot to initialize that number for the "opaque" format case. A > > tempory fix might be to add this after S_FMT: > > > > if (GST_VIDEO_INFO_FORMAT (&info.vinfo) == GST_VIDEO_FORMAT_DMA_DRM) > > n_v4l_planes = format.fmt.pix_mp.num_planes; > > > > Works for AFBC and QC at leat, since both are unambiguously single plane, and so > > cannot have mplane variants. > > I'll definitely try that ! thanks for the pointers ! > > > > > Let me know how far you get! Please be aware that Robert and I are making these > > patches based on feedback, we don't have access to any boards capable of > > decoding to QC compressed formats. > > > > > > > > > v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=P010 --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.P010 > > > > v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=Q10C --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.QC10 > > > > > > > > The non-10bit decoding still works as before. > > > > > > > > With Big_Buck_Bunny_1080_10s_30MB reencoded in 10-bit profile > > > > and tranformed in v4l2 header format with [1]: > > > > ffmpeg -i Big_Buck_Bunny_1080_10s_30MB.h264 -pix_fmt yuv420p10le -c:v libx265 -crf 28 -x265-params profile=main10 Big_Buck_Bunny_1080_10s_30MB_main10.h265 > > > > /path/to/mkhdr.sh Big_Buck_Bunny_1080_10s_30MB_main10.h265 raw Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr > > > > > > > > The frames correctness has been verified buy displaying them > > > > via Vulkan DMA_BUF import, including QC10C and QC08C. > > > > In GStreamer, once the video4linux plugin issues are fixed, you should be able > > to display the frames using glimagesink. GL only allow for RGB render, which > > damages the data, so its not good enough for conformance testing with > > compression enabled, but usually just doing visual inspection is acceptable. > > > > > > > > > > The support is probably incomplete for other platforms and > > > > I'm unsure what's required to conform to the V4L2 M2M stateless > > > > > > stateful > > > > > > > spec, especially since AFAIK the decoder doesn't support > > > > decoding 10bit streams in 8bit pixel format, thus the RFC state. > > > > Review is welcome ! > > > > Why would your decoder need to support decoding 10bit into 8bit ? This is quite > > rare and its only possible with post-processed capture buffer. > > Yeah it's just a note, the Amlogic one supported outputing main10 in NV12 but > only supported 10bit in their compressed format. > Ack. There is a lot of variation with various hardware for sure. The Allwinner stateless one swallow the extra 2bit plane (since they do some funky NV12 + two more planes for the missing 2bits, and that's complicate as a format hehe). cheers, Nicolas > > > > > > > > > > > [1] https://github.com/superna9999/pyv4l2compliance > > > > > > > > Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> > > > > --- > > > > Neil Armstrong (7): > > > > media: qcom: iris: add QC10C & P010 buffer size calculations > > > > media: qcom: iris: gen2: add support for 10bit decoding > > > > media: qcom: iris: add helpers for 8bit and 10bit formats > > > > media: qcom: iris: vdec: update size and stride calculations for 10bit formats > > > > media: qcom: iris: vdec: forbid g_fmt while waiting for first source change > > > > The is suspicious, it should just send the previous state until you get the > > event. Typical use case is for application to set a format based on bitstream > > parsing, and use that as a guess to try and pre-allocate the buffers. I don't > > usually review iris code, but I'll give that series some more eyes in the coming > > days. > > Yeah I wasn't sure, venus does that, same as the vendor driver so I thought it would > be good but I'm probably mistaken. > > > > > cheers, > > Nicolas > > Thanks! > Neil > > > > > > > media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats > > > > media: qcom: iris: vdec: allow decoding into 10bit format > > > > > > > > drivers/media/platform/qcom/iris/iris_buffer.c | 81 +++++++++++++++++++++- > > > > .../platform/qcom/iris/iris_hfi_gen2_command.c | 71 ++++++++++++++++++- > > > > .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + > > > > .../platform/qcom/iris/iris_hfi_gen2_response.c | 35 ++++++++-- > > > > drivers/media/platform/qcom/iris/iris_instance.h | 2 + > > > > .../platform/qcom/iris/iris_platform_common.h | 1 + > > > > .../media/platform/qcom/iris/iris_platform_gen2.c | 3 +- > > > > drivers/media/platform/qcom/iris/iris_state.c | 6 ++ > > > > drivers/media/platform/qcom/iris/iris_state.h | 1 + > > > > drivers/media/platform/qcom/iris/iris_utils.c | 16 ++++- > > > > drivers/media/platform/qcom/iris/iris_utils.h | 2 + > > > > drivers/media/platform/qcom/iris/iris_vdec.c | 70 +++++++++++++++++-- > > > > drivers/media/platform/qcom/iris/iris_vidc.c | 14 +++- > > > > 13 files changed, 285 insertions(+), 18 deletions(-) > > > > --- > > > > base-commit: f3e6330d7fe42b204af05a2dbc68b379e0ad179e > > > > change-id: 20260408-topic-sm8x50-iris-10bit-decoding-074c3ac7975c > > > > > > > > Best regards, > > > > -- > > > > Neil Armstrong <neil.armstrong@linaro.org> > > > > [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats 2026-04-09 13:19 ` Nicolas Dufresne @ 2026-04-10 12:00 ` Neil Armstrong 2026-04-10 16:25 ` Neil Armstrong 0 siblings, 1 reply; 34+ messages in thread From: Neil Armstrong @ 2026-04-10 12:00 UTC (permalink / raw) To: Nicolas Dufresne, Dmitry Baryshkov Cc: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel On 4/9/26 15:19, Nicolas Dufresne wrote: > Le jeudi 09 avril 2026 à 09:36 +0200, Neil Armstrong a écrit : >> Hi, >> >> On 4/9/26 03:04, Nicolas Dufresne wrote: >>> Hi, >>> >>> Le jeudi 09 avril 2026 à 03:02 +0300, Dmitry Baryshkov a écrit : >>>> On Wed, Apr 08, 2026 at 06:43:53PM +0200, Neil Armstrong wrote: >>>>> This adds the plumbing to support decoding HEVC and AV1 >>>>> streams into 10bit pixel formats, linear and compressed. >>>>> >>>>> This has only been tested on SM8650 with HEVC, and was inspired by >>>>> Venus and the downstream vidc driver for the buffer >>>>> calculations and HFI messages. >>>>> >>>>> I was unable to get 10bit decoding working with Gstreamer >>>>> and ffmpeg, but v4l2-ctl works with: >>>> >>>> Any particular errors? I assume Gstreamer needs to be taught about >>>> Q10C. But P010 should (hopefully) work. >>> >>> P010 should work for both Gst and FFMPEG, its probably a user error, or there is >>> a hidden bug in the driver that make it fail, v4l2-ctl is very permissive as it >>> simply dump to disk. You should provide an updated fluster score, so you have to >>> use one of these. >> >> I did run fluster and all main10 fails with Gstreamer and FFmpeg, I tried to manually >> run the gst and ffmpeg commands with v4l2-tracer and logs but I can't explain the reason, >> all returns from the driver seems valid but somehow they just error out with: >> >> FFmpeg: >> $ ffmpeg -c:v hevc_v4l2m2m -i Big_Buck_Bunny_1080_10s_30MB_main10.h265 -y -f null - >> ... >> [hevc_v4l2m2m @ 0x55c0328aa0] Using device /dev/video-dec0 >> [hevc_v4l2m2m @ 0x55c0328aa0] driver 'iris_driver' on card 'iris_decoder' in mplane mode >> [hevc_v4l2m2m @ 0x55c0328aa0] requesting formats: output=HEVC/none capture=NV12/yuv420p10le >> ... >> [hevc_v4l2m2m @ 0x55c0328aa0] An invalid frame was output by a decoder. This is a bug, please report it. >> [vist#0:0/hevc @ 0x55c02dc9b0] [dec:hevc_v4l2m2m @ 0x55c029d510] Decoding error: Internal bug, should not have happened >> > > This one needs further investigation for sure. This error can be various things, > and it requires going up to the v4l2 code to figure-out: > > > Case 1: > if (!frame->buf[0] || frame->format < 0) > goto fail; > > Case 2 > if (frame->width <= 0 || frame->height <= 0) > goto fail; > > But a quick look lead me to think it case 1 (frame->format < 0) since I don't > see P010 in the format map in ./libavcodec/v4l2_fmt.c (at least in mainline). > Its also missing support for any opaque format, in fact I believe the DMABuf/DRM > context is only in LibreELEC fork. But overall, it points toward ffmpeg for this > error so far. Yeah I didn't find any ffmpeg for with P010 supported... > > >> The v4l2 trace shows a normal sequence with the driver returning P010 as G_FMT after the source change event, >> and the capture planes dequeued but for an unknown reason the buffer is rejected by ffmpeg. >> >> Gst: >> $ gst-launch-1.0 -v -m filesrc location=Big_Buck_Bunny_1080_10s_30MB_main10.h265 ! h265parse ! v4l2h265dec ! tee ! fakevideosink >> Setting pipeline to PAUSED ... >> Pipeline is PREROLLING ... >> ... >> Got message #37 from element "h265parse0" (latency): no message details >> ERROR: from element /GstPipeline:pipeline0/GstH265Parse:h265parse0: Internal data stream error. >> Redistribute latency... >> Additional debug info: >> ../gstreamer/subprojects/gstreamer/libs/gst/base/gstbaseparse.c(3702): gst_base_parse_loop (): /GstPipeline:pipeline0/GstH265Parse:h265parse0: >> streaming stopped, reason not-negotiated (-4) >> Got message #39 from pad "h265parse0:src" (property-notify): ERROR: pipeline doesn't want to preroll. >> GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"video/x-h265\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1\,\ chroma-format\=\(string\)4:2:0\,\ bit-depth-luma\=\(uint\)10\,\ bit-depth-chroma\=\(uint\)10\,\ parsed\=\(boolean\)true\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)au\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ profile\=\(string\)main-10\,\ tier\=\(string\)main\,\ level\=\(string\)4"; >> /GstPipeline:pipeline0/GstH265Parse:h265parse0.GstPad:src: caps = video/x-h265, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)10, bit-depth-chroma=(uint)10, parsed=(boolean)true, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, profile=(string)main-10, tier=(string)main, level=(string)4 >> ... > > There is not a lot of details here, but I would start looking into > V4L2_CID_MPEG_VIDEO_HEVC_PROFILE and V4L2_CID_MPEG_VIDEO_HEVC_LEVEL > implementation. GStreamer (and Chromium too) will refuse to use a decoder that > does not advertise the supported profile (though I see there is code for that, > maybe its just some bug). > >> >> In this case OUTPUT is not STREAMON and no OUTPUT buffers are queued, so I wonder why this one fails.... >> >> My gstreamer and ffmpeg foo is bad and I probably missed something obvious... >> >> > You may get a different hint with more traces, just enabling general warnings: > > export GST_DEBUG=2 > > Or the full V4L2 traces too: > > export GST_DEBUG="v4l2*:7,2" > > > I'm sure its just a bug (or two). Happy to help to find it. You were right, this did the trick: diff --git a/drivers/media/platform/qcom/iris/iris_platform_gen2.c b/drivers/media/platform/qcom/iris/iris_platform_gen2.c index a9cdd93e77fd..debdd30a751e 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_gen2.c +++ b/drivers/media/platform/qcom/iris/iris_platform_gen2.c @@ -56,9 +56,10 @@ static const struct platform_inst_fw_cap inst_fw_cap_sm8550_dec[] = { { .cap_id = PROFILE_HEVC, .min = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN, - .max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE, + .max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10, .step_or_mask = BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN) | - BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE), + BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE) | + BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10), .value = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN, .hfi_id = HFI_PROP_PROFILE, .flags = CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU, But the gstreamer I'm using is too old and doesn't support P010... updating but it should work now, and I'll test the QC10 in the same time. Neil > >> >>> >>> For Q10C on GStreamer, it needs mapping [0] and you need some bugfix [1] and >>> another that I will be sending tomorrow. We had never tested video compression >>> with this module before. >>> >>> [0] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8195 >>> [1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/11222 >>> >>> The last issue has to do with: >>> https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/38965e2d9c1119674a65dc437ee7e8ec95339f31/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c#L4378 >>> >>> V4L2 format gives us the number of allocation, but not really the number of >>> planes, and we forgot to initialize that number for the "opaque" format case. A >>> tempory fix might be to add this after S_FMT: >>> >>> if (GST_VIDEO_INFO_FORMAT (&info.vinfo) == GST_VIDEO_FORMAT_DMA_DRM) >>> n_v4l_planes = format.fmt.pix_mp.num_planes; >>> >>> Works for AFBC and QC at leat, since both are unambiguously single plane, and so >>> cannot have mplane variants. >> >> I'll definitely try that ! thanks for the pointers ! >> >>> >>> Let me know how far you get! Please be aware that Robert and I are making these >>> patches based on feedback, we don't have access to any boards capable of >>> decoding to QC compressed formats. >>> >>>> >>>>> v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=P010 --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.P010 >>>>> v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=Q10C --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.QC10 >>>>> >>>>> The non-10bit decoding still works as before. >>>>> >>>>> With Big_Buck_Bunny_1080_10s_30MB reencoded in 10-bit profile >>>>> and tranformed in v4l2 header format with [1]: >>>>> ffmpeg -i Big_Buck_Bunny_1080_10s_30MB.h264 -pix_fmt yuv420p10le -c:v libx265 -crf 28 -x265-params profile=main10 Big_Buck_Bunny_1080_10s_30MB_main10.h265 >>>>> /path/to/mkhdr.sh Big_Buck_Bunny_1080_10s_30MB_main10.h265 raw Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr >>>>> >>>>> The frames correctness has been verified buy displaying them >>>>> via Vulkan DMA_BUF import, including QC10C and QC08C. >>> >>> In GStreamer, once the video4linux plugin issues are fixed, you should be able >>> to display the frames using glimagesink. GL only allow for RGB render, which >>> damages the data, so its not good enough for conformance testing with >>> compression enabled, but usually just doing visual inspection is acceptable. >>> >>>>> >>>>> The support is probably incomplete for other platforms and >>>>> I'm unsure what's required to conform to the V4L2 M2M stateless >>>> >>>> stateful >>>> >>>>> spec, especially since AFAIK the decoder doesn't support >>>>> decoding 10bit streams in 8bit pixel format, thus the RFC state. >>>>> Review is welcome ! >>> >>> Why would your decoder need to support decoding 10bit into 8bit ? This is quite >>> rare and its only possible with post-processed capture buffer. >> >> Yeah it's just a note, the Amlogic one supported outputing main10 in NV12 but >> only supported 10bit in their compressed format. >> > > Ack. There is a lot of variation with various hardware for sure. The Allwinner > stateless one swallow the extra 2bit plane (since they do some funky NV12 + two > more planes for the missing 2bits, and that's complicate as a format hehe). > > > cheers, > Nicolas > >> >>> >>>>> >>>>> [1] https://github.com/superna9999/pyv4l2compliance >>>>> >>>>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> >>>>> --- >>>>> Neil Armstrong (7): >>>>> media: qcom: iris: add QC10C & P010 buffer size calculations >>>>> media: qcom: iris: gen2: add support for 10bit decoding >>>>> media: qcom: iris: add helpers for 8bit and 10bit formats >>>>> media: qcom: iris: vdec: update size and stride calculations for 10bit formats >>>>> media: qcom: iris: vdec: forbid g_fmt while waiting for first source change >>> >>> The is suspicious, it should just send the previous state until you get the >>> event. Typical use case is for application to set a format based on bitstream >>> parsing, and use that as a guess to try and pre-allocate the buffers. I don't >>> usually review iris code, but I'll give that series some more eyes in the coming >>> days. >> >> Yeah I wasn't sure, venus does that, same as the vendor driver so I thought it would >> be good but I'm probably mistaken. >> >>> >>> cheers, >>> Nicolas >> >> Thanks! >> Neil >> >>> >>>>> media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats >>>>> media: qcom: iris: vdec: allow decoding into 10bit format >>>>> >>>>> drivers/media/platform/qcom/iris/iris_buffer.c | 81 +++++++++++++++++++++- >>>>> .../platform/qcom/iris/iris_hfi_gen2_command.c | 71 ++++++++++++++++++- >>>>> .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + >>>>> .../platform/qcom/iris/iris_hfi_gen2_response.c | 35 ++++++++-- >>>>> drivers/media/platform/qcom/iris/iris_instance.h | 2 + >>>>> .../platform/qcom/iris/iris_platform_common.h | 1 + >>>>> .../media/platform/qcom/iris/iris_platform_gen2.c | 3 +- >>>>> drivers/media/platform/qcom/iris/iris_state.c | 6 ++ >>>>> drivers/media/platform/qcom/iris/iris_state.h | 1 + >>>>> drivers/media/platform/qcom/iris/iris_utils.c | 16 ++++- >>>>> drivers/media/platform/qcom/iris/iris_utils.h | 2 + >>>>> drivers/media/platform/qcom/iris/iris_vdec.c | 70 +++++++++++++++++-- >>>>> drivers/media/platform/qcom/iris/iris_vidc.c | 14 +++- >>>>> 13 files changed, 285 insertions(+), 18 deletions(-) >>>>> --- >>>>> base-commit: f3e6330d7fe42b204af05a2dbc68b379e0ad179e >>>>> change-id: 20260408-topic-sm8x50-iris-10bit-decoding-074c3ac7975c >>>>> >>>>> Best regards, >>>>> -- >>>>> Neil Armstrong <neil.armstrong@linaro.org> >>>>> ^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats 2026-04-10 12:00 ` Neil Armstrong @ 2026-04-10 16:25 ` Neil Armstrong 2026-04-11 17:10 ` Dmitry Baryshkov 2026-04-14 15:35 ` Neil Armstrong 0 siblings, 2 replies; 34+ messages in thread From: Neil Armstrong @ 2026-04-10 16:25 UTC (permalink / raw) To: Nicolas Dufresne, Dmitry Baryshkov Cc: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel On 4/10/26 14:00, Neil Armstrong wrote: > On 4/9/26 15:19, Nicolas Dufresne wrote: >> Le jeudi 09 avril 2026 à 09:36 +0200, Neil Armstrong a écrit : >>> Hi, >>> >>> On 4/9/26 03:04, Nicolas Dufresne wrote: >>>> Hi, >>>> >>>> Le jeudi 09 avril 2026 à 03:02 +0300, Dmitry Baryshkov a écrit : >>>>> On Wed, Apr 08, 2026 at 06:43:53PM +0200, Neil Armstrong wrote: >>>>>> This adds the plumbing to support decoding HEVC and AV1 >>>>>> streams into 10bit pixel formats, linear and compressed. >>>>>> >>>>>> This has only been tested on SM8650 with HEVC, and was inspired by >>>>>> Venus and the downstream vidc driver for the buffer >>>>>> calculations and HFI messages. >>>>>> >>>>>> I was unable to get 10bit decoding working with Gstreamer >>>>>> and ffmpeg, but v4l2-ctl works with: >>>>> >>>>> Any particular errors? I assume Gstreamer needs to be taught about >>>>> Q10C. But P010 should (hopefully) work. >>>> >>>> P010 should work for both Gst and FFMPEG, its probably a user error, or there is >>>> a hidden bug in the driver that make it fail, v4l2-ctl is very permissive as it >>>> simply dump to disk. You should provide an updated fluster score, so you have to >>>> use one of these. >>> >>> I did run fluster and all main10 fails with Gstreamer and FFmpeg, I tried to manually >>> run the gst and ffmpeg commands with v4l2-tracer and logs but I can't explain the reason, >>> all returns from the driver seems valid but somehow they just error out with: >>> >>> FFmpeg: >>> $ ffmpeg -c:v hevc_v4l2m2m -i Big_Buck_Bunny_1080_10s_30MB_main10.h265 -y -f null - >>> ... >>> [hevc_v4l2m2m @ 0x55c0328aa0] Using device /dev/video-dec0 >>> [hevc_v4l2m2m @ 0x55c0328aa0] driver 'iris_driver' on card 'iris_decoder' in mplane mode >>> [hevc_v4l2m2m @ 0x55c0328aa0] requesting formats: output=HEVC/none capture=NV12/yuv420p10le >>> ... >>> [hevc_v4l2m2m @ 0x55c0328aa0] An invalid frame was output by a decoder. This is a bug, please report it. >>> [vist#0:0/hevc @ 0x55c02dc9b0] [dec:hevc_v4l2m2m @ 0x55c029d510] Decoding error: Internal bug, should not have happened >>> >> >> This one needs further investigation for sure. This error can be various things, >> and it requires going up to the v4l2 code to figure-out: >> >> >> Case 1: >> if (!frame->buf[0] || frame->format < 0) >> goto fail; >> >> Case 2 >> if (frame->width <= 0 || frame->height <= 0) >> goto fail; >> >> But a quick look lead me to think it case 1 (frame->format < 0) since I don't >> see P010 in the format map in ./libavcodec/v4l2_fmt.c (at least in mainline). >> Its also missing support for any opaque format, in fact I believe the DMABuf/DRM >> context is only in LibreELEC fork. But overall, it points toward ffmpeg for this >> error so far. > > Yeah I didn't find any ffmpeg for with P010 supported... > >> >> >>> The v4l2 trace shows a normal sequence with the driver returning P010 as G_FMT after the source change event, >>> and the capture planes dequeued but for an unknown reason the buffer is rejected by ffmpeg. >>> >>> Gst: >>> $ gst-launch-1.0 -v -m filesrc location=Big_Buck_Bunny_1080_10s_30MB_main10.h265 ! h265parse ! v4l2h265dec ! tee ! fakevideosink >>> Setting pipeline to PAUSED ... >>> Pipeline is PREROLLING ... >>> ... >>> Got message #37 from element "h265parse0" (latency): no message details >>> ERROR: from element /GstPipeline:pipeline0/GstH265Parse:h265parse0: Internal data stream error. >>> Redistribute latency... >>> Additional debug info: >>> ../gstreamer/subprojects/gstreamer/libs/gst/base/gstbaseparse.c(3702): gst_base_parse_loop (): /GstPipeline:pipeline0/GstH265Parse:h265parse0: >>> streaming stopped, reason not-negotiated (-4) >>> Got message #39 from pad "h265parse0:src" (property-notify): ERROR: pipeline doesn't want to preroll. >>> GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"video/x-h265\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1\,\ chroma-format\=\(string\)4:2:0\,\ bit-depth-luma\=\(uint\)10\,\ bit-depth-chroma\=\(uint\)10\,\ parsed\=\(boolean\)true\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)au\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ profile\=\(string\)main-10\,\ tier\=\(string\)main\,\ level\=\(string\)4"; >>> /GstPipeline:pipeline0/GstH265Parse:h265parse0.GstPad:src: caps = video/x-h265, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)10, bit-depth-chroma=(uint)10, parsed=(boolean)true, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, profile=(string)main-10, tier=(string)main, level=(string)4 >>> ... >> >> There is not a lot of details here, but I would start looking into >> V4L2_CID_MPEG_VIDEO_HEVC_PROFILE and V4L2_CID_MPEG_VIDEO_HEVC_LEVEL >> implementation. GStreamer (and Chromium too) will refuse to use a decoder that >> does not advertise the supported profile (though I see there is code for that, >> maybe its just some bug). >> >>> >>> In this case OUTPUT is not STREAMON and no OUTPUT buffers are queued, so I wonder why this one fails.... >>> >>> My gstreamer and ffmpeg foo is bad and I probably missed something obvious... >>> >>> >> You may get a different hint with more traces, just enabling general warnings: >> >> export GST_DEBUG=2 >> >> Or the full V4L2 traces too: >> >> export GST_DEBUG="v4l2*:7,2" >> >> >> I'm sure its just a bug (or two). Happy to help to find it. > > You were right, this did the trick: > diff --git a/drivers/media/platform/qcom/iris/iris_platform_gen2.c b/drivers/media/platform/qcom/iris/iris_platform_gen2.c > index a9cdd93e77fd..debdd30a751e 100644 > --- a/drivers/media/platform/qcom/iris/iris_platform_gen2.c > +++ b/drivers/media/platform/qcom/iris/iris_platform_gen2.c > @@ -56,9 +56,10 @@ static const struct platform_inst_fw_cap inst_fw_cap_sm8550_dec[] = { > { > .cap_id = PROFILE_HEVC, > .min = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN, > - .max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE, > + .max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10, > .step_or_mask = BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN) | > - BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE), > + BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE) | > + BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10), > .value = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN, > .hfi_id = HFI_PROP_PROFILE, > .flags = CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU, > > But the gstreamer I'm using is too old and doesn't support P010... updating but it should work now, > and I'll test the QC10 in the same time. Tested with gstreamer git, it works fine now with P010. But I applied the QC10 change, but how am I supposed to test it ? The QC formats seems to be detected and the right modifier is used: 0:00:07.231474967 296677 296852 INFO v4l2 gstv4l2object.c:5544:gst_v4l2_object_probe_caps:<v4l2h265dec0:src> probed caps: video/x-raw(memory:DMABuf), format=(string)DMA_DRM, drm-format=(string){ NV12:0x0500000000000001, NV12 }, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1, colorimetry=(string){ bt601, 1:4:16:3, smpte240m, bt709, 1:3:5:1, 2:4:5:2, 2:4:5:3, 1:4:5:3, 1:4:7:1, 2:4:7:1, 2:4:12:8, bt2020, bt2100-pq, 2:0:0:0 }; video/x-raw, format=(string)NV12, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1, colorimetry=(string){ bt601, 1:4:16:3, smpte240m, bt709, 1:3:5:1, 2:4:5:2, 2:4:5:3, 1:4:5:3, 1:4:7:1, 2:4:7:1, 2:4:12:8, bt2020, bt2100-pq, 2:0:0:0 }; video/x-raw(memory:DMABuf), format=(string)DMA_DRM, drm-format=(string){ NV12:0x0500000000000001, NV12 }, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1; video/x-raw, format=(string)NV12, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1 0:00:07.224200523 304189 304365 INFO v4l2 gstv4l2object.c:5544:gst_v4l2_object_probe_caps:<v4l2h265dec0:src> probed caps: video/x-raw(memory:DMABuf), format=(string)DMA_DRM, drm-format=(string){ P010, P010:0x0500000000000001 }, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1, colorimetry=(string){ bt601, 1:4:16:3, smpte240m, bt709, 1:3:5:1, 2:4:5:2, 2:4:5:3, 1:4:5:3, 1:4:7:1, 2:4:7:1, 2:4:12:8, bt2020, bt2100-pq, 2:0:0:0 }; video/x-raw, format=(string)P010_10LE, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1, colorimetry=(string){ bt601, 1:4:16:3, smpte240m, bt709, 1:3:5:1, 2:4:5:2, 2:4:5:3, 1:4:5:3, 1:4:7:1, 2:4:7:1, 2:4:12:8, bt2020, bt2100-pq, 2:0:0:0 }; video/x-raw(memory:DMABuf), format=(string)DMA_DRM, drm-format=(string){ P010, P010:0x0500000000000001 }, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1; video/x-raw, format=(string)P010_10LE, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1 But what's the proper way to validate ? I've been unable to run kmssink so far. Neil > > Neil > >> >>> >>>> >>>> For Q10C on GStreamer, it needs mapping [0] and you need some bugfix [1] and >>>> another that I will be sending tomorrow. We had never tested video compression >>>> with this module before. >>>> >>>> [0] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8195 >>>> [1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/11222 >>>> >>>> The last issue has to do with: >>>> https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/38965e2d9c1119674a65dc437ee7e8ec95339f31/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c#L4378 >>>> >>>> V4L2 format gives us the number of allocation, but not really the number of >>>> planes, and we forgot to initialize that number for the "opaque" format case. A >>>> tempory fix might be to add this after S_FMT: >>>> >>>> if (GST_VIDEO_INFO_FORMAT (&info.vinfo) == GST_VIDEO_FORMAT_DMA_DRM) >>>> n_v4l_planes = format.fmt.pix_mp.num_planes; >>>> >>>> Works for AFBC and QC at leat, since both are unambiguously single plane, and so >>>> cannot have mplane variants. >>> >>> I'll definitely try that ! thanks for the pointers ! >>> >>>> >>>> Let me know how far you get! Please be aware that Robert and I are making these >>>> patches based on feedback, we don't have access to any boards capable of >>>> decoding to QC compressed formats. >>>> >>>>> >>>>>> v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=P010 --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.P010 >>>>>> v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=Q10C --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.QC10 >>>>>> >>>>>> The non-10bit decoding still works as before. >>>>>> >>>>>> With Big_Buck_Bunny_1080_10s_30MB reencoded in 10-bit profile >>>>>> and tranformed in v4l2 header format with [1]: >>>>>> ffmpeg -i Big_Buck_Bunny_1080_10s_30MB.h264 -pix_fmt yuv420p10le -c:v libx265 -crf 28 -x265-params profile=main10 Big_Buck_Bunny_1080_10s_30MB_main10.h265 >>>>>> /path/to/mkhdr.sh Big_Buck_Bunny_1080_10s_30MB_main10.h265 raw Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr >>>>>> >>>>>> The frames correctness has been verified buy displaying them >>>>>> via Vulkan DMA_BUF import, including QC10C and QC08C. >>>> >>>> In GStreamer, once the video4linux plugin issues are fixed, you should be able >>>> to display the frames using glimagesink. GL only allow for RGB render, which >>>> damages the data, so its not good enough for conformance testing with >>>> compression enabled, but usually just doing visual inspection is acceptable. >>>> >>>>>> >>>>>> The support is probably incomplete for other platforms and >>>>>> I'm unsure what's required to conform to the V4L2 M2M stateless >>>>> >>>>> stateful >>>>> >>>>>> spec, especially since AFAIK the decoder doesn't support >>>>>> decoding 10bit streams in 8bit pixel format, thus the RFC state. >>>>>> Review is welcome ! >>>> >>>> Why would your decoder need to support decoding 10bit into 8bit ? This is quite >>>> rare and its only possible with post-processed capture buffer. >>> >>> Yeah it's just a note, the Amlogic one supported outputing main10 in NV12 but >>> only supported 10bit in their compressed format. >>> >> >> Ack. There is a lot of variation with various hardware for sure. The Allwinner >> stateless one swallow the extra 2bit plane (since they do some funky NV12 + two >> more planes for the missing 2bits, and that's complicate as a format hehe). >> >> >> cheers, >> Nicolas >> >>> >>>> >>>>>> >>>>>> [1] https://github.com/superna9999/pyv4l2compliance >>>>>> >>>>>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> >>>>>> --- >>>>>> Neil Armstrong (7): >>>>>> media: qcom: iris: add QC10C & P010 buffer size calculations >>>>>> media: qcom: iris: gen2: add support for 10bit decoding >>>>>> media: qcom: iris: add helpers for 8bit and 10bit formats >>>>>> media: qcom: iris: vdec: update size and stride calculations for 10bit formats >>>>>> media: qcom: iris: vdec: forbid g_fmt while waiting for first source change >>>> >>>> The is suspicious, it should just send the previous state until you get the >>>> event. Typical use case is for application to set a format based on bitstream >>>> parsing, and use that as a guess to try and pre-allocate the buffers. I don't >>>> usually review iris code, but I'll give that series some more eyes in the coming >>>> days. >>> >>> Yeah I wasn't sure, venus does that, same as the vendor driver so I thought it would >>> be good but I'm probably mistaken. >>> >>>> >>>> cheers, >>>> Nicolas >>> >>> Thanks! >>> Neil >>> >>>> >>>>>> media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats >>>>>> media: qcom: iris: vdec: allow decoding into 10bit format >>>>>> >>>>>> drivers/media/platform/qcom/iris/iris_buffer.c | 81 +++++++++++++++++++++- >>>>>> .../platform/qcom/iris/iris_hfi_gen2_command.c | 71 ++++++++++++++++++- >>>>>> .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + >>>>>> .../platform/qcom/iris/iris_hfi_gen2_response.c | 35 ++++++++-- >>>>>> drivers/media/platform/qcom/iris/iris_instance.h | 2 + >>>>>> .../platform/qcom/iris/iris_platform_common.h | 1 + >>>>>> .../media/platform/qcom/iris/iris_platform_gen2.c | 3 +- >>>>>> drivers/media/platform/qcom/iris/iris_state.c | 6 ++ >>>>>> drivers/media/platform/qcom/iris/iris_state.h | 1 + >>>>>> drivers/media/platform/qcom/iris/iris_utils.c | 16 ++++- >>>>>> drivers/media/platform/qcom/iris/iris_utils.h | 2 + >>>>>> drivers/media/platform/qcom/iris/iris_vdec.c | 70 +++++++++++++++++-- >>>>>> drivers/media/platform/qcom/iris/iris_vidc.c | 14 +++- >>>>>> 13 files changed, 285 insertions(+), 18 deletions(-) >>>>>> --- >>>>>> base-commit: f3e6330d7fe42b204af05a2dbc68b379e0ad179e >>>>>> change-id: 20260408-topic-sm8x50-iris-10bit-decoding-074c3ac7975c >>>>>> >>>>>> Best regards, >>>>>> -- >>>>>> Neil Armstrong <neil.armstrong@linaro.org> >>>>>> > ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats 2026-04-10 16:25 ` Neil Armstrong @ 2026-04-11 17:10 ` Dmitry Baryshkov 2026-04-14 15:35 ` Neil Armstrong 1 sibling, 0 replies; 34+ messages in thread From: Dmitry Baryshkov @ 2026-04-11 17:10 UTC (permalink / raw) To: Neil Armstrong Cc: Nicolas Dufresne, Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel On Fri, Apr 10, 2026 at 06:25:55PM +0200, Neil Armstrong wrote: > On 4/10/26 14:00, Neil Armstrong wrote: > > On 4/9/26 15:19, Nicolas Dufresne wrote: > > > Le jeudi 09 avril 2026 à 09:36 +0200, Neil Armstrong a écrit : > > > > Hi, > > > > > > > > On 4/9/26 03:04, Nicolas Dufresne wrote: > > > > > Hi, > > > > > > > > > > Le jeudi 09 avril 2026 à 03:02 +0300, Dmitry Baryshkov a écrit : > > > > > > On Wed, Apr 08, 2026 at 06:43:53PM +0200, Neil Armstrong wrote: > > > > > > > This adds the plumbing to support decoding HEVC and AV1 > > > > > > > streams into 10bit pixel formats, linear and compressed. > > > > > > > > > > > > > > This has only been tested on SM8650 with HEVC, and was inspired by > > > > > > > Venus and the downstream vidc driver for the buffer > > > > > > > calculations and HFI messages. > > > > > > > > > > > > > > I was unable to get 10bit decoding working with Gstreamer > > > > > > > and ffmpeg, but v4l2-ctl works with: > > > > > > > > > > > > Any particular errors? I assume Gstreamer needs to be taught about > > > > > > Q10C. But P010 should (hopefully) work. > > > > > > > > > > P010 should work for both Gst and FFMPEG, its probably a user error, or there is > > > > > a hidden bug in the driver that make it fail, v4l2-ctl is very permissive as it > > > > > simply dump to disk. You should provide an updated fluster score, so you have to > > > > > use one of these. > > > > > > > > I did run fluster and all main10 fails with Gstreamer and FFmpeg, I tried to manually > > > > run the gst and ffmpeg commands with v4l2-tracer and logs but I can't explain the reason, > > > > all returns from the driver seems valid but somehow they just error out with: > > > > > > > > FFmpeg: > > > > $ ffmpeg -c:v hevc_v4l2m2m -i Big_Buck_Bunny_1080_10s_30MB_main10.h265 -y -f null - > > > > ... > > > > [hevc_v4l2m2m @ 0x55c0328aa0] Using device /dev/video-dec0 > > > > [hevc_v4l2m2m @ 0x55c0328aa0] driver 'iris_driver' on card 'iris_decoder' in mplane mode > > > > [hevc_v4l2m2m @ 0x55c0328aa0] requesting formats: output=HEVC/none capture=NV12/yuv420p10le > > > > ... > > > > [hevc_v4l2m2m @ 0x55c0328aa0] An invalid frame was output by a decoder. This is a bug, please report it. > > > > [vist#0:0/hevc @ 0x55c02dc9b0] [dec:hevc_v4l2m2m @ 0x55c029d510] Decoding error: Internal bug, should not have happened > > > > > > > > > > This one needs further investigation for sure. This error can be various things, > > > and it requires going up to the v4l2 code to figure-out: > > > > > > > > > Case 1: > > > if (!frame->buf[0] || frame->format < 0) > > > goto fail; > > > > > > Case 2 > > > if (frame->width <= 0 || frame->height <= 0) > > > goto fail; > > > > > > But a quick look lead me to think it case 1 (frame->format < 0) since I don't > > > see P010 in the format map in ./libavcodec/v4l2_fmt.c (at least in mainline). > > > Its also missing support for any opaque format, in fact I believe the DMABuf/DRM > > > context is only in LibreELEC fork. But overall, it points toward ffmpeg for this > > > error so far. > > > > Yeah I didn't find any ffmpeg for with P010 supported... > > > > > > > > > > > > The v4l2 trace shows a normal sequence with the driver returning P010 as G_FMT after the source change event, > > > > and the capture planes dequeued but for an unknown reason the buffer is rejected by ffmpeg. > > > > > > > > Gst: > > > > $ gst-launch-1.0 -v -m filesrc location=Big_Buck_Bunny_1080_10s_30MB_main10.h265 ! h265parse ! v4l2h265dec ! tee ! fakevideosink > > > > Setting pipeline to PAUSED ... > > > > Pipeline is PREROLLING ... > > > > ... > > > > Got message #37 from element "h265parse0" (latency): no message details > > > > ERROR: from element /GstPipeline:pipeline0/GstH265Parse:h265parse0: Internal data stream error. > > > > Redistribute latency... > > > > Additional debug info: > > > > ../gstreamer/subprojects/gstreamer/libs/gst/base/gstbaseparse.c(3702): gst_base_parse_loop (): /GstPipeline:pipeline0/GstH265Parse:h265parse0: > > > > streaming stopped, reason not-negotiated (-4) > > > > Got message #39 from pad "h265parse0:src" (property-notify): ERROR: pipeline doesn't want to preroll. > > > > GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"video/x-h265\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1\,\ chroma-format\=\(string\)4:2:0\,\ bit-depth-luma\=\(uint\)10\,\ bit-depth-chroma\=\(uint\)10\,\ parsed\=\(boolean\)true\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)au\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ profile\=\(string\)main-10\,\ tier\=\(string\)main\,\ level\=\(string\)4"; > > > > /GstPipeline:pipeline0/GstH265Parse:h265parse0.GstPad:src: caps = video/x-h265, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)10, bit-depth-chroma=(uint)10, parsed=(boolean)true, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, profile=(string)main-10, tier=(string)main, level=(string)4 > > > > ... > > > > > > There is not a lot of details here, but I would start looking into > > > V4L2_CID_MPEG_VIDEO_HEVC_PROFILE and V4L2_CID_MPEG_VIDEO_HEVC_LEVEL > > > implementation. GStreamer (and Chromium too) will refuse to use a decoder that > > > does not advertise the supported profile (though I see there is code for that, > > > maybe its just some bug). > > > > > > > > > > > In this case OUTPUT is not STREAMON and no OUTPUT buffers are queued, so I wonder why this one fails.... > > > > > > > > My gstreamer and ffmpeg foo is bad and I probably missed something obvious... > > > > > > > > > > > You may get a different hint with more traces, just enabling general warnings: > > > > > > export GST_DEBUG=2 > > > > > > Or the full V4L2 traces too: > > > > > > export GST_DEBUG="v4l2*:7,2" > > > > > > > > > I'm sure its just a bug (or two). Happy to help to find it. > > > > You were right, this did the trick: > > diff --git a/drivers/media/platform/qcom/iris/iris_platform_gen2.c b/drivers/media/platform/qcom/iris/iris_platform_gen2.c > > index a9cdd93e77fd..debdd30a751e 100644 > > --- a/drivers/media/platform/qcom/iris/iris_platform_gen2.c > > +++ b/drivers/media/platform/qcom/iris/iris_platform_gen2.c > > @@ -56,9 +56,10 @@ static const struct platform_inst_fw_cap inst_fw_cap_sm8550_dec[] = { > > { > > .cap_id = PROFILE_HEVC, > > .min = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN, > > - .max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE, > > + .max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10, > > .step_or_mask = BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN) | > > - BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE), > > + BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE) | > > + BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10), > > .value = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN, > > .hfi_id = HFI_PROP_PROFILE, > > .flags = CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU, > > > > But the gstreamer I'm using is too old and doesn't support P010... updating but it should work now, > > and I'll test the QC10 in the same time. > > Tested with gstreamer git, it works fine now with P010. > > But I applied the QC10 change, but how am I supposed to test it ? > > The QC formats seems to be detected and the right modifier is used: > 0:00:07.231474967 296677 296852 INFO v4l2 gstv4l2object.c:5544:gst_v4l2_object_probe_caps:<v4l2h265dec0:src> probed caps: video/x-raw(memory:DMABuf), format=(string)DMA_DRM, drm-format=(string){ NV12:0x0500000000000001, NV12 }, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1, colorimetry=(string){ bt601, 1:4:16:3, smpte240m, bt709, 1:3:5:1, 2:4:5:2, 2:4:5:3, 1:4:5:3, 1:4:7:1, 2:4:7:1, 2:4:12:8, bt2020, bt2100-pq, 2:0:0:0 }; video/x-raw, format=(string)NV12, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1, colorimetry=(string){ bt601, 1:4:16:3, smpte240m, bt709, 1:3:5:1, 2:4:5:2, 2:4:5:3, 1:4:5:3, 1:4:7:1, 2:4:7:1, 2:4:12:8, bt2020, bt2100-pq, 2:0:0:0 }; video/x-raw(memory:DMABuf), format=(string)DMA_DRM, drm-format=(string){ NV12:0x0500000000000001, NV12 }, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1; video/x-raw, format=(string)NV12, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1 > 0:00:07.224200523 304189 304365 INFO v4l2 gstv4l2object.c:5544:gst_v4l2_object_probe_caps:<v4l2h265dec0:src> probed caps: video/x-raw(memory:DMABuf), format=(string)DMA_DRM, drm-format=(string){ P010, P010:0x0500000000000001 }, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1, colorimetry=(string){ bt601, 1:4:16:3, smpte240m, bt709, 1:3:5:1, 2:4:5:2, 2:4:5:3, 1:4:5:3, 1:4:7:1, 2:4:7:1, 2:4:12:8, bt2020, bt2100-pq, 2:0:0:0 }; video/x-raw, format=(string)P010_10LE, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1, colorimetry=(string){ bt601, 1:4:16:3, smpte240m, bt709, 1:3:5:1, 2:4:5:2, 2:4:5:3, 1:4:5:3, 1:4:7:1, 2:4:7:1, 2:4:12:8, bt2020, bt2100-pq, 2:0:0:0 }; video/x-raw(memory:DMABuf), format=(string)DMA_DRM, drm-format=(string){ P010, P010:0x0500000000000001 }, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1; video/x-raw, format=(string)P010_10LE, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1 > > But what's the proper way to validate ? I've been unable to run kmssink so far. Unfrotunately the easiest way would be to get it to work with the kmssink (or to dump the raw buffers and then get them displayed manually). -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats 2026-04-10 16:25 ` Neil Armstrong 2026-04-11 17:10 ` Dmitry Baryshkov @ 2026-04-14 15:35 ` Neil Armstrong 1 sibling, 0 replies; 34+ messages in thread From: Neil Armstrong @ 2026-04-14 15:35 UTC (permalink / raw) To: Nicolas Dufresne, Dmitry Baryshkov Cc: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar, Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel On 4/10/26 18:25, Neil Armstrong wrote: > On 4/10/26 14:00, Neil Armstrong wrote: >> On 4/9/26 15:19, Nicolas Dufresne wrote: >>> Le jeudi 09 avril 2026 à 09:36 +0200, Neil Armstrong a écrit : <snip> >>>> >>>> Gst: >>>> $ gst-launch-1.0 -v -m filesrc location=Big_Buck_Bunny_1080_10s_30MB_main10.h265 ! h265parse ! v4l2h265dec ! tee ! fakevideosink >>>> Setting pipeline to PAUSED ... >>>> Pipeline is PREROLLING ... >>>> ... >>>> Got message #37 from element "h265parse0" (latency): no message details >>>> ERROR: from element /GstPipeline:pipeline0/GstH265Parse:h265parse0: Internal data stream error. >>>> Redistribute latency... >>>> Additional debug info: >>>> ../gstreamer/subprojects/gstreamer/libs/gst/base/gstbaseparse.c(3702): gst_base_parse_loop (): /GstPipeline:pipeline0/GstH265Parse:h265parse0: >>>> streaming stopped, reason not-negotiated (-4) >>>> Got message #39 from pad "h265parse0:src" (property-notify): ERROR: pipeline doesn't want to preroll. >>>> GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"video/x-h265\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1\,\ chroma-format\=\(string\)4:2:0\,\ bit-depth-luma\=\(uint\)10\,\ bit-depth-chroma\=\(uint\)10\,\ parsed\=\(boolean\)true\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)au\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ profile\=\(string\)main-10\,\ tier\=\(string\)main\,\ level\=\(string\)4"; >>>> /GstPipeline:pipeline0/GstH265Parse:h265parse0.GstPad:src: caps = video/x-h265, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)10, bit-depth-chroma=(uint)10, parsed=(boolean)true, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, profile=(string)main-10, tier=(string)main, level=(string)4 >>>> ... >>> >>> There is not a lot of details here, but I would start looking into >>> V4L2_CID_MPEG_VIDEO_HEVC_PROFILE and V4L2_CID_MPEG_VIDEO_HEVC_LEVEL >>> implementation. GStreamer (and Chromium too) will refuse to use a decoder that >>> does not advertise the supported profile (though I see there is code for that, >>> maybe its just some bug). >>> >>>> >>>> In this case OUTPUT is not STREAMON and no OUTPUT buffers are queued, so I wonder why this one fails.... >>>> >>>> My gstreamer and ffmpeg foo is bad and I probably missed something obvious... >>>> >>>> >>> You may get a different hint with more traces, just enabling general warnings: >>> >>> export GST_DEBUG=2 >>> >>> Or the full V4L2 traces too: >>> >>> export GST_DEBUG="v4l2*:7,2" >>> >>> >>> I'm sure its just a bug (or two). Happy to help to find it. >> >> You were right, this did the trick: >> diff --git a/drivers/media/platform/qcom/iris/iris_platform_gen2.c b/drivers/media/platform/qcom/iris/iris_platform_gen2.c >> index a9cdd93e77fd..debdd30a751e 100644 >> --- a/drivers/media/platform/qcom/iris/iris_platform_gen2.c >> +++ b/drivers/media/platform/qcom/iris/iris_platform_gen2.c >> @@ -56,9 +56,10 @@ static const struct platform_inst_fw_cap inst_fw_cap_sm8550_dec[] = { >> { >> .cap_id = PROFILE_HEVC, >> .min = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN, >> - .max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE, >> + .max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10, >> .step_or_mask = BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN) | >> - BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE), >> + BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE) | >> + BIT(V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10), >> .value = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN, >> .hfi_id = HFI_PROP_PROFILE, >> .flags = CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU, >> >> But the gstreamer I'm using is too old and doesn't support P010... updating but it should work now, >> and I'll test the QC10 in the same time. > > Tested with gstreamer git, it works fine now with P010. > > But I applied the QC10 change, but how am I supposed to test it ? > > The QC formats seems to be detected and the right modifier is used: > 0:00:07.231474967 296677 296852 INFO v4l2 gstv4l2object.c:5544:gst_v4l2_object_probe_caps:<v4l2h265dec0:src> probed caps: video/x-raw(memory:DMABuf), format=(string)DMA_DRM, drm-format=(string){ NV12:0x0500000000000001, NV12 }, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1, colorimetry=(string){ bt601, 1:4:16:3, smpte240m, bt709, 1:3:5:1, 2:4:5:2, 2:4:5:3, 1:4:5:3, 1:4:7:1, 2:4:7:1, 2:4:12:8, bt2020, bt2100-pq, 2:0:0:0 }; video/x-raw, format=(string)NV12, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1, colorimetry=(string){ bt601, 1:4:16:3, smpte240m, bt709, 1:3:5:1, 2:4:5:2, 2:4:5:3, 1:4:5:3, 1:4:7:1, 2:4:7:1, 2:4:12:8, bt2020, bt2100-pq, 2:0:0:0 }; video/x-raw(memory:DMABuf), format=(string)DMA_DRM, drm-format=(string){ NV12:0x0500000000000001, NV12 }, width=(int)[ 96, 8192 ], height=(int) > [ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1; video/x-raw, format=(string)NV12, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1 > 0:00:07.224200523 304189 304365 INFO v4l2 gstv4l2object.c:5544:gst_v4l2_object_probe_caps:<v4l2h265dec0:src> probed caps: video/x-raw(memory:DMABuf), format=(string)DMA_DRM, drm-format=(string){ P010, P010:0x0500000000000001 }, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1, colorimetry=(string){ bt601, 1:4:16:3, smpte240m, bt709, 1:3:5:1, 2:4:5:2, 2:4:5:3, 1:4:5:3, 1:4:7:1, 2:4:7:1, 2:4:12:8, bt2020, bt2100-pq, 2:0:0:0 }; video/x-raw, format=(string)P010_10LE, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1, colorimetry=(string){ bt601, 1:4:16:3, smpte240m, bt709, 1:3:5:1, 2:4:5:2, 2:4:5:3, 1:4:5:3, 1:4:7:1, 2:4:7:1, 2:4:12:8, bt2020, bt2100-pq, 2:0:0:0 }; video/x-raw(memory:DMABuf), format=(string)DMA_DRM, drm-format=(string){ P010, P010:0x0500000000000001 }, width=(int)[ 96, 8192 ], > height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1; video/x-raw, format=(string)P010_10LE, width=(int)[ 96, 8192 ], height=(int)[ 96, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)1/1 > > But what's the proper way to validate ? I've been unable to run kmssink so far. Ok all works with kmssink, I was trying with a bad kernel config with the screen not modeset... Anyway, I managed to get all those working: gst-launch-1.0 -v -m filesrc location=Big_Buck_Bunny_1080_10s_30MB.h265 ! h265parse ! v4l2h265dec ! kmssink gst-launch-1.0 -v -m filesrc location=Big_Buck_Bunny_1080_10s_30MB_main10.h265 ! h265parse ! v4l2h265dec ! kmssink gst-launch-1.0 -v -m filesrc location=Big_Buck_Bunny_1080_10s_30MB.h265 ! h265parse ! v4l2h265dec ! "video/x-raw(memory:DMABuf), format=DMA_DRM, drm-format=NV12" ! kmssink gst-launch-1.0 -v -m filesrc location=Big_Buck_Bunny_1080_10s_30MB.h265 ! h265parse ! v4l2h265dec ! "video/x-raw(memory:DMABuf), format=DMA_DRM, drm-format=NV12:0x0500000000000001" ! kmssink gst-launch-1.0 -v -m filesrc location=Big_Buck_Bunny_1080_10s_30MB_main10.h265 ! h265parse ! v4l2h265dec ! "video/x-raw(memory:DMABuf), format=DMA_DRM, drm-format=P010" ! kmssink gst-launch-1.0 -v -m filesrc location=Big_Buck_Bunny_1080_10s_30MB_main10.h265 ! h265parse ! v4l2h265dec ! "video/x-raw(memory:DMABuf), format=DMA_DRM, drm-format=P010:0x0500000000000001" ! kmssink with those 2 merge requests : - https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8195 - https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/11222 and: =============================================================================== diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index df16adc..f7fbb29 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -4377,6 +4377,9 @@ gst_v4l2_object_set_format_full (GstV4l2Object * v4l2object, GstCaps * caps, align.padding_right = format.fmt.pix.width - width; } + if (GST_VIDEO_INFO_FORMAT (&info.vinfo) == GST_VIDEO_FORMAT_DMA_DRM) + n_v4l_planes = format.fmt.pix_mp.num_planes; + if (is_mplane && format.fmt.pix_mp.num_planes != n_v4l_planes) goto invalid_planes; =============================================================================== But this causes an error with QC10C: "plane 1 too small" in msm_framebuffer_init() probably because the plane 1 values are off because of the hack. Since the NV12 and QC08 buffer size is close it works unlike QC10C where the buffer size is way lower than P010 (4210688 vs 6266880). With this is works just fine, but it's a hack: =============================================================================== diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c index 9b681e144c07..4928e2d191dc 100644 --- a/drivers/gpu/drm/msm/msm_fb.c +++ b/drivers/gpu/drm/msm/msm_fb.c @@ -218,7 +218,7 @@ static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, + width * info->cpp[i] + mode_cmd->offsets[i]; - if (bos[i]->size < min_size) { + if (bos[i]->size < min_size && !MSM_FORMAT_IS_UBWC(format)) { ret = UERR(EINVAL, dev, "plane %d too small", i); goto fail; } =============================================================================== I can get NV12, QC08C, P010 and QC10C all decoding and displaying. I had to fix some alignement code in iris + remove format filtering on find_format_by_index, sending a v2 soon with the fixes + fluster reports. Neil > > Neil > >> >> Neil >> >>> >>>> >>>>> >>>>> For Q10C on GStreamer, it needs mapping [0] and you need some bugfix [1] and >>>>> another that I will be sending tomorrow. We had never tested video compression >>>>> with this module before. >>>>> >>>>> [0] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8195 >>>>> [1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/11222 >>>>> >>>>> The last issue has to do with: >>>>> https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/38965e2d9c1119674a65dc437ee7e8ec95339f31/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c#L4378 >>>>> >>>>> V4L2 format gives us the number of allocation, but not really the number of >>>>> planes, and we forgot to initialize that number for the "opaque" format case. A >>>>> tempory fix might be to add this after S_FMT: >>>>> >>>>> if (GST_VIDEO_INFO_FORMAT (&info.vinfo) == GST_VIDEO_FORMAT_DMA_DRM) >>>>> n_v4l_planes = format.fmt.pix_mp.num_planes; >>>>> >>>>> Works for AFBC and QC at leat, since both are unambiguously single plane, and so >>>>> cannot have mplane variants. >>>> >>>> I'll definitely try that ! thanks for the pointers ! >>>> >>>>> >>>>> Let me know how far you get! Please be aware that Robert and I are making these >>>>> patches based on feedback, we don't have access to any boards capable of >>>>> decoding to QC compressed formats. >>>>> >>>>>> >>>>>>> v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=P010 --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.P010 >>>>>>> v4l2-ctl --verbose --set-fmt-video-out=pixelformat=HEVC --set-fmt-video=pixelformat=Q10C --stream-mmap --stream-out-mmap --stream-from-hdr Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr --stream-to out.QC10 >>>>>>> >>>>>>> The non-10bit decoding still works as before. >>>>>>> >>>>>>> With Big_Buck_Bunny_1080_10s_30MB reencoded in 10-bit profile >>>>>>> and tranformed in v4l2 header format with [1]: >>>>>>> ffmpeg -i Big_Buck_Bunny_1080_10s_30MB.h264 -pix_fmt yuv420p10le -c:v libx265 -crf 28 -x265-params profile=main10 Big_Buck_Bunny_1080_10s_30MB_main10.h265 >>>>>>> /path/to/mkhdr.sh Big_Buck_Bunny_1080_10s_30MB_main10.h265 raw Big_Buck_Bunny_1080_10s_30MB_main10.h265.hdr >>>>>>> >>>>>>> The frames correctness has been verified buy displaying them >>>>>>> via Vulkan DMA_BUF import, including QC10C and QC08C. >>>>> >>>>> In GStreamer, once the video4linux plugin issues are fixed, you should be able >>>>> to display the frames using glimagesink. GL only allow for RGB render, which >>>>> damages the data, so its not good enough for conformance testing with >>>>> compression enabled, but usually just doing visual inspection is acceptable. >>>>> >>>>>>> >>>>>>> The support is probably incomplete for other platforms and >>>>>>> I'm unsure what's required to conform to the V4L2 M2M stateless >>>>>> >>>>>> stateful >>>>>> >>>>>>> spec, especially since AFAIK the decoder doesn't support >>>>>>> decoding 10bit streams in 8bit pixel format, thus the RFC state. >>>>>>> Review is welcome ! >>>>> >>>>> Why would your decoder need to support decoding 10bit into 8bit ? This is quite >>>>> rare and its only possible with post-processed capture buffer. >>>> >>>> Yeah it's just a note, the Amlogic one supported outputing main10 in NV12 but >>>> only supported 10bit in their compressed format. >>>> >>> >>> Ack. There is a lot of variation with various hardware for sure. The Allwinner >>> stateless one swallow the extra 2bit plane (since they do some funky NV12 + two >>> more planes for the missing 2bits, and that's complicate as a format hehe). >>> >>> >>> cheers, >>> Nicolas >>> >>>> >>>>> >>>>>>> >>>>>>> [1] https://github.com/superna9999/pyv4l2compliance >>>>>>> >>>>>>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> >>>>>>> --- >>>>>>> Neil Armstrong (7): >>>>>>> media: qcom: iris: add QC10C & P010 buffer size calculations >>>>>>> media: qcom: iris: gen2: add support for 10bit decoding >>>>>>> media: qcom: iris: add helpers for 8bit and 10bit formats >>>>>>> media: qcom: iris: vdec: update size and stride calculations for 10bit formats >>>>>>> media: qcom: iris: vdec: forbid g_fmt while waiting for first source change >>>>> >>>>> The is suspicious, it should just send the previous state until you get the >>>>> event. Typical use case is for application to set a format based on bitstream >>>>> parsing, and use that as a guess to try and pre-allocate the buffers. I don't >>>>> usually review iris code, but I'll give that series some more eyes in the coming >>>>> days. >>>> >>>> Yeah I wasn't sure, venus does that, same as the vendor driver so I thought it would >>>> be good but I'm probably mistaken. >>>> >>>>> >>>>> cheers, >>>>> Nicolas >>>> >>>> Thanks! >>>> Neil >>>> >>>>> >>>>>>> media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats >>>>>>> media: qcom: iris: vdec: allow decoding into 10bit format >>>>>>> >>>>>>> drivers/media/platform/qcom/iris/iris_buffer.c | 81 +++++++++++++++++++++- >>>>>>> .../platform/qcom/iris/iris_hfi_gen2_command.c | 71 ++++++++++++++++++- >>>>>>> .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + >>>>>>> .../platform/qcom/iris/iris_hfi_gen2_response.c | 35 ++++++++-- >>>>>>> drivers/media/platform/qcom/iris/iris_instance.h | 2 + >>>>>>> .../platform/qcom/iris/iris_platform_common.h | 1 + >>>>>>> .../media/platform/qcom/iris/iris_platform_gen2.c | 3 +- >>>>>>> drivers/media/platform/qcom/iris/iris_state.c | 6 ++ >>>>>>> drivers/media/platform/qcom/iris/iris_state.h | 1 + >>>>>>> drivers/media/platform/qcom/iris/iris_utils.c | 16 ++++- >>>>>>> drivers/media/platform/qcom/iris/iris_utils.h | 2 + >>>>>>> drivers/media/platform/qcom/iris/iris_vdec.c | 70 +++++++++++++++++-- >>>>>>> drivers/media/platform/qcom/iris/iris_vidc.c | 14 +++- >>>>>>> 13 files changed, 285 insertions(+), 18 deletions(-) >>>>>>> --- >>>>>>> base-commit: f3e6330d7fe42b204af05a2dbc68b379e0ad179e >>>>>>> change-id: 20260408-topic-sm8x50-iris-10bit-decoding-074c3ac7975c >>>>>>> >>>>>>> Best regards, >>>>>>> -- >>>>>>> Neil Armstrong <neil.armstrong@linaro.org> >>>>>>> >> > ^ permalink raw reply related [flat|nested] 34+ messages in thread
end of thread, other threads:[~2026-04-17 8:03 UTC | newest] Thread overview: 34+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-04-08 16:43 [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats Neil Armstrong 2026-04-08 16:43 ` [PATCH RFC 1/7] media: qcom: iris: add QC10C & P010 buffer size calculations Neil Armstrong 2026-04-08 23:59 ` Dmitry Baryshkov 2026-04-09 7:25 ` Neil Armstrong 2026-04-11 16:13 ` Dmitry Baryshkov 2026-04-17 6:47 ` Dikshita Agarwal 2026-04-17 8:03 ` Neil Armstrong 2026-04-08 16:43 ` [PATCH RFC 2/7] media: qcom: iris: gen2: add support for 10bit decoding Neil Armstrong 2026-04-17 7:22 ` Dikshita Agarwal 2026-04-17 8:03 ` Neil Armstrong 2026-04-08 16:43 ` [PATCH RFC 3/7] media: qcom: iris: add helpers for 8bit and 10bit formats Neil Armstrong 2026-04-17 7:23 ` Dikshita Agarwal 2026-04-17 8:03 ` Neil Armstrong 2026-04-08 16:43 ` [PATCH RFC 4/7] media: qcom: iris: vdec: update size and stride calculations for " Neil Armstrong 2026-04-10 10:10 ` Vishnu Reddy 2026-04-10 11:59 ` Neil Armstrong 2026-04-10 12:57 ` Vishnu Reddy 2026-04-10 13:47 ` Neil Armstrong 2026-04-14 23:39 ` Nicolas Dufresne 2026-04-08 16:43 ` [PATCH RFC 5/7] media: qcom: iris: vdec: forbid g_fmt while waiting for first source change Neil Armstrong 2026-04-08 16:43 ` [PATCH RFC 6/7] media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats Neil Armstrong 2026-04-15 6:39 ` Vishnu Reddy 2026-04-15 7:35 ` Neil Armstrong 2026-04-08 16:44 ` [PATCH RFC 7/7] media: qcom: iris: vdec: allow decoding into 10bit format Neil Armstrong 2026-04-09 0:02 ` [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats Dmitry Baryshkov 2026-04-09 1:04 ` Nicolas Dufresne 2026-04-09 1:40 ` Dmitry Baryshkov 2026-04-09 7:43 ` Neil Armstrong 2026-04-09 7:36 ` Neil Armstrong 2026-04-09 13:19 ` Nicolas Dufresne 2026-04-10 12:00 ` Neil Armstrong 2026-04-10 16:25 ` Neil Armstrong 2026-04-11 17:10 ` Dmitry Baryshkov 2026-04-14 15:35 ` Neil Armstrong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox