Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2227534ybz; Thu, 30 Apr 2020 13:12:09 -0700 (PDT) X-Google-Smtp-Source: APiQypIMO1H/CAbj3504HEtno1mxtNGXGqURNntWeuBPbmWeRSiqaHL5azFQQZDiyn/aHtRlY2tA X-Received: by 2002:a05:6402:1651:: with SMTP id s17mr699511edx.173.1588277528985; Thu, 30 Apr 2020 13:12:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588277528; cv=none; d=google.com; s=arc-20160816; b=ZQyrgd6DiRe3GtyJeh96kluQ/KpN1+98v8EAXzkzAPZNTIgLNFtOkQ6Ld0dQu4hLkW DQfEplYBd0Y0zactzWjc9x7F0avYm7w7rDehWLTcOVFsF5SD9optG4Lmh1Rct8tgiH2Q EWIqTR1rz7FRZBGZT7GZNtrxs3EG5RCdiy+7B697pRMNYAOgGJ3LApmrp+MB/d7edAJB WiffcL3fWrye1yTgMZYf/X2PRxEcd0VFgixSDtghtGG0AYbCQ64f9lJzfNVMZWT0CRsY 59V8KyFhzFRrCDB8Ay/EGn5xujAMvl2VrZhlPnvhAkDvbi6IH4wYLixeoKSKlamGUnvs euaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=bU+Gy6O+uYdQwdtawNbqdmqoPb5HNcT3EKUwg12HVTg=; b=eYR9LEX5c5aWdbMJ7B4OZ45/CcI6bqnTDW1gIiPMdxms/5aAZDZ5hq+3YCjS0p6i4J po1AHnR4Fc74NMOqZ56I9c7GqE8mD9vJiDNrVEwgj1tGMIFURxNuk9OFGTay7J/28NhK 17xN7IMLUy9weTOWtzryFozjWv+Litt5EUP1/M1kmuLi7hoqLN+inTdFP+x/yOntB+zf +UQPYDXRVeq5Pkl6UPOnPnZSIEsAIbriN7JjQm08PZ9cfGtvc8pi8WABLZxTh5Tsr+UO nX753/sE3810GEMcR5gwS0d0FypoK/I4h/q800ad5aAQgK2Oz+QZ9pT7YMrTyX36k/KY ChYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=HyHQiCKc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id by15si451206ejb.229.2020.04.30.13.11.45; Thu, 30 Apr 2020 13:12:08 -0700 (PDT) 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=pass header.i=@nvidia.com header.s=n1 header.b=HyHQiCKc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726781AbgD3UKJ (ORCPT + 99 others); Thu, 30 Apr 2020 16:10:09 -0400 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:14149 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726338AbgD3UKJ (ORCPT ); Thu, 30 Apr 2020 16:10:09 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 30 Apr 2020 13:08:04 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 30 Apr 2020 13:10:08 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 30 Apr 2020 13:10:08 -0700 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 30 Apr 2020 20:10:08 +0000 Received: from [10.2.165.152] (10.124.1.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 30 Apr 2020 20:10:07 +0000 Subject: Re: [RFC PATCH v11 6/9] media: tegra: Add Tegra210 Video input driver To: Dmitry Osipenko , , , , , , CC: , , , , , References: <1588197606-32124-1-git-send-email-skomatineni@nvidia.com> <1588197606-32124-7-git-send-email-skomatineni@nvidia.com> From: Sowjanya Komatineni Message-ID: Date: Thu, 30 Apr 2020 13:08:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To DRHQMAIL107.nvidia.com (10.27.9.16) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-US DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1588277285; bh=bU+Gy6O+uYdQwdtawNbqdmqoPb5HNcT3EKUwg12HVTg=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Transfer-Encoding: Content-Language; b=HyHQiCKccOmKDCyjff09+lV+ozUKZQWBN6MvpgIuXiK3zzsPD+iaHW31AJVM9WEf8 3MhEAYDuFgWjAmTiA2nyp5hm2cWXDXRr9huwo4ka9jmDEav+j+9KjV1OrWK9rMtHxf E13nWbrEMddT8yfbF1Zr+3D7YdUemyLDzPNp2b4282gI3lKPWS5GuoLeJX2RnhV5/H IYXVJakraLOdk5gznQvw3PPuV5QkXip+u7ASm/aNrOIijgkG1NIZfujf5QR4dZxlBX zYBFFYvAZNw0VBi/9VeVTx+5vkDlhVSRa1WiX549lhJhvQ9RL/SVRQhMFsg4yWqdPy AKedr1Sv/TXKA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/30/20 1:06 PM, Dmitry Osipenko wrote: > 30.04.2020 01:00, Sowjanya Komatineni =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> +static int chan_capture_kthread_start(void *data) >> +{ >> + struct tegra_vi_channel *chan =3D data; >> + struct tegra_channel_buffer *buf; >> + int err =3D 0; >> + >> + set_freezable(); >> + >> + while (1) { >> + try_to_freeze(); >> + >> + /* >> + * Source is not streaming if error is non-zero. >> + * So, do not dequeue buffers on error and let the thread sleep >> + * till kthread stop signal is received. >> + */ >> + wait_event_interruptible(chan->start_wait, >> + kthread_should_stop() || >> + (!list_empty(&chan->capture) && >> + !err)); > ... >> +static void tegra_channel_buffer_queue(struct vb2_buffer *vb) >> +{ >> + struct tegra_vi_channel *chan =3D vb2_get_drv_priv(vb->vb2_queue); >> + struct vb2_v4l2_buffer *vbuf =3D to_vb2_v4l2_buffer(vb); >> + struct tegra_channel_buffer *buf =3D to_tegra_channel_buffer(vbuf); >> + >> + /* put buffer into the capture queue */ >> + spin_lock(&chan->start_lock); >> + list_add_tail(&buf->queue, &chan->capture); >> + spin_unlock(&chan->start_lock); >> + >> + /* wait up kthread for capture */ >> + wake_up_interruptible(&chan->start_wait); >> +} > The V4L doc says that buffers could be enqueued before streaming is > started. I guess it should be a trouble here, shouldn't it? > > https://elixir.bootlin.com/linux/v5.7-rc3/source/include/media/videobuf2-= core.h#L379 what trouble are you referring here? I dont think so as we set min buffers needed as 2 always there will be 2=20 per-queued buffers. But buffers from this queue will be dequeued only when ready to=20 processes in the capture thread