Re: [PATCH v3 4/4] media: mali-c55: Implement Gamma block validation

From: Vincenzo Frascino

Date: Mon Jun 29 2026 - 06:17:00 EST


Hi Jacopo,

On 29/06/2026 10:19, Jacopo Mondi wrote:
>>> + /* Check the first and last gamma lut entries match the expectations. */
>>> + if (gamma->lut[0] != 0 ||
>>> + gamma->lut[MALI_C55_NUM_GAMMA_LUT_ELEMENTS - 1] != 0xfff) {
>> I am still learning about these things and might be wrong. Should not we also
>> validate that intermediate LUT entries are monotonic and non-decreasing?
>>
> Eh, good question.
>
> This all new for everyone, as this would be the first user of
> 'block_validate()' in tree.
>
> Here I checked only the first and last member because it seems like a
> good compromise between performances and correctness. This function
> might potentially run for every frame (where a CCM table is specified
> by userspace), so I'm a bit unsure how far we should go with
> validation.
>
> I kept these two patches broken out from the ones that introduce the
> uapi specifically to get feedback on this. Maybe I'm overconcerned
> about the additional cost of validation ?

I am not sure either. As a strategy I always prefer to be on the safe side hence
my comment. Is there any way we could come up with a comparative analysis and
check what's the impact of these additional costs? This should answer my
question I guess.

--
Regards,
Vincenzo