[v2,4/4] libcamera: ipu3: Return Raw buffers on error
diff mbox series

Message ID 20240311123234.32925-5-jacopo.mondi@ideasonboard.com
State Not Applicable
Headers show
Series
  • libcamera: Replace IPU3/RkISP1FrameInfo
Related show

Commit Message

Jacopo Mondi March 11, 2024, 12:32 p.m. UTC
When a Request is cancelled, all its application-provided buffers
are completed and the paramters and stats buffer are made available
again to the pipeline handler.

If the RAW buffer doesn't come from the application (no RAW stream
requested) it comes from the CIO2Device internal pool. Return it to
the CIO2 pool in case of error.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp | 3 +++
 1 file changed, 3 insertions(+)

Comments

Kieran Bingham March 12, 2024, 11:27 a.m. UTC | #1
Quoting Jacopo Mondi (2024-03-11 12:32:32)
> When a Request is cancelled, all its application-provided buffers
> are completed and the paramters and stats buffer are made available
> again to the pipeline handler.
> 
> If the RAW buffer doesn't come from the application (no RAW stream
> requested) it comes from the CIO2Device internal pool. Return it to
> the CIO2 pool in case of error.
> 
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/libcamera/pipeline/ipu3/ipu3.cpp | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 0c9d3167d2e6..57d0d6ed4758 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -1384,6 +1384,9 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)
>                 availableParamBuffers_.push(request->paramBuffer);
>                 availableStatBuffers_.push(request->statBuffer);
>  
> +               /* Return RAW buffer to the CIO2. */
> +               cio2_.tryReturnBuffer(buffer);
> +
>                 pipe()->completeRequest(request->_o<Request>());
>                 return;
>         }
> -- 
> 2.43.2
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 0c9d3167d2e6..57d0d6ed4758 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -1384,6 +1384,9 @@  void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)
 		availableParamBuffers_.push(request->paramBuffer);
 		availableStatBuffers_.push(request->statBuffer);
 
+		/* Return RAW buffer to the CIO2. */
+		cio2_.tryReturnBuffer(buffer);
+
 		pipe()->completeRequest(request->_o<Request>());
 		return;
 	}