Re: [RFC PATCH 08/28] media: mali-vpu: register V76 decoder controls and introduce UAPI controls
From: Charvi Mehta
Date: Tue Nov 24 2026 - 11:27:48 EST
On 11/19/26 21:06, Nicolas Dufresne wrote:
I had planned to add the documentation for these subsequently, but, I agree,Add Mali VPU userspace controls for NALU layout, stream escaping,I would strongly recommend to keep each vendor control in its own patch. These
intermediate buffer size, stream-header handling, frame reordering and
firmware debug output. Also expose the standard read-only
V4L2_CID_MIN_BUFFERS_FOR_CAPTURE control.
are API, and they need documentation. In practice, you'll prefer to not
introduce vendor control as a first introduction of your driver, its just a bad
idea. You completely missed Documentation/
it should accompany the controls. The initial driver series may not be the right
place for these vendor controls, so I’ll remove them and their UAPI definitions
from this patchset.
The firmware defaults to Annex B, which matches V4L2_PIX_FMT_H264, so+ .cid = V4L2_CID_MALI_VPU_NALU_FORMAT,This mixes alignment and NAL format. Its historical, but the format is bound to
+ .type = V4L2_CTRL_TYPE_MENU,
+ .name = "NALU format",
+ .qmenu = mali_v76_nalu_format_qmenu,
+ .min_val = MALI_VPU_NALU_FORMAT_START_CODES,
+ .max_val = MALI_VPU_NALU_FORMAT_FOUR_BYTE_LENGTH_FIELD,
+ .default_val = MALI_VPU_NALU_FORMAT_START_CODES,
+ .step_or_mask = BIT(MALI_VPU_NALU_FORMAT_START_CODES) |
+ BIT(MALI_VPU_NALU_FORMAT_ONE_NALU_PER_BUFFER) |
+ BIT(MALI_VPU_NALU_FORMAT_ONE_BYTE_LENGTH_FIELD) |
+ BIT(MALI_VPU_NALU_FORMAT_TWO_BYTE_LENGTH_FIELD) |
+ BIT(MALI_VPU_NALU_FORMAT_FOUR_BYTE_LENGTH_FIELD),
V4L2_PIX_FMT_H264 and is documented as Annex B. If you want to add something
such as AVCc formata instead, you'd need a new pixel format. There is
V4L2_PIX_FMT_H264_SC, but its hill define, nobody knows what it was originally
suppose to do. Venus (Qualcomm) maps it as if it was the same, perhaps they have
a clue, but I would stay away.
For the alignment, V4L2_CID_MPEG_VIDEO_HEADER_MODE does not cover your 1 buffer
per nalue case, it only does the split header like OMX IL was doing (sometimes,
interoperanility killed OMX).
this control is not needed for that input format. I'll drop this completely.
The firmware already calculates the intermediate working-buffer size when+ .cid = V4L2_CID_MALI_VPU_INTBUF_SIZE,No general equivalent, and to be fair, that seems like something the driver
+ .type = V4L2_CTRL_TYPE_INTEGER,
+ .name = "Internal buffer size",
should get correctly by itself, I'd say drop.
no override is supplied. I’ll remove this control completely.
Yes, this controls emulation-prevention byte handling.+ },No doc, I suppose it was about emulation bytes. Nobody needs that drop.
+ {
+ .cid = V4L2_CID_MALI_VPU_STREAM_ESCAPING,
Agreed that this can be dropped.
Ack. I’ll use an appropriate interface as suggested when I reintroduce this.+ {Debugging goes into sysfs or debugfs, drop.
+ .cid = V4L2_CID_MALI_VPU_HOST_PRINT_ENABLE,
This does not skip the initial headers; it retains existing SPS/PPS entries rather+ },If userspace want that, it can just strip the headers itself. Its not like a
+ {
+ .cid = V4L2_CID_MALI_VPU_IGNORE_STREAM_HEADERS,
stateful decoder can work without headers according to the spec. It will always
break one way or another.
than accepting replacements with the same ID. It was intended to prevent a heavily
corrupted stream from replacing valid settings, but it would also ignore legitimate
changes. Agreed to drop it.
Agreed, I’ll drop the vendor control. I’ll use the suggested standard controls with a+ },You can thank Samsung, instead you need
+ {
+ .cid = V4L2_CID_MALI_VPU_FRAME_REORDERING,
V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE and add support for
V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY 0. That will effectively disable
reordering. Some vendors calls this the thumbnail mode to add to the fun.
delay of zero, when I reintroduce this in subsequent patches.
I’ll drop the vendor controls from this series.+/*My recommendation, drop all the vendor controls, legacy users can use your
+ * The base for Arm Mali-VPU driver controls.
+ * We reserve 64 controls for this driver.
+ */
+#define V4L2_CID_USER_MALI_VPU_BASE (V4L2_CID_USER_BASE + 0x1260)
+
/* MPEG-class control IDs */
/* The MPEG controls are applicable to all codec controls
* and the 'MPEG' part of the define is historical */
downstream kernels.
Regards,
Charvi