[libcamera-devel] [PATCH 08/11] libcamera: ipu3: Attach to an IPA and allow it to set sensor controls

Jean-Michel Hautbois jeanmichel.hautbois at gmail.com
Tue Nov 10 15:22:27 CET 2020


Hi Niklas,

On 05/11/2020 01:15, Niklas Söderlund wrote:
> Attache to an IPA and allow it to push V4L2 controls that applies on the
> camera sensor. The IPA is not fully integrated in the pipeline as
> statistics and parameters buffers are not yet allocated, processed by
> the IPA nor queued to the hardware.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
>  src/libcamera/pipeline/ipu3/ipu3.cpp | 83 +++++++++++++++++++++++++++-
>  1 file changed, 82 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 62e99a308a6136a7..d161c2e68c0db0f2 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -14,11 +14,13 @@
>  #include <libcamera/camera.h>
>  #include <libcamera/control_ids.h>
>  #include <libcamera/formats.h>
> +#include <libcamera/ipa/ipu3.h>
>  #include <libcamera/request.h>
>  #include <libcamera/stream.h>
>  
>  #include "libcamera/internal/camera_sensor.h"
>  #include "libcamera/internal/device_enumerator.h"
> +#include "libcamera/internal/ipa_manager.h"
>  #include "libcamera/internal/log.h"
>  #include "libcamera/internal/media_device.h"
>  #include "libcamera/internal/pipeline_handler.h"
> @@ -49,10 +51,12 @@ class IPU3CameraData : public CameraData
>  {
>  public:
>  	IPU3CameraData(PipelineHandler *pipe)
> -		: CameraData(pipe)
> +		: CameraData(pipe), delayedCtrls_(nullptr)
>  	{
>  	}
>  
> +	int loadIPA();
> +
>  	void imguOutputBufferReady(FrameBuffer *buffer);
>  	void cio2BufferReady(FrameBuffer *buffer);
>  
> @@ -62,6 +66,11 @@ public:
>  	Stream outStream_;
>  	Stream vfStream_;
>  	Stream rawStream_;
> +
> +	DelayedControls *delayedCtrls_;
> +
> +private:
> +	void actOnIpa(unsigned int id, const IPAOperationData &op);
>  };
>  
>  class IPU3CameraConfiguration : public CameraConfiguration
> @@ -590,6 +599,12 @@ int PipelineHandlerIPU3::start(Camera *camera)
>  	IPU3CameraData *data = cameraData(camera);
>  	CIO2Device *cio2 = &data->cio2_;
>  	ImgUDevice *imgu = data->imgu_;
> +
> +	CameraSensorInfo sensorInfo = {};
> +	std::map<unsigned int, IPAStream> streamConfig;
> +	std::map<unsigned int, const ControlInfoMap &> entityControls;
> +	IPAOperationData ipaConfig;
> +
>  	int ret;
>  
>  	/* Allocate buffers for internal pipeline usage. */
> @@ -597,6 +612,10 @@ int PipelineHandlerIPU3::start(Camera *camera)
>  	if (ret)
>  		return ret;
>  
> +	ret = data->ipa_->start();
> +	if (ret)
> +		goto error;
> +
>  	/*
>  	 * Start the ImgU video devices, buffers will be queued to the
>  	 * ImgU output and viewfinder when requests will be queued.
> @@ -612,9 +631,33 @@ int PipelineHandlerIPU3::start(Camera *camera)
>  		goto error;
>  	}
>  
> +	/* Inform IPA of stream configuration and sensor controls. */
> +	ret = data->cio2_.sensor()->sensorInfo(&sensorInfo);
> +	if (ret) {
> +		/* \todo Turn to hard failure once sensors info is mandatory. */
> +		LOG(IPU3, Warning) << "Camera sensor information not available";
> +		sensorInfo = {};
> +		ret = 0;
> +	}

I tried this patch series on my Surface Go 2 and I have some issues with
it. The most critical is that I get a core dump :-) :

[0:08:57.210851579] [4959]  WARN IPU3 ipu3.cpp:646 Camera sensor
information not available
[0:08:57.211150487] [4959] ERROR IPAIPU3 ipu3.cpp:88 Can't find exposure
control
terminate called after throwing an instance of 'std::out_of_range'
  what():  _Map_base::at
Aborted (core dumped)

Thanks,
JM


More information about the libcamera-devel mailing list