summaryrefslogtreecommitdiff
path: root/cmds/flatland/GLHelper.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2024-11-12 22:22:43 -0800
committer Xin Li <delphij@google.com> 2024-11-12 22:22:43 -0800
commit6dc15689f6bb4b04c102ac3107f31377ee91f05e (patch)
tree3ca9d372bc99ac1182fdb4bc895c556d0f108bd3 /cmds/flatland/GLHelper.cpp
parentd4d02798539f29d00059d458fd01e5b2869acbb6 (diff)
parentf151262626f1c08a104cc35d9864493ea8a72dec (diff)
Merge 24Q4 (ab/12406339) into aosp-main-future
Bug: 370570306 Merged-In: I9be1254c3e2685b0aa950b314c581824f40ce26c Change-Id: I35bc501a2b1d9eb100aaab25cd660cf2e0542f99
Diffstat (limited to 'cmds/flatland/GLHelper.cpp')
-rw-r--r--cmds/flatland/GLHelper.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/cmds/flatland/GLHelper.cpp b/cmds/flatland/GLHelper.cpp
index c163095c50..77e732805e 100644
--- a/cmds/flatland/GLHelper.cpp
+++ b/cmds/flatland/GLHelper.cpp
@@ -18,6 +18,7 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
+#include <com_android_graphics_libgui_flags.h>
#include <gui/SurfaceComposerClient.h>
#include <ui/DisplayMode.h>
@@ -202,6 +203,14 @@ bool GLHelper::getShaderProgram(const char* name, GLuint* outPgm) {
bool GLHelper::createNamedSurfaceTexture(GLuint name, uint32_t w, uint32_t h,
sp<GLConsumer>* glConsumer, EGLSurface* surface) {
+#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
+ sp<GLConsumer> glc = new GLConsumer(name, GL_TEXTURE_EXTERNAL_OES, false, true);
+ glc->setDefaultBufferSize(w, h);
+ glc->getSurface()->setMaxDequeuedBufferCount(2);
+ glc->setConsumerUsageBits(GRALLOC_USAGE_HW_COMPOSER);
+
+ sp<ANativeWindow> anw = glc->getSurface();
+#else
sp<IGraphicBufferProducer> producer;
sp<IGraphicBufferConsumer> consumer;
BufferQueue::createBufferQueue(&producer, &consumer);
@@ -212,6 +221,7 @@ bool GLHelper::createNamedSurfaceTexture(GLuint name, uint32_t w, uint32_t h,
glc->setConsumerUsageBits(GRALLOC_USAGE_HW_COMPOSER);
sp<ANativeWindow> anw = new Surface(producer);
+#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
EGLSurface s = eglCreateWindowSurface(mDisplay, mConfig, anw.get(), nullptr);
if (s == EGL_NO_SURFACE) {
fprintf(stderr, "eglCreateWindowSurface error: %#x\n", eglGetError());