void BufferQueue::createBufferQueue(sp<IGraphicBufferProducer>* outProducer,
sp<IGraphicBufferConsumer>* outConsumer,
bool consumerIsSurfaceFlinger) {
sp<BufferQueueCore> core(new BufferQueueCore());
sp<IGraphicBufferProducer> producer(new BufferQueueProducer(core, consumerIsSurfaceFlinger));
sp<IGraphicBufferConsumer> consumer(new BufferQueueConsumer(core));
*outProducer = producer;
*outConsumer = consumer;
}
- 静态函数
createBufferQueue()
中创建 BufferQueueCore、BufferQueueProducer 和 BufferQueueConsumer。
class BufferQueueProducer : public BnGraphicBufferProducer,
private IBinder::DeathRecipient {
sp<BufferQueueCore> mCore;
}
class BufferQueueConsumer : public BnGraphicBufferConsumer {
sp<BufferQueueCore> mCore;
}
- BufferQueueProducer 和 BufferQueueConsumer 都有成员
mCore
,从 createBufferQueue()
可知它是在调用构造函数时传进来的。
- 2014 年把 BufferQueue 拆分成了 BufferQueueCore、BufferQueueProducer 和 BufferQueueConsumer。
commit 289ade165e60b5f71734d30e535f16eb1f4313ad
Author: Dan Stoza <[email protected]>
Date: Fri Feb 28 11:17:17 2014 -0800
Split BufferQueue into core + producer + consumer
Change-Id: Idc39f1e511d68ce4f02202d35425a419bc0bcd92
include/gui/BufferItem.h | 103 +++++++++++++++++
include/gui/BufferQueueConsumer.h | 148 ++++++++++++++++++++++++
include/gui/BufferQueueCore.h | 120 ++++++++++++++++++++
include/gui/BufferQueueProducer.h | 165 +++++++++++++++++++++++++++
include/gui/BufferSlot.h | 136 ++++++++++++++++++++++
libs/gui/Android.mk | 5 +
libs/gui/BufferItem.cpp | 190 +++++++++++++++++++++++++++++++
libs/gui/BufferQueueConsumer.cpp | 398 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
libs/gui/BufferQueueCore.cpp | 209 ++++++++++++++++++++++++++++++++++
libs/gui/BufferQueueProducer.cpp | 705 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
libs/gui/BufferSlot.cpp | 15 +++
11 files changed, 2194 insertions(+)