Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1053971pxm; Wed, 23 Feb 2022 16:58:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwupYQC4mAvb9W8CiyWPIK+KG0zZVuKUY+PEGENrHNjEggg6ckxohZ2VEoo002aiQASMIQu X-Received: by 2002:a05:6a00:1a04:b0:4e1:294:e1e5 with SMTP id g4-20020a056a001a0400b004e10294e1e5mr112670pfv.51.1645664298799; Wed, 23 Feb 2022 16:58:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645664298; cv=none; d=google.com; s=arc-20160816; b=IGaact4ahzDqdtyrhUy1GyornrGw8O/hQOK7eCsOa+cyCcMkpFsRnBFdpBzncRCv6X sgN8LRNMIJarxpkga4o0HSPmMCOUg6t69SOo33POwn0u7d/DqlsCRFSfpnl3aUt9F4yx ncB+YWz8JBHUqTld873letJB6aR0T5JSJwjyXBEY15Kb9UMFHhMU8/stlQ2klnBHFF6s XOKj0nrOo9JBH4mIwwK8Kn0ruK1CTIgqLDm4BA1w5qH2gR42lL19by7fhSSW2m6XwVxO G3sySll2bUrQQMMf+opsTSMjUNHLtFT6tei5cvnHwVdD8ygAV2tNLIrP/bW8+W+uprKY ED4w== 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; bh=uoGg4Q2OnWFa/rJKy9IxJkzaH3ISyRI86XIbseDyNfE=; b=Vm6RQNtyV5Jz8kPrm+OOnYdxvw3Xn/zkRNOACwTCni/IzECmvk3P4cxJGjtAaa/t4v tWsZU6IlcAqlCPOH6rTW3gRX1ZBfdtOMcKHMpMuKJtG1bDadl2BaNdAKTiJlzJy4jAo5 +grB6f7vzd8quutGhBwTukiFsteLsO94VehDSDiS1O4MTGpw+gAH9agYyZI+hsIfnRhm LpyQzAFw9O7vlC9KrgSfwHz7ce7Nh/g+jlnx5gnmLD4jOXl3RnDqSJ3xgf7OQ0xaXrfq yOG/WhAAS1N19RrLnYGo5pcDQFlXAHtUdcSjHu2N4lOXBZWODoO+Jz/KrezTCIahNcT4 mmbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u3si1007461pjv.145.2022.02.23.16.58.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 16:58:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 24CE1122F70; Wed, 23 Feb 2022 16:50:57 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243181AbiBWRGL (ORCPT + 99 others); Wed, 23 Feb 2022 12:06:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243173AbiBWRGH (ORCPT ); Wed, 23 Feb 2022 12:06:07 -0500 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46BB3541B0; Wed, 23 Feb 2022 09:05:38 -0800 (PST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 4E5B7E0013; Wed, 23 Feb 2022 17:05:35 +0000 (UTC) Date: Wed, 23 Feb 2022 18:05:33 +0100 From: Jacopo Mondi To: Eugen Hristev Cc: linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl, nicolas.ferre@microchip.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, claudiu.beznea@microchip.com Subject: Re: [PATCH v5 01/13] media: atmel: atmel-isc-base: use streaming status when queueing buffers Message-ID: <20220223170533.mgzbkg2v45bhahqd@uno.localdomain> References: <20220217135645.1427466-1-eugen.hristev@microchip.com> <20220217135645.1427466-2-eugen.hristev@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220217135645.1427466-2-eugen.hristev@microchip.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi Eugen On Thu, Feb 17, 2022 at 03:56:33PM +0200, Eugen Hristev wrote: > During experiments with libcamera, it looks like vb2_is_streaming returns > true before our start streaming is called. > Order of operations is streamon -> queue -> start_streaming > ISC would have started the DMA immediately when a buffer is being added > to the vbqueue if the queue is streaming. > It is more safe to start the DMA after the start streaming of the driver is > called. > Thus, even if vb2queue is streaming, add the buffer to the dma queue of the > driver instead of actually starting the DMA process, if the start streaming > has not been called yet. > Tho achieve this, we have to use vb2_start_streaming_called instead of > vb2_is_streaming. > > Signed-off-by: Eugen Hristev Reviewed-by: Jacopo Mondi Thanks j > --- > drivers/media/platform/atmel/atmel-isc-base.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c > index db15770d5b88..d2cc6c99984f 100644 > --- a/drivers/media/platform/atmel/atmel-isc-base.c > +++ b/drivers/media/platform/atmel/atmel-isc-base.c > @@ -442,7 +442,7 @@ static void isc_buffer_queue(struct vb2_buffer *vb) > > spin_lock_irqsave(&isc->dma_queue_lock, flags); > if (!isc->cur_frm && list_empty(&isc->dma_queue) && > - vb2_is_streaming(vb->vb2_queue)) { > + vb2_start_streaming_called(vb->vb2_queue)) { > isc->cur_frm = buf; > isc_start_dma(isc); > } else > -- > 2.25.1 >