Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1393391pxb; Fri, 21 Jan 2022 17:29:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbgVHlltfIRKoXU+3hwK9Uk/1Mbyk1x2Dhm1XZbgx7IPgW843m2ObYIol9Grz2rKQI91j4 X-Received: by 2002:aa7:9188:0:b0:4be:3d3a:c6d0 with SMTP id x8-20020aa79188000000b004be3d3ac6d0mr6067935pfa.4.1642814990668; Fri, 21 Jan 2022 17:29:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642814990; cv=none; d=google.com; s=arc-20160816; b=yod2gGFOyoA5QGaKJg2wVzjuzdeHOt6A5f7s0/QycrxyJIh4ewdQqpuso1hkkji7pq 5XarOyLi2avmmqKC0lAmj/sE9pjGcl9xwPjZT+zBHHT+tOBhu9uRwaAwF9Dzd3BTzyoM 1KIjc/OG9PVQivnkEn4/mMln7vMkcgTDq5d51rrSR3uoUOnzO4exN72C87vhPAvAEPgm o6+qaxU2mZjRxwbdX1l1ZUOLU3VErqXySRzSgqJXAU8TkRF6l91KMc1AKfgzuEbtjArV eZfAhk4ZKF+0V5ufVleB16J6J02J0ogAKvoTLM7D1pxdac6ENpt0BasiUnX0zhJCU42U jZaQ== 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 :ironport-sdr:dkim-signature; bh=+iO3QBvu5T8qp+pzt++QD8HEBXMqzjXaXsUr037iKz8=; b=x/u323IhRzBnEHvXORCORDKchYamc6GK1zUN3nV2VjLatxaAHSkVU5SrDopyfsAd0t J296Mb2mUBhZXtadzcW5bWY2h06ylPcFcr7ueYBUmSJcFc5lwcBtNsTw2TiGohPZbxx0 08pGlnqV0Y9JVRWVG/VAI7HMRF9AhpEGU4MPok/12AIEaJDno+5ox5lQpnY2xjqnoWJe c9eku/hgnljG/dHpk/4rhYNco+UOvgWiC6eZz1CZJH5k5cYCrXpkBTNlhStuaoxlnI2a na2Jp+IXvwsP2tw9dVpRVjh9ECjnFIW+VxH94TUvoXEIOOWl+Rck4Jz/kNEY3sTzVcf4 traQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=MS4hnM56; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si7592852pgc.103.2022.01.21.17.29.38; Fri, 21 Jan 2022 17:29:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=MS4hnM56; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1380589AbiAUNPW (ORCPT + 99 others); Fri, 21 Jan 2022 08:15:22 -0500 Received: from esa.microchip.iphmx.com ([68.232.153.233]:38473 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350597AbiAUNPV (ORCPT ); Fri, 21 Jan 2022 08:15:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1642770921; x=1674306921; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=90mw6wISjBdLTNNxTG/BgqJuSTNAKubVgA1+rrwpVU8=; b=MS4hnM566ZgJrR6qtUCUX7Xq11ktpCZf4Lm11Az4AZdSdzTtxewxUUWg A31j74Loj2k3snUX82uGyk4QV5sWpdzGezaMLBvp4mM5/uhgJO4cbfGfw OsNgQD7q3771hSo7XtKZkXqeIv4levcDd7N4git5UfvJ7RStNx7T4pUlO 3XRXS1HpyrX5688VDjikrF3hIGyB3UTSgog5qpxGmVioYweUni4JgFcWN cTb+BSIXF4WMlMnqe5Wg5sNGjYsPH4tc5GgqTwrKBNWSc6pulYcVkXR+L 6sc5M+fjepxW3D7jp38R6kSF3hmgPTeQmfNpboDPGby00nX4bSh88G1v5 Q==; IronPort-SDR: kTsR5MUwRq2CT9roV1nvuSx+4gF/i20ECvUj3IFbMyVRMb3Z+k0BlbmUowbD1vsLQne6FRN/nX yy1i7L1kmggSG+qnm9kIROw2ncatd517G/JqMQ/aGgOrOS/j1QBLeP7n9guvCQC4pT4lEJ+A44 n58kjDdKo3ACFCVzvgoshNVAPRYHfyuix4T/H1hC3A/dnKCClgAtMwESxLf+7EaN0ZovlH3jBA kkKg5RzhUBH/Nx0UgkoiIRIDgjGZBk4OiOqhjqn4vKhlVYxkKOYerBcuU72BoTWrP4btkGqO3s oRYHxuPO+Jw9U9rruxaab2U9 X-IronPort-AV: E=Sophos;i="5.88,304,1635231600"; d="scan'208";a="150454050" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 21 Jan 2022 06:15:21 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Fri, 21 Jan 2022 06:15:20 -0700 Received: from ROB-ULT-M18282.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Fri, 21 Jan 2022 06:14:51 -0700 From: Eugen Hristev To: , , , , , , CC: , , , Eugen Hristev Subject: [PATCH v4 02/11] media: atmel: atmel-isc-base: use streaming status when queueing buffers Date: Fri, 21 Jan 2022 15:14:07 +0200 Message-ID: <20220121131416.603972-3-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220121131416.603972-1-eugen.hristev@microchip.com> References: <20220121131416.603972-1-eugen.hristev@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 --- Changes in v4: - changed to using vb2_start_streaming_called instead of stop variable drivers/media/platform/atmel/atmel-isc-base.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c index 9c62d0ae7887..6b0005987a17 100644 --- a/drivers/media/platform/atmel/atmel-isc-base.c +++ b/drivers/media/platform/atmel/atmel-isc-base.c @@ -439,7 +439,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 @@ -1532,7 +1532,7 @@ static int isc_s_awb_ctrl(struct v4l2_ctrl *ctrl) isc_update_awb_ctrls(isc); - if (vb2_is_streaming(&isc->vb2_vidq)) { + if (vb2_start_streaming_called(&isc->vb2_vidq)) { /* * If we are streaming, we can update profile to * have the new settings in place. @@ -1549,7 +1549,7 @@ static int isc_s_awb_ctrl(struct v4l2_ctrl *ctrl) /* if we have autowhitebalance on, start histogram procedure */ if (ctrls->awb == ISC_WB_AUTO && - vb2_is_streaming(&isc->vb2_vidq) && + vb2_start_streaming_called(&isc->vb2_vidq) && ISC_IS_FORMAT_RAW(isc->config.sd_format->mbus_code)) isc_set_histogram(isc, true); -- 2.25.1