Re: [PATCH] media: venus: dec: Fix capture formats enumeration order

From: Javier Martinez Canillas
Date: Mon Mar 06 2023 - 05:10:26 EST


Jordan Crouse <jorcrous@xxxxxxxxxx> writes:

Hello Jordan,

> On Fri, Feb 10, 2023 at 09:18:35AM +0100, Javier Martinez Canillas wrote:
>> Commit 9593126dae3e ("media: venus: Add a handling of QC08C compressed
>> format") and commit cef92b14e653 ("media: venus: Add a handling of QC10C
>> compressed format") added support for the QC08C and QC10C compressed
>> formats respectively.
>>
>> But these also caused a regression, because the new formats where added
>> at the beginning of the vdec_formats[] array and the vdec_inst_init()
>> function sets the default format output and capture using fixed indexes
>> of that array:
>>
>> static void vdec_inst_init(struct venus_inst *inst)
>> {
>> ...
>> inst->fmt_out = &vdec_formats[8];
>> inst->fmt_cap = &vdec_formats[0];
>> ...
>> }
>>
>> Since now V4L2_PIX_FMT_NV12 is not the first entry in the array anymore,
>> the default capture format is not set to that as it was done before.
>>
>> Both commits changed the first index to keep inst->fmt_out default format
>> set to V4L2_PIX_FMT_H264, but did not update the latter to keep .fmt_out
>> default format set to V4L2_PIX_FMT_NV12.
>>
>> Rather than updating the index to the current V4L2_PIX_FMT_NV12 position,
>> let's reorder the entries so that this format is the first entry again.
>>
>> This would also make VIDIOC_ENUM_FMT report the V4L2_PIX_FMT_NV12 format
>> with an index 0 as it did before the QC08C and QC10C formats were added.
>>
>> Fixes: 9593126dae3e ("media: venus: Add a handling of QC08C compressed format")
>> Fixes: cef92b14e653 ("media: venus: Add a handling of QC10C compressed format")
>> Signed-off-by: Javier Martinez Canillas <javierm@xxxxxxxxxx>
>
> I just came across this issue independently and can confirm this patch fixes
> the GStreamer V4L2 decoder on QRB5165.
>
> Tested-by: Jordan Crouse <jorcrous@xxxxxxxxxx>
>

Thanks for testing it!

Stanimir, can we please get this for v6.3 as well?

--
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat