Re: [PATCH v9 1/6] media: verisilicon: Do not set context src/dst formats in reset functions

From: Marek Szyprowski
Date: Wed Apr 12 2023 - 13:12:20 EST


Hi,

On 12.04.2023 18:40, Benjamin Gaignard wrote:
>
> Le 12/04/2023 à 18:14, Marek Szyprowski a écrit :
>> Hi,
>>
>> On 20.02.2023 11:48, Benjamin Gaignard wrote:
>>> Setting context source and destination formats should only be done
>>> in hantro_set_fmt_out() and hantro_set_fmt_cap() after check that
>>> the targeted queue is not busy.
>>> Remove these calls from hantro_reset_encoded_fmt() and
>>> hantro_reset_raw_fmt() to clean the driver.
>>>
>>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@xxxxxxxxxxxxx>
>> This patch landed recently in linux-next as commit db6f68b51e5c ("media:
>> verisilicon: Do not set context src/dst formats in reset functions").
>
> Hi,
>
> I do not have this board up and running with Hantro encoder but
> I think the attached patch may solve the issue.
> Could you tell me if it works ?

Yep, it fixes the issue.

Tested-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>


It looks that the code could be a bit more cleaned up, as with the
attached patch, there is such construction:

        if (coded) {
                pix_mp->num_planes = 1;
                vpu_fmt = fmt;
        } else if (ctx->is_encoder) {
                vpu_fmt = fmt;
        } else {
                vpu_fmt = fmt;
                /*
                 * Width/height on the CAPTURE end of a decoder are
ignored and
                 * replaced by the OUTPUT ones.
                 */
                pix_mp->width = ctx->src_fmt.width;
                pix_mp->height = ctx->src_fmt.height;
        }

Common 'vpu_fmt = fmt' can be moved out of the above if-else block.


Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland