Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2530893pxp; Mon, 7 Mar 2022 18:03:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCscnKxMgl4PT7IoCbE6L0bhEAyBk2STzhw7Xlv2qcZJPMOgrpCsjqKVi2comgrkBl8cxw X-Received: by 2002:a63:5a5c:0:b0:378:73b1:e1d8 with SMTP id k28-20020a635a5c000000b0037873b1e1d8mr12187632pgm.364.1646705025262; Mon, 07 Mar 2022 18:03:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646705025; cv=none; d=google.com; s=arc-20160816; b=kxzkTGN++9gYIEKISGTH3L5xypCUZY9BKVGrYqdcyaWgjkdIjljivanLc1H9Hr6KqO l2MzsoxPA08ibSJSKnGKKQhb+lH0BK8gHLsTC5obZpdZpF4cypEpki37CP6qNFFOFNzn kJlX3I9CdNeAOckNIqMNAfPQg11tnWS3Rl7hX4S1nH9PohBeX8PRhoNjwQFck2seS5Qt XvaPRRK7yNnob2f4kZnv5hIgLMcOWVOkKwBO4n6YdKidy+63LHzj1LgIrRgKKeS/1IJz CN7iQTHyTu97ThmmAwbHCdkx+1bL1Pc7DkraugL4byzRooFiP7o7NlStUqn56j8Dph6f l74Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gjxK07JEMz/3L7OcUloERAWdBmY6btW2Mq7QGQS7ZWA=; b=ib1xdbdcrtgmOrOPLGgxCW01QHTZhptu4GaKtgkc8Cep7D9JNow0REXx1yYeTwcxRC 1/I7+H1g+6z6006+oHymAwWwsgMG9O8IDDLakOO/TJlATLvKBqlnUGuQdGYpNsbIZbwg C+ytmdTAmMNDSFZk6ozEs5JMoGCPKjO1x84Wc8vUnLKdkS04Tiw7vH5qJkqBZYBjMhO2 T0Li5WbanCNz4I3A2sPRlE4BTBsSt+MsW5AcUXgdihQvwPVoEcszhVQzd4suPYWF7IpV LXug/U85igQqXzpZrynoXGt/wQ7PS+Efhmte+vT7cnOy+jjy5O1zXG9uOPCri+2LZVSt vPuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=breMHYhd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f22-20020a170902ab9600b0015025f7252asi12860697plr.529.2022.03.07.18.03.21; Mon, 07 Mar 2022 18:03:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=breMHYhd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229588AbiCGMGC (ORCPT + 99 others); Mon, 7 Mar 2022 07:06:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239450AbiCGMF5 (ORCPT ); Mon, 7 Mar 2022 07:05:57 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4520E73072; Mon, 7 Mar 2022 04:05:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1646654703; x=1678190703; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8pGmp/P6DW09QNCZnxhFBr88c90cP0y+5hBJacUv2zo=; b=breMHYhdoySW4E8RIQa9w+sjYqPPDMMleUBZ/FfqG3Hv4qEw6mPnPmRK DaQ67Ju6IzqsWLAAEu61YL7M6Z7RoGL3KVCLOTifwc9Wb0MlSx8wu9Aua VbNFuO/tObvds6jaXzG13Qs/ksJP9SgNfllMuFFeThp/Ux1hZ0Z9m3Sty haKsojOKM6xx8CpSaqhUnb3KL4BTb9TSdtYMO/3Yc6McgNtmDUBd7CrBS x/U0UlaQAwX1K6dZS4umWQoPUBCBmf/oL8XvSddzuxgFgADLUvbP1qc7I HZQcVrbu7SgEJct4J/GTb/W3259VCI0LGelTDSq3HjGoL9hP9Nin3yI0v g==; X-IronPort-AV: E=Sophos;i="5.90,162,1643698800"; d="scan'208";a="155485875" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 07 Mar 2022 05:05:03 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 7 Mar 2022 05:05:02 -0700 Received: from ROB-ULT-M18282.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Mon, 7 Mar 2022 05:04:56 -0700 From: Eugen Hristev To: , CC: , , , , , , Eugen Hristev Subject: [PATCH v7 01/13] media: atmel: atmel-isc-base: use streaming status when queueing buffers Date: Mon, 7 Mar 2022 14:04:11 +0200 Message-ID: <20220307120423.2427631-2-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307120423.2427631-1-eugen.hristev@microchip.com> References: <20220307120423.2427631-1-eugen.hristev@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,T_SCC_BODY_TEXT_LINE, T_SPF_PERMERROR 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 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 --- 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