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 97741E7B61B for ; Wed, 4 Oct 2023 13:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6YefT76YHyFB/JYvi3hZmgDMSpEDhjGk9q0G0bC9L7Q=; b=VjmYwMdje65CHY W9+wi544FgmoCeWcB9MKrYS/3MP3zjKqwnrtlJ2E+lNUbgRM7m6VKXGKakaDQx+iPgffaAkkfQu8p qPIFmJJyqTVaS9JR+2iwrsA433/WGGpsku21boQS4Epop5iuQe0Sa9VOsQoZa4hOZ8pVRGNsPRKaG zgsOYLQOKDxSryPohPtWB9g6bEDLHcFFjSzJFKJDGDyUUvucHtHkVoWrui5WBXOYCPMK0ffS7SlGr 3tIW2oISxpNkfMnw2fWj/MDIfSG15lGBXjL245RN7JAjWIVd8Unif+pUV4FeawK/58HqCEQhLdCAx dLm+ARxQnyPR267rlLWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qo2HO-000A0E-2J; Wed, 04 Oct 2023 13:51:10 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qo2HJ-0009yn-1j for linux-arm-kernel@lists.infradead.org; Wed, 04 Oct 2023 13:51:09 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0051A61485; Wed, 4 Oct 2023 13:51:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3EC3C433C8; Wed, 4 Oct 2023 13:51:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696427464; bh=5dxwRtP0WUsm4uqALVgMvEmHcGfySQY48FXS22qdXnA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iq5KLCxXupKp+Y3rbet2SD1FP/DSA2ynwy90znIO2JhCclGmP/8wtqZdSaZNIfE1o KxpCnJb8rBrSmLUTpl9R4Qqp0LWHDmylUP/L2LQMYbKwuNfawq84z/q1YEws5sL3BY lWMnJPhn1BhZpx2GI7Il8QTHKjK6Bp44Ry3+EUrpw/fBpkAkEr2WxO/Dfl+xqybz31 49MuogcugaZC9FwlklYR+5VFQOpqtnatb+pTwRtr4ZwPg5dyV53od0FBcXaxDmIeT0 48oOiPvZOtJUdy59Ptesgs5Hej8VJGGSFAeZRmyH5IYAYkxvCh8Ij7QKthKF+uUeG0 iChVYAvDiqLYA== Date: Wed, 4 Oct 2023 19:21:00 +0530 From: Vinod Koul To: Laurent Pinchart Cc: Jai Luthra , Tomi Valkeinen , Vignesh Raghavendra , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sakari Ailus , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mauro Carvalho Chehab , Maxime Ripard , niklas.soderlund+renesas@ragnatech.se, Benoit Parrot , Vaishnav Achath , nm@ti.com, devarsht@ti.com, a-bhatia1@ti.com, Martyn Welch , Julien Massot Subject: Re: [PATCH v9 13/13] media: ti: Add CSI2RX support for J721E Message-ID: References: <20230811-upstream_csi-v9-0-8943f7a68a81@ti.com> <20230811-upstream_csi-v9-13-8943f7a68a81@ti.com> <20230829155513.GG6477@pendragon.ideasonboard.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230829155513.GG6477@pendragon.ideasonboard.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231004_065105_664604_FC96873B X-CRM114-Status: GOOD ( 40.24 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 29-08-23, 18:55, Laurent Pinchart wrote: > Hi Jai, > > (CC'ing Vinod, the maintainer of the DMA engine subsystem, for a > question below) Sorry this got lost > > On Fri, Aug 18, 2023 at 03:55:06PM +0530, Jai Luthra wrote: > > On Aug 15, 2023 at 16:00:51 +0300, Tomi Valkeinen wrote: > > > On 11/08/2023 13:47, Jai Luthra wrote: > > > > From: Pratyush Yadav > > [snip] > > > > > +static int ti_csi2rx_start_streaming(struct vb2_queue *vq, unsigned int count) > > > > +{ > > > > + struct ti_csi2rx_dev *csi = vb2_get_drv_priv(vq); > > > > + struct ti_csi2rx_dma *dma = &csi->dma; > > > > + struct ti_csi2rx_buffer *buf; > > > > + unsigned long flags; > > > > + int ret = 0; > > > > + > > > > + spin_lock_irqsave(&dma->lock, flags); > > > > + if (list_empty(&dma->queue)) > > > > + ret = -EIO; > > > > + spin_unlock_irqrestore(&dma->lock, flags); > > > > + if (ret) > > > > + return ret; > > > > + > > > > + dma->drain.len = csi->v_fmt.fmt.pix.sizeimage; > > > > + dma->drain.vaddr = dma_alloc_coherent(csi->dev, dma->drain.len, > > > > + &dma->drain.paddr, GFP_KERNEL); > > > > + if (!dma->drain.vaddr) > > > > + return -ENOMEM; > > > > > > This is still allocating a large buffer every time streaming is started (and > > > with streams support, a separate buffer for each stream?). > > > > > > Did you check if the TI DMA can do writes to a constant address? That would > > > be the best option, as then the whole buffer allocation problem goes away. > > > > I checked with Vignesh, the hardware can support a scenario where we > > flush out all the data without allocating a buffer, but I couldn't find > > a way to signal that via the current dmaengine framework APIs. Will look > > into it further as it will be important for multi-stream support. > > That would be the best option. It's not immediately apparent to me if > the DMA engine API supports such a use case. > dmaengine_prep_interleaved_dma() gives you finer grain control on the > source and destination increments, but I haven't seen a way to instruct > the DMA engine to direct writes to /dev/null (so to speak). Vinod, is > this something that is supported, or could be supported ? Write to a dummy buffer could have the same behaviour, no? > > > > Alternatively, can you flush the buffers with multiple one line transfers? > > > The flushing shouldn't be performance critical, so even if that's slower > > > than a normal full-frame DMA, it shouldn't matter much. And if that can be > > > done, a single probe time line-buffer allocation should do the trick. > > > > There will be considerable overhead if we queue many DMA transactions > > (in the order of 1000s or even 100s), which might not be okay for the > > scenarios where we have to drain mid-stream. Will have to run some > > experiments to see if that is worth it. > > > > But one optimization we can for sure do is re-use a single drain buffer > > for all the streams. We will need to ensure to re-allocate the buffer > > for the "largest" framesize supported across the different streams at > > stream-on time. > > If you implement .device_prep_interleaved_dma() in the DMA engine driver > you could write to a single line buffer, assuming that the hardware would > support so in a generic way. > > > My guess is the endpoint is not buffering a full-frame's worth of data, > > I will also check if we can upper bound that size to something feasible. > > > > > Other than this drain buffer topic, I think this looks fine. So, I'm going > > > to give Rb, but I do encourage you to look more into optimizing this drain > > > buffer. > > > > Thank you! > > > > > Reviewed-by: Tomi Valkeinen > > -- > Regards, > > Laurent Pinchart -- ~Vinod _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel