Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp886115pxk; Sat, 12 Sep 2020 03:46:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwN0pUk69BsJFnNhV21G/0uTtthCniSbgKQXjjb8c3kusHWd3CxEKdqrVOLBiCIYIj3laiO X-Received: by 2002:a05:6402:292:: with SMTP id l18mr7796447edv.6.1599907581792; Sat, 12 Sep 2020 03:46:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599907581; cv=none; d=google.com; s=arc-20160816; b=ps8/Eo9bqHzmapR3gExnIZrvGkKDCm6eBcgkDg8X/H4/jB6pTAQvUBvysi4w6MO0kb dFPBn0zhHQIUFLZ8Awd+IBZLNzrw8/UrnexqH/MPJkWO9hevs0C/YV9B1yd6UpBe6Ueb fGg046KSeBaS886QZbV2wtRgFCC5/Bhw0I3b/mO94hz/x7HVmTXdPxJNRQYwJJgtIXEK j1pSv76pOg16G8HoAqKvgXrcYybbtc5jhgegtA90VozrUVDxmmkLFNfoypNtFd9mlyAX UvAJ60+sjPDvVcDP1mYtHsLpxBL66WVKnZrcb/yKRP3cQdL9dfZndsQt9DOAcp5d67NQ 45GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=lkuXqN8dqWKzdrjlBRBC+QDQOX5NBg+pLH7DeRXH8eE=; b=eK3F9iW9wjv0CSPBAQUdH6GcSDscSOg6O7JkLruOa7FN8HWczlXoNOsQMUW2dMcUs2 qnSNgTjHtQK3XTe54wpIFmfCg9NINA1I7Pk2AY6Lc0d/D6xqoJ0/5SWbI36GJklbq92P ZotIhzpKkPc6WnxNJ8OBXugIsr4vT7VvfTzKF0jClZ4qcW4oA8oj4KHxp/hzdEjkf9pG LbBdG5SZ/TfucSLJTlssMcGeapQPUeF9KU24US72XQnUziHLiidJGVARQ6zJV2XEEjYd 72pHC4PugEozBia33y7ZVUhCIJQPt5/PJzrkATMKNKvNB/9LgW2hxdX7Rj7qBfuOL8R2 esdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@es-iitr-ac-in.20150623.gappssmtp.com header.s=20150623 header.b=rbGEY2ml; 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=NONE dis=NONE) header.from=iitr.ac.in Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k17si3031951ejc.412.2020.09.12.03.45.59; Sat, 12 Sep 2020 03:46:21 -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=@es-iitr-ac-in.20150623.gappssmtp.com header.s=20150623 header.b=rbGEY2ml; 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=NONE dis=NONE) header.from=iitr.ac.in Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725859AbgILKpU (ORCPT + 99 others); Sat, 12 Sep 2020 06:45:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725847AbgILKpP (ORCPT ); Sat, 12 Sep 2020 06:45:15 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2451BC061757 for ; Sat, 12 Sep 2020 03:45:15 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id mm21so2967672pjb.4 for ; Sat, 12 Sep 2020 03:45:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=lkuXqN8dqWKzdrjlBRBC+QDQOX5NBg+pLH7DeRXH8eE=; b=rbGEY2ml6P4YmGCLMJkrk6jnaTnFY6ENY1hS8ELAelyi4jjkcVGdGY1unjljjcjp8W RdNiNM7R5dchauITFfVkov/s8SL6PxR3+QbTlOtHknwKrhUk8EXZcH+7zBOJ212yKcMC QSO2Bxq+ZGk24oTOcc09hp37BKg3aS5LmL+DnfSn7llKWsu/TEs7kna+x6AwSA8IILkd M/9tbmf4fIKs29C9TY7SsXeGMQcSKXmWpdR4pecl1RQVO4gzJs/gqQwhyir7tck3HOBE Msfmr80cnUvEG5oQSlcDSS/0EJNUEn++2iVEV1WiMCHKOZUt1CFhrvk3RtnlYx5vGdAd wD2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=lkuXqN8dqWKzdrjlBRBC+QDQOX5NBg+pLH7DeRXH8eE=; b=fU4JiijnwClHgQrYcp3rmSQ5VpFShq46TJCaNQBupVJ/FyTI95JAb56oCh3ufQosJO Hi4WAFgkGpGJpuK80nrR79Y5rzoOpOCTKORGoageoGIHImcwJzx3f/1v6z35wOGfqLY9 Fe0I9mQJtWTSiIc3f24/Usr9Oi/2in3XhBUfEhU+N6UZfH0vxDERGaKIlODwNkRfFHHj 42hrVPjoGrNUW/WFrcIFz5aaBO4LXAGUA4fK3b+pdQJXxFWavcGzebZs7/Z8aTsJX9MN 7zKRz+dX1ZupStyttv1kPxKYBvX52O8OWpkPQzFri5uuMMW55pMuCp38FNh9pmhYOq+U r3ZA== X-Gm-Message-State: AOAM532o7Ff+K9LoFeVYZ3Mq4L5rVGvu+EcXUnXoQEuJKcbJRE9SpFBG +qY1K4UbXRdKfE68n49BDoXmrQ== X-Received: by 2002:a17:90a:6701:: with SMTP id n1mr6179958pjj.87.1599907514399; Sat, 12 Sep 2020 03:45:14 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([2405:201:6801:484c:954a:305:9758:cc93]) by smtp.gmail.com with ESMTPSA id c127sm4803357pfa.165.2020.09.12.03.45.11 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 12 Sep 2020 03:45:13 -0700 (PDT) Date: Sat, 12 Sep 2020 16:15:08 +0530 From: Kaaira Gupta To: Kieran Bingham Cc: Helen Koike , Shuah Khan , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 9/9] media: vimc: Run multiple captures on same thread Message-ID: <20200912104508.GF5022@kaaira-HP-Pavilion-Notebook> References: <20200819180442.11630-1-kgupta@es.iitr.ac.in> <20200819180442.11630-10-kgupta@es.iitr.ac.in> <58df4c43-ab07-0001-f725-9098f18a8e6f@ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <58df4c43-ab07-0001-f725-9098f18a8e6f@ideasonboard.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 02, 2020 at 11:46:50AM +0100, Kieran Bingham wrote: > Hi Kaaira, > > On 19/08/2020 19:04, Kaaira Gupta wrote: > > If multiple captures try to enable stream, start their stream but do not > > initialise the pipeline again. Also, don't start the thread separately. > > Starting their streams will update the use count and their frames would > > be processed by the already running thread. > > > > Signed-off-by: Kaaira Gupta > > --- > > drivers/media/test-drivers/vimc/vimc-streamer.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/media/test-drivers/vimc/vimc-streamer.c b/drivers/media/test-drivers/vimc/vimc-streamer.c > > index fade37bee26d..880c31759cc0 100644 > > --- a/drivers/media/test-drivers/vimc/vimc-streamer.c > > +++ b/drivers/media/test-drivers/vimc/vimc-streamer.c > > @@ -275,13 +275,14 @@ int vimc_streamer_s_stream(struct vimc_stream *stream, > > return ret; > > > > if (enable) { > > - if (stream->kthread) > > - return 0; > > > > ret = vimc_streamer_stream_start(ved); > > if (ret) > > goto out; > > > > + if (stream->kthread) > > + goto out; > > + > > This goto out makes it look like it's an error path. So that probably > warrants a comment along the lines of 'don't reinitialise the pipeline > if it has already started'. ? > > I wonder if it's better to handle the pipeline_init during _stream_start > 'only' in the code path where it's the first stream ? stream_start needs to be called for both (or all) the captures, while init must be called just once...so I think keeping it here inside s_stream and calling it just once will be okay too as that wouldn't need refcounts..but yes I think I should keep them symmetrical for better readability of code. What do you think is a better method? > > Then similarly, the pipeline_terminate would happen on stream_stop > 'only' when it's the last stream. > > Or I guess that is handled by the refcount ... Hrm it would be nice to > be able to make/keep it symmetrical somehow. > > > > ret = vimc_streamer_pipeline_init(stream, ved); > > if (ret) > > goto out; > > > > -- > Regards > -- > Kieran