Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2238844ybz; Thu, 30 Apr 2020 13:25:57 -0700 (PDT) X-Google-Smtp-Source: APiQypKAqyNyeTHr0QR2A1o1a2sXPW63O7czv7kyMJowwx/RyK/jpXEYVb9TpJqF/i/nftlC7TCU X-Received: by 2002:a17:906:8286:: with SMTP id h6mr249259ejx.28.1588278356952; Thu, 30 Apr 2020 13:25:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588278356; cv=none; d=google.com; s=arc-20160816; b=IZYkVbCy4PnVfpVB4jgW7S1jeYNQ575oAKaU5Nomy+xmr56KoNRzR4ffw3zXGWwx9z SpW15XivNA7xMBMumVxWsQSCd4r/aOk5H9gNtlMaPravYfYq3OPHtl66danLjzZbwssO SbkHP2o62OmNA2Z9xmhnPsDPJ6N3gZlNlEceq/gB6hgouqdl1H7dQLcmpT6CDTnRIx2+ U6uFiMETYn+rQtsh/T4RgXa0+niqMl5Gnmwn7mBnjDB2MqCpl4hAVSoidJ1vdtsxQV4+ sr7d1rnqjuXTou+1UzlzXeq97qPHNMRbhRpn7XsL5UnAiFdPQcJp7FBqvRcsdBsgjiNj oWcQ== 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=4+/UTSmWZA6aF77P2/8J93AOfTND6l5qFFYe2ctxF4Q=; b=wZfukF4QI5OAXQWEtvLEbr9FL9aquihv64/Sq0BFChxa39OZ++r5NKs3NxHfHlpGy/ nJ7r+bJVATTqcz2T9nNy7E2WOo1SlmVdXEoapuqYccyLzt0znEtyREF5FYIFCCg5+Bvq Pw79/auGaeloIpBZggC98dU+3JHj7u1L8I+EXKvgbO/O0mdJbF5Nc+RtTre2sjd9cqmX c66eqK4sCwrxUDaWwoUx/xKXs++Uo7QX6URdFXI/8S+ZWaL3ZIGWfC89cBfT6/YVj95A foW4/pNPNqXj+FqE3UhgEfhwUKmY1jiHUX+DUUqhiDJX7Azcqe21Xfp6EkOcsOHjNlEN FkSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=e0NoxIpS; 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 i3si386023edy.312.2020.04.30.13.25.32; Thu, 30 Apr 2020 13:25:56 -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=e0NoxIpS; 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 S1726930AbgD3UWp (ORCPT + 99 others); Thu, 30 Apr 2020 16:22:45 -0400 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:11591 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726745AbgD3UWp (ORCPT ); Thu, 30 Apr 2020 16:22:45 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 30 Apr 2020 13:21:37 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 30 Apr 2020 13:22:44 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 30 Apr 2020 13:22:44 -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:22:44 +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:22:43 +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> <52b98347-4b78-f637-04f4-cc730ad336f3@nvidia.com> <8da0929d-4a58-75b8-381c-511ce66f8d9d@gmail.com> From: Sowjanya Komatineni Message-ID: Date: Thu, 30 Apr 2020 13:21:15 -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: <8da0929d-4a58-75b8-381c-511ce66f8d9d@gmail.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) 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=1588278097; bh=4+/UTSmWZA6aF77P2/8J93AOfTND6l5qFFYe2ctxF4Q=; 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=e0NoxIpSz0QgI/vCC25BgCu4y5yZLE6jyMFQpqWNDabNeROYXEINBIS38hisW58mt 7xFe9s8UqXtWJkj59geL66IxPUXF9AJ3dUuB8N5DMQ1bd1v/VR5ZSpgcO5pP1k1E8G q5dCCNhjEu3KwWtDp9EFBj5WRUXxhBeM3JhE+nWwOtpo0jXgb0pvehrDOrzziotrqc L2dZIzDKVpN4Jv7l2g+c7+CGKb9MSuZeIRWtCunz8ov6PzcRDsk8gqpjBycIrGbh0R iAkv9qC/0ZK2KuR4zDdXQiA9qoDR6i7NjV2rVZqrl89YIqMIarvcraMMoUhu74r5ZS 773zBlkpLz82w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/30/20 1:21 PM, Dmitry Osipenko wrote: > 30.04.2020 23:09, Sowjanya Komatineni =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> 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 str= eaming if error is non-zero. >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * So, do not dequeu= e buffers on error and let the thread >>>>> sleep >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * till kthread stop= signal 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(= chan->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->= capture) && >>>>> +=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_pri= v(vb->vb2_queue); >>>>> +=C2=A0=C2=A0=C2=A0 struct vb2_v4l2_buffer *vbuf =3D to_vb2_v4l2_buff= er(vb); >>>>> +=C2=A0=C2=A0=C2=A0 struct tegra_channel_buffer *buf =3D to_tegra_cha= nnel_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/videobu= f2-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 per-queued buffers. >> typo* pre-queued buffers before streaming start >>> But buffers from this queue will be dequeued only when ready to >>> processes in the capture thread > I see now that the threads won't be running until start_streaming() is > invoked, should be okay then. ok. yes threads run only during streaming