[libcamera-devel,6/8] libcamera: pipeline: ipu3: frames: Group FrameBuffer operations
diff mbox series

Message ID 20210312061131.854849-7-kieran.bingham@ideasonboard.com
State Changes Requested
Delegated to: Kieran Bingham
Headers show
Series
  • IPU3 Debug improvements
Related show

Commit Message

Kieran Bingham March 12, 2021, 6:11 a.m. UTC
Ensure that checks on resource availability are handled first, and then
operate on the queues only after the resources are confirmed as
available.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/libcamera/pipeline/ipu3/frames.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart March 14, 2021, 2:03 a.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Fri, Mar 12, 2021 at 06:11:29AM +0000, Kieran Bingham wrote:
> Ensure that checks on resource availability are handled first, and then
> operate on the queues only after the resources are confirmed as
> available.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

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

> ---
>  src/libcamera/pipeline/ipu3/frames.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/pipeline/ipu3/frames.cpp b/src/libcamera/pipeline/ipu3/frames.cpp
> index b8b471c3c561..7a7c5643df43 100644
> --- a/src/libcamera/pipeline/ipu3/frames.cpp
> +++ b/src/libcamera/pipeline/ipu3/frames.cpp
> @@ -47,12 +47,13 @@ IPU3Frames::Info *IPU3Frames::create(Request *request)
>  		LOG(IPU3, Error) << "Parameters buffer underrun";
>  		return nullptr;
>  	}
> -	FrameBuffer *paramBuffer = availableParamBuffers_.front();
>  
>  	if (availableStatBuffers_.empty()) {
>  		LOG(IPU3, Error) << "Statistics buffer underrun";
>  		return nullptr;
>  	}
> +
> +	FrameBuffer *paramBuffer = availableParamBuffers_.front();
>  	FrameBuffer *statBuffer = availableStatBuffers_.front();
>  
>  	availableParamBuffers_.pop();

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/ipu3/frames.cpp b/src/libcamera/pipeline/ipu3/frames.cpp
index b8b471c3c561..7a7c5643df43 100644
--- a/src/libcamera/pipeline/ipu3/frames.cpp
+++ b/src/libcamera/pipeline/ipu3/frames.cpp
@@ -47,12 +47,13 @@  IPU3Frames::Info *IPU3Frames::create(Request *request)
 		LOG(IPU3, Error) << "Parameters buffer underrun";
 		return nullptr;
 	}
-	FrameBuffer *paramBuffer = availableParamBuffers_.front();
 
 	if (availableStatBuffers_.empty()) {
 		LOG(IPU3, Error) << "Statistics buffer underrun";
 		return nullptr;
 	}
+
+	FrameBuffer *paramBuffer = availableParamBuffers_.front();
 	FrameBuffer *statBuffer = availableStatBuffers_.front();
 
 	availableParamBuffers_.pop();