[libcamera-devel,v3,07/14] libcamera: request: Add a ControlList

Message ID 20190630233817.10130-8-laurent.pinchart@ideasonboard.com
State Superseded
Headers show
Series
  • libcamera Controls
Related show

Commit Message

Laurent Pinchart June 30, 2019, 11:38 p.m. UTC
From: Kieran Bingham <kieran.bingham@ideasonboard.com>

Provide a ControlList on request objects to facilitate setting controls.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 include/libcamera/request.h |  3 +++
 src/libcamera/request.cpp   | 15 ++++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

Comments

Jacopo Mondi July 1, 2019, 4:52 p.m. UTC | #1
Hi Laurent, Kieran,

On Mon, Jul 01, 2019 at 02:38:10AM +0300, Laurent Pinchart wrote:
> From: Kieran Bingham <kieran.bingham@ideasonboard.com>
>
> Provide a ControlList on request objects to facilitate setting controls.
>
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>  include/libcamera/request.h |  3 +++
>  src/libcamera/request.cpp   | 15 ++++++++++++++-
>  2 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/include/libcamera/request.h b/include/libcamera/request.h
> index 58de6f00a554..8075270a9a12 100644
> --- a/include/libcamera/request.h
> +++ b/include/libcamera/request.h
> @@ -11,6 +11,7 @@
>  #include <unordered_set>
>
>  #include <libcamera/signal.h>
> +#include <libcamera/controls.h>
>
>  namespace libcamera {
>
> @@ -32,6 +33,7 @@ public:
>  	Request(const Request &) = delete;
>  	Request &operator=(const Request &) = delete;
>
> +	ControlList &controls() { return controls_; }
>  	const std::map<Stream *, Buffer *> &buffers() const { return bufferMap_; }
>  	int setBuffers(const std::map<Stream *, Buffer *> &streamMap);
>  	Buffer *findBuffer(Stream *stream) const;
> @@ -50,6 +52,7 @@ private:
>  	bool completeBuffer(Buffer *buffer);
>
>  	Camera *camera_;
> +	ControlList controls_;
>  	std::map<Stream *, Buffer *> bufferMap_;
>  	std::unordered_set<Buffer *> pending_;
>
> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
> index fa3ee46da440..7d91e7f900fe 100644
> --- a/src/libcamera/request.cpp
> +++ b/src/libcamera/request.cpp
> @@ -48,10 +48,20 @@ LOG_DEFINE_CATEGORY(Request)
>   * \param[in] camera The camera that creates the request
>   */
>  Request::Request(Camera *camera)
> -	: camera_(camera), status_(RequestPending)
> +	: camera_(camera), controls_(camera), status_(RequestPending)
>  {
>  }
>
> +/**
> + * \fn Request::controls()
> + * \brief Retrieve the request's ControlList
> + *
> + * Return a reference to the ControlList that stores all the controls relevant
> + * to this request.
> + *
> + * \return A reference to the ControlList in this request
> + */
> +
>  /**
>   * \fn Request::buffers()
>   * \brief Retrieve the request's streams to buffers map
> @@ -158,6 +168,9 @@ void Request::complete(Status status)
>  {
>  	ASSERT(!hasPendingBuffers());
>  	status_ = status;
> +
> +	/* Controls are 'per-frame' and not re-usable */
> +	controls_.clear();

I then assume there will be a 'result' list that contains the metadata
associated with this request?

Thanks
   j

>  }
>
>  /**
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Laurent Pinchart July 1, 2019, 5:13 p.m. UTC | #2
Hi Jacopo,

On Mon, Jul 01, 2019 at 06:52:41PM +0200, Jacopo Mondi wrote:
> On Mon, Jul 01, 2019 at 02:38:10AM +0300, Laurent Pinchart wrote:
> > From: Kieran Bingham <kieran.bingham@ideasonboard.com>
> >
> > Provide a ControlList on request objects to facilitate setting controls.
> >
> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > ---
> >  include/libcamera/request.h |  3 +++
> >  src/libcamera/request.cpp   | 15 ++++++++++++++-
> >  2 files changed, 17 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/libcamera/request.h b/include/libcamera/request.h
> > index 58de6f00a554..8075270a9a12 100644
> > --- a/include/libcamera/request.h
> > +++ b/include/libcamera/request.h
> > @@ -11,6 +11,7 @@
> >  #include <unordered_set>
> >
> >  #include <libcamera/signal.h>
> > +#include <libcamera/controls.h>
> >
> >  namespace libcamera {
> >
> > @@ -32,6 +33,7 @@ public:
> >  	Request(const Request &) = delete;
> >  	Request &operator=(const Request &) = delete;
> >
> > +	ControlList &controls() { return controls_; }
> >  	const std::map<Stream *, Buffer *> &buffers() const { return bufferMap_; }
> >  	int setBuffers(const std::map<Stream *, Buffer *> &streamMap);
> >  	Buffer *findBuffer(Stream *stream) const;
> > @@ -50,6 +52,7 @@ private:
> >  	bool completeBuffer(Buffer *buffer);
> >
> >  	Camera *camera_;
> > +	ControlList controls_;
> >  	std::map<Stream *, Buffer *> bufferMap_;
> >  	std::unordered_set<Buffer *> pending_;
> >
> > diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
> > index fa3ee46da440..7d91e7f900fe 100644
> > --- a/src/libcamera/request.cpp
> > +++ b/src/libcamera/request.cpp
> > @@ -48,10 +48,20 @@ LOG_DEFINE_CATEGORY(Request)
> >   * \param[in] camera The camera that creates the request
> >   */
> >  Request::Request(Camera *camera)
> > -	: camera_(camera), status_(RequestPending)
> > +	: camera_(camera), controls_(camera), status_(RequestPending)
> >  {
> >  }
> >
> > +/**
> > + * \fn Request::controls()
> > + * \brief Retrieve the request's ControlList
> > + *
> > + * Return a reference to the ControlList that stores all the controls relevant
> > + * to this request.
> > + *
> > + * \return A reference to the ControlList in this request
> > + */
> > +
> >  /**
> >   * \fn Request::buffers()
> >   * \brief Retrieve the request's streams to buffers map
> > @@ -158,6 +168,9 @@ void Request::complete(Status status)
> >  {
> >  	ASSERT(!hasPendingBuffers());
> >  	status_ = status;
> > +
> > +	/* Controls are 'per-frame' and not re-usable */
> > +	controls_.clear();
> 
> I then assume there will be a 'result' list that contains the metadata
> associated with this request?

