intel: Add x8r8g8b8 visuals to DRI1 fbconfigs alongside a8r8gb8.
authorEric Anholt <eric@anholt.net>
Tue, 10 Feb 2009 22:30:38 +0000 (14:30 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 11 Feb 2009 02:45:18 +0000 (18:45 -0800)
This involved fixing driConcatConfigs to not return const (which had made a
mess of a previous patch too).

src/mesa/drivers/dri/common/utils.c
src/mesa/drivers/dri/common/utils.h
src/mesa/drivers/dri/intel/intel_screen.c
src/mesa/drivers/dri/swrast/swrast.c
src/mesa/drivers/dri/tdfx/tdfx_screen.c

index 5175ab0abbfd12c725d560c9d33e1d68459e2f15..6b44ed9a673cbdd48fb49559066a489187f22be1 100644 (file)
@@ -754,10 +754,10 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
     return configs;
 }
 
-const __DRIconfig **driConcatConfigs(const __DRIconfig **a,
-                                    const __DRIconfig **b)
+__DRIconfig **driConcatConfigs(__DRIconfig **a,
+                              __DRIconfig **b)
 {
-    const __DRIconfig **all;
+    __DRIconfig **all;
     int i, j, index;
 
     i = 0;
index a4ef5092478ab6f067db748a0acaf16ad4a0bf97..9e9e5bc224b35ba4c4bebea519eb309dbda52f78 100644 (file)
@@ -134,8 +134,8 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
                 const GLenum * db_modes, unsigned num_db_modes,
                 const uint8_t * msaa_samples, unsigned num_msaa_modes);
 
-const __DRIconfig **driConcatConfigs(const __DRIconfig **a,
-                                    const __DRIconfig **b);
+__DRIconfig **driConcatConfigs(__DRIconfig **a,
+                              __DRIconfig **b);
 
 int
 driGetConfigAttrib(const __DRIconfig *config,
index 4c06170cdf3593d2ac945da55f3756f5e33f55fd..a52271158c6bf43bea362d7ad7658aa47b7d753b 100644 (file)
@@ -465,8 +465,6 @@ intelFillInModes(__DRIscreenPrivate *psp,
    __GLcontextModes *m;
    unsigned depth_buffer_factor;
    unsigned back_buffer_factor;
-   GLenum fb_format;
-   GLenum fb_type;
    int i;
 
    /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
@@ -501,20 +499,33 @@ intelFillInModes(__DRIscreenPrivate *psp,
    back_buffer_factor = (have_back_buffer) ? 3 : 1;
 
    if (pixel_bits == 16) {
-      fb_format = GL_RGB;
-      fb_type = GL_UNSIGNED_SHORT_5_6_5;
+      configs = 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);
    }
    else {
-      fb_format = GL_BGRA;
-      fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
+      __DRIconfig **configs_a8r8g8b8;
+      __DRIconfig **configs_x8r8g8b8;
+
+      configs_a8r8g8b8 = 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_x8r8g8b8 = driCreateConfigs(GL_BGR, 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 = driConcatConfigs(configs_a8r8g8b8, configs_x8r8g8b8);
    }
 
-   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__);
@@ -686,7 +697,7 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp)
    };
    uint8_t depth_bits[4], stencil_bits[4], msaa_samples_array[1];
    int color;
-   const __DRIconfig **configs = NULL;
+   __DRIconfig **configs = NULL;
 
    /* Calling driInitExtensions here, with a NULL context pointer,
     * does not actually enable the extensions.  It just makes sure
@@ -747,17 +758,16 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp)
    fb_type[2] = GL_UNSIGNED_INT_8_8_8_8_REV;
 
    for (color = 0; color < ARRAY_SIZE(fb_format); color++) {
-      const __DRIconfig **new_configs;
-
-      new_configs = (const __DRIconfig **)
-        driCreateConfigs(fb_format[color], fb_type[color],
-                         depth_bits,
-                         stencil_bits,
-                         ARRAY_SIZE(depth_bits),
-                         back_buffer_modes,
-                         ARRAY_SIZE(back_buffer_modes),
-                          msaa_samples_array, ARRAY_SIZE(msaa_samples_array));
-
+      __DRIconfig **new_configs;
+
+      new_configs = driCreateConfigs(fb_format[color], fb_type[color],
+                                    depth_bits,
+                                    stencil_bits,
+                                    ARRAY_SIZE(depth_bits),
+                                    back_buffer_modes,
+                                    ARRAY_SIZE(back_buffer_modes),
+                                    msaa_samples_array,
+                                    ARRAY_SIZE(msaa_samples_array));
       if (configs == NULL)
         configs = new_configs;
       else
@@ -770,7 +780,7 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp)
       return NULL;
    }
 
-   return configs;
+   return (const __DRIconfig **)configs;
 }
 
 const struct __DriverAPIRec driDriverAPI = {
index b00f4ff2fe2e980eed8d23d88f534d3475b8303f..2e7f11327e6301e987d9ca76930cedd8bdde6895 100644 (file)
@@ -127,7 +127,7 @@ setupLoaderExtensions(__DRIscreen *psp,
     }
 }
 
-static const __DRIconfig **
+static __DRIconfig **
 swrastFillInModes(__DRIscreen *psp,
                  unsigned pixel_bits, unsigned depth_bits,
                  unsigned stencil_bits, GLboolean have_back_buffer)
@@ -200,7 +200,7 @@ swrastFillInModes(__DRIscreen *psp,
        return NULL;
     }
 
-    return (const __DRIconfig **)configs;
+    return configs;
 }
 
 static __DRIscreen *
@@ -209,7 +209,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
 {
     static const __DRIextension *emptyExtensionList[] = { NULL };
     __DRIscreen *psp;
-    const __DRIconfig **configs8, **configs16, **configs24, **configs32;
+    __DRIconfig **configs8, **configs16, **configs24, **configs32;
 
     (void) data;
 
@@ -231,7 +231,8 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
 
     configs16 = driConcatConfigs(configs8, configs16);
     configs24 = driConcatConfigs(configs16, configs24);
-    *driver_configs = driConcatConfigs(configs24, configs32);
+    *driver_configs = (const __DRIconfig **)
+       driConcatConfigs(configs24, configs32);
 
     driInitExtensions( NULL, card_extensions, GL_FALSE );
 
index 6d509a4d88319aa7708838e4db2cac0afae3f4cb..5f2f5cfff5179cbe03c37ad15cda0d739e71291d 100644 (file)
@@ -380,14 +380,15 @@ tdfxFillInModes(__DRIscreenPrivate *psp,
 
        msaa_samples_array[0] = 0;
 
-       return driCreateConfigs(
-               deep ? GL_RGBA : GL_RGB,
-               deep ? GL_UNSIGNED_INT_8_8_8_8 : GL_UNSIGNED_SHORT_5_6_5,
-               depth_bits_array,
-               stencil_bits_array,
-               deep ? 2 : 4,
-               db_modes, 2,
-                msaa_samples_array, 1);
+       return (const __DRIconfig **)
+          driCreateConfigs(deep ? GL_RGBA : GL_RGB,
+                           deep ? GL_UNSIGNED_INT_8_8_8_8 :
+                                  GL_UNSIGNED_SHORT_5_6_5,
+                           depth_bits_array,
+                           stencil_bits_array,
+                           deep ? 2 : 4,
+                           db_modes, 2,
+                           msaa_samples_array, 1);
 }
 
 /**