radeon: Expose a 32 bit RGBA fbconfig even when the screen depth is 16.
authorMichel Dänzer <daenzer@vmware.com>
Mon, 6 Apr 2009 06:59:57 +0000 (08:59 +0200)
committerMichel Dänzer <daenzer@vmware.com>
Mon, 6 Apr 2009 06:59:57 +0000 (08:59 +0200)
Otherwise current xserver / libGL no longer expose a 32 bit RGBA GLX visual,
and compiz fails.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=20479 .

src/mesa/drivers/dri/radeon/radeon_screen.c

index e964feb9cc4560096df6d5fd78d9531190fcbca1..882853344bb7186437c4dd1911b8d353745f89a3 100644 (file)
@@ -261,8 +261,6 @@ radeonFillInModes( __DRIscreenPrivate *psp,
     __GLcontextModes *m;
     unsigned depth_buffer_factor;
     unsigned back_buffer_factor;
-    GLenum fb_format;
-    GLenum fb_type;
     int i;
 
     /* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy
@@ -293,20 +291,27 @@ radeonFillInModes( __DRIscreenPrivate *psp,
     depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1;
     back_buffer_factor  = (have_back_buffer) ? 2 : 1;
 
-    if ( pixel_bits == 16 ) {
-        fb_format = GL_RGB;
-        fb_type = GL_UNSIGNED_SHORT_5_6_5;
-    }
-    else {
-        fb_format = GL_BGRA;
-        fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
-    }
+    if (pixel_bits == 16) {
+       __DRIconfig **configs_a8r8g8b8;
+       __DRIconfig **configs_r5g6b5;
+
+       configs_r5g6b5 = driCreateConfigs(GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
+                                         depth_bits_array, stencil_bits_array,
+                                         depth_buffer_factor, back_buffer_modes,
+                                         back_buffer_factor, msaa_samples_array,
+                                         1);
+       configs_a8r8g8b8 = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
+                                           depth_bits_array, stencil_bits_array,
+                                           1, back_buffer_modes, 1,
+                                           msaa_samples_array, 1);
+       configs = driConcatConfigs(configs_r5g6b5, configs_a8r8g8b8);
+   } else
+       configs = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
+                                  depth_bits_array, stencil_bits_array,
+                                  depth_buffer_factor,
+                                  back_buffer_modes, back_buffer_factor,
+                                  msaa_samples_array, 1);
 
-    configs = driCreateConfigs(fb_format, fb_type,
-                              depth_bits_array, stencil_bits_array,
-                              depth_buffer_factor,
-                              back_buffer_modes, back_buffer_factor,
-                              msaa_samples_array, 1);
     if (configs == NULL) {
        fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
                 __func__, __LINE__ );