summaryrefslogtreecommitdiff
path: root/libs/gui/BufferQueueProducer.cpp
diff options
context:
space:
mode:
author Alec Mouri <alecmouri@google.com> 2019-03-21 11:44:18 -0700
committer Alec Mouri <alecmouri@google.com> 2019-03-28 11:43:03 -0700
commitd7b3a8bcf9946a32213812a46f9c88a910151686 (patch)
tree72870b23665ad96b703f4e1d32b7c0dabce54e89 /libs/gui/BufferQueueProducer.cpp
parentdc705b9eafeb07326155a580e722c7dca8d61892 (diff)
Create EGLImages during buffer allocation
EGLImage creation is now performed on an async binder thread, so now GPU composition should rarely be stalled by expensive image creation. Bug: 129008989 Test: systrace Change-Id: I9732f866933a8950a4c69ff51d5ac1622bbb3470
Diffstat (limited to 'libs/gui/BufferQueueProducer.cpp')
-rw-r--r--libs/gui/BufferQueueProducer.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index a462b0362f..e657488969 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -530,6 +530,13 @@ status_t BufferQueueProducer::dequeueBuffer(int* outSlot, sp<android::Fence>* ou
return NO_INIT;
}
+ if (mCore->mConsumerListener != nullptr) {
+ BufferItem item;
+ item.mGraphicBuffer = graphicBuffer;
+ item.mSlot = *outSlot;
+ mCore->mConsumerListener->onBufferAllocated(item);
+ }
+
VALIDATE_CONSISTENCY();
} // Autolock scope
}
@@ -1414,6 +1421,13 @@ void BufferQueueProducer::allocateBuffers(uint32_t width, uint32_t height,
BQ_LOGV("allocateBuffers: allocated a new buffer in slot %d",
*slot);
+ if (mCore->mConsumerListener != nullptr) {
+ BufferItem item;
+ item.mGraphicBuffer = buffers[i];
+ item.mSlot = *slot;
+ mCore->mConsumerListener->onBufferAllocated(item);
+ }
+
// Make sure the erase is done after all uses of the slot
// iterator since it will be invalid after this point.
mCore->mFreeSlots.erase(slot);