summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/intel
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2012-08-02 17:13:17 -0700
committerChad Versace <[email protected]>2012-08-07 09:30:34 -0700
commite943e5c291c5f4c017f9f5a483f1940313333fc3 (patch)
tree1cbb87edac3820757191855f2ac8c02f89bc9b0f /src/mesa/drivers/dri/intel
parent8b5d68dd28a78c2250bfc4a7fa62cd9e5cdd756e (diff)
intel: Advertise multisample DRI2 configs on gen >= 6
This turns on window system MSAA. This patch changes the id of many GLX visuals and configs, but that couldn't be prevented. I attempted to preserve the id's of extant configs by appending the multisample configs to the end of the extant ones. But somewhere, perhaps in the X server, the configs are reordered with multisample configs interspersed among the singlesample ones. Test results: Tested with xonotic and `glxgears -samples 1` on Ivybridge. No piglit regressions on Ivybridge. On Sandybridge, passes 68/70 of oglconform's winsys multisample tests. The two failing tests are: multisample(advanced.pixelmap.depth) multisample(advanced.pixelmap.depthCopyPixels) These tests hang the gpu (on kernel 3.4.6) due to a glDrawPixels/glReadPixels pair on an MSAA depth buffer. I don't expect realworld apps to do that, so I'm not too concerned about the hang. On Ivybridge, passes 69/70. The failing case is multisample(advanced.line.changeWidth). Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/intel')
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c54
1 files changed, 51 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index cd057acc183..5c38c8d3772 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -829,7 +829,9 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
};
static const uint8_t singlesample_samples[1] = {0};
+ static const uint8_t multisample_samples[2] = {4, 8};
+ struct intel_screen *screen = dri_screen->driverPrivate;
GLenum fb_format[3];
GLenum fb_type[3];
uint8_t depth_bits[4], stencil_bits[4];
@@ -844,9 +846,7 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
fb_format[2] = GL_BGRA;
fb_type[2] = GL_UNSIGNED_INT_8_8_8_8_REV;
- /* Generate a rich set of useful configs that do not include an
- * accumulation buffer.
- */
+ /* Generate singlesample configs without accumulation buffer. */
for (int i = 0; i < ARRAY_SIZE(fb_format); i++) {
__DRIconfig **new_configs;
const int num_depth_stencil_bits = 2;
@@ -899,6 +899,54 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
configs = driConcatConfigs(configs, new_configs);
}
+ /* Generate multisample configs.
+ *
+ * This loop breaks early, and hence is a no-op, on gen < 6.
+ *
+ * Multisample configs must follow the singlesample configs in order to
+ * work around an X server bug present in 1.12. The X server chooses to
+ * associate the first listed RGBA888-Z24S8 config, regardless of its
+ * sample count, with the 32-bit depth visual used for compositing.
+ *
+ * Only doublebuffer configs with GLX_SWAP_UNDEFINED_OML behavior are
+ * supported. Singlebuffer configs are not supported because no one wants
+ * them. GLX_SWAP_COPY_OML is not supported due to page flipping.
+ */
+ for (int i = 0; i < ARRAY_SIZE(fb_format); i++) {
+ if (screen->gen < 6)
+ break;
+
+ __DRIconfig **new_configs;
+ const int num_depth_stencil_bits = 2;
+ int num_msaa_modes;
+
+ depth_bits[0] = 0;
+ stencil_bits[0] = 0;
+
+ if (fb_type[i] == GL_UNSIGNED_SHORT_5_6_5) {
+ depth_bits[1] = 16;
+ stencil_bits[1] = 0;
+ } else {
+ depth_bits[1] = 24;
+ stencil_bits[1] = 8;
+ }
+
+ if (screen->gen >= 7)
+ num_msaa_modes = 2;
+ else if (screen->gen == 6)
+ num_msaa_modes = 1;
+
+ new_configs = driCreateConfigs(fb_format[i], fb_type[i],
+ depth_bits,
+ stencil_bits,
+ num_depth_stencil_bits,
+ back_buffer_modes + 1, 1,
+ multisample_samples,
+ num_msaa_modes,
+ false);
+ configs = driConcatConfigs(configs, new_configs);
+ }
+
if (configs == NULL) {
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
__LINE__);