[libcamera-devel,v3,12/22] libcamera: pipeline: rkisp1: Track buffers for self path

Message ID 20200925014207.1455796-13-niklas.soderlund@ragnatech.se
State Accepted
Headers show
Series
  • libcamera: pipeline: rkisp1: Extend to support two streams
Related show

Commit Message

Niklas Söderlund Sept. 25, 2020, 1:41 a.m. UTC
In preparation of supporting both the main and self path extend
RkISP1FrameInfo to track buffers from the self path stream.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Jacopo Mondi Sept. 25, 2020, 2:29 p.m. UTC | #1
Hi Niklas,

On Fri, Sep 25, 2020 at 03:41:57AM +0200, Niklas Söderlund wrote:
> In preparation of supporting both the main and self path extend
> RkISP1FrameInfo to track buffers from the self path stream.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

> ---
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 28e99129498e4a0a..cd3049485746edd6 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -69,6 +69,7 @@ struct RkISP1FrameInfo {
>  	FrameBuffer *paramBuffer;
>  	FrameBuffer *statBuffer;
>  	FrameBuffer *mainPathBuffer;
> +	FrameBuffer *selfPathBuffer;
>
>  	bool paramFilled;
>  	bool paramDequeued;
> @@ -272,6 +273,7 @@ RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, Request *req
>  	FrameBuffer *statBuffer = pipe_->availableStatBuffers_.front();
>
>  	FrameBuffer *mainPathBuffer = request->findBuffer(&data->mainPathStream_);
> +	FrameBuffer *selfPathBuffer = request->findBuffer(&data->selfPathStream_);
>
>  	pipe_->availableParamBuffers_.pop();
>  	pipe_->availableStatBuffers_.pop();
> @@ -282,6 +284,7 @@ RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, Request *req
>  	info->request = request;
>  	info->paramBuffer = paramBuffer;
>  	info->mainPathBuffer = mainPathBuffer;
> +	info->selfPathBuffer = selfPathBuffer;
>  	info->statBuffer = statBuffer;
>  	info->paramFilled = false;
>  	info->paramDequeued = false;
> @@ -340,7 +343,8 @@ RkISP1FrameInfo *RkISP1Frames::find(FrameBuffer *buffer)
>
>  		if (info->paramBuffer == buffer ||
>  		    info->statBuffer == buffer ||
> -		    info->mainPathBuffer == buffer)
> +		    info->mainPathBuffer == buffer ||
> +		    info->selfPathBuffer == buffer)
>  			return info;
>  	}
>
> @@ -412,7 +416,12 @@ protected:
>
>  		pipe_->param_->queueBuffer(info->paramBuffer);
>  		pipe_->stat_->queueBuffer(info->statBuffer);
> -		pipe_->mainPathVideo_->queueBuffer(info->mainPathBuffer);
> +
> +		if (info->mainPathBuffer)
> +			pipe_->mainPathVideo_->queueBuffer(info->mainPathBuffer);
> +
> +		if (info->selfPathBuffer)
> +			pipe_->selfPathVideo_->queueBuffer(info->selfPathBuffer);
>  	}
>
>  private:
> --
> 2.28.0
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 28e99129498e4a0a..cd3049485746edd6 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -69,6 +69,7 @@  struct RkISP1FrameInfo {
 	FrameBuffer *paramBuffer;
 	FrameBuffer *statBuffer;
 	FrameBuffer *mainPathBuffer;
+	FrameBuffer *selfPathBuffer;
 
 	bool paramFilled;
 	bool paramDequeued;
@@ -272,6 +273,7 @@  RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, Request *req
 	FrameBuffer *statBuffer = pipe_->availableStatBuffers_.front();
 
 	FrameBuffer *mainPathBuffer = request->findBuffer(&data->mainPathStream_);
+	FrameBuffer *selfPathBuffer = request->findBuffer(&data->selfPathStream_);
 
 	pipe_->availableParamBuffers_.pop();
 	pipe_->availableStatBuffers_.pop();
@@ -282,6 +284,7 @@  RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, Request *req
 	info->request = request;
 	info->paramBuffer = paramBuffer;
 	info->mainPathBuffer = mainPathBuffer;
+	info->selfPathBuffer = selfPathBuffer;
 	info->statBuffer = statBuffer;
 	info->paramFilled = false;
 	info->paramDequeued = false;
@@ -340,7 +343,8 @@  RkISP1FrameInfo *RkISP1Frames::find(FrameBuffer *buffer)
 
 		if (info->paramBuffer == buffer ||
 		    info->statBuffer == buffer ||
-		    info->mainPathBuffer == buffer)
+		    info->mainPathBuffer == buffer ||
+		    info->selfPathBuffer == buffer)
 			return info;
 	}
 
@@ -412,7 +416,12 @@  protected:
 
 		pipe_->param_->queueBuffer(info->paramBuffer);
 		pipe_->stat_->queueBuffer(info->statBuffer);
-		pipe_->mainPathVideo_->queueBuffer(info->mainPathBuffer);
+
+		if (info->mainPathBuffer)
+			pipe_->mainPathVideo_->queueBuffer(info->mainPathBuffer);
+
+		if (info->selfPathBuffer)
+			pipe_->selfPathVideo_->queueBuffer(info->selfPathBuffer);
 	}
 
 private: