[libcamera-devel] [PATCH 06/10] libcamera: ipu3: Implement buffer release
Jacopo Mondi
jacopo at jmondi.org
Thu Feb 28 21:04:06 CET 2019
Release buffers on all video devices in the pipeline.
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
src/libcamera/pipeline/ipu3/ipu3.cpp | 40 +++++++++++++++++++++++++---
1 file changed, 36 insertions(+), 4 deletions(-)
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index c7b7973952a0..60a48859b398 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -145,6 +145,8 @@ private:
int initCio2(unsigned int index, Cio2Device *cio2);
void registerCameras();
+ int releaseBuffers(V4L2Device *dev);
+
ImguDevice imgu0_;
ImguDevice imgu1_;
@@ -371,13 +373,32 @@ error_reserve_memory:
int PipelineHandlerIPU3::freeBuffers(Camera *camera, Stream *stream)
{
IPU3CameraData *data = cameraData(camera);
+ V4L2Device *viewfinder = data->imgu->viewfinder;
+ V4L2Device *output = data->imgu->output;
+ V4L2Device *input = data->imgu->input;
V4L2Device *cio2 = data->cio2.output;
+ V4L2Device *stat = data->imgu->stat;
+ int ret;
- int ret = cio2->releaseBuffers();
- if (ret) {
- LOG(IPU3, Error) << "Failed to release memory";
+ ret = releaseBuffers(viewfinder);
+ if (ret)
+ return ret;
+
+ ret = releaseBuffers(stat);
+ if (ret)
+ return ret;
+
+ ret = releaseBuffers(output);
+ if (ret)
+ return ret;
+
+ ret = releaseBuffers(cio2);
+ if (ret)
+ return ret;
+
+ ret = releaseBuffers(input);
+ if (ret)
return ret;
- }
return 0;
}
@@ -877,6 +898,17 @@ void PipelineHandlerIPU3::registerCameras()
}
}
+int PipelineHandlerIPU3::releaseBuffers(V4L2Device *dev)
+{
+ int ret = dev->releaseBuffers();
+ if (ret) {
+ LOG(IPU3, Error) << "Failed to release memory";
+ return ret;
+ }
+
+ return 0;
+}
+
REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3);
} /* namespace libcamera */
--
2.20.1
More information about the libcamera-devel
mailing list