From patchwork Tue May 3 08:44:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 12835290 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 1F79DC433EF for ; Tue, 3 May 2022 08:46: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: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+mAUzbmZEG/OqyiM9oStyS3/HIUT00vhffwiaM8gdjU=; b=QhFz8Ddl6waqyu fiCFYz5yU2CIgsqwjyNE9UN4MzHjJv4HD/sZt5TizNkI+ZXwE3a24oXBaSYCIk078sdyWthRdo94X FY0GaykW9Pe56jS4HmgIuD7AIvChPiWKfkkFYMJl97mXDX8Qzuy9LMuOfeVFcBULn6V7DmJbjGjTo GbDsDnQ9PXZFBfrkA0Gf3VEyki/Q+iToSrgBHFfct6dRp68FL6kT6+XAT7fI8hVfbF3IVwTbAbzp4 JkSgzM9saIm0qfTIGQEbtvFiroTBOKqAwyK0EtKmiIiob2R1rd+qsCsxc0rtxMI0pwV5tSQBHEdmR EKzwfB1gsWvfA/PU3oYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlo9W-004fPP-Pl; Tue, 03 May 2022 08:45:02 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlo9P-004fLU-62 for linux-arm-kernel@lists.infradead.org; Tue, 03 May 2022 08:44:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1651567495; x=1683103495; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8pGmp/P6DW09QNCZnxhFBr88c90cP0y+5hBJacUv2zo=; b=m0dmTuXqdR6FJ9Bh1NR4fiHopu+/tHent0bpRjW9NHOzYf5AS43AFQp9 R2dte9zU7gE+HfUOKJUwnmeczgvnLEkzNG9Tt1gE2bpXY2chaMoqmLVBp 2O0HYSleWdci+hvS8sC8g8jI8q82AQtZJIqIS2tJSu5Wvn8WwbMzSz2CP F5SHaaV2xN0OjIvt/PQ98oFtWIB1iSrjMxy48x5210UK8AXzGZR65poEs XLORkYAjcGmPclU1RIiOQbOsCs1dWbpH3IrLKqSTTFErtrBHGlPptLfE7 z1SSKSWL1FhjLgTa58FGe83xy+M9GwYPDPiG7jvHFjxu6adRWHxch3vIq A==; X-IronPort-AV: E=Sophos;i="5.91,194,1647327600"; d="scan'208";a="171742560" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 May 2022 01:44:55 -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; Tue, 3 May 2022 01:44:54 -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; Tue, 3 May 2022 01:44:49 -0700 From: Eugen Hristev To: , CC: , , , , Eugen Hristev Subject: [PATCH v10 1/8] media: atmel: atmel-isc-base: use streaming status when queueing buffers Date: Tue, 3 May 2022 11:44:14 +0300 Message-ID: <20220503084421.40682-2-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220503084421.40682-1-eugen.hristev@microchip.com> References: <20220503084421.40682-1-eugen.hristev@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220503_014455_248380_8BB74A75 X-CRM114-Status: GOOD ( 14.99 ) 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 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