[PATCH v2 10/11] staging: media: cedrus: h264: clear the DRAM buffer sizes on start

Nicolas Dufresne nicolas.dufresne at collabora.com
Thu Nov 26 14:39:52 PST 2026


Le lundi 09 novembre 2026 à 18:50 +0100, Jernej Skrabec a écrit :
> Above 2048 pixels, the H.264 decoder puts its deblocking and intra
> prediction buffers into DRAM, and stop() frees them when their sizes
> are not zero. start() only sets the sizes for wide pictures and nothing
> clears them, so a narrow stream after a wide one on the same file
> handle frees the buffers of the wide one again. The codec data is also
> shared with the other codecs, whose data can end up in the sizes.
> 
> Clear the sizes at the start of start().
> 
> Fixes: 03e612e701a6 ("media: cedrus: Fix H264 4k support")
> Signed-off-by: Jernej Skrabec <jernej.skrabec at gmail.com>

Reviewed-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>

> ---
>  drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
> index 97958ceee8d1..e7a3bfbc3531 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
> @@ -573,6 +573,14 @@ static int cedrus_h264_start(struct cedrus_ctx *ctx)
>  	unsigned int pic_info_size;
>  	int ret;
>  
> +	/*
> +	 * The sizes tell stop() whether the DRAM buffers below were
> +	 * allocated. Clear them, as they are only set for wide pictures and
> +	 * the codec data is shared with the other codecs.
> +	 */
> +	ctx->codec.h264.deblk_buf_size = 0;
> +	ctx->codec.h264.intra_pred_buf_size = 0;
> +
>  	/*
>  	 * NOTE: All buffers allocated here are only used by HW, so we
>  	 * can add DMA_ATTR_NO_KERNEL_MAPPING flag when allocating them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20261126/6252d709/attachment.sig>


More information about the linux-arm-kernel mailing list