diff options
| -rw-r--r-- | core/java/android/view/ThreadedRenderer.java | 6 | ||||
| -rw-r--r-- | libs/hwui/renderthread/DrawFrameTask.cpp | 13 | ||||
| -rw-r--r-- | libs/hwui/renderthread/DrawFrameTask.h | 11 |
3 files changed, 22 insertions, 8 deletions
diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java index 206ba1664407..34110df5767a 100644 --- a/core/java/android/view/ThreadedRenderer.java +++ b/core/java/android/view/ThreadedRenderer.java @@ -307,6 +307,12 @@ public final class ThreadedRenderer { private static final int SYNC_INVALIDATE_REQUIRED = 1 << 0; // Spoiler: the reward is GPU-accelerated drawing, better find that Surface! private static final int SYNC_LOST_SURFACE_REWARD_IF_FOUND = 1 << 1; + // setStopped is true, drawing is false + // TODO: Remove this and SYNC_LOST_SURFACE_REWARD_IF_FOUND? + // This flag isn't really used as there's nothing that we care to do + // in response, so it really just exists to differentiate from LOST_SURFACE + // but possibly both can just be deleted. + private static final int SYNC_CONTEXT_IS_STOPPED = 1 << 2; private static final String[] VISUALIZERS = { PROFILE_PROPERTY_VISUALIZE_BARS, diff --git a/libs/hwui/renderthread/DrawFrameTask.cpp b/libs/hwui/renderthread/DrawFrameTask.cpp index ed472ac4bd02..c9c07b3df292 100644 --- a/libs/hwui/renderthread/DrawFrameTask.cpp +++ b/libs/hwui/renderthread/DrawFrameTask.cpp @@ -32,7 +32,7 @@ namespace renderthread { DrawFrameTask::DrawFrameTask() : mRenderThread(nullptr) , mContext(nullptr) - , mSyncResult(kSync_OK) { + , mSyncResult(SyncResult::OK) { } DrawFrameTask::~DrawFrameTask() { @@ -68,7 +68,7 @@ void DrawFrameTask::removeLayerUpdate(DeferredLayerUpdater* layer) { int DrawFrameTask::drawFrame(TreeObserver* observer) { LOG_ALWAYS_FATAL_IF(!mContext, "Cannot drawFrame with no CanvasContext!"); - mSyncResult = kSync_OK; + mSyncResult = SyncResult::OK; mSyncQueued = systemTime(CLOCK_MONOTONIC); mObserver = observer; postAndWait(); @@ -127,13 +127,18 @@ 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() || !canDraw)) { - mSyncResult |= kSync_LostSurfaceRewardIfFound; + if (!mContext->hasSurface()) { + mSyncResult |= SyncResult::LostSurfaceRewardIfFound; + } else { + // If we have a surface but can't draw we must be stopped + mSyncResult |= SyncResult::ContextIsStopped; + } info.out.canDrawThisFrame = false; } if (info.out.hasAnimations) { if (info.out.requiresUiRedraw) { - mSyncResult |= kSync_UIRedrawRequired; + mSyncResult |= SyncResult::UIRedrawRequired; } } // If prepareTextures is false, we ran out of texture cache space diff --git a/libs/hwui/renderthread/DrawFrameTask.h b/libs/hwui/renderthread/DrawFrameTask.h index 9bba0656b822..c02d376098a6 100644 --- a/libs/hwui/renderthread/DrawFrameTask.h +++ b/libs/hwui/renderthread/DrawFrameTask.h @@ -40,11 +40,14 @@ namespace renderthread { class CanvasContext; class RenderThread; -enum SyncResult { - kSync_OK = 0, - kSync_UIRedrawRequired = 1 << 0, - kSync_LostSurfaceRewardIfFound = 1 << 1, +namespace SyncResult { +enum { + OK = 0, + UIRedrawRequired = 1 << 0, + LostSurfaceRewardIfFound = 1 << 1, + ContextIsStopped = 1 << 2, }; +} /* * This is a special Super Task. It is re-used multiple times by RenderProxy, |