[libcamera-devel,v2,11/13] libcamera: pipeline: rkisp1: Track buffers for self path

Message ID 20200914142149.63857-12-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. 14, 2020, 2:21 p.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>
---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

Comments

Laurent Pinchart Sept. 15, 2020, 1:16 a.m. UTC | #1
Hi Niklas,

Thank you for the patch.

On Mon, Sep 14, 2020 at 04:21:47PM +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>
> ---
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 01cd461427e3a6dc..bc961f8e78f2c979 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,7 +273,8 @@ RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, Request *req
>  	FrameBuffer *statBuffer = pipe_->availableStatBuffers_.front();
>  
>  	FrameBuffer *mainPathBuffer = request->findBuffer(&data->mainPathStream_);
> -	if (!mainPathBuffer) {
> +	FrameBuffer *selfPathBuffer = request->findBuffer(&data->selfPathStream_);
> +	if (!mainPathBuffer && !selfPathBuffer) {
>  		LOG(RkISP1, Error)
>  			<< "Attempt to queue request with invalid stream";
>  		return nullptr;

Can't we drop this check, doesn't Camera::queueRequest() handle this
already ?

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

> @@ -287,6 +289,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;
> @@ -345,7 +348,8 @@ RkISP1FrameInfo *RkISP1Frames::find(FrameBuffer *buffer)
>  
>  		if (info->paramBuffer == buffer ||
>  		    info->statBuffer == buffer ||
> -		    info->mainPathBuffer == buffer)
> +		    info->mainPathBuffer == buffer ||
> +		    info->selfPathBuffer == buffer)
>  			return info;
>  	}
>  
> @@ -417,7 +421,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:

Patch

diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 01cd461427e3a6dc..bc961f8e78f2c979 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,7 +273,8 @@  RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, Request *req
 	FrameBuffer *statBuffer = pipe_->availableStatBuffers_.front();
 
 	FrameBuffer *mainPathBuffer = request->findBuffer(&data->mainPathStream_);
-	if (!mainPathBuffer) {
+	FrameBuffer *selfPathBuffer = request->findBuffer(&data->selfPathStream_);
+	if (!mainPathBuffer && !selfPathBuffer) {
 		LOG(RkISP1, Error)
 			<< "Attempt to queue request with invalid stream";
 		return nullptr;
@@ -287,6 +289,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;
@@ -345,7 +348,8 @@  RkISP1FrameInfo *RkISP1Frames::find(FrameBuffer *buffer)
 
 		if (info->paramBuffer == buffer ||
 		    info->statBuffer == buffer ||
-		    info->mainPathBuffer == buffer)
+		    info->mainPathBuffer == buffer ||
+		    info->selfPathBuffer == buffer)
 			return info;
 	}
 
@@ -417,7 +421,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: