and this fixes compositing on newest intel+mesa drivers... wrong fb
authorCarsten Haitzler <raster@rasterman.com>
Tue, 13 Nov 2012 14:07:39 +0000 (14:07 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Tue, 13 Nov 2012 14:07:39 +0000 (14:07 +0000)
config wasa being chosen as it was done by hand not accounting for
multisample buffers. now using glxchoosefbconfig instead and it works.

SVN revision: 79232

ChangeLog
NEWS
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 1ad7e0b..97d91a5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,42 @@
+2012-11-13  Carsten Haitzler (The Rasterman)
+
+        * Fixed GLX native surface handling to use glXChooseFBConfig.
+        This frixes a break in compositing on new intel mesa drivers.
+
+2012-11-12  Mike Blumenkrantz
+
+        * Add eina_list_last_data_get
+        
+2012-11-10  Vincent Torri
+
+        * Fix build of eina_file on Solaris 10
+
+2012-11-09  Vincent Torri
+
+       * Fixed longstanding memset bug in evas box.
+
+2012-10-19  Cedric Bail
+
+       * Add eina_thread API.
+
+2012-10-19  Patryk Kaczmarek
+
+       * eina_stringshare_add_length return NULL when func args are wrong.
+
+2012-10-17  Carsten Haitzler (The Rasterman)
+
+        * Add eina_barrier API to cover pthread_barrier functionality
+        * Add eina_tmpstr_add() and eina_tmpstr_del().
+
+2012-10-04  Vincent Torri
+
+       * Update lz4 code to rev. 77. This fix compilation on NetBSD 5.0
+
+2012-10-31  Cedric Bail
+
+       * Add eet_list_entries().
+       * Add eet -l -v to give more information about an eet file.
+
 2012-09-27 Patryk Kaczmarek <patryk.k@samsung.com>
 
         * Add eet file handle null checks to eet_data_write_cipher(),
 
         * Fix EINA_INLIST_FOREACH_SAFE macro to work when inlist is not the
         first item in the struct.
-
-2012-10-04  Vincent Torri
-
-       * Update lz4 code to rev. 77. This fix compilation on NetBSD 5.0
-
-2012-10-17  Carsten Haitzler (The Rasterman)
-
-        * Add eina_barrier API to cover pthread_barrier functionality
-        * Add eina_tmpstr_add() and eina_tmpstr_del().
-
-2012-10-19  Patryk Kaczmarek
-
-       * eina_stringshare_add_length return NULL when func args are wrong.
-
-2012-10-19  Cedric Bail
-
-       * Add eina_thread API.
-
-2012-10-31  Cedric Bail
-
-       * Add eet_list_entries().
-       * Add eet -l -v to give more information about an eet file.
-
-2012-11-09  Vincent Torri
-
-       * Fixed longstanding memset bug in evas box.
-
-2012-11-10  Vincent Torri
-
-        * Fix build of eina_file on Solaris 10
-
-2012-11-12  Mike Blumenkrantz
-
-        * Add eina_list_last_data_get
diff --git a/NEWS b/NEWS
index 1e6e108..d955f48 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -22,3 +22,5 @@ Fixes:
     * Fix PPC (big endian) image codec bug.
     * Fix return value of eina_mmap_safety_enabled_set() and future
       eina_mmap_safety_enabled_get() returns after success
+    * Fixed GLX native surface handling to use glXChooseFBConfig.
+      This frixes a break in compositing on new intel mesa drivers.
index b8d7914..62b8ab8 100644 (file)
@@ -342,9 +342,8 @@ evgl_eng_window_surface_destroy(void *data, void *surface)
    eglDestroySurface(re->win->egl_disp, (EGLSurface)surface);
 #endif
 
-   surface = NULL;
-
    return 1;
+   if (surface) return 0;
 }
 
 static void *
