Loading core/java/android/view/GLRenderer.java +26 −0 Original line number Diff line number Diff line Loading @@ -554,6 +554,32 @@ public class GLRenderer extends HardwareRenderer { return true; } @Override public void invokeFunctor(long functor, boolean waitForCompletion) { boolean needsContext = !isEnabled() || checkRenderContext() == SURFACE_STATE_ERROR; boolean hasContext = !needsContext; if (needsContext) { GLRendererEglContext managedContext = (GLRendererEglContext) sEglContextStorage.get(); if (managedContext != null) { usePbufferSurface(managedContext.getContext()); hasContext = true; } } try { nInvokeFunctor(functor, hasContext); } finally { if (needsContext) { sEgl.eglMakeCurrent(sEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); } } } private static native void nInvokeFunctor(long functor, boolean hasContext); @Override void destroyHardwareResources(final View view) { if (view != null) { Loading core/java/android/view/HardwareRenderer.java +11 −0 Original line number Diff line number Diff line Loading @@ -437,6 +437,17 @@ public abstract class HardwareRenderer { */ abstract void attachFunctor(View.AttachInfo attachInfo, long functor); /** * Schedules the functor for execution in either kModeProcess or * kModeProcessNoContext, depending on whether or not there is an EGLContext. * * @param functor The native functor to invoke * @param waitForCompletion If true, this will not return until the functor * has invoked. If false, the functor may be invoked * asynchronously. */ public abstract void invokeFunctor(long functor, boolean waitForCompletion); /** * Initializes the hardware renderer for the specified surface and setup the * renderer for drawing, if needed. This is invoked when the ViewAncestor has Loading core/java/android/view/ThreadedRenderer.java +6 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,11 @@ public class ThreadedRenderer extends HardwareRenderer { nAttachFunctor(mNativeProxy, functor); } @Override public void invokeFunctor(long functor, boolean waitForCompletion) { nInvokeFunctor(mNativeProxy, functor, waitForCompletion); } @Override HardwareLayer createDisplayListLayer(int width, int height) { long layer = nCreateDisplayListLayer(mNativeProxy, width, height); Loading Loading @@ -266,6 +271,7 @@ public class ThreadedRenderer extends HardwareRenderer { private static native void nAttachFunctor(long nativeProxy, long functor); private static native void nDetachFunctor(long nativeProxy, long functor); private static native void nInvokeFunctor(long nativeProxy, long functor, boolean waitForCompletion); private static native long nCreateDisplayListLayer(long nativeProxy, int width, int height); private static native long nCreateTextureLayer(long nativeProxy); Loading core/jni/android_view_GLRenderer.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ #include <utils/Timers.h> #include <private/hwui/DrawGlInfo.h> #include <Caches.h> #include <Extensions.h> #include <LayerRenderer.h> Loading Loading @@ -155,6 +157,14 @@ static void android_view_GLRenderer_updateRenderNodeProperties(JNIEnv* env, jobj renderNode->updateProperties(); } static void android_view_GLRenderer_invokeFunctor(JNIEnv* env, jobject clazz, jlong functorPtr, jboolean hasContext) { using namespace android::uirenderer; Functor* functor = reinterpret_cast<Functor*>(functorPtr); DrawGlInfo::Mode mode = hasContext ? DrawGlInfo::kModeProcess : DrawGlInfo::kModeProcessNoContext; (*functor)(mode, NULL); } #endif // USE_OPENGL_RENDERER // ---------------------------------------------------------------------------- Loading Loading @@ -187,6 +197,7 @@ static JNINativeMethod gMethods[] = { { "nDestroyLayer", "(J)V", (void*) android_view_GLRenderer_destroyLayer }, { "nSetDisplayListData", "(JJ)V", (void*) android_view_GLRenderer_setDisplayListData }, { "nUpdateRenderNodeProperties", "(J)V", (void*) android_view_GLRenderer_updateRenderNodeProperties }, { "nInvokeFunctor", "(JZ)V", (void*) android_view_GLRenderer_invokeFunctor }, #endif { "setupShadersDiskCache", "(Ljava/lang/String;)V", Loading core/jni/android_view_ThreadedRenderer.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,13 @@ static void android_view_ThreadedRenderer_detachFunctor(JNIEnv* env, jobject cla proxy->detachFunctor(functor); } static void android_view_ThreadedRenderer_invokeFunctor(JNIEnv* env, jobject clazz, jlong proxyPtr, jlong functorPtr, jboolean waitForCompletion) { RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr); Functor* functor = reinterpret_cast<Functor*>(functorPtr); proxy->invokeFunctor(functor, waitForCompletion); } static void android_view_ThreadedRenderer_runWithGlContext(JNIEnv* env, jobject clazz, jlong proxyPtr, jobject jrunnable) { RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr); Loading Loading @@ -196,6 +203,7 @@ static JNINativeMethod gMethods[] = { { "nDestroyCanvas", "(J)V", (void*) android_view_ThreadedRenderer_destroyCanvas }, { "nAttachFunctor", "(JJ)V", (void*) android_view_ThreadedRenderer_attachFunctor }, { "nDetachFunctor", "(JJ)V", (void*) android_view_ThreadedRenderer_detachFunctor }, { "nInvokeFunctor", "(JJZ)V", (void*) android_view_ThreadedRenderer_invokeFunctor }, { "nRunWithGlContext", "(JLjava/lang/Runnable;)V", (void*) android_view_ThreadedRenderer_runWithGlContext }, { "nCreateDisplayListLayer", "(JII)J", (void*) android_view_ThreadedRenderer_createDisplayListLayer }, { "nCreateTextureLayer", "(J)J", (void*) android_view_ThreadedRenderer_createTextureLayer }, Loading Loading
core/java/android/view/GLRenderer.java +26 −0 Original line number Diff line number Diff line Loading @@ -554,6 +554,32 @@ public class GLRenderer extends HardwareRenderer { return true; } @Override public void invokeFunctor(long functor, boolean waitForCompletion) { boolean needsContext = !isEnabled() || checkRenderContext() == SURFACE_STATE_ERROR; boolean hasContext = !needsContext; if (needsContext) { GLRendererEglContext managedContext = (GLRendererEglContext) sEglContextStorage.get(); if (managedContext != null) { usePbufferSurface(managedContext.getContext()); hasContext = true; } } try { nInvokeFunctor(functor, hasContext); } finally { if (needsContext) { sEgl.eglMakeCurrent(sEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); } } } private static native void nInvokeFunctor(long functor, boolean hasContext); @Override void destroyHardwareResources(final View view) { if (view != null) { Loading
core/java/android/view/HardwareRenderer.java +11 −0 Original line number Diff line number Diff line Loading @@ -437,6 +437,17 @@ public abstract class HardwareRenderer { */ abstract void attachFunctor(View.AttachInfo attachInfo, long functor); /** * Schedules the functor for execution in either kModeProcess or * kModeProcessNoContext, depending on whether or not there is an EGLContext. * * @param functor The native functor to invoke * @param waitForCompletion If true, this will not return until the functor * has invoked. If false, the functor may be invoked * asynchronously. */ public abstract void invokeFunctor(long functor, boolean waitForCompletion); /** * Initializes the hardware renderer for the specified surface and setup the * renderer for drawing, if needed. This is invoked when the ViewAncestor has Loading
core/java/android/view/ThreadedRenderer.java +6 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,11 @@ public class ThreadedRenderer extends HardwareRenderer { nAttachFunctor(mNativeProxy, functor); } @Override public void invokeFunctor(long functor, boolean waitForCompletion) { nInvokeFunctor(mNativeProxy, functor, waitForCompletion); } @Override HardwareLayer createDisplayListLayer(int width, int height) { long layer = nCreateDisplayListLayer(mNativeProxy, width, height); Loading Loading @@ -266,6 +271,7 @@ public class ThreadedRenderer extends HardwareRenderer { private static native void nAttachFunctor(long nativeProxy, long functor); private static native void nDetachFunctor(long nativeProxy, long functor); private static native void nInvokeFunctor(long nativeProxy, long functor, boolean waitForCompletion); private static native long nCreateDisplayListLayer(long nativeProxy, int width, int height); private static native long nCreateTextureLayer(long nativeProxy); Loading
core/jni/android_view_GLRenderer.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ #include <utils/Timers.h> #include <private/hwui/DrawGlInfo.h> #include <Caches.h> #include <Extensions.h> #include <LayerRenderer.h> Loading Loading @@ -155,6 +157,14 @@ static void android_view_GLRenderer_updateRenderNodeProperties(JNIEnv* env, jobj renderNode->updateProperties(); } static void android_view_GLRenderer_invokeFunctor(JNIEnv* env, jobject clazz, jlong functorPtr, jboolean hasContext) { using namespace android::uirenderer; Functor* functor = reinterpret_cast<Functor*>(functorPtr); DrawGlInfo::Mode mode = hasContext ? DrawGlInfo::kModeProcess : DrawGlInfo::kModeProcessNoContext; (*functor)(mode, NULL); } #endif // USE_OPENGL_RENDERER // ---------------------------------------------------------------------------- Loading Loading @@ -187,6 +197,7 @@ static JNINativeMethod gMethods[] = { { "nDestroyLayer", "(J)V", (void*) android_view_GLRenderer_destroyLayer }, { "nSetDisplayListData", "(JJ)V", (void*) android_view_GLRenderer_setDisplayListData }, { "nUpdateRenderNodeProperties", "(J)V", (void*) android_view_GLRenderer_updateRenderNodeProperties }, { "nInvokeFunctor", "(JZ)V", (void*) android_view_GLRenderer_invokeFunctor }, #endif { "setupShadersDiskCache", "(Ljava/lang/String;)V", Loading
core/jni/android_view_ThreadedRenderer.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,13 @@ static void android_view_ThreadedRenderer_detachFunctor(JNIEnv* env, jobject cla proxy->detachFunctor(functor); } static void android_view_ThreadedRenderer_invokeFunctor(JNIEnv* env, jobject clazz, jlong proxyPtr, jlong functorPtr, jboolean waitForCompletion) { RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr); Functor* functor = reinterpret_cast<Functor*>(functorPtr); proxy->invokeFunctor(functor, waitForCompletion); } static void android_view_ThreadedRenderer_runWithGlContext(JNIEnv* env, jobject clazz, jlong proxyPtr, jobject jrunnable) { RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr); Loading Loading @@ -196,6 +203,7 @@ static JNINativeMethod gMethods[] = { { "nDestroyCanvas", "(J)V", (void*) android_view_ThreadedRenderer_destroyCanvas }, { "nAttachFunctor", "(JJ)V", (void*) android_view_ThreadedRenderer_attachFunctor }, { "nDetachFunctor", "(JJ)V", (void*) android_view_ThreadedRenderer_detachFunctor }, { "nInvokeFunctor", "(JJZ)V", (void*) android_view_ThreadedRenderer_invokeFunctor }, { "nRunWithGlContext", "(JLjava/lang/Runnable;)V", (void*) android_view_ThreadedRenderer_runWithGlContext }, { "nCreateDisplayListLayer", "(JII)J", (void*) android_view_ThreadedRenderer_createDisplayListLayer }, { "nCreateTextureLayer", "(J)J", (void*) android_view_ThreadedRenderer_createTextureLayer }, Loading