Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp376994rdb; Thu, 5 Oct 2023 08:26:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2Q3i1yJVlMxaiZLtczZEkboucfx2AVu81Bb4JkTRcb7wUfGGhjH3H+Gv2bIXmwErgYjt8 X-Received: by 2002:a05:6a21:4984:b0:15c:b7ba:69cd with SMTP id ax4-20020a056a21498400b0015cb7ba69cdmr4833887pzc.19.1696519616197; Thu, 05 Oct 2023 08:26:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696519616; cv=none; d=google.com; s=arc-20160816; b=SXxe5ccCAi9S2cr1aRTZOY/qc/wPYVkKYhHmnfy4huSDajSwiOgHtsQYcQjkfelyaL 7LfAPKlT6b63wH8KJgsY5tFIRUz/8IQjNbQJQnAh7699xmdTY9XgkA4jSRscOESNnj3H YCEFoYrHAKhtLesBe2o567EU7GKUvu+OO7fHC1WEaFVvu9GTxbfnStg6z8Ciwf375mMA AV+vUghJ5NkjJIJYrJbtc4KJZwK48+Lgo3+EcqZBeZdFEDRV96j8eL6OtDOXcRfeXbhU g3mrLuShaaPRDMfJqNlBO39tYHZD+vmNroxyN/dLQNXlfI35oxOPUFUy/xTPequjo6qy tn5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PLOaZCrH4AS4dNXuxBbutaqievZ1tb51sZNYpNPOArQ=; fh=jo/FqLhIrGBY2BWAzhhNJF4N/HQGtJTPHRsv0czfd+8=; b=Qqurr4oniQ+mhP55jwKm3mkznCd6QsFgH5jTk2d4O8hlldB2VKYtlU2isQAKQG5mBN Shc3G886TzrxCSMM1GdX52c/nhQwXalmYHWVck/9L9/GVO4kaoxGPfdY8/vqS7avQCHq JVwNYBaNnNHInMaXWnLPLyihblpFfdULXOngBBuWOpk9QOXnvuKA8eDcSCnc9rXFDggZ w4SeohnKyV489af4qG0V8omGlrFtqEjhIqkwWvqianiGclNiYqY4YUhivNdB6s44vtzQ ZaNFRx/yVGaOHyLGKBO8MGRMmxeqRRzo+0aZ1g0gybdPfBZWBQsGjfbAUMu0zST92kbl gdrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cUGQPMVm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id y20-20020a63e254000000b005781e99d048si1592634pgj.889.2023.10.05.08.26.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 08:26:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cUGQPMVm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 5C04B8705E8C; Thu, 5 Oct 2023 08:26:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232672AbjJEP0q (ORCPT + 99 others); Thu, 5 Oct 2023 11:26:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232602AbjJEPZx (ORCPT ); Thu, 5 Oct 2023 11:25:53 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E91C86078A; Thu, 5 Oct 2023 07:51:03 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1BB1C433CB; Thu, 5 Oct 2023 04:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696479019; bh=tvQ6HmqskzVwBQufXqWAzijK9xLx9i/yIFRHr3dsOjg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cUGQPMVmdNnKQ0RoWKzH79W5T8AWaX52R5iZQaBiaKi+e773J54Ahe6zZ3s7p6pzB WtHdPYGr1LFupPbB+ZUJHOVLwqBeJcNuVaAgf2Vvwwy1uSv28lE6HX9NRGq87B6o7a Zab4J1b51rBp2Dz+Z5xRryrrFhRn5XE6a9VBlk/YCHq2OrREr9bBjDnTIpO2cfd0XP CXadHlD2fzWFoS+FrMbrYO/ncV/jrXyO+QQ354YZO2Bl0VdsYTI7n3L+UO3wc6FAWf F3ZgLzlbZwKm1ej4WRH/RHNWsUY2mPVvDBLyXar3PUyTQ8rrqsg+EQnloOmdkoJbhH +DN+dx1Jhy6Fw== Date: Thu, 5 Oct 2023 09:40:14 +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> <20231004200312.GE30342@pendragon.ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231004200312.GE30342@pendragon.ideasonboard.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 05 Oct 2023 08:26:55 -0700 (PDT) On 04-10-23, 23:03, Laurent Pinchart wrote: > On Wed, Oct 04, 2023 at 07:21:00PM +0530, Vinod Koul wrote: > > 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 > > No worries. > > > > 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? > > Yes, but if the DMA engine can write to /dev/null, that avoids > allocating a dummy buffer, which is nicer. For video use cases, dummy > buffers are often large. hmmm maybe I haven't comprehended it full, would you mind explaining the details on how such a potential interleaved transfer would look like so that we can model it or change apis to model this -- ~Vinod