[libcamera-devel] [PATCH 6/8] android: camera_device: Allocate buffer pool
Jacopo Mondi
jacopo at jmondi.org
Wed Sep 9 17:54:55 CEST 2020
CameraStream instances that are not directly mapped to application
facing Android streams need memory to be reserved in libcamera on their
behalf.
After the libcamera::Camera has been configured, reserve memory for the
CameraStream isntances that need a pool of libcamera allocated buffers.
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
src/android/camera_device.cpp | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index d35c6b93b654..a7cb1be03b9a 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1329,6 +1329,26 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
return ret;
}
+ /*
+ * Allocate buffers in libcamera for stream not directly mapped to
+ * Android streams.
+ */
+ for (unsigned int i = 0; i < stream_list->num_streams; ++i) {
+ camera3_stream_t *camera3Stream = stream_list->streams[i];
+ CameraStream *cameraStream = static_cast<CameraStream *>(camera3Stream->priv);
+ StreamConfiguration &cfg = config_->at(cameraStream->index());
+
+ if (cameraStream->type() != CameraStream::Type::Internal)
+ continue;
+
+ int ret = allocator_.allocate(cfg.stream());
+ if (ret < 0) {
+ LOG(HAL, Error)
+ << "Failed to allocate buffers for stream " << i;
+ return ret;
+ }
+ }
+
return 0;
}
--
2.28.0
More information about the libcamera-devel
mailing list