[PATCH v2 2/4] media: verisilicon: Set need_postproc before resetting the CAPTURE format

Benjamin Gaignard benjamin.gaignard at collabora.com
Mon Nov 23 01:28:34 PST 2026


Le 15/11/2026 à 09:39, Arun Iyengar via B4 Relay a écrit :
> From: Arun Iyengar <aiyengar1990 at gmail.com>
>
> hantro_reset_raw_fmt() sets bit_depth and need_postproc only after
> hantro_set_fmt_cap(), so hantro_try_fmt() sizes the format with the old
> values: after AV1 film grain is turned off, the CAPTURE buffers lack the
> motion vector area. Set them first and restore them on error.
>
> Fixes: 80c7373a456e ("media: verisilicon: Conditionally ignore native formats")
> Cc: stable at vger.kernel.org
> Signed-off-by: Arun Iyengar <aiyengar1990 at gmail.com>

Reviewed-by: Benjamin Gaignard <benjamin.gaignard at collabora.com>

> ---
>   drivers/media/platform/verisilicon/hantro_v4l2.c | 11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/verisilicon/hantro_v4l2.c b/drivers/media/platform/verisilicon/hantro_v4l2.c
> index 83af9fa1ce94..5939fffc350d 100644
> --- a/drivers/media/platform/verisilicon/hantro_v4l2.c
> +++ b/drivers/media/platform/verisilicon/hantro_v4l2.c
> @@ -449,6 +449,8 @@ hantro_reset_raw_fmt(struct hantro_ctx *ctx, int bit_depth, bool need_postproc)
>   {
>   	const struct hantro_fmt *raw_vpu_fmt;
>   	struct v4l2_pix_format_mplane raw_fmt, *encoded_fmt;
> +	bool old_need_postproc = ctx->need_postproc;
> +	int old_bit_depth = ctx->bit_depth;
>   	int ret;
>   
>   	raw_vpu_fmt = hantro_get_default_fmt(ctx, false, bit_depth, need_postproc);
> @@ -465,14 +467,17 @@ hantro_reset_raw_fmt(struct hantro_ctx *ctx, int bit_depth, bool need_postproc)
>   	hantro_reset_fmt(&raw_fmt, raw_vpu_fmt);
>   	raw_fmt.width = encoded_fmt->width;
>   	raw_fmt.height = encoded_fmt->height;
> +
> +	ctx->bit_depth = bit_depth;
> +	ctx->need_postproc = need_postproc;
>   	if (ctx->is_encoder)
>   		ret = hantro_set_fmt_out(ctx, &raw_fmt, need_postproc);
>   	else
>   		ret = hantro_set_fmt_cap(ctx, &raw_fmt);
>   
> -	if (!ret) {
> -		ctx->bit_depth = bit_depth;
> -		ctx->need_postproc = need_postproc;
> +	if (ret) {
> +		ctx->bit_depth = old_bit_depth;
> +		ctx->need_postproc = old_need_postproc;
>   	}
>   
>   	return ret;
>



More information about the Linux-rockchip mailing list