Merge "BufferQueue: Remove Bn version of create*"
This commit is contained in:
commit
fb9bf8725d
@ -112,10 +112,6 @@ public:
|
||||
// needed gralloc buffers.
|
||||
BufferQueue(const sp<IGraphicBufferAlloc>& allocator = NULL);
|
||||
|
||||
static void createBufferQueue(sp<BnGraphicBufferProducer>* outProducer,
|
||||
sp<BnGraphicBufferConsumer>* outConsumer,
|
||||
const sp<IGraphicBufferAlloc>& allocator = NULL);
|
||||
|
||||
static void createBufferQueue(sp<IGraphicBufferProducer>* outProducer,
|
||||
sp<IGraphicBufferConsumer>* outConsumer,
|
||||
const sp<IGraphicBufferAlloc>& allocator = NULL);
|
||||
|
@ -43,19 +43,6 @@ 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);
|
||||
}
|
||||
|
||||
void BufferQueue::createBufferQueue(sp<IGraphicBufferProducer>* outProducer,
|
||||
sp<IGraphicBufferConsumer>* outConsumer,
|
||||
const sp<IGraphicBufferAlloc>& allocator) {
|
||||
@ -65,8 +52,19 @@ void BufferQueue::createBufferQueue(sp<IGraphicBufferProducer>* outProducer,
|
||||
"BufferQueue: outConsumer must not be NULL");
|
||||
|
||||
sp<BufferQueueCore> core(new BufferQueueCore(allocator));
|
||||
*outProducer = new BufferQueueProducer(core);
|
||||
*outConsumer = new BufferQueueConsumer(core);
|
||||
LOG_ALWAYS_FATAL_IF(core == NULL,
|
||||
"BufferQueue: failed to create BufferQueueCore");
|
||||
|
||||
sp<IGraphicBufferProducer> producer(new BufferQueueProducer(core));
|
||||
LOG_ALWAYS_FATAL_IF(producer == NULL,
|
||||
"BufferQueue: failed to create BufferQueueProducer");
|
||||
|
||||
sp<IGraphicBufferConsumer> consumer(new BufferQueueConsumer(core));
|
||||
LOG_ALWAYS_FATAL_IF(consumer == NULL,
|
||||
"BufferQueue: failed to create BufferQueueConsumer");
|
||||
|
||||
*outProducer = producer;
|
||||
*outConsumer = consumer;
|
||||
}
|
||||
|
||||
BufferQueue::BufferQueue(const sp<IGraphicBufferAlloc>& allocator) :
|
||||
|
@ -81,12 +81,12 @@ TEST_F(BufferQueueTest, BufferQueueInAnotherProcess) {
|
||||
|
||||
if (forkPid == 0) {
|
||||
// Child process
|
||||
sp<BnGraphicBufferProducer> producer;
|
||||
sp<BnGraphicBufferConsumer> consumer;
|
||||
sp<IGraphicBufferProducer> producer;
|
||||
sp<IGraphicBufferConsumer> consumer;
|
||||
BufferQueue::createBufferQueue(&producer, &consumer);
|
||||
sp<IServiceManager> serviceManager = defaultServiceManager();
|
||||
serviceManager->addService(PRODUCER_NAME, producer.get());
|
||||
serviceManager->addService(CONSUMER_NAME, consumer.get());
|
||||
serviceManager->addService(PRODUCER_NAME, producer->asBinder());
|
||||
serviceManager->addService(CONSUMER_NAME, consumer->asBinder());
|
||||
ProcessState::self()->startThreadPool();
|
||||
IPCThreadState::self()->joinThreadPool();
|
||||
LOG_ALWAYS_FATAL("Shouldn't be here");
|
||||
|
@ -117,8 +117,8 @@ Layer::Layer(SurfaceFlinger* flinger, const sp<Client>& client,
|
||||
|
||||
void Layer::onFirstRef() {
|
||||
// Creates a custom BufferQueue for SurfaceFlingerConsumer to use
|
||||
sp<BnGraphicBufferProducer> producer;
|
||||
sp<BnGraphicBufferConsumer> consumer;
|
||||
sp<IGraphicBufferProducer> producer;
|
||||
sp<IGraphicBufferConsumer> consumer;
|
||||
BufferQueue::createBufferQueue(&producer, &consumer);
|
||||
mProducer = new MonitoredProducer(producer, mFlinger);
|
||||
mSurfaceFlingerConsumer = new SurfaceFlingerConsumer(consumer, mTextureName);
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
namespace android {
|
||||
|
||||
MonitoredProducer::MonitoredProducer(const sp<BnGraphicBufferProducer>& producer,
|
||||
MonitoredProducer::MonitoredProducer(const sp<IGraphicBufferProducer>& producer,
|
||||
const sp<SurfaceFlinger>& flinger) :
|
||||
mProducer(producer),
|
||||
mFlinger(flinger) {}
|
||||
@ -49,8 +49,7 @@ MonitoredProducer::~MonitoredProducer() {
|
||||
wp<IBinder> mProducer;
|
||||
};
|
||||
|
||||
mFlinger->postMessageAsync(new MessageCleanUpList(mFlinger,
|
||||
static_cast<BnGraphicBufferProducer*>(this)));
|
||||
mFlinger->postMessageAsync(new MessageCleanUpList(mFlinger, asBinder()));
|
||||
}
|
||||
|
||||
status_t MonitoredProducer::requestBuffer(int slot, sp<GraphicBuffer>* buf) {
|
||||
@ -101,5 +100,9 @@ status_t MonitoredProducer::setSidebandStream(const sp<NativeHandle>& stream) {
|
||||
return mProducer->setSidebandStream(stream);
|
||||
}
|
||||
|
||||
IBinder* MonitoredProducer::onAsBinder() {
|
||||
return mProducer->asBinder().get();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
}; // namespace android
|
||||
|
@ -27,9 +27,9 @@ class SurfaceFlinger;
|
||||
|
||||
// MonitoredProducer wraps an IGraphicBufferProducer so that SurfaceFlinger will
|
||||
// be notified upon its destruction
|
||||
class MonitoredProducer : public BnGraphicBufferProducer {
|
||||
class MonitoredProducer : public IGraphicBufferProducer {
|
||||
public:
|
||||
MonitoredProducer(const sp<BnGraphicBufferProducer>& producer,
|
||||
MonitoredProducer(const sp<IGraphicBufferProducer>& producer,
|
||||
const sp<SurfaceFlinger>& flinger);
|
||||
virtual ~MonitoredProducer();
|
||||
|
||||
@ -49,9 +49,10 @@ public:
|
||||
bool producerControlledByApp, QueueBufferOutput* output);
|
||||
virtual status_t disconnect(int api);
|
||||
virtual status_t setSidebandStream(const sp<NativeHandle>& stream);
|
||||
virtual IBinder* onAsBinder();
|
||||
|
||||
private:
|
||||
sp<BnGraphicBufferProducer> mProducer;
|
||||
sp<IGraphicBufferProducer> mProducer;
|
||||
sp<SurfaceFlinger> mFlinger;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user