Loading core/java/android/view/Choreographer.java +7 −1 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ public final class Choreographer { private boolean mCallbacksRunning; private long mLastFrameTimeNanos; private long mFrameIntervalNanos; private boolean mSoftwareRendered; /** * Callback type: Input callback. Runs first. Loading Loading @@ -173,6 +174,7 @@ public final class Choreographer { for (int i = 0; i <= CALLBACK_LAST; i++) { mCallbackQueues[i] = new CallbackQueue(); } mSoftwareRendered = false; } private static float getRefreshRate() { Loading Loading @@ -274,6 +276,10 @@ public final class Choreographer { writer.println(TimeUtils.formatUptime(mLastFrameTimeNanos / 1000000)); } void setSoftwareRendering(boolean softRendered) { mSoftwareRendered = softRendered; } /** * Posts a callback to run on the next frame. * <p> Loading Loading @@ -478,7 +484,7 @@ public final class Choreographer { private void scheduleFrameLocked(long now) { if (!mFrameScheduled) { mFrameScheduled = true; if (USE_VSYNC) { if (USE_VSYNC && !mSoftwareRendered) { if (DEBUG) { Log.d(TAG, "Scheduling next frame on vsync."); } Loading core/java/android/view/ViewRootImpl.java +12 −0 Original line number Diff line number Diff line Loading @@ -195,6 +195,7 @@ public final class ViewRootImpl implements ViewParent, InputQueue mInputQueue; FallbackEventHandler mFallbackEventHandler; Choreographer mChoreographer; boolean mDebugCpuRendVsync; final Rect mTempRect; // used in the transaction to not thrash the heap. final Rect mVisRect; // used to retrieve visible rect of focused view. Loading Loading @@ -388,6 +389,8 @@ public final class ViewRootImpl implements ViewParent, mNoncompatDensity = context.getResources().getDisplayMetrics().noncompatDensityDpi; mFallbackEventHandler = PolicyManager.makeNewFallbackEventHandler(context); mChoreographer = Choreographer.getInstance(); mDebugCpuRendVsync = SystemProperties.getBoolean("debug.cpurend.vsync", true); Log.i(TAG, "CPU Rendering VSync enable = " + mDebugCpuRendVsync); mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE); loadSystemProperties(); mWindowIsRound = context.getResources().getBoolean( Loading Loading @@ -484,6 +487,15 @@ public final class ViewRootImpl implements ViewParent, enableHardwareAcceleration(attrs); } if (!mDebugCpuRendVsync) { if(!mAttachInfo.mHardwareAccelerated || mAttachInfo.mHardwareRenderer == null) { mChoreographer.setSoftwareRendering(true); } else { mChoreographer.setSoftwareRendering(false); } } boolean restore = false; if (mTranslator != null) { mSurface.setCompatibilityTranslator(mTranslator); Loading Loading
core/java/android/view/Choreographer.java +7 −1 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ public final class Choreographer { private boolean mCallbacksRunning; private long mLastFrameTimeNanos; private long mFrameIntervalNanos; private boolean mSoftwareRendered; /** * Callback type: Input callback. Runs first. Loading Loading @@ -173,6 +174,7 @@ public final class Choreographer { for (int i = 0; i <= CALLBACK_LAST; i++) { mCallbackQueues[i] = new CallbackQueue(); } mSoftwareRendered = false; } private static float getRefreshRate() { Loading Loading @@ -274,6 +276,10 @@ public final class Choreographer { writer.println(TimeUtils.formatUptime(mLastFrameTimeNanos / 1000000)); } void setSoftwareRendering(boolean softRendered) { mSoftwareRendered = softRendered; } /** * Posts a callback to run on the next frame. * <p> Loading Loading @@ -478,7 +484,7 @@ public final class Choreographer { private void scheduleFrameLocked(long now) { if (!mFrameScheduled) { mFrameScheduled = true; if (USE_VSYNC) { if (USE_VSYNC && !mSoftwareRendered) { if (DEBUG) { Log.d(TAG, "Scheduling next frame on vsync."); } Loading
core/java/android/view/ViewRootImpl.java +12 −0 Original line number Diff line number Diff line Loading @@ -195,6 +195,7 @@ public final class ViewRootImpl implements ViewParent, InputQueue mInputQueue; FallbackEventHandler mFallbackEventHandler; Choreographer mChoreographer; boolean mDebugCpuRendVsync; final Rect mTempRect; // used in the transaction to not thrash the heap. final Rect mVisRect; // used to retrieve visible rect of focused view. Loading Loading @@ -388,6 +389,8 @@ public final class ViewRootImpl implements ViewParent, mNoncompatDensity = context.getResources().getDisplayMetrics().noncompatDensityDpi; mFallbackEventHandler = PolicyManager.makeNewFallbackEventHandler(context); mChoreographer = Choreographer.getInstance(); mDebugCpuRendVsync = SystemProperties.getBoolean("debug.cpurend.vsync", true); Log.i(TAG, "CPU Rendering VSync enable = " + mDebugCpuRendVsync); mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE); loadSystemProperties(); mWindowIsRound = context.getResources().getBoolean( Loading Loading @@ -484,6 +487,15 @@ public final class ViewRootImpl implements ViewParent, enableHardwareAcceleration(attrs); } if (!mDebugCpuRendVsync) { if(!mAttachInfo.mHardwareAccelerated || mAttachInfo.mHardwareRenderer == null) { mChoreographer.setSoftwareRendering(true); } else { mChoreographer.setSoftwareRendering(false); } } boolean restore = false; if (mTranslator != null) { mSurface.setCompatibilityTranslator(mTranslator); Loading