summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2020-07-17 16:18:32 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2020-08-06 15:44:02 +0100
commit6bc652ee1c4a102f3fe3f321afd6dedf7c233e01 (patch)
tree2aedf18cf8dd9e0673c4ef975c5d5cda5f4c5d1c /src
parentf4c65be7b3db0c70e5194614817e7e76b8901c88 (diff)
android: camera_device: Query plane length
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@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/android/camera_device.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index e609ed76..fd68fe4a 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1132,12 +1132,13 @@ FrameBuffer *CameraDevice::createFrameBuffer(const buffer_handle_t camera3buffer
return nullptr;
}
- /*
- * 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));
}