diff options
author | John Reck <jreck@google.com> | 2016-04-07 16:02:33 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2016-04-07 16:02:33 -0700 |
commit | 945961f78a78eced823d5ba78505c781b079703d (patch) | |
tree | 770f49272fa8c981be4f0e1d9c1c3fc3726dfdf3 /libs/hwui/renderthread/DrawFrameTask.cpp | |
parent | 3397c88f7900d8db677204cdbe9e7a5dc26e453a (diff) |
Make stopped state a first-class thing
Bug: 27286867
WindowManager has committed to stopped state
controlling the lifecycle of the Surface, so
make that a first-class thing in HWUI as well.
This makes it more resistent to things like
a rogue updateSurface() happening while mStopped=true,
leading to bad things down the line. Instead let
the surface be changed/updated as often as desired,
and just block any attempt to draw on that surface.
Also removes some unnecessary makeCurrent()s, as
EglManager ensures that we *always* have a valid
GL context now (using a pbuffer surface if there is
no window surface set)
Change-Id: Iead78ddebc7997e8fdb0c9534836352f5e54b9bd
Diffstat (limited to 'libs/hwui/renderthread/DrawFrameTask.cpp')
-rw-r--r-- | libs/hwui/renderthread/DrawFrameTask.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/hwui/renderthread/DrawFrameTask.cpp b/libs/hwui/renderthread/DrawFrameTask.cpp index e8b9725fe808..bd0c1dc031c4 100644 --- a/libs/hwui/renderthread/DrawFrameTask.cpp +++ b/libs/hwui/renderthread/DrawFrameTask.cpp @@ -113,7 +113,7 @@ bool DrawFrameTask::syncFrameState(TreeInfo& info) { ATRACE_CALL(); int64_t vsync = mFrameInfo[static_cast<int>(FrameInfoIndex::Vsync)]; mRenderThread->timeLord().vsyncReceived(vsync); - mContext->makeCurrent(); + bool canDraw = mContext->makeCurrent(); Caches::getInstance().textureCache.resetMarkInUse(mContext); for (size_t i = 0; i < mLayers.size(); i++) { @@ -124,8 +124,9 @@ bool DrawFrameTask::syncFrameState(TreeInfo& 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())) { + if (CC_UNLIKELY(!mContext->hasSurface() || !canDraw)) { mSyncResult |= kSync_LostSurfaceRewardIfFound; + info.out.canDrawThisFrame = false; } if (info.out.hasAnimations) { |