summaryrefslogtreecommitdiffstats
path: root/libs/gui/BufferQueue.cpp
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2014-03-06 15:14:33 -0800
committerDan Stoza <stoza@google.com>2014-03-10 16:45:38 -0700
commit9f3053de78630815d60cf48a2cf2348cc5867c45 (patch)
treee87e2a86d1ca837a80fc7730daece3f28a41e800 /libs/gui/BufferQueue.cpp
parent544b09523b791935ffe9aa64d1f20335f7e2dc78 (diff)
downloadframeworks_native-9f3053de78630815d60cf48a2cf2348cc5867c45.zip
frameworks_native-9f3053de78630815d60cf48a2cf2348cc5867c45.tar.gz
frameworks_native-9f3053de78630815d60cf48a2cf2348cc5867c45.tar.bz2
BufferQueue: Allow detaching/reattaching buffers
Adds detachBuffer and attachBuffer calls to both the producer and consumer sides of BufferQueue. Buffers may be detached while dequeued by the producer or acquired by the consumer, and when attached, enter the dequeued and acquired states, respectively. Bug: 13173343 Change-Id: Ic152692b0a94d99e0135b9bfa62747dab2a54220
Diffstat (limited to 'libs/gui/BufferQueue.cpp')
-rw-r--r--libs/gui/BufferQueue.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index af857fd..26e215b 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -43,6 +43,19 @@ void BufferQueue::ProxyConsumerListener::onBuffersReleased() {
}
}
+void BufferQueue::createBufferQueue(sp<BnGraphicBufferProducer>* outProducer,
+ sp<BnGraphicBufferConsumer>* outConsumer,
+ const sp<IGraphicBufferAlloc>& allocator) {
+ LOG_ALWAYS_FATAL_IF(outProducer == NULL,
+ "BufferQueue: outProducer must not be NULL");
+ LOG_ALWAYS_FATAL_IF(outConsumer == NULL,
+ "BufferQueue: outConsumer must not be NULL");
+
+ sp<BufferQueueCore> core(new BufferQueueCore(allocator));
+ *outProducer = new BufferQueueProducer(core);
+ *outConsumer = new BufferQueueConsumer(core);
+}
+
BufferQueue::BufferQueue(const sp<IGraphicBufferAlloc>& allocator) :
mProducer(),
mConsumer()
@@ -75,6 +88,15 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool async
return mProducer->dequeueBuffer(outBuf, outFence, async, w, h, format, usage);
}
+status_t BufferQueue::detachProducerBuffer(int slot) {
+ return mProducer->detachBuffer(slot);
+}
+
+status_t BufferQueue::attachProducerBuffer(int* slot,
+ const sp<GraphicBuffer>& buffer) {
+ return mProducer->attachBuffer(slot, buffer);
+}
+
status_t BufferQueue::queueBuffer(int buf,
const QueueBufferInput& input, QueueBufferOutput* output) {
return mProducer->queueBuffer(buf, input, output);
@@ -97,6 +119,15 @@ status_t BufferQueue::acquireBuffer(BufferItem* buffer, nsecs_t presentWhen) {
return mConsumer->acquireBuffer(buffer, presentWhen);
}
+status_t BufferQueue::detachConsumerBuffer(int slot) {
+ return mConsumer->detachBuffer(slot);
+}
+
+status_t BufferQueue::attachConsumerBuffer(int* slot,
+ const sp<GraphicBuffer>& buffer) {
+ return mConsumer->attachBuffer(slot, buffer);
+}
+
status_t BufferQueue::releaseBuffer(
int buf, uint64_t frameNumber, EGLDisplay display,
EGLSyncKHR eglFence, const sp<Fence>& fence) {