Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ce952aa authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Choreographer: Add disable VSync for CPU Rendered apps"

parents e2d396f7 cbe6850d
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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.
@@ -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() {
@@ -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>
@@ -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.");
                }
+12 −0
Original line number Diff line number Diff line
@@ -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.
@@ -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(
@@ -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);