summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/EglManager.cpp
diff options
context:
space:
mode:
authorChristian Poetzsch <christian.potzsch@imgtec.com>2016-02-05 14:22:01 +0000
committerJohn Reck <jreck@google.com>2016-02-05 13:51:37 -0800
commit9a878a646f6aca6160f22c139a5efd4de94199f8 (patch)
tree613f63cd0e6cf18a41824372540e34d0650da343 /libs/hwui/renderthread/EglManager.cpp
parent0b69467d424dcc4e1dcf29bcd96b239a13393591 (diff)
hwui: set buffer destroyed swap mode explicitly
Not using EGL_SWAP_BEHAVIOR_PRESERVED_BIT as config attribute for eglChooseConfig doesn't automatically mean the swap behavior is buffer destroyed. This is driver implementation specific and on some hw this can still be buffer preserved. Make sure it is buffer destroyed by explicitly setting it for every new surface when requested. Change-Id: Ie2c7c89b0d20e35832b488c6263bb4d9dd844a75 Signed-off-by: Christian Poetzsch <christian.potzsch@imgtec.com>
Diffstat (limited to 'libs/hwui/renderthread/EglManager.cpp')
-rw-r--r--libs/hwui/renderthread/EglManager.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp
index 466fef9def09..805bec1f449d 100644
--- a/libs/hwui/renderthread/EglManager.cpp
+++ b/libs/hwui/renderthread/EglManager.cpp
@@ -228,6 +228,13 @@ EGLSurface EglManager::createSurface(EGLNativeWindowType window) {
LOG_ALWAYS_FATAL_IF(surface == EGL_NO_SURFACE,
"Failed to create EGLSurface for window %p, eglErr = %s",
(void*) window, egl_error_str());
+
+ if (mSwapBehavior != SwapBehavior::Preserved) {
+ LOG_ALWAYS_FATAL_IF(eglSurfaceAttrib(mEglDisplay, surface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED) == EGL_FALSE,
+ "Failed to set swap behavior to destroyed for window %p, eglErr = %s",
+ (void*) window, egl_error_str());
+ }
+
return surface;
}