Module: Mesa
Branch: master
Commit: 160c3617fc8867edc445b1ba62fc996c4630cc35
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=160c3617fc8867edc445b1ba62fc996c4630cc35

Author: Eric Anholt <[email protected]>
Date:   Thu Feb 26 00:18:46 2009 -0800

intel: Disable creating DRI2 FBconfigs with depth size != color size.

While it's a nice idea to be able to allow clients to choose a smaller
(or bigger for 16bpp screens!) depth size, right now DRI2 hands back a buffer
with a size that matches the drawable, rather than being based off of the
visual.  This led to problems in readback as parts of the driver disagreed
on what format the depth buffer was really in.

Fixes the remainder of bug #19447.

---

 src/mesa/drivers/dri/intel/intel_screen.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index df40469..09eba13 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -765,13 +765,34 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp)
    fb_format[2] = GL_BGRA;
    fb_type[2] = GL_UNSIGNED_INT_8_8_8_8_REV;
 
+   depth_bits[0] = 0;
+   stencil_bits[0] = 0;
+
    for (color = 0; color < ARRAY_SIZE(fb_format); color++) {
       __DRIconfig **new_configs;
+      int depth_factor;
+
+      /* With DRI2 right now, GetBuffers always returns a depth/stencil buffer
+       * with the same cpp as the drawable.  So we can't support depth cpp !=
+       * color cpp currently.
+       */
+      if (fb_type[color] == GL_UNSIGNED_SHORT_5_6_5) {
+        depth_bits[1] = 16;
+        stencil_bits[1] = 0;
+
+        depth_factor = 2;
+      } else {
+        depth_bits[1] = 24;
+        stencil_bits[1] = 0;
+        depth_bits[2] = 24;
+        stencil_bits[2] = 8;
 
+        depth_factor = 3;
+      }
       new_configs = driCreateConfigs(fb_format[color], fb_type[color],
                                     depth_bits,
                                     stencil_bits,
-                                    ARRAY_SIZE(depth_bits),
+                                    depth_factor,
                                     back_buffer_modes,
                                     ARRAY_SIZE(back_buffer_modes),
                                     msaa_samples_array,

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to