From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF78BCEF17A for ; Tue, 8 Oct 2024 14:26:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Date:Cc:To:From :Subject:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xKTWbogi7rDKZ0L4Lnq6s12hOjhCMJLQw5BZshd3wNU=; b=ndMLepgowTvEqK80/KK0YMWrid d2JXP8q+AmRlwRvtpzIVsrhd90W8VZ+wSwWjv08yFHIUGT1CjTakT50jlG2WYsTUVT6Ng5QR+65zR UhP0UHIYI5axAm+L2Dq9N9VGpv4vDQwDg4OBy+2Wu9Riqc2J4BXgbyAqtvS7ByXl1FFTyY2vgnP7d FfZ5RgjBBkuHw2TOJayt7YM5dv+Hn9E23IFmTIxTsX9ZZVhD5jVQeWqfymhISgtq0EfGFMloQwx2l xS+xZEBBbB6chGFTaU+6Ctc4ANKejpjVIlRwMQCx3ZLYUWv+o5l48R4XK0fTPWwmNIivRKInJ4r/8 n4tb3Tkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syB9z-000000069nl-1tJd; Tue, 08 Oct 2024 14:25:59 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syB7Y-000000069BQ-3jhI for linux-arm-kernel@lists.infradead.org; Tue, 08 Oct 2024 14:23:30 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1syB7N-0007J1-6W; Tue, 08 Oct 2024 16:23:17 +0200 Received: from [2a0a:edc0:0:900:1d::4e] (helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1syB7M-000Nu1-Fu; Tue, 08 Oct 2024 16:23:16 +0200 Received: from pza by lupine with local (Exim 4.96) (envelope-from ) id 1syB7M-000Bnr-1K; Tue, 08 Oct 2024 16:23:16 +0200 Message-ID: <05c5b863f98bb61f67e79e83e05ca341285db205.camel@pengutronix.de> Subject: Re: [PATCH v2 2/2] media: imx: vdic: Introduce mem2mem VDI deinterlacer driver From: Philipp Zabel To: Marek Vasut , Nicolas Dufresne , linux-media@vger.kernel.org Cc: Daniel Vetter , David Airlie , Fabio Estevam , Greg Kroah-Hartman , Helge Deller , Mauro Carvalho Chehab , Pengutronix Kernel Team , Sascha Hauer , Shawn Guo , Steve Longerbeam , dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev Date: Tue, 08 Oct 2024 16:23:16 +0200 In-Reply-To: <0da39b8f-4cca-438f-9a39-40da7c34c895@denx.de> References: <20240724002044.112544-1-marex@denx.de> <20240724002044.112544-2-marex@denx.de> <85a5a42667e5867bc45da31baf045d4c9557f5f1.camel@ndufresne.ca> <6b45e30c-b215-4f7a-91a4-fde05d78f737@denx.de> <0da39b8f-4cca-438f-9a39-40da7c34c895@denx.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241008_072328_941600_E62EB914 X-CRM114-Status: GOOD ( 18.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Do, 2024-10-03 at 16:57 +0200, Marek Vasut wrote: > On 9/26/24 1:16 PM, Philipp Zabel wrote: > > On Mi, 2024-09-25 at 22:45 +0200, Marek Vasut wrote: > > [...] > > > > The driver is not taking ownership of prev_buf, only curr_buf is gu= aranteed to > > > > exist until v4l2_m2m_job_finish() is called. Usespace could streamo= ff, allocate > > > > new buffers, and then an old freed buffer may endup being used. > > >=20 > > > So, what should I do about this ? Is there some way to ref the buffer= to > > > keep it around ? > >=20 > > Have a look how other deinterlacers with temporal filtering do it. > > sunxi/sun8i-di or ti/vpe look like candidates. > I don't see exactly what those drivers are doing differently to protect= =20 > the prev buffer during deinterlacing . Can you be more specific ? In the EOF interrupt you are calling v4l2_m2m_buf_done() on src_buf, which should be the same as ctx->curr_buf in the previous device_run. Instead, you could release ctx->prev_buf and then store src_buf into ctx->prev_buf. Storing curr_buf on the ctx doesn't seem to be necessary at all. The mentioned deinterlacer drivers do something similar [1][2]. [1] https://elixir.bootlin.com/linux/master/source/drivers/media/platform/s= unxi/sun8i-di/sun8i-di.c#L236 [2] https://elixir.bootlin.com/linux/master/source/drivers/media/platform/t= i/vpe/vpe.c#L1481 regards Philipp