summaryrefslogtreecommitdiff
path: root/libs/gui/BufferQueue.cpp
diff options
context:
space:
mode:
author Dan Stoza <stoza@google.com> 2014-03-11 23:47:14 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2014-03-11 23:47:15 +0000
commitc9ed7d376882ff3c32913473fecd729c804dad0e (patch)
tree82bf721ff883badc8953cec01dce566a44335890 /libs/gui/BufferQueue.cpp
parente98151e004fa57184c3e688e268f8b9c36c41f8a (diff)
parent9f3053de78630815d60cf48a2cf2348cc5867c45 (diff)
Merge "BufferQueue: Allow detaching/reattaching buffers"
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 af857fd3ea..26e215b1d7 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) {