[Mesa-dev] [PATCH 15/15] intel: Advertise multisample DRI2 configs on gen >= 6
Ian Romanick
idr at freedesktop.org
Mon Jul 23 13:45:58 PDT 2012
On 07/21/2012 05:36 PM, Chad Versace wrote:
> This turns on window system multisampling.
>
> No Piglit regressions on Ivybridge.
>
> Tested with `glxgears -samples 1`.
>
> Passes 53/70 of oglconform's winsys multisample tests. The failing tests
> mostly consist of those that call glDrawPixels on the depth and stencil
> buffer (which fail due to a swrast fallback) or do fancy things with the
> msaa alpha enums.
>
> CC: Eric Anholt <eric at anholt.net>
> CC: Ian Romanick <idr at freedesktop.org>
> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
> ---
> src/mesa/drivers/dri/intel/intel_screen.c | 44 +++++++++++++++++++++++++++++--
> 1 file changed, 42 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
> index 61daea7..420901e 100644
> --- a/src/mesa/drivers/dri/intel/intel_screen.c
> +++ b/src/mesa/drivers/dri/intel/intel_screen.c
> @@ -866,14 +866,54 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
> GLX_SWAP_UNDEFINED_OML, GLX_NONE, GLX_SWAP_COPY_OML,
> };
>
> - static const uint8_t msaa_samples[] = {0};
> + static const uint8_t msaa_samples[] = {0, 4};
> +
> + struct intel_screen *screen = dri_screen->driverPrivate;
> +
> + int num_msaa_modes;
> + if (screen->gen >= 6)
> + num_msaa_modes = 2;
> + else
> + num_msaa_modes = 1;
>
> /* Starting with DRI2 protocol version 1.1 we can request a depth/stencil
> * buffer that has a different number of bits per pixel than the color
> * buffer. This isn't yet supported here.
> */
> struct config_params params[] = {
> - /* Configs without accumulation buffer. */
> + /* Multisample configs. */
The new configs should go at the end. This is to maintain the numbering
that I mentioned in the previous patch.
> + {
> + .color_format = GL_RGB,
> + .color_type = GL_UNSIGNED_SHORT_5_6_5,
> + .depth_sizes = {0, 16},
> + .stencil_sizes = {0, 0},
> + .num_depth_stencil_sizes = 2,
> + .num_back_buffer_modes = 1,
> + .num_msaa_modes = num_msaa_modes,
> + .enable_accum = false,
> + },
> + {
> + .color_format = GL_BGR,
> + .color_type = GL_UNSIGNED_INT_8_8_8_8_REV,
> + .depth_sizes = {0, 24},
> + .stencil_sizes = {0, 8},
It occurs to me that there is some advantage in advertising 24/0 formats
on GPUs that require the use of separate stencil. On these GPUs we
allocate a giant (32-bits per pixel!) stencil buffer that the
application is never going to use.
Of course, adding these in a sensible way will ruin the config
numbering. Alas.
> + .num_depth_stencil_sizes = 2,
> + .num_back_buffer_modes = 1,
> + .num_msaa_modes = num_msaa_modes,
> + .enable_accum = false,
> + },
> + {
> + .color_format = GL_BGRA,
> + .color_type = GL_UNSIGNED_INT_8_8_8_8_REV,
> + .depth_sizes = {0, 24},
> + .stencil_sizes = {0, 8},
> + .num_depth_stencil_sizes = 2,
> + .num_back_buffer_modes = 1,
> + .num_msaa_modes = num_msaa_modes,
> + .enable_accum = false,
> + },
> +
> + /* Single sample configs. */
> {
> .color_format = GL_RGB,
> .color_type = GL_UNSIGNED_SHORT_5_6_5,
>
More information about the mesa-dev
mailing list