[libcamera-devel] [PATCH v3 18/22] libcamera: pipeline: rkisp1: Add wrappers for accessing the path video device

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Sep 29 00:42:33 CEST 2020


Hi Niklas,

Thank you for the patch.

On Fri, Sep 25, 2020 at 03:42:03AM +0200, Niklas Söderlund wrote:
> As a step to be able to make RkISP1Path::video_ private add simple
> wrappers for buffer handling. There is no functional change.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp     | 12 ++++++------
>  src/libcamera/pipeline/rkisp1/rkisp1path.cpp |  6 ++++++
>  src/libcamera/pipeline/rkisp1/rkisp1path.h   | 10 +++++++++-
>  3 files changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 114aee3e180afb77..7dd4fb11c39dd811 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -403,10 +403,10 @@ protected:
>  		pipe_->stat_->queueBuffer(info->statBuffer);
>  
>  		if (info->mainPathBuffer)
> -			pipe_->mainPath_.video_->queueBuffer(info->mainPathBuffer);
> +			pipe_->mainPath_.queueBuffer(info->mainPathBuffer);
>  
>  		if (info->selfPathBuffer)
> -			pipe_->selfPath_.video_->queueBuffer(info->selfPathBuffer);
> +			pipe_->selfPath_.queueBuffer(info->selfPathBuffer);
>  	}
>  
>  private:
> @@ -752,9 +752,9 @@ int PipelineHandlerRkISP1::exportFrameBuffers([[maybe_unused]] Camera *camera, S
>  	unsigned int count = stream->configuration().bufferCount;
>  
>  	if (stream == &data->mainPathStream_)
> -		return mainPath_.video_->exportBuffers(count, buffers);
> +		return mainPath_.exportBuffers(count, buffers);
>  	else if (stream == &data->selfPathStream_)
> -		return selfPath_.video_->exportBuffers(count, buffers);
> +		return selfPath_.exportBuffers(count, buffers);
>  
>  	return -EINVAL;
>  }
> @@ -1154,8 +1154,8 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)
>  	if (!selfPath_.init(media_))
>  		return false;
>  
> -	mainPath_.video_->bufferReady.connect(this, &PipelineHandlerRkISP1::bufferReady);
> -	selfPath_.video_->bufferReady.connect(this, &PipelineHandlerRkISP1::bufferReady);
> +	mainPath_.bufferReady().connect(this, &PipelineHandlerRkISP1::bufferReady);
> +	selfPath_.bufferReady().connect(this, &PipelineHandlerRkISP1::bufferReady);
>  	stat_->bufferReady.connect(this, &PipelineHandlerRkISP1::statReady);
>  	param_->bufferReady.connect(this, &PipelineHandlerRkISP1::paramReady);
>  
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1path.cpp
> index 0be4d20bb1cd2094..74eaa5d32388184b 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1path.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1path.cpp
> @@ -149,6 +149,12 @@ int RkISP1Path::configure(const StreamConfiguration &config,
>  	return 0;
>  }
>  
> +int RkISP1Path::exportBuffers(unsigned int bufferCount,
> +			      std::vector<std::unique_ptr<FrameBuffer>> *buffers)
> +{
> +	return video_->exportBuffers(bufferCount, buffers);
> +}
> +
>  RkISP1MainPath::RkISP1MainPath()
>  	: RkISP1Path("main",
>  		     {
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1path.h b/src/libcamera/pipeline/rkisp1/rkisp1path.h
> index 5b2917c746ee1d95..1315b2c64feac681 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1path.h
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1path.h
> @@ -10,6 +10,9 @@
>  #include <vector>
>  
>  #include <libcamera/camera.h>
> +#include <libcamera/signal.h>
> +
> +#include "libcamera/internal/v4l2_videodevice.h"
>  
>  namespace libcamera {
>  
> @@ -17,7 +20,6 @@ class MediaDevice;
>  class PixelFormat;
>  class Size;
>  class V4L2Subdevice;
> -class V4L2VideoDevice;
>  struct StreamConfiguration;
>  struct V4L2SubdeviceFormat;
>  
> @@ -36,6 +38,12 @@ public:
>  	int configure(const StreamConfiguration &config,
>  		      const V4L2SubdeviceFormat &inputFormat);
>  
> +	int exportBuffers(unsigned int bufferCount,
> +			  std::vector<std::unique_ptr<FrameBuffer>> *buffers);

With the next two functions inline, how about inlining this one too ?

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> +
> +	int queueBuffer(FrameBuffer *buffer) { return video_->queueBuffer(buffer); }
> +	Signal<FrameBuffer *> &bufferReady() { return video_->bufferReady; }
> +
>  	/* \todo Make video private. */
>  	V4L2VideoDevice *video_;
>  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list