libgui: ConsumerBase-based classes now create their own BufferQueues
Using ConsumerBase-based classes is now the recommended way to create
BufferQueues.
This also includes a few new methods that are used by downstream classes
to avoid calling methods on raw IGBP/IGBCs.
I decided to keep and deprecate the old ctors temporarily. Before I roll
the flag out I'll remove them, but this way I can build the whole build
with or without the flag.
This is an important step for go/warren-buffers, because it consolidates
usages of BufferQueues to supported APIs and reduces the libgui API
surface that exposes IGBP/IGBC.
BYPASS_IGBP_IGBC_API_REASON: this CL is part of the migration.
Bug: 340933754
Flag: com.android.graphics.libgui.flags.wb_consumer_base_owns_bq
Test: atest, presubmit, compiles
Change-Id: I977165f3e50bc343df396a4c5ecc97fe31a67d5a
diff --git a/libs/gui/tests/SurfaceTextureClient_test.cpp b/libs/gui/tests/SurfaceTextureClient_test.cpp
index b28dca8..59d05b6 100644
--- a/libs/gui/tests/SurfaceTextureClient_test.cpp
+++ b/libs/gui/tests/SurfaceTextureClient_test.cpp
@@ -40,12 +40,8 @@
}
virtual void SetUp() {
- sp<IGraphicBufferProducer> producer;
- sp<IGraphicBufferConsumer> consumer;
- BufferQueue::createBufferQueue(&producer, &consumer);
- mST = new GLConsumer(consumer, 123, GLConsumer::TEXTURE_EXTERNAL, true,
- false);
- mSTC = new Surface(producer);
+ mST = new GLConsumer(123, GLConsumer::TEXTURE_EXTERNAL, true, false);
+ mSTC = mST->getSurface();
mANW = mSTC;
// We need a valid GL context so we can test updateTexImage()
@@ -731,12 +727,8 @@
ASSERT_NE(EGL_NO_CONTEXT, mEglContext);
for (int i = 0; i < NUM_SURFACE_TEXTURES; i++) {
- sp<IGraphicBufferProducer> producer;
- sp<IGraphicBufferConsumer> consumer;
- BufferQueue::createBufferQueue(&producer, &consumer);
- sp<GLConsumer> st(new GLConsumer(consumer, i,
- GLConsumer::TEXTURE_EXTERNAL, true, false));
- sp<Surface> stc(new Surface(producer));
+ sp<GLConsumer> st(new GLConsumer(i, GLConsumer::TEXTURE_EXTERNAL, true, false));
+ sp<Surface> stc = st->getSurface();
mEglSurfaces[i] = eglCreateWindowSurface(mEglDisplay, myConfig,
static_cast<ANativeWindow*>(stc.get()), nullptr);
ASSERT_EQ(EGL_SUCCESS, eglGetError());