@@ -1888,16 +1887,88 @@ eng_image_native_set(void *data, void *image, void *native)
                  n = calloc(1, sizeof(Native));
                  if (n)
                    {
-                      int pixmap_att[20];
-                      unsigned int target = 0;
-                      unsigned int i = 0;
+                      int pixmap_att[20], i;
+                      int config_attrs[40], num = 0;
+                      int tex_format = 0, tex_target = 0, yinvert = 0, mipmap = 0;
+                      unsigned int target;
+                      GLXFBConfig *configs;
+                      
+                      i = 0;
+                      config_attrs[i++] = GLX_BUFFER_SIZE;
+                      config_attrs[i++] = depth;
+                      if (depth == 32)
+                        {
+                           config_attrs[i++] = GLX_BIND_TO_TEXTURE_RGBA_EXT;
+                           config_attrs[i++] = 1;
+                        }
+                      else
+                        {
+                           config_attrs[i++] = GLX_BIND_TO_TEXTURE_RGB_EXT;
+                           config_attrs[i++] = 1;
+                        }
+                      
+#ifndef GLX_VISUAL_ID
+# define GLX_VISUAL_ID 0x800b
+#endif
+                      config_attrs[i++] = GLX_VISUAL_ID;
+                      config_attrs[i++] = XVisualIDFromVisual(vis);
+#ifndef GLX_SAMPLE_BUFFERS
+# define GLX_SAMPLE_BUFFERS 0x186a0
+#endif
+                      config_attrs[i++] = GLX_SAMPLE_BUFFERS;
+                      config_attrs[i++] = 0;
+                      config_attrs[i++] = GLX_DEPTH_SIZE;
+                      config_attrs[i++] = 0;
+                      config_attrs[i++] = GLX_STENCIL_SIZE;
+                      config_attrs[i++] = 0;
+                      config_attrs[i++] = GLX_AUX_BUFFERS;
+                      config_attrs[i++] = 0;
+                      config_attrs[i++] = GLX_STEREO;
+                      config_attrs[i++] = 0;
+                      
+                      config_attrs[i++] = 0;
+                      
+                      configs = glXChooseFBConfig(re->win->disp,
+                                                  re->win->screen,
+                                                  config_attrs,
+                                                  &num);
+                      if (configs)
+                        {
+                           int j = 0, val = 0;
+                           
+                           tex_format = GLX_TEXTURE_FORMAT_RGB_EXT;
+                           glXGetFBConfigAttrib(re->win->disp, configs[j],
+                                                GLX_ALPHA_SIZE, &val);
+                           if (val > 0)
+                             {
+                                glXGetFBConfigAttrib(re->win->disp, configs[j],
+                                                     GLX_BIND_TO_TEXTURE_RGBA_EXT, &val);
+                                if (val) tex_format = GLX_TEXTURE_FORMAT_RGBA_EXT;
+                             }
+                           else
+                             {
+                                glXGetFBConfigAttrib(re->win->disp, configs[j],
+                                                     GLX_BIND_TO_TEXTURE_RGB_EXT, &val);
+                                if (val) tex_format = GLX_TEXTURE_FORMAT_RGB_EXT;
+                             }
+                           glXGetFBConfigAttrib(re->win->disp, configs[j],
+                                                GLX_Y_INVERTED_EXT, &val);
+                           yinvert = val;
+                           glXGetFBConfigAttrib(re->win->disp, configs[j],
+                                                GLX_BIND_TO_TEXTURE_TARGETS_EXT,
+                                                &val);
+                           tex_target = val;
+                           glXGetFBConfigAttrib(re->win->disp, configs[j],
+                                                GLX_BIND_TO_MIPMAP_TEXTURE_EXT, &val);
+                           mipmap = val;
+                           n->fbc = configs[j];
+                           XFree(configs);
+                        }
                       
                       eina_hash_add(re->win->gl_context->shared->native_pm_hash, &pmid, im);
-                      if ((re->win->depth_cfg[depth].tex_target &
-                           GLX_TEXTURE_2D_BIT_EXT))
+                      if ((tex_target & GLX_TEXTURE_2D_BIT_EXT))
                         target = GLX_TEXTURE_2D_EXT;
-                      else if ((re->win->depth_cfg[depth].tex_target &
-                                GLX_TEXTURE_RECTANGLE_BIT_EXT))
+                      else if ((target & GLX_TEXTURE_RECTANGLE_BIT_EXT))
                         {
                            ERR("rect!!! (not handled)");
                            target = GLX_TEXTURE_RECTANGLE_EXT;
@@ -1905,31 +1976,27 @@ eng_image_native_set(void *data, void *image, void *native)
                       if (!target)
                         {
                            ERR("broken tex-from-pixmap");
-                           if (!(re->win->depth_cfg[depth].tex_target &
-                                 GLX_TEXTURE_2D_BIT_EXT))
+                           if (!(tex_target & GLX_TEXTURE_2D_BIT_EXT))
                              target = GLX_TEXTURE_RECTANGLE_EXT;
-                           else if (!(re->win->depth_cfg[depth].tex_target &
-                                      GLX_TEXTURE_RECTANGLE_BIT_EXT))
+                           else if (!(tex_target & GLX_TEXTURE_RECTANGLE_BIT_EXT))
                              target = GLX_TEXTURE_2D_EXT;
                         }
                       
+                      i = 0;
                       pixmap_att[i++] = GLX_TEXTURE_FORMAT_EXT;
-                      pixmap_att[i++] = re->win->depth_cfg[depth].tex_format;
+                      pixmap_att[i++] = tex_format;
                       pixmap_att[i++] = GLX_MIPMAP_TEXTURE_EXT;
-                      pixmap_att[i++] = re->win->depth_cfg[depth].mipmap;
-                      
+                      pixmap_att[i++] = mipmap;
                       if (target)
                         {
                            pixmap_att[i++] = GLX_TEXTURE_TARGET_EXT;
                            pixmap_att[i++] = target;
                         }
-                      
                       pixmap_att[i++] = 0;
                       
                       memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
                       n->pixmap = pm;
                       n->visual = vis;
-                      n->fbc = re->win->depth_cfg[depth].fbc;
                       if (glsym_glXCreatePixmap)
                         n->glx_pixmap = glsym_glXCreatePixmap(re->win->disp,
                                                               n->fbc,
@@ -1953,7 +2020,7 @@ eng_image_native_set(void *data, void *image, void *native)
                            if (target == GLX_TEXTURE_2D_EXT)
                              {
                                 im->native.target = GL_TEXTURE_2D;
-                                im->native.mipmap = re->win->depth_cfg[depth].mipmap;
+                                im->native.mipmap = mipmap;
                              }
 #  ifdef GL_TEXTURE_RECTANGLE_ARB
                            else if (target == GLX_TEXTURE_RECTANGLE_EXT)
@@ -1971,7 +2038,7 @@ eng_image_native_set(void *data, void *image, void *native)
                         }
                       else
                         ERR("GLX Pixmap create fail");
-                      im->native.yinvert     = re->win->depth_cfg[depth].yinvert;
+                      im->native.yinvert     = yinvert;
                       im->native.loose       = re->win->detected.loose_binding;
                       im->native.data        = n;
                       im->native.func.data   = re;
index f52caf4..8478ce9 100644 (file)
@@ -83,13 +83,6 @@ struct _Evas_GL_X11_Window
 #else
    GLXContext       context;
    GLXWindow        glxwin;
-   struct {
-      GLXFBConfig   fbc;
-      int           tex_format;
-      int           tex_target;
-      int           mipmap;
-      unsigned char yinvert : 1;
-   } depth_cfg[33]; // config for all 32 possible depths!
 
    struct {
       unsigned int loose_binding : 1;
index ccda5cc..c1543af 100644 (file)
@@ -264,9 +264,6 @@ eng_window_new(Display *disp,
      }
    if (gw->context)
      {
-        int i, j,  num;
-        GLXFBConfig *fbc;
-
         if (gw->glxwin)
           {
              if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
@@ -398,88 +395,6 @@ eng_window_new(Display *disp,
           {
              // noothing yet. add more cases and options over time
           }
-
-        fbc = glXGetFBConfigs(gw->disp, screen, &num);
-        if (!fbc)
-          {
-             ERR("glXGetFBConfigs() returned no fb configs");
-             eng_window_free(gw);
-             return NULL;
-          }
-        for (i = 0; i <= 32; i++)
-          {
-             for (j = 0; j < num; j++)
-               {
-                  XVisualInfo *vi;
-                  int vd;
-                  int alph, val, dbuf, stencil, tdepth;
-                  int rgba;
-
-                  vi = glXGetVisualFromFBConfig(gw->disp, fbc[j]);
-                  if (!vi) continue;
-                  vd = vi->depth;
-                  XFree(vi);
-
-                  if (vd != i) continue;
-
-                  glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_ALPHA_SIZE, &alph);
-                  glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BUFFER_SIZE, &val);
-
-                  if ((val != i) && ((val - alph) != i)) continue;
-
-                  val = 0;
-                  rgba = 0;
-
-                  if (i == 32)
-                    {
-                       glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_RGBA_EXT, &val);
-                       if (val)
-                         {
-                            rgba = 1;
-                            gw->depth_cfg[i].tex_format = GLX_TEXTURE_FORMAT_RGBA_EXT;
-                         }
-                    }
-                  if (!val)
-                    {
-                       if (rgba) continue;
-                       glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_RGB_EXT, &val);
-                       if (!val) continue;
-                       gw->depth_cfg[i].tex_format = GLX_TEXTURE_FORMAT_RGB_EXT;
-                    }
-
-                  dbuf = 0x7fff;
-                  glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DOUBLEBUFFER, &val);
-                  if (val > dbuf) continue;
-                  dbuf = val;
-
-                  stencil = 0x7fff;
-                  glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_STENCIL_SIZE, &val);
-                  if (val > stencil) continue;
-                  stencil = val;
-
-                  tdepth = 0x7fff;
-                  glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DEPTH_SIZE, &val);
-                  if (val > tdepth) continue;
-                  tdepth = val;
-
-                  glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_MIPMAP_TEXTURE_EXT, &val);
-                  if (val < 0) continue;
-                  gw->depth_cfg[i].mipmap = val;
-
-                  glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_Y_INVERTED_EXT, &val);
-                  gw->depth_cfg[i].yinvert = val;
-
-                  glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_TARGETS_EXT, &val);
-                  gw->depth_cfg[i].tex_target = val;
-
-                  gw->depth_cfg[i].fbc = fbc[j];
-               }
-          }
-        XFree(fbc);
-        if (!gw->depth_cfg[DefaultDepth(gw->disp, screen)].fbc)
-          {
-             WRN("texture from pixmap not going to work");
-          }
      }
 #endif