When we will get there, probably :-)

> >  }
> >
> >  /**

Patch

diff --git a/include/libcamera/request.h b/include/libcamera/request.h
index 58de6f00a554..8075270a9a12 100644
--- a/include/libcamera/request.h
+++ b/include/libcamera/request.h
@@ -11,6 +11,7 @@ 
 #include <unordered_set>
 
 #include <libcamera/signal.h>
+#include <libcamera/controls.h>
 
 namespace libcamera {
 
@@ -32,6 +33,7 @@  public:
 	Request(const Request &) = delete;
 	Request &operator=(const Request &) = delete;
 
+	ControlList &controls() { return controls_; }
 	const std::map<Stream *, Buffer *> &buffers() const { return bufferMap_; }
 	int setBuffers(const std::map<Stream *, Buffer *> &streamMap);
 	Buffer *findBuffer(Stream *stream) const;
@@ -50,6 +52,7 @@  private:
 	bool completeBuffer(Buffer *buffer);
 
 	Camera *camera_;
+	ControlList controls_;
 	std::map<Stream *, Buffer *> bufferMap_;
 	std::unordered_set<Buffer *> pending_;
 
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index fa3ee46da440..7d91e7f900fe 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -48,10 +48,20 @@  LOG_DEFINE_CATEGORY(Request)
  * \param[in] camera The camera that creates the request
  */
 Request::Request(Camera *camera)
-	: camera_(camera), status_(RequestPending)
+	: camera_(camera), controls_(camera), status_(RequestPending)
 {
 }
 
+/**
+ * \fn Request::controls()
+ * \brief Retrieve the request's ControlList
+ *
+ * Return a reference to the ControlList that stores all the controls relevant
+ * to this request.
+ *
+ * \return A reference to the ControlList in this request
+ */
+
 /**
  * \fn Request::buffers()
  * \brief Retrieve the request's streams to buffers map
@@ -158,6 +168,9 @@  void Request::complete(Status status)
 {
 	ASSERT(!hasPendingBuffers());
 	status_ = status;
+
+	/* Controls are 'per-frame' and not re-usable */
+	controls_.clear();
 }
 
 /**