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

Commit 97d5c418 authored by Jeff Brown's avatar Jeff Brown
Browse files

Remove unused pipelining optimization.

Bug: 6375101
Change-Id: I5fcbbabfafae9e1661adac7b2becc748e42c4b66
parent 80b27603
Loading
Loading
Loading
Loading
+0 −74
Original line number Diff line number Diff line
@@ -69,18 +69,9 @@ public final class Choreographer {
    private static final boolean USE_VSYNC = SystemProperties.getBoolean(
            "debug.choreographer.vsync", true);

    // Enable/disable allowing traversals to proceed immediately if no drawing occurred
    // during the previous frame.  When true, the Choreographer can degrade more gracefully
    // if drawing takes longer than a frame, but it may potentially block in eglSwapBuffers()
    // if there are two dirty buffers enqueued.
    // When false, we always schedule traversals on strict vsync boundaries.
    private static final boolean USE_PIPELINING = SystemProperties.getBoolean(
            "debug.choreographer.pipeline", false);

    private static final int MSG_DO_FRAME = 0;
    private static final int MSG_DO_SCHEDULE_VSYNC = 1;
    private static final int MSG_DO_SCHEDULE_CALLBACK = 2;
    private static final int MSG_DO_TRAVERSAL = 3;

    private final Object mLock = new Object();

@@ -94,8 +85,6 @@ public final class Choreographer {

    private boolean mFrameScheduled;
    private long mLastFrameTime;
    private boolean mDrewLastFrame;
    private boolean mTraversalScheduled;

    /**
     * Callback type: Input callback.  Runs first.
@@ -236,35 +225,11 @@ public final class Choreographer {
        }

        synchronized (mLock) {
            if (USE_PIPELINING && callbackType == CALLBACK_INPUT) {
                Message msg = Message.obtain(mHandler, action);
                msg.setAsynchronous(true);
                mHandler.sendMessage(msg);
                return;
            }

            final long now = SystemClock.uptimeMillis();
            final long dueTime = now + delayMillis;
            mCallbackQueues[callbackType].addCallbackLocked(dueTime, action, token);

            if (dueTime <= now) {
                if (USE_PIPELINING && callbackType == CALLBACK_TRAVERSAL) {
                    if (!mDrewLastFrame) {
                        if (DEBUG) {
                            Log.d(TAG, "Scheduling traversal immediately.");
                        }
                        if (!mTraversalScheduled) {
                            mTraversalScheduled = true;
                            Message msg = mHandler.obtainMessage(MSG_DO_TRAVERSAL);
                            msg.setAsynchronous(true);
                            mHandler.sendMessageAtTime(msg, dueTime);
                        }
                        return;
                    }
                    if (DEBUG) {
                        Log.d(TAG, "Scheduling traversal on next frame.");
                    }
                }
                scheduleFrameLocked(now);
            } else {
                Message msg = mHandler.obtainMessage(MSG_DO_SCHEDULE_CALLBACK, action);
@@ -305,27 +270,6 @@ public final class Choreographer {
        }
    }

    /**
     * Tells the choreographer that the application has actually drawn to a surface.
     *
     * It uses this information to determine whether to draw immediately or to
     * post a draw to the next vsync because it might otherwise block.
     */
    public void notifyDrawOccurred() {
        if (DEBUG) {
            Log.d(TAG, "Draw occurred.");
        }

        if (USE_PIPELINING) {
            synchronized (mLock) {
                if (!mDrewLastFrame) {
                    mDrewLastFrame = true;
                    scheduleFrameLocked(SystemClock.uptimeMillis());
                }
            }
        }
    }

    private void scheduleFrameLocked(long now) {
        if (!mFrameScheduled) {
            mFrameScheduled = true;
@@ -363,7 +307,6 @@ public final class Choreographer {
            }
            mFrameScheduled = false;
            mLastFrameTime = SystemClock.uptimeMillis();
            mDrewLastFrame = false;
        }

        doCallbacks(Choreographer.CALLBACK_INPUT);
@@ -382,11 +325,6 @@ public final class Choreographer {
        synchronized (mLock) {
            start = SystemClock.uptimeMillis();
            callbacks = mCallbackQueues[callbackType].extractDueCallbacksLocked(start);

            if (USE_PIPELINING && callbackType == CALLBACK_TRAVERSAL && mTraversalScheduled) {
                mTraversalScheduled = false;
                mHandler.removeMessages(MSG_DO_TRAVERSAL);
            }
        }

        if (callbacks != null) {
@@ -428,15 +366,6 @@ public final class Choreographer {
        }
    }

    void doTraversal() {
        synchronized (mLock) {
            if (mTraversalScheduled) {
                mTraversalScheduled = false;
                doCallbacks(CALLBACK_TRAVERSAL);
            }
        }
    }

    private void scheduleVsyncLocked() {
        mDisplayEventReceiver.scheduleVsync();
    }
@@ -483,9 +412,6 @@ public final class Choreographer {
                case MSG_DO_SCHEDULE_CALLBACK:
                    doScheduleCallback(msg.arg1);
                    break;
                case MSG_DO_TRAVERSAL:
                    doTraversal();
                    break;
            }
        }
    }
+0 −1
Original line number Diff line number Diff line
@@ -1994,7 +1994,6 @@ public final class ViewRootImpl implements ViewParent,

        final boolean fullRedrawNeeded = mFullRedrawNeeded;
        mFullRedrawNeeded = false;
        mChoreographer.notifyDrawOccurred();

        Trace.traceBegin(Trace.TRACE_TAG_VIEW, "draw");
        try {