summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-07-29 17:55:48 -0700
committerMathias Agopian <mathias@google.com>2011-08-01 14:06:20 -0700
commit982d2da4eef0a48d84d88e3e1d2d1dbdbb413a27 (patch)
tree2a5036e97e04b0467eab8f73a283f0a0730c0d61 /opengl
parent03116780a17cb6db7c926d01630cb9f68a19539b (diff)
downloadframeworks_base-982d2da4eef0a48d84d88e3e1d2d1dbdbb413a27.zip
frameworks_base-982d2da4eef0a48d84d88e3e1d2d1dbdbb413a27.tar.gz
frameworks_base-982d2da4eef0a48d84d88e3e1d2d1dbdbb413a27.tar.bz2
connect/disconnect is now called from our EGL wrapper
the original connect/disconnect hooks are deprecated and replace by api_connect/api_disconnect. the original hooks are no no-ops. api_connect/api_disconnect is now only called from the android framework. Bug: 5057915 Change-Id: I8ca64cd1acd6cabf915bf54689ec2e5f6dfa495a
Diffstat (limited to 'opengl')
-rw-r--r--opengl/libs/EGL/eglApi.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index ba5d29a..10cea22 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -363,6 +363,12 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config,
EGLConfig iConfig = dp->configs[intptr_t(config)].config;
EGLint format;
+ if (native_window_api_connect(window, NATIVE_WINDOW_API_EGL) != OK) {
+ LOGE("EGLNativeWindowType %p already connected to another API",
+ window);
+ return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
+ }
+
// set the native window's buffers format to match this config
if (cnx->egl.eglGetConfigAttrib(iDpy,
iConfig, EGL_NATIVE_VISUAL_ID, &format)) {
@@ -371,6 +377,7 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config,
if (err != 0) {
LOGE("error setting native window pixel format: %s (%d)",
strerror(-err), err);
+ native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL);
return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
}
}
@@ -383,6 +390,10 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config,
dp->configs[intptr_t(config)].impl, cnx);
return s;
}
+
+ // EGLSurface creation failed
+ native_window_set_buffers_format(window, 0);
+ native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL);
}
return EGL_NO_SURFACE;
}
@@ -443,8 +454,12 @@ EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
EGLBoolean result = s->cnx->egl.eglDestroySurface(
dp->disp[s->impl].dpy, s->surface);
if (result == EGL_TRUE) {
- if (s->win != NULL) {
- native_window_set_buffers_geometry(s->win.get(), 0, 0, 0);
+ ANativeWindow* const window = s->win.get();
+ if (window != NULL) {
+ native_window_set_buffers_format(window, 0);
+ if (native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL)) {
+ LOGE("EGLNativeWindowType %p disconnected failed", window);
+ }
}
_s.terminate();
}