From bae716bc153962c3ac79660bf32e5c50f0de343d Mon Sep 17 00:00:00 2001 From: Jamie Gennis Date: Mon, 14 Mar 2011 15:34:04 -0700 Subject: SurfaceTexture: disallow unsupported uses. This change makes the ANativeWindow_lock NDK function error out if it is passed an ANativeWindow with a concrete type that is not Surface. It also makes eglCreateWindowSurface fail if it is passed a SurfaceTextureClient as its 'window' argument. Bug: 4087277 Change-Id: Ie68c50c52d88f72d8a387f6c094908044c83a88c --- opengl/libs/EGL/egl.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'opengl/libs') diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp index 3d5a4d1..f4a1650 100644 --- a/opengl/libs/EGL/egl.cpp +++ b/opengl/libs/EGL/egl.cpp @@ -1094,6 +1094,16 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config, EGLConfig iConfig = dp->configs[intptr_t(config)].config; EGLint format; + // for now fail if the window is not a Surface. + int type = -1; + ANativeWindow* anw = reinterpret_cast(window); + if ((anw->query(window, NATIVE_WINDOW_CONCRETE_TYPE, &type) != 0) || + (type == NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT)) { + LOGE("native window is a SurfaceTextureClient (currently " + "unsupported)"); + 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)) { -- cgit v1.1