Overhual DvrBuffer and DvrBufferQueue API: Step 1
Adding new APIs:
dvrWriteBufferQueueGainBuffer
dvrWriteBufferQueuePostBuffer
dvrReadBufferQueueAcquireBuffer
dvrReadBufferQueueReleaseBuffer
Those new APIs streamlines DVR buffer operations:
1/ It allows static Dvr{Read,Write}Buffer objects to be statically
allocated with the queue.
2/ Symentric Gain/Post on WriteBufferQueue and Acquire/Release on
ReadBufferQueue.
3/ Use fixed buffer metadata.
4/ This is also a prerequisite to using shared memory based metadata and
async buffer IPC.
More details and discussion at: go/gvr-async-bufferhub
Special note regarding DVR API order in this CL: The new buffer queue
API entries are inserted before new PoseClient API as the PoseClient is
still blocked from being released and the new BufferQueue APIs are
expected to be released sooner than that.
Bug: 65455724
Bug: 65468551
Bug: 65458332
Bug: 65165821
Test: dvr_api-test
Change-Id: Iae8e7787d696d72ebf7457df9f98f4467cd20932
diff --git a/libs/vr/libdvr/dvr_internal.h b/libs/vr/libdvr/dvr_internal.h
index 28b6c28..de8bb96 100644
--- a/libs/vr/libdvr/dvr_internal.h
+++ b/libs/vr/libdvr/dvr_internal.h
@@ -34,10 +34,20 @@
extern "C" {
struct DvrWriteBuffer {
+ // The slot nubmer of the buffer, a valid slot number must be in the range of
+ // [0, android::BufferQueueDefs::NUM_BUFFER_SLOTS). This is only valid for
+ // DvrWriteBuffer acquired from a DvrWriteBufferQueue.
+ int32_t slot = -1;
+
std::shared_ptr<android::dvr::BufferProducer> write_buffer;
};
struct DvrReadBuffer {
+ // The slot nubmer of the buffer, a valid slot number must be in the range of
+ // [0, android::BufferQueueDefs::NUM_BUFFER_SLOTS). This is only valid for
+ // DvrReadBuffer acquired from a DvrReadBufferQueue.
+ int32_t slot = -1;
+
std::shared_ptr<android::dvr::BufferConsumer> read_buffer;
};