glx: Fix black windows in E on nvidia
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 3 Aug 2016 07:32:39 +0000 (16:32 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Wed, 3 Aug 2016 08:32:14 +0000 (17:32 +0900)
This fixes calls to glXCreatePixmap that would consistently
fail on nvidia >= 360.

It seems glXCreatePixmapEXT was used instead of glXCreatePixmap,
and that function always returned 0.

One could assume always using the non-EXT version of the
function should be preferred. Unfortunately, doing so for all
the other functions brings back the black windows.

I'm taking a very careful approach by doing this only for drivers
>= 360.

Fixes T3030

@fix

src/modules/evas/engines/gl_x11/evas_engine.c
src/modules/evas/engines/gl_x11/evas_engine.h
src/modules/evas/engines/gl_x11/evas_x_main.c

index 7a9f943..f5d783d 100644 (file)
@@ -1330,13 +1330,15 @@ gl_symbols(void)
 }
 
 void
-eng_gl_symbols(void)
+eng_gl_symbols(Eina_Bool noext_glXCreatePixmap)
 {
    static int done = 0;
 
    if (done) return;
 
 #ifdef GL_GLES
+   (void) noext_glXCreatePixmap;
+
 #define FINDSYM(dst, sym, typ) \
    if (glsym_eglGetProcAddress) { \
       if (!dst) dst = (typ)glsym_eglGetProcAddress(sym); \
@@ -1374,6 +1376,16 @@ eng_gl_symbols(void)
 
    glsym_evas_gl_symbols((void*)glsym_glXGetProcAddress);
 
+   if (noext_glXCreatePixmap)
+     {
+        /* Note for nvidia >= 360:
+         * glXBindTexImage{EXT,ARB} should be preferred over glXBindTexImage
+         * glXCreatePixmap should be preferred over glXCreatePixmap{EXT,ARB}
+         */
+        FINDSYM(glsym_glXCreatePixmap, "glXCreatePixmap", glsym_func_xid);
+        FINDSYM(glsym_glXDestroyPixmap, "glXDestroyPixmap", glsym_func_void);
+     }
+
    FINDSYM(glsym_glXBindTexImage, "glXBindTexImageEXT", glsym_func_void);
    FINDSYM(glsym_glXBindTexImage, "glXBindTexImageARB", glsym_func_void);
    FINDSYM(glsym_glXBindTexImage, "glXBindTexImage", glsym_func_void);
index f84313b..5ecdd59 100644 (file)
@@ -76,6 +76,7 @@ struct _Outbuf
       unsigned char msaa;
 #ifndef GL_GLES
       Eina_Bool     loose_binding : 1;
+      Eina_Bool     noext_glXCreatePixmap : 1;
 #endif
    } detected;
 
@@ -199,7 +200,7 @@ Evas_Engine_GL_Context *eng_outbuf_gl_context_get(Outbuf *ob);
 void *eng_outbuf_egl_display_get(Outbuf *ob);
 
 Eina_Bool eng_preload_make_current(void *data, void *doit);
-void eng_gl_symbols(void);
+void eng_gl_symbols(Eina_Bool noext_glXCreatePixmap);
 
 static inline int
 _re_wincheck(Outbuf *ob)
index f5e2edf..9e03851 100644 (file)
@@ -542,6 +542,7 @@ try_gles2:
              // ALSO as of some nvidia driver version loose binding is
              // probably not needed
              if (v1 < 195) gw->detected.loose_binding = 1;
+             if (v1 >= 360) gw->detected.noext_glXCreatePixmap = 1;
           }
      }
    else
@@ -557,7 +558,7 @@ try_gles2:
    gw->detected.msaa = val;
 #endif
 
-   eng_gl_symbols();
+   eng_gl_symbols(gw->detected.noext_glXCreatePixmap);
    gw->gl_context = glsym_evas_gl_common_context_new();
    if (!gw->gl_context)
      {