summaryrefslogtreecommitdiffstats
path: root/core/java/android/view
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2014-03-31 18:04:06 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-03-31 18:04:06 +0000
commit8e150fef2bb0d3e672b7ecba2caa35ee37a8c27d (patch)
treed6eecbef1fdb7d88a345c879db177e434573a9c3 /core/java/android/view
parent877ffde5f6b5d605a0c3727f8538c8f48427fdab (diff)
parent0d1f634f4b5e1bb37aa51777efb6a68619488d01 (diff)
downloadframeworks_base-8e150fef2bb0d3e672b7ecba2caa35ee37a8c27d.zip
frameworks_base-8e150fef2bb0d3e672b7ecba2caa35ee37a8c27d.tar.gz
frameworks_base-8e150fef2bb0d3e672b7ecba2caa35ee37a8c27d.tar.bz2
Merge "Add invokeFunctor"
Diffstat (limited to 'core/java/android/view')
-rw-r--r--core/java/android/view/GLRenderer.java26
-rw-r--r--core/java/android/view/HardwareRenderer.java11
-rw-r--r--core/java/android/view/ThreadedRenderer.java6
3 files changed, 43 insertions, 0 deletions
diff --git a/core/java/android/view/GLRenderer.java b/core/java/android/view/GLRenderer.java
index 125d11e..d6e1781 100644
--- a/core/java/android/view/GLRenderer.java
+++ b/core/java/android/view/GLRenderer.java
@@ -555,6 +555,32 @@ public class GLRenderer extends HardwareRenderer {
}
@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) {
safelyRun(new Runnable() {
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index 34efcf5..4f646e1 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -438,6 +438,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
* potentially lost the hardware renderer. The hardware renderer should be
diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java
index 2a488a0..7b8a1ff 100644
--- a/core/java/android/view/ThreadedRenderer.java
+++ b/core/java/android/view/ThreadedRenderer.java
@@ -186,6 +186,11 @@ public class ThreadedRenderer extends HardwareRenderer {
}
@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);
return HardwareLayer.adoptDisplayListLayer(this, layer);
@@ -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);