OSDN Git Service

EGL: Allow creating a SurfaceTexture EGLSurface.
authorJamie Gennis <jgennis@google.com>
Mon, 25 Apr 2011 23:41:11 +0000 (16:41 -0700)
committerJamie Gennis <jgennis@google.com>
Mon, 25 Apr 2011 23:41:11 +0000 (16:41 -0700)
This change removes the check that disallowed the creation of an
EGLSurface that would send frames to a SurfaceTexture.

Change-Id: I44c6d5df503cc676a88144d72d39b414692ce4c9

libs/gui/tests/SurfaceTextureClient_test.cpp
opengl/libs/EGL/egl.cpp

index 348171d..db781de 100644 (file)
@@ -64,7 +64,7 @@ TEST_F(SurfaceTextureClientTest, ANativeWindowLockFails) {
     ASSERT_EQ(BAD_VALUE, ANativeWindow_lock(anw.get(), &buf, NULL));
 }
 
-TEST_F(SurfaceTextureClientTest, EglCreateWindowSurfaceFails) {
+TEST_F(SurfaceTextureClientTest, EglCreateWindowSurfaceSucceeds) {
     sp<ANativeWindow> anw(mSTC);
 
     EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
@@ -94,8 +94,8 @@ TEST_F(SurfaceTextureClientTest, EglCreateWindowSurfaceFails) {
 
     EGLSurface eglSurface = eglCreateWindowSurface(dpy, myConfig, anw.get(),
             NULL);
-    ASSERT_EQ(EGL_NO_SURFACE, eglSurface);
-    ASSERT_EQ(EGL_BAD_NATIVE_WINDOW, eglGetError());
+    ASSERT_NE(EGL_NO_SURFACE, eglSurface);
+    ASSERT_EQ(EGL_SUCCESS, eglGetError());
 
     eglTerminate(dpy);
 }
index 9cf7223..aabba28 100644 (file)
@@ -1132,16 +1132,6 @@ 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<ANativeWindow*>(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)) {