[libcamera-devel] [PATCH v3 09/13] android: camera_device: Query plane length
Kieran Bingham
kieran.bingham at ideasonboard.com
Tue Aug 4 23:47:07 CEST 2020
Use lseek to query the length of planes where possible rather than leaving
the plane.length as zero, which prevents mapping buffers for software
processing.
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
v3
- Return nullptr if we fail to query plane length
v2:
- no longer support an invalid plane length.
---
src/android/camera_device.cpp | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 087e226f5a82..5899154b3e78 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1096,12 +1096,13 @@ FrameBuffer *CameraDevice::createFrameBuffer(const buffer_handle_t camera3buffer
break;
}
- /*
- * Setting length to zero here is OK as the length is only used
- * to map the memory of the plane. Libcamera do not need to poke
- * at the memory content queued by the HAL.
- */
- plane.length = 0;
+ off_t length = lseek(plane.fd.fd(), 0, SEEK_END);
+ if (length == -1) {
+ LOG(HAL, Error) << "Failed to query plane length";
+ return nullptr;
+ }
+
+ plane.length = length;
planes.push_back(std::move(plane));
}
--
2.25.1
More information about the libcamera-devel
mailing list