diff options
author | John Reck <jreck@google.com> | 2014-11-07 22:55:32 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-07 22:55:32 +0000 |
commit | f1923c368c5c08a477b9f94dea6a499798d91d4f (patch) | |
tree | 02b6b199a0e5ef102f50fc21d75ac0fe614c03a9 /libs/hwui | |
parent | 9a0aa553ad9f6657cbbf0a182566c481e191e6b7 (diff) | |
parent | 8dda03a08603f45b3c2c90633491ce2c1fea266b (diff) | |
download | frameworks_base-f1923c368c5c08a477b9f94dea6a499798d91d4f.zip frameworks_base-f1923c368c5c08a477b9f94dea6a499798d91d4f.tar.gz frameworks_base-f1923c368c5c08a477b9f94dea6a499798d91d4f.tar.bz2 |
am 8dda03a0: am ca93f69c: Merge "Have an actual fallback if the surface is lost" into lmp-mr1-dev
* commit '8dda03a08603f45b3c2c90633491ce2c1fea266b':
Have an actual fallback if the surface is lost
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 5 | ||||
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.h | 2 | ||||
-rw-r--r-- | libs/hwui/renderthread/DrawFrameTask.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/renderthread/DrawFrameTask.h | 1 |
4 files changed, 14 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index b499dd0..6c3637d 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -166,6 +166,11 @@ void CanvasContext::prepareTree(TreeInfo& info) { freePrefetechedLayers(); } + if (CC_UNLIKELY(!mNativeWindow.get())) { + info.out.canDrawThisFrame = false; + return; + } + int runningBehind = 0; // TODO: This query is moderately expensive, investigate adding some sort // of fast-path based off when we last called eglSwapBuffers() as well as diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h index e20564b..435244e 100644 --- a/libs/hwui/renderthread/CanvasContext.h +++ b/libs/hwui/renderthread/CanvasContext.h @@ -68,6 +68,8 @@ public: bool initialize(ANativeWindow* window); void updateSurface(ANativeWindow* window); void pauseSurface(ANativeWindow* window); + bool hasSurface() { return mNativeWindow.get(); } + void setup(int width, int height, const Vector3& lightCenter, float lightRadius, uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha); void setOpaque(bool opaque); diff --git a/libs/hwui/renderthread/DrawFrameTask.cpp b/libs/hwui/renderthread/DrawFrameTask.cpp index dd34e09..97b31a9 100644 --- a/libs/hwui/renderthread/DrawFrameTask.cpp +++ b/libs/hwui/renderthread/DrawFrameTask.cpp @@ -132,6 +132,12 @@ bool DrawFrameTask::syncFrameState(TreeInfo& info) { mLayers.clear(); mContext->prepareTree(info); + // This is after the prepareTree so that any pending operations + // (RenderNode tree state, prefetched layers, etc...) will be flushed. + if (CC_UNLIKELY(!mContext->hasSurface())) { + mSyncResult |= kSync_LostSurfaceRewardIfFound; + } + if (info.out.hasAnimations) { if (info.out.requiresUiRedraw) { mSyncResult |= kSync_UIRedrawRequired; diff --git a/libs/hwui/renderthread/DrawFrameTask.h b/libs/hwui/renderthread/DrawFrameTask.h index 243cc5d..28f6cb2 100644 --- a/libs/hwui/renderthread/DrawFrameTask.h +++ b/libs/hwui/renderthread/DrawFrameTask.h @@ -42,6 +42,7 @@ class RenderThread; enum SyncResult { kSync_OK = 0, kSync_UIRedrawRequired = 1 << 0, + kSync_LostSurfaceRewardIfFound = 1 << 1, }; /* |