Camera: batching dequeueBuffer call for batched requests
Add plumbing to call into batched version of getBuffer call.
Also add some logic so batched version can be used even
when camera HAL is request buffer one at a time.
Camera3OutputStream will batch dequeue buffers on a batch unit.
This way we can save extra IPCs even when the client (camera
framework or camera HAL) does not call into batch dequeue API
(dequeueBuffers) directly.
As a safety measure, right before client is about to return
all outstanding buffers, all prefetched buffers will also
be returned.
TODO:
- Consider also batch queueBuffer path
- switch to batch API in requestStreamBuffer API
Test: GCA high speed recording
Bug: 113788435
Change-Id: I3cc0b62e8a6891d6ff6cad0e3c78e1d7abff6317
diff --git a/services/camera/libcameraservice/device3/Camera3StreamInterface.h b/services/camera/libcameraservice/device3/Camera3StreamInterface.h
index d417252..c558b07 100644
--- a/services/camera/libcameraservice/device3/Camera3StreamInterface.h
+++ b/services/camera/libcameraservice/device3/Camera3StreamInterface.h
@@ -306,6 +306,24 @@
nsecs_t waitBufferTimeout,
const std::vector<size_t>& surface_ids = std::vector<size_t>()) = 0;
+ struct OutstandingBuffer {
+ camera_stream_buffer* outBuffer;
+
+ /**
+ * Multiple surfaces could share the same HAL stream, but a request may
+ * be only for a subset of surfaces. In this case, the
+ * Camera3StreamInterface object needs the surface ID information to acquire
+ * buffers for those surfaces. For the case of single surface for a HAL
+ * stream, surface_ids parameter has no effect.
+ */
+ std::vector<size_t> surface_ids;
+ };
+ /**
+ * Similar to getBuffer() except this method fills multiple buffers.
+ */
+ virtual status_t getBuffers(std::vector<OutstandingBuffer>* buffers,
+ nsecs_t waitBufferTimeout) = 0;
+
/**
* Return a buffer to the stream after use by the HAL.
*