[libcamera-devel] [PATCH 07/10] libcamera: pipeline_handler: Add Camera properties
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Wed Dec 4 17:14:15 CET 2019
Hi Jacopo,
Thank you for the patch.
On Wed, Dec 04, 2019 at 02:21:03PM +0100, Jacopo Mondi wrote:
> Associate to each Camera a ControlList which contains the Camera
> properties as created by pipeline handlers in the pipeline handler's
> CameraData and provide an operation to retrieve them.
>
> Collect properties from the camera sensor in all pipeline handlers that
> support one (IPU3, RKISP1 and VIMC).
>
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> ---
> src/libcamera/include/pipeline_handler.h | 2 ++
> src/libcamera/pipeline/ipu3/ipu3.cpp | 3 +++
> src/libcamera/pipeline/rkisp1/rkisp1.cpp | 3 +++
> src/libcamera/pipeline/vimc.cpp | 4 ++++
> src/libcamera/pipeline_handler.cpp | 19 +++++++++++++++++++
> 5 files changed, 31 insertions(+)
>
> diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h
> index a02e6e77dc9c..68761cc473c4 100644
> --- a/src/libcamera/include/pipeline_handler.h
> +++ b/src/libcamera/include/pipeline_handler.h
> @@ -43,6 +43,7 @@ public:
> PipelineHandler *pipe_;
> std::list<Request *> queuedRequests_;
> ControlInfoMap controlInfo_;
> + ControlList properties_;
> std::unique_ptr<IPAInterface> ipa_;
>
> private:
> @@ -64,6 +65,7 @@ public:
> void unlock();
>
> const ControlInfoMap &controls(Camera *camera);
> + const ControlList &properties(Camera *camera);
>
> virtual CameraConfiguration *generateConfiguration(Camera *camera,
> const StreamRoles &roles) = 0;
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 1c5fccf69428..536a63a30018 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -867,6 +867,9 @@ int PipelineHandlerIPU3::registerCameras()
> if (ret)
> continue;
>
> + /* Initialize the camera properties. */
> + data->properties_ = cio2->sensor_->properties();
> +
> /**
> * \todo Dynamically assign ImgU and output devices to each
> * stream and camera; as of now, limit support to two cameras
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 4a583a7a1d7e..e9a70755f4c5 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -888,6 +888,9 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)
> if (ret)
> return ret;
>
> + /* Initialize the camera properties. */
> + data->properties_ = data->sensor_->properties();
> +
> ret = data->loadIPA();
> if (ret)
> return ret;
> diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp
> index 06664fed42e7..f043cf55889e 100644
> --- a/src/libcamera/pipeline/vimc.cpp
> +++ b/src/libcamera/pipeline/vimc.cpp
> @@ -454,6 +454,10 @@ int VimcCameraData::init(MediaDevice *media)
> }
>
> controlInfo_ = std::move(ctrls);
> +
> + /* Initialize the camera properties. */
> + properties_ = sensor_->properties();
> +
It would be nice if we could generalize this a little bit across
pipeline handlers, but that's out of scope for this patch series.
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> return 0;
> }
>
> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
> index 4349ca8957e4..a023fa1001f5 100644
> --- a/src/libcamera/pipeline_handler.cpp
> +++ b/src/libcamera/pipeline_handler.cpp
> @@ -96,6 +96,14 @@ LOG_DEFINE_CATEGORY(Pipeline)
> * creating the camera, and shall not be modified afterwards.
> */
>
> +/**
> + * \var CameraData::properties_
> + * \brief The list of properties supported by the camera
> + *
> + * The list of camera properties shall be initialised by the pipeline handler
> + * when creating the camera, and shall not be modified afterwards.
> + */
> +
> /**
> * \var CameraData::ipa_
> * \brief The IPA module used by the camera
> @@ -244,6 +252,17 @@ const ControlInfoMap &PipelineHandler::controls(Camera *camera)
> return data->controlInfo_;
> }
>
> +/**
> + * \brief Retrieve the list of properties for a camera
> + * \param[in] camera The camera
> + * \return A ControlList of properties supported by \a camera
> + */
> +const ControlList &PipelineHandler::properties(Camera *camera)
> +{
> + CameraData *data = cameraData(camera);
> + return data->properties_;
> +}
> +
> /**
> * \fn PipelineHandler::generateConfiguration()
> * \brief Generate a camera configuration for a specified camera
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list