diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/renderengine/gl/GLES20RenderEngine.cpp | 31 | ||||
| -rw-r--r-- | libs/renderengine/gl/GLES20RenderEngine.h | 6 |
2 files changed, 23 insertions, 14 deletions
diff --git a/libs/renderengine/gl/GLES20RenderEngine.cpp b/libs/renderengine/gl/GLES20RenderEngine.cpp index e244a83c09..70a4322c5f 100644 --- a/libs/renderengine/gl/GLES20RenderEngine.cpp +++ b/libs/renderengine/gl/GLES20RenderEngine.cpp @@ -275,8 +275,6 @@ std::unique_ptr<GLES20RenderEngine> GLES20RenderEngine::create(int hwcFormat, // now figure out what version of GL did we actually get // NOTE: a dummy surface is not needed if KHR_create_context is supported - // TODO(alecmouri): don't create this surface if EGL_KHR_surfaceless_context - // is supported. EGLConfig dummyConfig = config; if (dummyConfig == EGL_NO_CONFIG) { @@ -303,10 +301,10 @@ std::unique_ptr<GLES20RenderEngine> GLES20RenderEngine::create(int hwcFormat, break; case GLES_VERSION_2_0: case GLES_VERSION_3_0: - engine = std::make_unique<GLES20RenderEngine>(featureFlags, display, config, ctxt, - dummy); + engine = std::make_unique<GLES20RenderEngine>(featureFlags); break; } + engine->setEGLHandles(display, config, ctxt); ALOGI("OpenGL ES informations:"); ALOGI("vendor : %s", extensions.getVendor()); @@ -316,6 +314,9 @@ std::unique_ptr<GLES20RenderEngine> GLES20RenderEngine::create(int hwcFormat, ALOGI("GL_MAX_TEXTURE_SIZE = %zu", engine->getMaxTextureSize()); ALOGI("GL_MAX_VIEWPORT_DIMS = %zu", engine->getMaxViewportDims()); + eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglDestroySurface(display, dummy); + return engine; } @@ -358,13 +359,11 @@ EGLConfig GLES20RenderEngine::chooseEglConfig(EGLDisplay display, int format, bo return config; } -GLES20RenderEngine::GLES20RenderEngine(uint32_t featureFlags, EGLDisplay display, EGLConfig config, - EGLContext ctxt, EGLSurface dummy) +GLES20RenderEngine::GLES20RenderEngine(uint32_t featureFlags) : renderengine::impl::RenderEngine(featureFlags), - mEGLDisplay(display), - mEGLConfig(config), - mEGLContext(ctxt), - mDummySurface(dummy), + mEGLDisplay(EGL_NO_DISPLAY), + mEGLConfig(nullptr), + mEGLContext(EGL_NO_CONTEXT), mVpWidth(0), mVpHeight(0), mUseColorManagement(featureFlags & USE_COLOR_MANAGEMENT) { @@ -637,6 +636,12 @@ void GLES20RenderEngine::unbindFrameBuffer(Framebuffer* /* framebuffer */) { // back to main framebuffer glBindFramebuffer(GL_FRAMEBUFFER, 0); + + // Workaround for b/77935566 to force the EGL driver to release the + // screenshot buffer + setScissor(Rect::EMPTY_RECT); + clearWithColor(0.0, 0.0, 0.0, 0.0); + disableScissor(); } void GLES20RenderEngine::checkErrors() const { @@ -969,6 +974,12 @@ bool GLES20RenderEngine::needsXYZTransformMatrix() const { return (isInputHdrDataSpace || isOutputHdrDataSpace) && inputTransfer != outputTransfer; } +void GLES20RenderEngine::setEGLHandles(EGLDisplay display, EGLConfig config, EGLContext ctxt) { + mEGLDisplay = display; + mEGLConfig = config; + mEGLContext = ctxt; +} + } // namespace gl } // namespace renderengine } // namespace android diff --git a/libs/renderengine/gl/GLES20RenderEngine.h b/libs/renderengine/gl/GLES20RenderEngine.h index aebb319a99..148df2fbb4 100644 --- a/libs/renderengine/gl/GLES20RenderEngine.h +++ b/libs/renderengine/gl/GLES20RenderEngine.h @@ -47,8 +47,7 @@ public: static std::unique_ptr<GLES20RenderEngine> create(int hwcFormat, uint32_t featureFlags); static EGLConfig chooseEglConfig(EGLDisplay display, int format, bool logConfig); - GLES20RenderEngine(uint32_t featureFlags, // See RenderEngine::FeatureFlag - EGLDisplay display, EGLConfig config, EGLContext ctxt, EGLSurface dummy); + GLES20RenderEngine(uint32_t featureFlags); // See RenderEngine::FeatureFlag ~GLES20RenderEngine() override; std::unique_ptr<Framebuffer> createFramebuffer() override; @@ -121,12 +120,11 @@ private: // with PQ or HLG transfer function. bool isHdrDataSpace(const ui::Dataspace dataSpace) const; bool needsXYZTransformMatrix() const; - void setEGLHandles(EGLDisplay display, EGLConfig config, EGLContext ctxt, EGLSurface dummy); + void setEGLHandles(EGLDisplay display, EGLConfig config, EGLContext ctxt); EGLDisplay mEGLDisplay; EGLConfig mEGLConfig; EGLContext mEGLContext; - EGLSurface mDummySurface; GLuint mProtectedTexName; GLint mMaxViewportDims[2]; GLint mMaxTextureSize; |