[libcamera-devel,1/2] libcamera: streams: extend stream configuration with buffer count

Message ID 20190204185521.23471-2-niklas.soderlund@ragnatech.se
State Accepted
Headers show
Series
  • libcamera: pipeline: uvcvideo: set a default format
Related show

Commit Message

Niklas Söderlund Feb. 4, 2019, 6:55 p.m. UTC
The camera needs to be configured with the number of buffers to use to
satisfy the application use-case. While it's free for the application to
request any number of buffers the pipeline needs to take the Linux
drivers constraints into consideration.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 include/libcamera/stream.h | 2 ++
 src/libcamera/stream.cpp   | 5 +++++
 2 files changed, 7 insertions(+)

Comments

Kieran Bingham Feb. 4, 2019, 7:08 p.m. UTC | #1
Hi Niklas,

On 04/02/2019 19:55, Niklas Söderlund wrote:
> The camera needs to be configured with the number of buffers to use to
> satisfy the application use-case. While it's free for the application to> request any number of buffers the pipeline needs to take the Linux
> drivers constraints into consideration.

Some minor rewording, it was easier to write out the paragraph: This is
how I would phrase it:


The camera needs to be configured with the number of buffers required to
satisfy the applications use case. While the application can request any
number of buffers, the pipeline must take the constraints of the Linux
driver into consideration.





> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>



> ---
>  include/libcamera/stream.h | 2 ++
>  src/libcamera/stream.cpp   | 5 +++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h
> index 4b24dd841dd64b64..890678360ee87fd7 100644
> --- a/include/libcamera/stream.h
> +++ b/include/libcamera/stream.h
> @@ -17,6 +17,8 @@ struct StreamConfiguration {
>  	unsigned int width;
>  	unsigned int height;
>  	unsigned int pixelFormat;
> +
> +	unsigned int bufferCount;
>  };
>  
>  } /* namespace libcamera */
> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
> index b0b4efe39c81e747..5ebdce9acdbd3560 100644
> --- a/src/libcamera/stream.cpp
> +++ b/src/libcamera/stream.cpp
> @@ -73,4 +73,9 @@ namespace libcamera {
>   * format described in V4L2 using the V4L2_PIX_FMT_* definitions.
>   */
>  
> +/**
> + * \var StreamConfiguration::bufferCount
> + * \brief Number of buffers to allocate for the stream

This is fine - but do we need to say this is a 'request'?:

"Requested number of buffers to allocate for the stream"

Either way is fine with me.

--
Kieran


> + */
> +
>  } /* namespace libcamera */
>
Niklas Söderlund Feb. 4, 2019, 7:31 p.m. UTC | #2
Hi Kieran,

Thanks for your feedback.

On 2019-02-04 20:08:25 +0100, Kieran Bingham wrote:
> Hi Niklas,
> 
> On 04/02/2019 19:55, Niklas Söderlund wrote:
> > The camera needs to be configured with the number of buffers to use to
> > satisfy the application use-case. While it's free for the application to> request any number of buffers the pipeline needs to take the Linux
> > drivers constraints into consideration.
> 
> Some minor rewording, it was easier to write out the paragraph: This is
> how I would phrase it:
> 
> 
> The camera needs to be configured with the number of buffers required to
> satisfy the applications use case. While the application can request any
> number of buffers, the pipeline must take the constraints of the Linux
> driver into consideration.
> 
> 
> 
> 
> 
> > 
> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

I incorporated your comments to this patch and merged this series to 
master.

> 
> 
> 
> > ---
> >  include/libcamera/stream.h | 2 ++
> >  src/libcamera/stream.cpp   | 5 +++++
> >  2 files changed, 7 insertions(+)
> > 
> > diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h
> > index 4b24dd841dd64b64..890678360ee87fd7 100644
> > --- a/include/libcamera/stream.h
> > +++ b/include/libcamera/stream.h
> > @@ -17,6 +17,8 @@ struct StreamConfiguration {
> >  	unsigned int width;
> >  	unsigned int height;
> >  	unsigned int pixelFormat;
> > +
> > +	unsigned int bufferCount;
> >  };
> >  
> >  } /* namespace libcamera */
> > diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
> > index b0b4efe39c81e747..5ebdce9acdbd3560 100644
> > --- a/src/libcamera/stream.cpp
> > +++ b/src/libcamera/stream.cpp
> > @@ -73,4 +73,9 @@ namespace libcamera {
> >   * format described in V4L2 using the V4L2_PIX_FMT_* definitions.
> >   */
> >  
> > +/**
> > + * \var StreamConfiguration::bufferCount
> > + * \brief Number of buffers to allocate for the stream
> 
> This is fine - but do we need to say this is a 'request'?:
> 
> "Requested number of buffers to allocate for the stream"
> 
> Either way is fine with me.
> 
> --
> Kieran
> 
> 
> > + */
> > +
> >  } /* namespace libcamera */
> > 
> 
> -- 
> Regards
> --
> Kieran

Patch

diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h
index 4b24dd841dd64b64..890678360ee87fd7 100644
--- a/include/libcamera/stream.h
+++ b/include/libcamera/stream.h
@@ -17,6 +17,8 @@  struct StreamConfiguration {
 	unsigned int width;
 	unsigned int height;
 	unsigned int pixelFormat;
+
+	unsigned int bufferCount;
 };
 
 } /* namespace libcamera */
diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
index b0b4efe39c81e747..5ebdce9acdbd3560 100644
--- a/src/libcamera/stream.cpp
+++ b/src/libcamera/stream.cpp
@@ -73,4 +73,9 @@  namespace libcamera {
  * format described in V4L2 using the V4L2_PIX_FMT_* definitions.
  */
 
+/**
+ * \var StreamConfiguration::bufferCount
+ * \brief Number of buffers to allocate for the stream
+ */
+
 } /* namespace libcamera */