linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kaaira Gupta <kgupta@es.iitr.ac.in>
To: Kieran Bingham <kieran.bingham@ideasonboard.com>
Cc: Helen Koike <helen.koike@collabora.com>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 9/9] media: vimc: Run multiple captures on same thread
Date: Sat, 12 Sep 2020 16:15:08 +0530	[thread overview]
Message-ID: <20200912104508.GF5022@kaaira-HP-Pavilion-Notebook> (raw)
In-Reply-To: <58df4c43-ab07-0001-f725-9098f18a8e6f@ideasonboard.com>

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 <kgupta@es.iitr.ac.in>
> > ---
> >  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

  reply	other threads:[~2020-09-12 10:45 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-19 18:04 [PATCH v3 0/9] media: vimc: Multiple stream support in vimc Kaaira Gupta
2020-08-19 18:04 ` [PATCH v3 1/9] media: vimc: Move get_source_entity to vimc-common Kaaira Gupta
2020-08-20 15:32   ` Kieran Bingham
2020-08-19 18:04 ` [PATCH v3 2/9] media: vimc: Add get_frame callback Kaaira Gupta
2020-08-20 15:36   ` Kieran Bingham
2020-09-12 10:01     ` Kaaira Gupta
2020-10-02 11:08     ` Dafna Hirschfeld
2020-08-19 18:04 ` [PATCH v3 3/9] media: vimc: Add usage count to subdevices Kaaira Gupta
2020-10-02 11:13   ` Dafna Hirschfeld
2020-08-19 18:04 ` [PATCH v3 4/9] media: vimc: Separate starting stream from pipeline initialisation Kaaira Gupta
2020-08-21 15:11   ` Dafna Hirschfeld
2020-08-21 21:01     ` Kaaira Gupta
2020-08-28 20:37       ` Dafna Hirschfeld
2020-09-02  9:56         ` Kieran Bingham
2020-09-12 10:21           ` Kaaira Gupta
2020-09-12 10:16         ` Kaaira Gupta
2020-08-19 18:04 ` [PATCH v3 5/9] media: vimc: Separate closing of stream and thread Kaaira Gupta
2020-09-02 10:13   ` Kieran Bingham
2020-09-12 10:28     ` Kaaira Gupta
2020-08-19 18:04 ` [PATCH v3 6/9] media: vimc: Serialize vimc_streamer_s_stream() Kaaira Gupta
2020-08-19 18:04 ` [PATCH v3 7/9] media: vimc: Dynamically allocate stream struct Kaaira Gupta
2020-09-02 10:29   ` Kieran Bingham
2020-09-12 10:39     ` Kaaira Gupta
2020-08-19 18:04 ` [PATCH v3 8/9] media: vimc: Join pipeline if one already exists Kaaira Gupta
2020-09-02 10:40   ` Kieran Bingham
2020-08-19 18:04 ` [PATCH v3 9/9] media: vimc: Run multiple captures on same thread Kaaira Gupta
2020-09-02 10:46   ` Kieran Bingham
2020-09-12 10:45     ` Kaaira Gupta [this message]
2020-09-02 10:51 ` [PATCH v3 0/9] media: vimc: Multiple stream support in vimc Kieran Bingham
2020-09-12 10:49   ` Kaaira Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200912104508.GF5022@kaaira-HP-Pavilion-Notebook \
    --to=kgupta@es.iitr.ac.in \
    --cc=helen.koike@collabora.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --subject='Re: [PATCH v3 9/9] media: vimc: Run multiple captures on same thread' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).