diff options
| author | John Reck <jreck@google.com> | 2015-05-08 18:06:51 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-08 18:06:57 +0000 |
| commit | a8dca228b254fd1553824d2c5de3aaedc2fe4400 (patch) | |
| tree | 0c24b70048e669210872be1caa6ee0d50ec69db4 /libs/hwui/renderthread/EglManager.cpp | |
| parent | b954ecda0922a894835f224bead0f06ec7a8ef17 (diff) | |
| parent | d04794a9a3f9edc8b7ca336175d66eb81a8f55fa (diff) | |
| download | frameworks_base-a8dca228b254fd1553824d2c5de3aaedc2fe4400.zip frameworks_base-a8dca228b254fd1553824d2c5de3aaedc2fe4400.tar.gz frameworks_base-a8dca228b254fd1553824d2c5de3aaedc2fe4400.tar.bz2 | |
Merge "Add eglSwapBuffersWithDamageKHR support" into mnc-dev
Diffstat (limited to 'libs/hwui/renderthread/EglManager.cpp')
| -rw-r--r-- | libs/hwui/renderthread/EglManager.cpp | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp index 3afca2f..6255f5e 100644 --- a/libs/hwui/renderthread/EglManager.cpp +++ b/libs/hwui/renderthread/EglManager.cpp @@ -16,9 +16,10 @@ #include "EglManager.h" -#include "../Caches.h" -#include "../renderstate/RenderState.h" +#include "Caches.h" +#include "Properties.h" #include "RenderThread.h" +#include "renderstate/RenderState.h" #include <cutils/log.h> #include <cutils/properties.h> @@ -261,7 +262,8 @@ void EglManager::beginFrame(EGLSurface surface, EGLint* width, EGLint* height) { mInFrame = true; } -bool EglManager::swapBuffers(EGLSurface surface) { +bool EglManager::swapBuffers(EGLSurface surface, const SkRect& dirty, + EGLint width, EGLint height) { mInFrame = false; #if WAIT_FOR_GPU_COMPLETION @@ -271,7 +273,37 @@ bool EglManager::swapBuffers(EGLSurface surface) { } #endif +#ifdef EGL_KHR_swap_buffers_with_damage + if (CC_UNLIKELY(Properties::swapBuffersWithDamage)) { + SkIRect idirty; + dirty.roundOut(&idirty); + /* + * EGL_KHR_swap_buffers_with_damage spec states: + * + * The rectangles are specified relative to the bottom-left of the surface + * and the x and y components of each rectangle specify the bottom-left + * position of that rectangle. + * + * HWUI does everything with 0,0 being top-left, so need to map + * the rect + */ + EGLint y = height - (idirty.y() + idirty.height()); + // layout: {x, y, width, height} + EGLint rects[4] = { idirty.x(), y, idirty.width(), idirty.height() }; + EGLint numrects = dirty.isEmpty() ? 0 : 1; + // TODO: Remove prior to enabling this path by default + ALOGD("Swap buffers with damage %d: %d, %d, %d, %d (src=" + RECT_STRING ")", + dirty.isEmpty() ? 0 : 1, rects[0], rects[1], rects[2], rects[3], + SK_RECT_ARGS(dirty)); + eglSwapBuffersWithDamageKHR(mEglDisplay, surface, rects, numrects); + } else { + eglSwapBuffers(mEglDisplay, surface); + } +#else eglSwapBuffers(mEglDisplay, surface); +#endif + EGLint err = eglGetError(); if (CC_LIKELY(err == EGL_SUCCESS)) { return true; |
