Bug 834243 - Revert to old behavior of holding off from starting the compositor until we have successfully preallocated its EGLSurface - r=snorp

This commit is contained in:
Benoit Jacob 2013-11-21 16:47:20 -05:00
Родитель f3d929fdf3
Коммит 76b65afddb
1 изменённых файлов: 24 добавлений и 4 удалений

Просмотреть файл

@ -46,6 +46,7 @@ public class GLController {
private EGL10 mEGL;
private EGLDisplay mEGLDisplay;
private EGLConfig mEGLConfig;
private EGLSurface mEGLSurfaceForCompositor;
private static final int LOCAL_EGL_OPENGL_ES2_BIT = 4;
@ -84,6 +85,11 @@ public class GLController {
mServerSurfaceValid = false;
if (mEGLSurfaceForCompositor != null) {
mEGL.eglDestroySurface(mEGLDisplay, mEGLSurfaceForCompositor);
mEGLSurfaceForCompositor = null;
}
// We need to coordinate with Gecko when pausing composition, to ensure
// that Gecko never executes a draw event while the compositor is paused.
// This is sent synchronously to make sure that we don't attempt to use
@ -132,6 +138,10 @@ public class GLController {
return;
}
if (!AttemptPreallocateEGLSurfaceForCompositor()) {
return;
}
// Only try to create the compositor if we have a valid surface and gecko is up. When these
// two conditions are satisfied, we can be relatively sure that the compositor creation will
// happen without needing to block anyhwere. Do it with a sync gecko event so that the
@ -215,10 +225,20 @@ public class GLController {
throw new GLControllerException("No suitable EGL configuration found");
}
@GeneratableAndroidBridgeTarget(allowMultithread = true, stubName = "CreateEGLSurfaceForCompositorWrapper")
private EGLSurface createEGLSurfaceForCompositor() {
private synchronized boolean AttemptPreallocateEGLSurfaceForCompositor() {
if (mEGLSurfaceForCompositor == null) {
initEGL();
return mEGL.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, mView.getNativeWindow(), null);
mEGLSurfaceForCompositor = mEGL.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, mView.getNativeWindow(), null);
}
return mEGLSurfaceForCompositor != null;
}
@GeneratableAndroidBridgeTarget(allowMultithread = true, stubName = "CreateEGLSurfaceForCompositorWrapper")
private synchronized EGLSurface createEGLSurfaceForCompositor() {
AttemptPreallocateEGLSurfaceForCompositor();
EGLSurface result = mEGLSurfaceForCompositor;
mEGLSurfaceForCompositor = null;
return result;
}
private String getEGLError() {