Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2229576ybz; Thu, 30 Apr 2020 13:14:29 -0700 (PDT) X-Google-Smtp-Source: APiQypIqzGnja9qltnWsPSj8VyuE1mIHIF0nMPsq9OhC2t0CpfBJyrrvOJklRWgzky2l74i9bskz X-Received: by 2002:a17:906:359b:: with SMTP id o27mr171522ejb.282.1588277669412; Thu, 30 Apr 2020 13:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588277669; cv=none; d=google.com; s=arc-20160816; b=TIu+sPDIB/C3hG/4BpGlwk9KVbVRWAZPkQl/tiSAd6iErRtq+em7tMCC9/YiC9WPNJ Ck4Q/2LXVMtcIvLgqnUt3UUtDsHlS4TiJClxmCekbpdM7c+Vfsmd79B6zkEcRBwzq158 8nXcbthd62Kzdp2OcceKVj7f06PWe01lWcj7WaZExSLMkB/CyQJxzstIWB5lXiUiK8EE SMosi1zR/RU6duHcRJngQ4WJooMCSTDtQO7G7VQcl7tlZ1w6CNOYysWSOUJ4GTtl/zOc BijLVtWSocDKLhj47PaxrVxtNLqpEXmhRdhaE0P/H4n8WTSlmbsP8D1PmeA5cnMMM3uL Erww== 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:references:cc:to:from:subject; bh=KUYq48abhJkd8ZVPLEcyM2FZjGIskbxNUttIp0WPjzk=; b=NfszEUg//YNsFsYXA5tFVpSxTQE5JkAjO/M7UTJxA6t9n3gZYk+bqTBDdqqm70YQFi SXMAD+ma+reDiuSMS9zHfsCX9yXt/HzjWBMYqSmi8M1oLpjkS7d2/Xuul3y3GEVF/uRH 4R3k4Bpp6SgZwcU2J/Ut4tR3ullpittOKbHKEh0ktjzvlhbQIxuuZubxP7jfTd6bhIfY qxqsb7ZaMvkQ8PY//ekyMyndNC9bJmD6JOgdJC9vGLkxr51DLoq6jK0ohm1uT6IcyvQZ 5VRVj+V6HwM5c9r0COG8AdCaCNFd1deYS7R7nPlUstQwUGQXl6DI/Do1LJLOgXWmvlng npKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=ashNi4iv; 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 s13si384706ejr.484.2020.04.30.13.14.05; Thu, 30 Apr 2020 13:14:29 -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=ashNi4iv; 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 S1726853AbgD3UL1 (ORCPT + 99 others); Thu, 30 Apr 2020 16:11:27 -0400 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:14216 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726486AbgD3UL1 (ORCPT ); Thu, 30 Apr 2020 16:11:27 -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:09:22 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 30 Apr 2020 13:11:26 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 30 Apr 2020 13:11:26 -0700 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 30 Apr 2020 20:11:26 +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:11:25 +0000 Subject: Re: [RFC PATCH v11 6/9] media: tegra: Add Tegra210 Video input driver From: Sowjanya Komatineni To: Dmitry Osipenko , , , , , , CC: , , , , , References: <1588197606-32124-1-git-send-email-skomatineni@nvidia.com> <1588197606-32124-7-git-send-email-skomatineni@nvidia.com> Message-ID: <52b98347-4b78-f637-04f4-cc730ad336f3@nvidia.com> Date: Thu, 30 Apr 2020 13:09:57 -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=1588277362; bh=KUYq48abhJkd8ZVPLEcyM2FZjGIskbxNUttIp0WPjzk=; h=X-PGP-Universal:Subject:From:To:CC:References:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Transfer-Encoding: Content-Language; b=ashNi4ivzUfGGFMK/QS2UgeBL7ggdCBCB6zUn0NLfqSpCQNhd070KlZz2MMZ0Yn8d E5xb/4u3nUkcnAW+7E3yGNTKSg/ruhzouo+HUcFdX02BajCQsHyN7UTa8iVEGDFffL GTsJEPrqd4sea+EimqDLKEvpTzsSNHmz2k17kRX0WQSwMSSLycs7s2VBW7s45Nc8cD ZqaGLiSpT9RmUJb7A8W8fDLz/5wLjHrUAulxsRXxRDfxIOfiUPmhk3KJdxE+Vy1qIb Tqq1304C4UCIok34Gw4Hs/eGSp8LjI5NgJ5ao6/QKzYckzJt9KTVGyZaf3jQ+BncyK ebjysIeQh4/HA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/30/20 1:08 PM, Sowjanya Komatineni wrote: > > 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) >>> +{ >>> +=C2=A0=C2=A0=C2=A0 struct tegra_vi_channel *chan =3D data; >>> +=C2=A0=C2=A0=C2=A0 struct tegra_channel_buffer *buf; >>> +=C2=A0=C2=A0=C2=A0 int err =3D 0; >>> + >>> +=C2=A0=C2=A0=C2=A0 set_freezable(); >>> + >>> +=C2=A0=C2=A0=C2=A0 while (1) { >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 try_to_freeze(); >>> + >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * Source is not strea= ming if error is non-zero. >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * So, do not dequeue = buffers on error and let the thread=20 >>> sleep >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * till kthread stop s= ignal is received. >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 */ >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 wait_event_interruptible(ch= an->start_wait, >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 kthread_should_stop() |= | >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (!list_empty(&chan->cap= ture) && >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 !err)); >> ... >>> +static void tegra_channel_buffer_queue(struct vb2_buffer *vb) >>> +{ >>> +=C2=A0=C2=A0=C2=A0 struct tegra_vi_channel *chan =3D vb2_get_drv_priv(= vb->vb2_queue); >>> +=C2=A0=C2=A0=C2=A0 struct vb2_v4l2_buffer *vbuf =3D to_vb2_v4l2_buffer= (vb); >>> +=C2=A0=C2=A0=C2=A0 struct tegra_channel_buffer *buf =3D to_tegra_chann= el_buffer(vbuf); >>> + >>> +=C2=A0=C2=A0=C2=A0 /* put buffer into the capture queue */ >>> +=C2=A0=C2=A0=C2=A0 spin_lock(&chan->start_lock); >>> +=C2=A0=C2=A0=C2=A0 list_add_tail(&buf->queue, &chan->capture); >>> +=C2=A0=C2=A0=C2=A0 spin_unlock(&chan->start_lock); >>> + >>> +=C2=A0=C2=A0=C2=A0 /* wait up kthread for capture */ >>> +=C2=A0=C2=A0=C2=A0 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=20 >> > > what trouble are you referring here? > > I dont think so as we set min buffers needed as 2 always there will be=20 > 2 per-queued buffers. typo* pre-queued buffers before streaming start > > But buffers from this queue will be dequeued only when ready to=20 > processes in the capture thread >