summaryrefslogtreecommitdiffstats
path: root/opengl/java/android
diff options
context:
space:
mode:
authorJack Palevich <jackpal@google.com>2010-03-06 10:39:27 -0800
committerJack Palevich <jackpal@google.com>2010-03-06 10:39:27 -0800
commit4a2221ec4a929976be570ad096252c8dea326e19 (patch)
treef26fca340770c2784f7f08c59316c7ee951af791 /opengl/java/android
parent931bf89d327ecf07301231fd86b17deac535feaa (diff)
downloadframeworks_base-4a2221ec4a929976be570ad096252c8dea326e19.zip
frameworks_base-4a2221ec4a929976be570ad096252c8dea326e19.tar.gz
frameworks_base-4a2221ec4a929976be570ad096252c8dea326e19.tar.bz2
Fix inverted release-EGLContext-on-pause logic.
This works around a bug in the "Q3Dimension MSM7500" driver. That driver only supports a single active EGLContext, so we must release and restore the EGLContext when pausing and unpausing. Unfortunately the test for deciding whether to release the context was inverted. We were releasing the context on every device besides the MSM7500 devices, which was a performance drain, and we were not releasing the context on the MSM7500, which meant the underlying driver bug was not worked around. Now we release the EGL context when pausing only on the devices that have the bug.
Diffstat (limited to 'opengl/java/android')
-rw-r--r--opengl/java/android/opengl/GLSurfaceView.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java
index a186e58..71411ef 100644
--- a/opengl/java/android/opengl/GLSurfaceView.java
+++ b/opengl/java/android/opengl/GLSurfaceView.java
@@ -149,6 +149,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
private final static boolean LOG_THREADS = false;
private final static boolean LOG_SURFACE = false;
private final static boolean LOG_RENDERER = false;
+ private final static boolean LOG_RENDERER_DRAW_FRAME = false;
// Work-around for bug 2263168
private final static boolean DRAW_TWICE_AFTER_SIZE_CHANGED = true;
/**
@@ -1209,15 +1210,18 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
}
if (createEglSurface) {
+ if (LOG_SURFACE) {
+ Log.w("GLThread", "egl createSurface");
+ }
gl = (GL10) mEglHelper.createSurface(getHolder());
sGLThreadManager.checkGLDriver(gl);
- if (LOG_RENDERER) {
- Log.w("GLThread", "onSurfaceCreated");
- }
createEglSurface = false;
}
if (createEglContext) {
+ if (LOG_RENDERER) {
+ Log.w("GLThread", "onSurfaceCreated");
+ }
mRenderer.onSurfaceCreated(gl, mEglHelper.mEglConfig);
createEglContext = false;
}
@@ -1230,7 +1234,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
sizeChanged = false;
}
- if (LOG_RENDERER) {
+ if (LOG_RENDERER_DRAW_FRAME) {
Log.w("GLThread", "onDrawFrame");
}
mRenderer.onDrawFrame(gl);
@@ -1438,6 +1442,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
}
private static class GLThreadManager {
+ private static String TAG = "GLThreadManager";
public synchronized void threadExiting(GLThread thread) {
if (LOG_THREADS) {
@@ -1483,7 +1488,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
public synchronized boolean shouldReleaseEGLContextWhenPausing() {
checkGLESVersion();
- return mMultipleGLESContextsAllowed;
+ return !mMultipleGLESContextsAllowed;
}
public synchronized void checkGLDriver(GL10 gl) {
@@ -1493,6 +1498,10 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
String renderer = gl.glGetString(GL10.GL_RENDERER);
mMultipleGLESContextsAllowed =
! renderer.startsWith(kMSM7K_RENDERER_PREFIX);
+ if (LOG_SURFACE) {
+ Log.w(TAG, "checkGLDriver renderer = \"" + renderer + "\" multipleContextsAllowed = "
+ + mMultipleGLESContextsAllowed);
+ }
notifyAll();
}
mGLESDriverCheckComplete = true;
@@ -1507,6 +1516,10 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
if (mGLESVersion >= kGLES_20) {
mMultipleGLESContextsAllowed = true;
}
+ if (LOG_SURFACE) {
+ Log.w(TAG, "checkGLESVersion mGLESVersion =" +
+ " " + mGLESVersion + " mMultipleGLESContextsAllowed = " + mMultipleGLESContextsAllowed);
+ }
mGLESVersionCheckComplete = true;
}
}