mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jernej Skrabec <jernej.skrabec@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@kernel.org>
Cc: Maxime Ripard <mripard@kernel.org>,
	Paul Kocialkowski <paulk@sys-base.io>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Chen-Yu Tsai <wens@kernel.org>,
	Samuel Holland <samuel@sholland.org>,
	Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
	Jernej Skrabec <jernej.skrabec@gmail.com>
Subject: [PATCH v2 10/11] staging: media: cedrus: h264: clear the DRAM buffer sizes on start
Date: Mon,  9 Nov 2026 18:50:15 +0100	[thread overview]
Message-ID: <20261109175016.42061-11-jernej.skrabec@gmail.com> (raw)
In-Reply-To: <20261109175016.42061-1-jernej.skrabec@gmail.com>

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@gmail.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.
-- 
2.43.0


  parent reply	other threads:[~2026-11-09 17:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 17:50 [PATCH v2 00/11] staging: media: cedrus: assorted fixes and VP8 4K support Jernej Skrabec
2026-11-09 17:50 ` [PATCH v2 01/11] staging: media: cedrus: free MV-col buffers in buf_cleanup Jernej Skrabec
2026-11-09 17:50 ` [PATCH v2 02/11] staging: media: cedrus: reject too large H.264/HEVC SPS Jernej Skrabec
2026-11-09 17:50 ` [PATCH v2 03/11] staging: media: cedrus: h264: mark long-term references in the frame info Jernej Skrabec
2026-11-09 17:50 ` [PATCH v2 04/11] staging: media: cedrus: mpeg2: use the field height for field pictures Jernej Skrabec
2026-11-09 17:50 ` [PATCH v2 05/11] staging: media: cedrus: mpeg2: derive the field order of " Jernej Skrabec
2026-11-09 17:50 ` [PATCH v2 06/11] staging: media: cedrus: mpeg2: fix the references " Jernej Skrabec
2026-11-09 17:50 ` [PATCH v2 07/11] staging: media: cedrus: validate VP8 frame size Jernej Skrabec
2026-11-09 17:50 ` [PATCH v2 08/11] staging: media: cedrus: vp8: use the vendor probability table size Jernej Skrabec
2026-11-09 17:50 ` [PATCH v2 09/11] staging: media: cedrus: h616: use the 256-bit DDR mode Jernej Skrabec
2026-11-09 17:50 ` Jernej Skrabec [this message]
2026-11-09 17:50 ` [PATCH v2 11/11] staging: media: cedrus: vp8: support frames wider than 2048 pixels Jernej Skrabec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261109175016.42061-11-jernej.skrabec@gmail.com \
    --to=jernej.skrabec@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=mripard@kernel.org \
    --cc=nicolas.dufresne@collabora.com \
    --cc=paulk@sys-base.io \
    --cc=samuel@sholland.org \
    --cc=wens@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®