Re: [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats

From: Nicolas Dufresne

Date: Wed Apr 08 2026 - 21:04:44 EST


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@xxxxxxxxxx>
> > ---
> > 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@xxxxxxxxxx>
> >

Attachment: signature.asc
Description: This is a digitally signed message part