[libcamera-devel] libcamera: request: Facilitate retrieval of the camera

Message ID 20200814133714.46846-1-kieran.bingham@ideasonboard.com
State New
Delegated to: Kieran Bingham
Headers show
Series
  • [libcamera-devel] libcamera: request: Facilitate retrieval of the camera
Related show

Commit Message

Kieran Bingham Aug. 14, 2020, 1:37 p.m. UTC
Provide a means of identifying the Camera object which created the Request.

This allows identifying the correct Camera device to work with in completion
callbacks which are not otherwise wrapped with a means to identify the
Camera responsible for completion.

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

Comments

Niklas Söderlund Aug. 14, 2020, 1:43 p.m. UTC | #1
Hi Kieran,

On 2020-08-14 14:37:14 +0100, Kieran Bingham wrote:
> Provide a means of identifying the Camera object which created the Request.
> 
> This allows identifying the correct Camera device to work with in completion
> callbacks which are not otherwise wrapped with a means to identify the
> Camera responsible for completion.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

As discussed on IRC I think this is going in the wrong direction for 
what we want to do with Request's going forward. I might be wrong and 
the patch itself is fine,

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

> ---
>  include/libcamera/request.h | 2 ++
>  src/libcamera/request.cpp   | 7 +++++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/include/libcamera/request.h b/include/libcamera/request.h
> index eded68318b7d..ae8d450da20b 100644
> --- a/include/libcamera/request.h
> +++ b/include/libcamera/request.h
> @@ -36,6 +36,8 @@ public:
>  	Request &operator=(const Request &) = delete;
>  	~Request();
>  
> +	Camera *camera() const { return camera_; }
> +
>  	ControlList &controls() { return *controls_; }
>  	ControlList &metadata() { return *metadata_; }
>  	const std::map<Stream *, FrameBuffer *> &buffers() const { return bufferMap_; }
> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
> index f3753514131a..3ef0e061a270 100644
> --- a/src/libcamera/request.cpp
> +++ b/src/libcamera/request.cpp
> @@ -80,6 +80,13 @@ Request::~Request()
>  	delete validator_;
>  }
>  
> +/**
> + * \fn Request::camera()
> + * \brief Retrieve the camera that created the request
> + *
> + * \return A pointer to the camera associated with the request
> + */
> +
>  /**
>   * \fn Request::controls()
>   * \brief Retrieve the request's ControlList
> -- 
> 2.25.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Kieran Bingham Aug. 14, 2020, 1:55 p.m. UTC | #2
Hi Niklas,

On 14/08/2020 14:43, Niklas Söderlund wrote:
> Hi Kieran,
> 
> On 2020-08-14 14:37:14 +0100, Kieran Bingham wrote:
>> Provide a means of identifying the Camera object which created the Request.
>>
>> This allows identifying the correct Camera device to work with in completion
>> callbacks which are not otherwise wrapped with a means to identify the
>> Camera responsible for completion.
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> As discussed on IRC I think this is going in the wrong direction for 
> what we want to do with Request's going forward. I might be wrong and 
> the patch itself is fine,
> 
> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

Thanks, indeed I posted the patch so it could be discussed and
determined here ;-)

--
Kieran


> 
>> ---
>>  include/libcamera/request.h | 2 ++
>>  src/libcamera/request.cpp   | 7 +++++++
>>  2 files changed, 9 insertions(+)
>>
>> diff --git a/include/libcamera/request.h b/include/libcamera/request.h
>> index eded68318b7d..ae8d450da20b 100644
>> --- a/include/libcamera/request.h
>> +++ b/include/libcamera/request.h
>> @@ -36,6 +36,8 @@ public:
>>  	Request &operator=(const Request &) = delete;
>>  	~Request();
>>  
>> +	Camera *camera() const { return camera_; }
>> +
>>  	ControlList &controls() { return *controls_; }
>>  	ControlList &metadata() { return *metadata_; }
>>  	const std::map<Stream *, FrameBuffer *> &buffers() const { return bufferMap_; }
>> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
>> index f3753514131a..3ef0e061a270 100644
>> --- a/src/libcamera/request.cpp
>> +++ b/src/libcamera/request.cpp
>> @@ -80,6 +80,13 @@ Request::~Request()
>>  	delete validator_;
>>  }
>>  
>> +/**
>> + * \fn Request::camera()
>> + * \brief Retrieve the camera that created the request
>> + *
>> + * \return A pointer to the camera associated with the request
>> + */
>> +
>>  /**
>>   * \fn Request::controls()
>>   * \brief Retrieve the request's ControlList
>> -- 
>> 2.25.1
>>
>> _______________________________________________
>> libcamera-devel mailing list
>> libcamera-devel@lists.libcamera.org
>> https://lists.libcamera.org/listinfo/libcamera-devel
>

Patch

diff --git a/include/libcamera/request.h b/include/libcamera/request.h
index eded68318b7d..ae8d450da20b 100644
--- a/include/libcamera/request.h
+++ b/include/libcamera/request.h
@@ -36,6 +36,8 @@  public:
 	Request &operator=(const Request &) = delete;
 	~Request();
 
+	Camera *camera() const { return camera_; }
+
 	ControlList &controls() { return *controls_; }
 	ControlList &metadata() { return *metadata_; }
 	const std::map<Stream *, FrameBuffer *> &buffers() const { return bufferMap_; }
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index f3753514131a..3ef0e061a270 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -80,6 +80,13 @@  Request::~Request()
 	delete validator_;
 }
 
+/**
+ * \fn Request::camera()
+ * \brief Retrieve the camera that created the request
+ *
+ * \return A pointer to the camera associated with the request
+ */
+
 /**
  * \fn Request::controls()
  * \brief Retrieve the request's ControlList