Merge "Remove unused pipelining optimization." into jb-dev
This commit is contained in:
@@ -69,18 +69,9 @@ public final class Choreographer {
|
|||||||
private static final boolean USE_VSYNC = SystemProperties.getBoolean(
|
private static final boolean USE_VSYNC = SystemProperties.getBoolean(
|
||||||
"debug.choreographer.vsync", true);
|
"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_FRAME = 0;
|
||||||
private static final int MSG_DO_SCHEDULE_VSYNC = 1;
|
private static final int MSG_DO_SCHEDULE_VSYNC = 1;
|
||||||
private static final int MSG_DO_SCHEDULE_CALLBACK = 2;
|
private static final int MSG_DO_SCHEDULE_CALLBACK = 2;
|
||||||
private static final int MSG_DO_TRAVERSAL = 3;
|
|
||||||
|
|
||||||
private final Object mLock = new Object();
|
private final Object mLock = new Object();
|
||||||
|
|
||||||
@@ -94,8 +85,6 @@ public final class Choreographer {
|
|||||||
|
|
||||||
private boolean mFrameScheduled;
|
private boolean mFrameScheduled;
|
||||||
private long mLastFrameTime;
|
private long mLastFrameTime;
|
||||||
private boolean mDrewLastFrame;
|
|
||||||
private boolean mTraversalScheduled;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback type: Input callback. Runs first.
|
* Callback type: Input callback. Runs first.
|
||||||
@@ -236,35 +225,11 @@ public final class Choreographer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
synchronized (mLock) {
|
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 now = SystemClock.uptimeMillis();
|
||||||
final long dueTime = now + delayMillis;
|
final long dueTime = now + delayMillis;
|
||||||
mCallbackQueues[callbackType].addCallbackLocked(dueTime, action, token);
|
mCallbackQueues[callbackType].addCallbackLocked(dueTime, action, token);
|
||||||
|
|
||||||
if (dueTime <= now) {
|
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);
|
scheduleFrameLocked(now);
|
||||||
} else {
|
} else {
|
||||||
Message msg = mHandler.obtainMessage(MSG_DO_SCHEDULE_CALLBACK, action);
|
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) {
|
private void scheduleFrameLocked(long now) {
|
||||||
if (!mFrameScheduled) {
|
if (!mFrameScheduled) {
|
||||||
mFrameScheduled = true;
|
mFrameScheduled = true;
|
||||||
@@ -363,7 +307,6 @@ public final class Choreographer {
|
|||||||
}
|
}
|
||||||
mFrameScheduled = false;
|
mFrameScheduled = false;
|
||||||
mLastFrameTime = SystemClock.uptimeMillis();
|
mLastFrameTime = SystemClock.uptimeMillis();
|
||||||
mDrewLastFrame = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
doCallbacks(Choreographer.CALLBACK_INPUT);
|
doCallbacks(Choreographer.CALLBACK_INPUT);
|
||||||
@@ -382,11 +325,6 @@ public final class Choreographer {
|
|||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
start = SystemClock.uptimeMillis();
|
start = SystemClock.uptimeMillis();
|
||||||
callbacks = mCallbackQueues[callbackType].extractDueCallbacksLocked(start);
|
callbacks = mCallbackQueues[callbackType].extractDueCallbacksLocked(start);
|
||||||
|
|
||||||
if (USE_PIPELINING && callbackType == CALLBACK_TRAVERSAL && mTraversalScheduled) {
|
|
||||||
mTraversalScheduled = false;
|
|
||||||
mHandler.removeMessages(MSG_DO_TRAVERSAL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callbacks != null) {
|
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() {
|
private void scheduleVsyncLocked() {
|
||||||
mDisplayEventReceiver.scheduleVsync();
|
mDisplayEventReceiver.scheduleVsync();
|
||||||
}
|
}
|
||||||
@@ -483,9 +412,6 @@ public final class Choreographer {
|
|||||||
case MSG_DO_SCHEDULE_CALLBACK:
|
case MSG_DO_SCHEDULE_CALLBACK:
|
||||||
doScheduleCallback(msg.arg1);
|
doScheduleCallback(msg.arg1);
|
||||||
break;
|
break;
|
||||||
case MSG_DO_TRAVERSAL:
|
|
||||||
doTraversal();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1994,7 +1994,6 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
|
|
||||||
final boolean fullRedrawNeeded = mFullRedrawNeeded;
|
final boolean fullRedrawNeeded = mFullRedrawNeeded;
|
||||||
mFullRedrawNeeded = false;
|
mFullRedrawNeeded = false;
|
||||||
mChoreographer.notifyDrawOccurred();
|
|
||||||
|
|
||||||
Trace.traceBegin(Trace.TRACE_TAG_VIEW, "draw");
|
Trace.traceBegin(Trace.TRACE_TAG_VIEW, "draw");
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user