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/Camera3OutputStreamInterface.h b/services/camera/libcameraservice/device3/Camera3OutputStreamInterface.h
index 7f5c87a..49f9f62 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputStreamInterface.h
+++ b/services/camera/libcameraservice/device3/Camera3OutputStreamInterface.h
@@ -95,6 +95,19 @@
* Query the physical camera id for the output stream.
*/
virtual const String8& getPhysicalCameraId() const = 0;
+
+ /**
+ * Set the batch size for buffer operations. The output stream will request
+ * buffers from buffer queue on a batch basis. Currently only video streams
+ * are allowed to set the batch size. Also if the stream is managed by
+ * buffer manager (Surface group in Java API) then batching is also not
+ * supported. Changing batch size on the fly while there is already batched
+ * buffers in the stream is also not supported.
+ * If the batch size is larger than the max dequeue count set
+ * by the camera HAL, the batch size will be set to the max dequeue count
+ * instead.
+ */
+ virtual status_t setBatchSize(size_t batchSize = 1) = 0;
};
// Helper class to organize a synchronized mapping of stream IDs to stream instances