Re: [PATCH v3] media: v4l2-ctrls: add full AV1 profile validation in validate_av1_sequence()

From: Daniel Almeida

Date: Sat Sep 27 2025 - 04:57:21 EST


Hi, I’ll review this in the coming weeks.

> On 27 Sep 2025, at 06:51, opensource india <opensource206@xxxxxxxxx> wrote:
>
> On Sat, Sep 13, 2025 at 4:23 PM Pavan Bobba <opensource206@xxxxxxxxx> wrote:
>>
>> Complete the "TODO: PROFILES" by enforcing profile-specific and
>> monochrome constraints as defined by the AV1 specification
>> (Section 5.5.2, "Color config syntax").
>>
>> The validator now checks:
>>
>> - Flags: reject any unknown bits set in sequence->flags
>> - Profile range: only profiles 0..2 are valid
>> - Profile 0: 8/10-bit only, subsampling must be 4:2:0 (sx=1, sy=1),
>> monochrome allowed
>> - Profile 1: 8/10-bit only, subsampling must be 4:4:4 (sx=0, sy=0),
>> monochrome forbidden
>> - Profile 2:
>> * 8/10-bit: only 4:2:2 allowed (sx=1, sy=0)
>> * 12-bit: 4:4:4 (sx=0, sy=0), 4:2:2 (sx=1, sy=0), or 4:2:0 (sx=1, sy=1)
>> allowed
>> - Monochrome path (all profiles except 1): forces subsampling_x=1,
>> subsampling_y=1, separate_uv_delta_q=0
>>
>> These checks prevent userspace from providing invalid AV1 sequence
>> headers that would otherwise be accepted, leading to undefined driver
>> or hardware behavior.

Mauro,

A reminder that I have been warning about this for quite a while [0], which
includes mentioning that patches like this, although welcome, do not solve the
root issue completely.

I keep working on what I believe to be the solution [1][2]. I would appreciate if
we could restart this discussion.

[0]: https://lwn.net/Articles/970565/
[1]: https://lore.kernel.org/linux-media/20250818-v4l2-v1-0-6887e772aac2@xxxxxxxxxxxxx/
[2]: https://lwn.net/Articles/963966/