[libcamera-devel,07/13] libcamera: request: Add RequestData

Message ID 20190828011710.32128-8-niklas.soderlund@ragnatech.se
State Superseded
Headers show
Series
  • libcamera: ipa: Add basic IPA support
Related show

Commit Message

Niklas Söderlund Aug. 28, 2019, 1:17 a.m. UTC
Add a RequestData pointer to the Request class, this is intended to be
used by pipeline handlers while handling the request and is invalid
outside the pipeline handler context.

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

Comments

Kieran Bingham Aug. 29, 2019, 2:02 p.m. UTC | #1
Hi Niklas,

This seems quite sparse so far, so I haven't seen what it's used for
yet. I guess that will come soon.

It might be tempting to squash this with whatever uses it... we'll see ...


On 28/08/2019 02:17, Niklas Söderlund wrote:
> Add a RequestData pointer to the Request class, this is intended to be
> used by pipeline handlers while handling the request and is invalid
> outside the pipeline handler context.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> ---
>  include/libcamera/request.h |  5 +++++
>  src/libcamera/request.cpp   | 10 +++++++++-
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/include/libcamera/request.h b/include/libcamera/request.h
> index 9edf1cedc054014f..570924c5ef5e2425 100644
> --- a/include/libcamera/request.h
> +++ b/include/libcamera/request.h
> @@ -21,6 +21,9 @@ class Buffer;
>  class Camera;
>  class Stream;
>  
> +class RequestData
> +{
> +};
>  
>  class Request
>  {
> @@ -46,6 +49,8 @@ public:
>  
>  	bool hasPendingBuffers() const { return !pending_.empty(); }
>  
> +	RequestData *data;
> +
>  private:
>  	friend class Camera;
>  	friend class PipelineHandler;
> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
> index ee2158fc7a9cf0b9..4d7bf177534267ac 100644
> --- a/src/libcamera/request.cpp
> +++ b/src/libcamera/request.cpp
> @@ -55,7 +55,7 @@ LOG_DEFINE_CATEGORY(Request)
>   *
>   */
>  Request::Request(Camera *camera, uint64_t cookie)
> -	: camera_(camera), controls_(camera), cookie_(cookie),
> +	: data(nullptr), camera_(camera), controls_(camera), cookie_(cookie),
>  	  status_(RequestPending), cancelled_(false)
>  {
>  }
> @@ -178,6 +178,14 @@ Buffer *Request::findBuffer(Stream *stream) const
>   * otherwise
>   */
>  
> +/**
> + * \var Request::data
> + * \brief Pipeline handler specific data
> + *
> + * Pipeline handlers may associate private data with with an request that
> + * is valid for the requests liftime inside the pipeline handler.

s/liftime/lifetime/


> + */
> +
>  /**
>   * \brief Validate the request and prepare it for the completion handler
>   *
>

Patch

diff --git a/include/libcamera/request.h b/include/libcamera/request.h
index 9edf1cedc054014f..570924c5ef5e2425 100644
--- a/include/libcamera/request.h
+++ b/include/libcamera/request.h
@@ -21,6 +21,9 @@  class Buffer;
 class Camera;
 class Stream;
 
+class RequestData
+{
+};
 
 class Request
 {
@@ -46,6 +49,8 @@  public:
 
 	bool hasPendingBuffers() const { return !pending_.empty(); }
 
+	RequestData *data;
+
 private:
 	friend class Camera;
 	friend class PipelineHandler;
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index ee2158fc7a9cf0b9..4d7bf177534267ac 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -55,7 +55,7 @@  LOG_DEFINE_CATEGORY(Request)
  *
  */
 Request::Request(Camera *camera, uint64_t cookie)
-	: camera_(camera), controls_(camera), cookie_(cookie),
+	: data(nullptr), camera_(camera), controls_(camera), cookie_(cookie),
 	  status_(RequestPending), cancelled_(false)
 {
 }
@@ -178,6 +178,14 @@  Buffer *Request::findBuffer(Stream *stream) const
  * otherwise
  */
 
+/**
+ * \var Request::data
+ * \brief Pipeline handler specific data
+ *
+ * Pipeline handlers may associate private data with with an request that
+ * is valid for the requests liftime inside the pipeline handler.
+ */
+
 /**
  * \brief Validate the request and prepare it for the completion handler
  *