Loading core/java/android/os/Message.java +7 −10 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ package android.os; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.util.TimeUtils; /** Loading Loading @@ -368,13 +365,13 @@ public final class Message implements Parcelable { * * Asynchronous messages represent interrupts or events that do not require global ordering * with represent to synchronous messages. Asynchronous messages are not subject to * the synchronization barriers introduced by {@link MessageQueue#acquireSyncBarrier()}. * the synchronization barriers introduced by {@link MessageQueue#enqueueSyncBarrier(long)}. * * @return True if the message is asynchronous. * * @see #setAsynchronous(boolean) * @see MessageQueue#acquireSyncBarrier() * @see MessageQueue#releaseSyncBarrier() * @see MessageQueue#enqueueSyncBarrier(long) * @see MessageQueue#removeSyncBarrier(int) * * @hide */ Loading @@ -387,13 +384,13 @@ public final class Message implements Parcelable { * * Asynchronous messages represent interrupts or events that do not require global ordering * with represent to synchronous messages. Asynchronous messages are not subject to * the synchronization barriers introduced by {@link MessageQueue#acquireSyncBarrier()}. * the synchronization barriers introduced by {@link MessageQueue#enqueueSyncBarrier(long)}. * * @param async True if the message is asynchronous. * * @see #isAsynchronous() * @see MessageQueue#acquireSyncBarrier() * @see MessageQueue#releaseSyncBarrier() * @see MessageQueue#enqueueSyncBarrier(long) * @see MessageQueue#removeSyncBarrier(int) * * @hide */ Loading Loading @@ -506,7 +503,7 @@ public final class Message implements Parcelable { Messenger.writeMessengerOrNullToParcel(replyTo, dest); } private final void readFromParcel(Parcel source) { private void readFromParcel(Parcel source) { what = source.readInt(); arg1 = source.readInt(); arg2 = source.readInt(); Loading core/java/android/view/GLES20Canvas.java +7 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,13 @@ class GLES20Canvas extends HardwareCanvas { private static native int nCallDrawGLFunction(int renderer, int drawGLFunction); @Override public int invokeFunctors(Rect dirty) { return nInvokeFunctors(mRenderer, dirty); } private static native int nInvokeFunctors(int renderer, Rect dirty); /////////////////////////////////////////////////////////////////////////// // Memory /////////////////////////////////////////////////////////////////////////// Loading core/java/android/view/HardwareCanvas.java +12 −0 Original line number Diff line number Diff line Loading @@ -98,4 +98,16 @@ public abstract class HardwareCanvas extends Canvas { // Noop - this is done in the display list recorder subclass return DisplayList.STATUS_DONE; } /** * Invoke all the functors who requested to be invoked during the previous frame. * * @param dirty The region to redraw when the functors return {@link DisplayList#STATUS_DRAW} * * @return One of {@link DisplayList#STATUS_DONE}, {@link DisplayList#STATUS_DRAW} or * {@link DisplayList#STATUS_INVOKE} */ public int invokeFunctors(Rect dirty) { return DisplayList.STATUS_DONE; } } core/java/android/view/HardwareRenderer.java +44 −10 Original line number Diff line number Diff line Loading @@ -503,6 +503,8 @@ public abstract class HardwareRenderer { static final int SURFACE_STATE_SUCCESS = 1; static final int SURFACE_STATE_UPDATED = 2; static final int FUNCTOR_PROCESS_DELAY = 2; static EGL10 sEgl; static EGLDisplay sEglDisplay; static EGLConfig sEglConfig; Loading Loading @@ -549,7 +551,9 @@ public abstract class HardwareRenderer { private boolean mDestroyed; private final Rect mRedrawClip = new Rect(); private final int[] mSurfaceSize = new int[2]; private final FunctorsRunnable mFunctorsRunnable = new FunctorsRunnable(); GlRenderer(int glVersion, boolean translucent) { mGlVersion = glVersion; Loading Loading @@ -957,6 +961,24 @@ public abstract class HardwareRenderer { void onPostDraw() { } class FunctorsRunnable implements Runnable { View.AttachInfo attachInfo; @Override public void run() { final HardwareRenderer renderer = attachInfo.mHardwareRenderer; if (renderer == null || !renderer.isEnabled() || renderer != GlRenderer.this) { return; } final int surfaceState = checkCurrent(); if (surfaceState != SURFACE_STATE_ERROR) { int status = mCanvas.invokeFunctors(mRedrawClip); handleFunctorStatus(attachInfo, status); } } } @Override boolean draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callbacks, Rect dirty) { Loading Loading @@ -1051,15 +1073,7 @@ public abstract class HardwareRenderer { } } if (status != DisplayList.STATUS_DONE) { if (mRedrawClip.isEmpty()) { attachInfo.mViewRootImpl.invalidate(); } else { attachInfo.mViewRootImpl.invalidateChildInParent( null, mRedrawClip); mRedrawClip.setEmpty(); } } handleFunctorStatus(attachInfo, status); } else { // Shouldn't reach here view.draw(canvas); Loading Loading @@ -1111,6 +1125,26 @@ public abstract class HardwareRenderer { return false; } private void handleFunctorStatus(View.AttachInfo attachInfo, int status) { // If the draw flag is set, functors will be invoked while executing // the tree of display lists if ((status & DisplayList.STATUS_DRAW) != 0) { if (mRedrawClip.isEmpty()) { attachInfo.mViewRootImpl.invalidate(); } else { attachInfo.mViewRootImpl.invalidateChildInParent(null, mRedrawClip); mRedrawClip.setEmpty(); } } if ((status & DisplayList.STATUS_INVOKE) != 0) { attachInfo.mHandler.removeCallbacks(mFunctorsRunnable); mFunctorsRunnable.attachInfo = attachInfo; // delay the functor callback by a few ms so it isn't polled constantly attachInfo.mHandler.postDelayed(mFunctorsRunnable, FUNCTOR_PROCESS_DELAY); } } /** * Ensures the current EGL context is the one we expect. * Loading core/jni/android_view_GLES20Canvas.cpp +19 −2 Original line number Diff line number Diff line Loading @@ -163,6 +163,21 @@ static jint android_view_GLES20Canvas_callDrawGLFunction(JNIEnv* env, jobject cl return renderer->callDrawGLFunction(functor, dirty); } static jint android_view_GLES20Canvas_invokeFunctors(JNIEnv* env, jobject clazz, OpenGLRenderer* renderer, jobject dirty) { android::uirenderer::Rect bounds; status_t status = renderer->invokeFunctors(bounds); if (status != DrawGlInfo::kStatusDone && dirty != NULL) { env->CallVoidMethod(dirty, gRectClassInfo.set, int(bounds.left), int(bounds.top), int(bounds.right), int(bounds.bottom)); } return status; } // ---------------------------------------------------------------------------- // Misc // ---------------------------------------------------------------------------- static jint android_view_GLES20Canvas_getMaxTextureWidth(JNIEnv* env, jobject clazz) { return Caches::getInstance().maxTextureSize; } Loading Loading @@ -824,6 +839,8 @@ static JNINativeMethod gMethods[] = { { "nGetStencilSize", "()I", (void*) android_view_GLES20Canvas_getStencilSize }, { "nCallDrawGLFunction", "(II)I", (void*) android_view_GLES20Canvas_callDrawGLFunction }, { "nInvokeFunctors", "(ILandroid/graphics/Rect;)I", (void*) android_view_GLES20Canvas_invokeFunctors }, { "nSave", "(II)I", (void*) android_view_GLES20Canvas_save }, { "nRestore", "(I)V", (void*) android_view_GLES20Canvas_restore }, Loading Loading
core/java/android/os/Message.java +7 −10 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ package android.os; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.util.TimeUtils; /** Loading Loading @@ -368,13 +365,13 @@ public final class Message implements Parcelable { * * Asynchronous messages represent interrupts or events that do not require global ordering * with represent to synchronous messages. Asynchronous messages are not subject to * the synchronization barriers introduced by {@link MessageQueue#acquireSyncBarrier()}. * the synchronization barriers introduced by {@link MessageQueue#enqueueSyncBarrier(long)}. * * @return True if the message is asynchronous. * * @see #setAsynchronous(boolean) * @see MessageQueue#acquireSyncBarrier() * @see MessageQueue#releaseSyncBarrier() * @see MessageQueue#enqueueSyncBarrier(long) * @see MessageQueue#removeSyncBarrier(int) * * @hide */ Loading @@ -387,13 +384,13 @@ public final class Message implements Parcelable { * * Asynchronous messages represent interrupts or events that do not require global ordering * with represent to synchronous messages. Asynchronous messages are not subject to * the synchronization barriers introduced by {@link MessageQueue#acquireSyncBarrier()}. * the synchronization barriers introduced by {@link MessageQueue#enqueueSyncBarrier(long)}. * * @param async True if the message is asynchronous. * * @see #isAsynchronous() * @see MessageQueue#acquireSyncBarrier() * @see MessageQueue#releaseSyncBarrier() * @see MessageQueue#enqueueSyncBarrier(long) * @see MessageQueue#removeSyncBarrier(int) * * @hide */ Loading Loading @@ -506,7 +503,7 @@ public final class Message implements Parcelable { Messenger.writeMessengerOrNullToParcel(replyTo, dest); } private final void readFromParcel(Parcel source) { private void readFromParcel(Parcel source) { what = source.readInt(); arg1 = source.readInt(); arg2 = source.readInt(); Loading
core/java/android/view/GLES20Canvas.java +7 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,13 @@ class GLES20Canvas extends HardwareCanvas { private static native int nCallDrawGLFunction(int renderer, int drawGLFunction); @Override public int invokeFunctors(Rect dirty) { return nInvokeFunctors(mRenderer, dirty); } private static native int nInvokeFunctors(int renderer, Rect dirty); /////////////////////////////////////////////////////////////////////////// // Memory /////////////////////////////////////////////////////////////////////////// Loading
core/java/android/view/HardwareCanvas.java +12 −0 Original line number Diff line number Diff line Loading @@ -98,4 +98,16 @@ public abstract class HardwareCanvas extends Canvas { // Noop - this is done in the display list recorder subclass return DisplayList.STATUS_DONE; } /** * Invoke all the functors who requested to be invoked during the previous frame. * * @param dirty The region to redraw when the functors return {@link DisplayList#STATUS_DRAW} * * @return One of {@link DisplayList#STATUS_DONE}, {@link DisplayList#STATUS_DRAW} or * {@link DisplayList#STATUS_INVOKE} */ public int invokeFunctors(Rect dirty) { return DisplayList.STATUS_DONE; } }
core/java/android/view/HardwareRenderer.java +44 −10 Original line number Diff line number Diff line Loading @@ -503,6 +503,8 @@ public abstract class HardwareRenderer { static final int SURFACE_STATE_SUCCESS = 1; static final int SURFACE_STATE_UPDATED = 2; static final int FUNCTOR_PROCESS_DELAY = 2; static EGL10 sEgl; static EGLDisplay sEglDisplay; static EGLConfig sEglConfig; Loading Loading @@ -549,7 +551,9 @@ public abstract class HardwareRenderer { private boolean mDestroyed; private final Rect mRedrawClip = new Rect(); private final int[] mSurfaceSize = new int[2]; private final FunctorsRunnable mFunctorsRunnable = new FunctorsRunnable(); GlRenderer(int glVersion, boolean translucent) { mGlVersion = glVersion; Loading Loading @@ -957,6 +961,24 @@ public abstract class HardwareRenderer { void onPostDraw() { } class FunctorsRunnable implements Runnable { View.AttachInfo attachInfo; @Override public void run() { final HardwareRenderer renderer = attachInfo.mHardwareRenderer; if (renderer == null || !renderer.isEnabled() || renderer != GlRenderer.this) { return; } final int surfaceState = checkCurrent(); if (surfaceState != SURFACE_STATE_ERROR) { int status = mCanvas.invokeFunctors(mRedrawClip); handleFunctorStatus(attachInfo, status); } } } @Override boolean draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callbacks, Rect dirty) { Loading Loading @@ -1051,15 +1073,7 @@ public abstract class HardwareRenderer { } } if (status != DisplayList.STATUS_DONE) { if (mRedrawClip.isEmpty()) { attachInfo.mViewRootImpl.invalidate(); } else { attachInfo.mViewRootImpl.invalidateChildInParent( null, mRedrawClip); mRedrawClip.setEmpty(); } } handleFunctorStatus(attachInfo, status); } else { // Shouldn't reach here view.draw(canvas); Loading Loading @@ -1111,6 +1125,26 @@ public abstract class HardwareRenderer { return false; } private void handleFunctorStatus(View.AttachInfo attachInfo, int status) { // If the draw flag is set, functors will be invoked while executing // the tree of display lists if ((status & DisplayList.STATUS_DRAW) != 0) { if (mRedrawClip.isEmpty()) { attachInfo.mViewRootImpl.invalidate(); } else { attachInfo.mViewRootImpl.invalidateChildInParent(null, mRedrawClip); mRedrawClip.setEmpty(); } } if ((status & DisplayList.STATUS_INVOKE) != 0) { attachInfo.mHandler.removeCallbacks(mFunctorsRunnable); mFunctorsRunnable.attachInfo = attachInfo; // delay the functor callback by a few ms so it isn't polled constantly attachInfo.mHandler.postDelayed(mFunctorsRunnable, FUNCTOR_PROCESS_DELAY); } } /** * Ensures the current EGL context is the one we expect. * Loading
core/jni/android_view_GLES20Canvas.cpp +19 −2 Original line number Diff line number Diff line Loading @@ -163,6 +163,21 @@ static jint android_view_GLES20Canvas_callDrawGLFunction(JNIEnv* env, jobject cl return renderer->callDrawGLFunction(functor, dirty); } static jint android_view_GLES20Canvas_invokeFunctors(JNIEnv* env, jobject clazz, OpenGLRenderer* renderer, jobject dirty) { android::uirenderer::Rect bounds; status_t status = renderer->invokeFunctors(bounds); if (status != DrawGlInfo::kStatusDone && dirty != NULL) { env->CallVoidMethod(dirty, gRectClassInfo.set, int(bounds.left), int(bounds.top), int(bounds.right), int(bounds.bottom)); } return status; } // ---------------------------------------------------------------------------- // Misc // ---------------------------------------------------------------------------- static jint android_view_GLES20Canvas_getMaxTextureWidth(JNIEnv* env, jobject clazz) { return Caches::getInstance().maxTextureSize; } Loading Loading @@ -824,6 +839,8 @@ static JNINativeMethod gMethods[] = { { "nGetStencilSize", "()I", (void*) android_view_GLES20Canvas_getStencilSize }, { "nCallDrawGLFunction", "(II)I", (void*) android_view_GLES20Canvas_callDrawGLFunction }, { "nInvokeFunctors", "(ILandroid/graphics/Rect;)I", (void*) android_view_GLES20Canvas_invokeFunctors }, { "nSave", "(II)I", (void*) android_view_GLES20Canvas_save }, { "nRestore", "(I)V", (void*) android_view_GLES20Canvas_restore }, Loading