[libcamera-devel] [PATCH v3 06/13] libcamera: pipeline: Add helper to process meta data coming from IPA

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sat Sep 28 21:37:29 CEST 2019


Hi Niklas,

Thank you for the patch.

On Fri, Sep 27, 2019 at 04:44:10AM +0200, Niklas Söderlund wrote:
> Add a helper to process meta data coming out of an IPA and associating
> it with a request. The helper is needed as the pipeline handler needs to
> access the private meta data member of the request, something only the
> base pipeline class handler can do.

I was going to say that the Request class should probably be reworked to
ease its use in pipeline handlers, but it's actually a nice feature that
pipeline handlers implementations can't poke freely in the request.

As metadata should use a control list instead of a fixed structure, I
think the control list should be exposed in a similar way as
Request::controls(), especially given that pipeline handlers may need to
build it incrementally. That makes the automatic setting of the ready
field more difficult. We'll probably have to think a little bit more
about how this should be exposed exactly. I believe that a setMetaData()
method for the Request class, callable by the PipelineHandler base class
only, could be a good option, as it would allow the Request to emit a
signal as soon as metadata is ready. It may be a premature optimisation
though.

> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
>  src/libcamera/include/pipeline_handler.h |  3 +++
>  src/libcamera/pipeline_handler.cpp       | 16 ++++++++++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h
> index 4400c7ed835f551d..d2581a327c0804c3 100644
> --- a/src/libcamera/include/pipeline_handler.h
> +++ b/src/libcamera/include/pipeline_handler.h
> @@ -30,6 +30,7 @@ class DeviceMatch;
>  class MediaDevice;
>  class PipelineHandler;
>  class Request;
> +struct IPAMetaData;
>  
>  class CameraData
>  {
> @@ -94,6 +95,8 @@ protected:
>  
>  	CameraData *cameraData(const Camera *camera);
>  
> +	void processMetaData(Request *request, const IPAMetaData &metaData);
> +
>  	CameraManager *manager_;
>  
>  private:
> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
> index b8a3787e10a587b5..da0ad678b652768c 100644
> --- a/src/libcamera/pipeline_handler.cpp
> +++ b/src/libcamera/pipeline_handler.cpp
> @@ -480,6 +480,22 @@ void PipelineHandler::hotplugMediaDevice(MediaDevice *media)
>  	media->disconnected.connect(this, &PipelineHandler::mediaDeviceDisconnected);
>  }
>  
> +/**
> + * \brief Helper to process meta data from the IPA
> + * \param[in] request The request to associate the \a metaData with
> + * \param[in] metaData The meta data to process
> + *
> + * This function is a helper for pipline handler implementations to process
> + * meta data retrived from an IPA. It is mandatory to call this function with
> + * any meta data returned from the IPA before it's passed to the application.
> + */
> +void PipelineHandler::processMetaData(Request *request,
> +				      const IPAMetaData &metaData)
> +{
> +	request->metaData_ = metaData;
> +	request->metaData_.ready = true;
> +}
> +
>  /**
>   * \brief Slot for the MediaDevice disconnected signal
>   */

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list