Loading core/java/android/view/ThreadedRenderer.java +8 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ public class ThreadedRenderer extends HardwareRenderer { private static final int SYNC_OK = 0; // Needs a ViewRoot invalidate 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; private static final String[] VISUALIZERS = { PROFILE_PROPERTY_VISUALIZE_BARS, Loading Loading @@ -336,6 +338,12 @@ public class ThreadedRenderer extends HardwareRenderer { int syncResult = nSyncAndDrawFrame(mNativeProxy, frameTimeNanos, recordDuration, view.getResources().getDisplayMetrics().density); if ((syncResult & SYNC_LOST_SURFACE_REWARD_IF_FOUND) != 0) { setEnabled(false); // Invalidate since we failed to draw. This should fetch a Surface // if it is still needed or do nothing if we are no longer drawing attachInfo.mViewRootImpl.invalidate(); } if ((syncResult & SYNC_INVALIDATE_REQUIRED) != 0) { attachInfo.mViewRootImpl.invalidate(); } Loading libs/hwui/renderthread/CanvasContext.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -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 Loading libs/hwui/renderthread/CanvasContext.h +2 −0 Original line number Diff line number Diff line Loading @@ -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); Loading libs/hwui/renderthread/DrawFrameTask.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -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; Loading libs/hwui/renderthread/DrawFrameTask.h +1 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ class RenderThread; enum SyncResult { kSync_OK = 0, kSync_UIRedrawRequired = 1 << 0, kSync_LostSurfaceRewardIfFound = 1 << 1, }; /* Loading Loading
core/java/android/view/ThreadedRenderer.java +8 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ public class ThreadedRenderer extends HardwareRenderer { private static final int SYNC_OK = 0; // Needs a ViewRoot invalidate 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; private static final String[] VISUALIZERS = { PROFILE_PROPERTY_VISUALIZE_BARS, Loading Loading @@ -336,6 +338,12 @@ public class ThreadedRenderer extends HardwareRenderer { int syncResult = nSyncAndDrawFrame(mNativeProxy, frameTimeNanos, recordDuration, view.getResources().getDisplayMetrics().density); if ((syncResult & SYNC_LOST_SURFACE_REWARD_IF_FOUND) != 0) { setEnabled(false); // Invalidate since we failed to draw. This should fetch a Surface // if it is still needed or do nothing if we are no longer drawing attachInfo.mViewRootImpl.invalidate(); } if ((syncResult & SYNC_INVALIDATE_REQUIRED) != 0) { attachInfo.mViewRootImpl.invalidate(); } Loading
libs/hwui/renderthread/CanvasContext.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
libs/hwui/renderthread/CanvasContext.h +2 −0 Original line number Diff line number Diff line Loading @@ -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); Loading
libs/hwui/renderthread/DrawFrameTask.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -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; Loading
libs/hwui/renderthread/DrawFrameTask.h +1 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ class RenderThread; enum SyncResult { kSync_OK = 0, kSync_UIRedrawRequired = 1 << 0, kSync_LostSurfaceRewardIfFound = 1 << 1, }; /* Loading