summaryrefslogtreecommitdiffstats
path: root/libs/hwui/renderthread/EglManager.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2014-10-31 23:30:57 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-31 23:30:57 +0000
commit9481684560b2815d2706512086bb36467ef6acc0 (patch)
treee6258e3075f56533df3ec11cf1443a0d1882b17d /libs/hwui/renderthread/EglManager.cpp
parentbc622ed7c3f9ead17c8aede3ccc10babf0b8e0fa (diff)
parente05575e9c36850d8cfe49396ac9a1372511b12bf (diff)
downloadframeworks_base-9481684560b2815d2706512086bb36467ef6acc0.zip
frameworks_base-9481684560b2815d2706512086bb36467ef6acc0.tar.gz
frameworks_base-9481684560b2815d2706512086bb36467ef6acc0.tar.bz2
am e05575e9: am a8d83d63: Merge "Layer changes" into lmp-mr1-dev automerge: a51fba0
* commit 'e05575e9c36850d8cfe49396ac9a1372511b12bf': Layer changes
Diffstat (limited to 'libs/hwui/renderthread/EglManager.cpp')
-rw-r--r--libs/hwui/renderthread/EglManager.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp
index 4f79ba7..e49863d 100644
--- a/libs/hwui/renderthread/EglManager.cpp
+++ b/libs/hwui/renderthread/EglManager.cpp
@@ -74,7 +74,8 @@ EglManager::EglManager(RenderThread& thread)
, mAllowPreserveBuffer(load_dirty_regions_property())
, mCurrentSurface(EGL_NO_SURFACE)
, mAtlasMap(NULL)
- , mAtlasMapSize(0) {
+ , mAtlasMapSize(0)
+ , mInFrame(false) {
mCanSetPreserveBuffer = mAllowPreserveBuffer;
ALOGD("Use EGL_SWAP_BEHAVIOR_PRESERVED: %s", mAllowPreserveBuffer ? "true" : "false");
}
@@ -106,10 +107,12 @@ bool EglManager::hasEglContext() {
void EglManager::requireGlContext() {
LOG_ALWAYS_FATAL_IF(mEglDisplay == EGL_NO_DISPLAY, "No EGL context");
- // We can't be certain about the state of the current surface (whether
- // or not it is destroyed, for example), so err on the side of using
- // the pbuffer surface which we fully control
- usePBufferSurface();
+ if (!mInFrame) {
+ // We can't be certain about the state of the current surface (whether
+ // or not it is destroyed, for example), so err on the side of using
+ // the pbuffer surface which we fully control
+ usePBufferSurface();
+ }
}
void EglManager::loadConfig() {
@@ -252,9 +255,11 @@ void EglManager::beginFrame(EGLSurface surface, EGLint* width, EGLint* height) {
eglQuerySurface(mEglDisplay, surface, EGL_HEIGHT, height);
}
eglBeginFrame(mEglDisplay, surface);
+ mInFrame = true;
}
bool EglManager::swapBuffers(EGLSurface surface) {
+ mInFrame = false;
eglSwapBuffers(mEglDisplay, surface);
EGLint err = eglGetError();
if (CC_LIKELY(err == EGL_SUCCESS)) {
@@ -273,6 +278,10 @@ bool EglManager::swapBuffers(EGLSurface surface) {
return false;
}
+void EglManager::cancelFrame() {
+ mInFrame = false;
+}
+
bool EglManager::setPreserveBuffer(EGLSurface surface, bool preserve) {
if (CC_UNLIKELY(!mAllowPreserveBuffer)) return false;