Loading core/java/android/view/HardwareRenderer.java +6 −0 Original line number Diff line number Diff line Loading @@ -578,6 +578,12 @@ public abstract class HardwareRenderer { */ abstract void fence(); /** * Called by {@link ViewRootImpl} when a new performTraverals is scheduled. */ public void notifyFramePending() { } /** * Describes a series of frames that should be drawn on screen as a graph. * Each frame is composed of 1 or more elements. Loading core/java/android/view/ThreadedRenderer.java +6 −0 Original line number Diff line number Diff line Loading @@ -290,6 +290,11 @@ public class ThreadedRenderer extends HardwareRenderer { nFence(mNativeProxy); } @Override public void notifyFramePending() { nNotifyFramePending(mNativeProxy); } @Override protected void finalize() throws Throwable { try { Loading Loading @@ -364,4 +369,5 @@ public class ThreadedRenderer extends HardwareRenderer { private static native void nDestroyLayer(long nativeProxy, long layer); private static native void nFence(long nativeProxy); private static native void nNotifyFramePending(long nativeProxy); } core/java/android/view/ViewRootImpl.java +12 −0 Original line number Diff line number Diff line Loading @@ -999,6 +999,17 @@ public final class ViewRootImpl implements ViewParent, } } /** * Notifies the HardwareRenderer that a new frame will be coming soon. * Currently only {@link ThreadedRenderer} cares about this, and uses * this knowledge to adjust the scheduling of off-thread animations */ void notifyRendererOfFramePending() { if (mAttachInfo.mHardwareRenderer != null) { mAttachInfo.mHardwareRenderer.notifyFramePending(); } } void scheduleTraversals() { if (!mTraversalScheduled) { mTraversalScheduled = true; Loading @@ -1006,6 +1017,7 @@ public final class ViewRootImpl implements ViewParent, mChoreographer.postCallback( Choreographer.CALLBACK_TRAVERSAL, mTraversalRunnable, null); scheduleConsumeBatchedInput(); notifyRendererOfFramePending(); } } Loading core/jni/android_view_ThreadedRenderer.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -299,6 +299,12 @@ static void android_view_ThreadedRenderer_fence(JNIEnv* env, jobject clazz, proxy->fence(); } static void android_view_ThreadedRenderer_notifyFramePending(JNIEnv* env, jobject clazz, jlong proxyPtr) { RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr); proxy->notifyFramePending(); } #endif // ---------------------------------------------------------------------------- Loading Loading @@ -329,6 +335,7 @@ static JNINativeMethod gMethods[] = { { "nCopyLayerInto", "(JJJ)Z", (void*) android_view_ThreadedRenderer_copyLayerInto }, { "nDestroyLayer", "(JJ)V", (void*) android_view_ThreadedRenderer_destroyLayer }, { "nFence", "(J)V", (void*) android_view_ThreadedRenderer_fence }, { "nNotifyFramePending", "(J)V", (void*) android_view_ThreadedRenderer_notifyFramePending }, #endif }; Loading libs/hwui/TreeInfo.h +8 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ struct TreeInfo { : hasFunctors(false) , hasAnimations(false) , requiresUiRedraw(false) , canDrawThisFrame(true) {} bool hasFunctors; // This is only updated if evaluateAnimations is true Loading @@ -60,6 +61,13 @@ struct TreeInfo { // animate itself, such as if hasFunctors is true // This is only set if hasAnimations is true bool requiresUiRedraw; // This is set to true if draw() can be called this frame // false means that we must delay until the next vsync pulse as frame // production is outrunning consumption // NOTE that if this is false CanvasContext will set either requiresUiRedraw // *OR* will post itself for the next vsync automatically, use this // only to avoid calling draw() bool canDrawThisFrame; } out; // TODO: Damage calculations Loading Loading
core/java/android/view/HardwareRenderer.java +6 −0 Original line number Diff line number Diff line Loading @@ -578,6 +578,12 @@ public abstract class HardwareRenderer { */ abstract void fence(); /** * Called by {@link ViewRootImpl} when a new performTraverals is scheduled. */ public void notifyFramePending() { } /** * Describes a series of frames that should be drawn on screen as a graph. * Each frame is composed of 1 or more elements. Loading
core/java/android/view/ThreadedRenderer.java +6 −0 Original line number Diff line number Diff line Loading @@ -290,6 +290,11 @@ public class ThreadedRenderer extends HardwareRenderer { nFence(mNativeProxy); } @Override public void notifyFramePending() { nNotifyFramePending(mNativeProxy); } @Override protected void finalize() throws Throwable { try { Loading Loading @@ -364,4 +369,5 @@ public class ThreadedRenderer extends HardwareRenderer { private static native void nDestroyLayer(long nativeProxy, long layer); private static native void nFence(long nativeProxy); private static native void nNotifyFramePending(long nativeProxy); }
core/java/android/view/ViewRootImpl.java +12 −0 Original line number Diff line number Diff line Loading @@ -999,6 +999,17 @@ public final class ViewRootImpl implements ViewParent, } } /** * Notifies the HardwareRenderer that a new frame will be coming soon. * Currently only {@link ThreadedRenderer} cares about this, and uses * this knowledge to adjust the scheduling of off-thread animations */ void notifyRendererOfFramePending() { if (mAttachInfo.mHardwareRenderer != null) { mAttachInfo.mHardwareRenderer.notifyFramePending(); } } void scheduleTraversals() { if (!mTraversalScheduled) { mTraversalScheduled = true; Loading @@ -1006,6 +1017,7 @@ public final class ViewRootImpl implements ViewParent, mChoreographer.postCallback( Choreographer.CALLBACK_TRAVERSAL, mTraversalRunnable, null); scheduleConsumeBatchedInput(); notifyRendererOfFramePending(); } } Loading
core/jni/android_view_ThreadedRenderer.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -299,6 +299,12 @@ static void android_view_ThreadedRenderer_fence(JNIEnv* env, jobject clazz, proxy->fence(); } static void android_view_ThreadedRenderer_notifyFramePending(JNIEnv* env, jobject clazz, jlong proxyPtr) { RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr); proxy->notifyFramePending(); } #endif // ---------------------------------------------------------------------------- Loading Loading @@ -329,6 +335,7 @@ static JNINativeMethod gMethods[] = { { "nCopyLayerInto", "(JJJ)Z", (void*) android_view_ThreadedRenderer_copyLayerInto }, { "nDestroyLayer", "(JJ)V", (void*) android_view_ThreadedRenderer_destroyLayer }, { "nFence", "(J)V", (void*) android_view_ThreadedRenderer_fence }, { "nNotifyFramePending", "(J)V", (void*) android_view_ThreadedRenderer_notifyFramePending }, #endif }; Loading
libs/hwui/TreeInfo.h +8 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ struct TreeInfo { : hasFunctors(false) , hasAnimations(false) , requiresUiRedraw(false) , canDrawThisFrame(true) {} bool hasFunctors; // This is only updated if evaluateAnimations is true Loading @@ -60,6 +61,13 @@ struct TreeInfo { // animate itself, such as if hasFunctors is true // This is only set if hasAnimations is true bool requiresUiRedraw; // This is set to true if draw() can be called this frame // false means that we must delay until the next vsync pulse as frame // production is outrunning consumption // NOTE that if this is false CanvasContext will set either requiresUiRedraw // *OR* will post itself for the next vsync automatically, use this // only to avoid calling draw() bool canDrawThisFrame; } out; // TODO: Damage calculations Loading