[Mesa-dev] [PATCH] gallium: add st_api feature mask to prevent advertising MS visuals

Brian Paul brianp at vmware.com
Tue May 22 07:23:37 PDT 2012


On 05/21/2012 03:46 PM, Christoph Bumiller wrote:
> ---
>   src/gallium/include/state_tracker/st_api.h         |   16 +++++++++++++
>   src/gallium/state_trackers/dri/common/dri_screen.c |   23 +++++++++++--------
>   src/gallium/state_trackers/vega/vg_manager.c       |    1 +
>   src/mesa/state_tracker/st_manager.c                |    1 +
>   4 files changed, 31 insertions(+), 10 deletions(-)

Hi Christopher, could you give a bit more background on this?  I'm not 
sure I understand the problem you're trying to solve here.



> diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
> index 3af1dfc..86ab02d 100644
> --- a/src/gallium/include/state_tracker/st_api.h
> +++ b/src/gallium/include/state_tracker/st_api.h
> @@ -70,6 +70,17 @@ enum st_profile_type
>   #define ST_PROFILE_OPENGL_ES2_MASK   (1<<  ST_PROFILE_OPENGL_ES2)
>
>   /**
> + * Optional API/state tracker features.
> + */
> +enum st_api_feature
> +{
> +   ST_API_FEATURE_MS_VISUALS  /**<  support for multisample visuals */
> +};
> +
> +/* for feature_mask in st_api */
> +#define ST_API_FEATURE_MS_VISUALS_MASK (1<<  ST_API_FEATURE_MS_VISUALS)
> +
> +/**
>    * New context flags for GL 3.0 and beyond.
>    *
>    * Profile information (core vs. compatibilty for OpenGL 3.2+) is communicated
> @@ -430,6 +441,11 @@ struct st_api
>      unsigned profile_mask;
>
>      /**
> +    * The supported optional features.  Tested with ST_FEATURE_*_MASK.
> +    */
> +   unsigned feature_mask;
> +
> +   /**
>       * Destroy the API.
>       */
>      void (*destroy)(struct st_api *stapi);
> diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
> index 24efbde..744cc00 100644
> --- a/src/gallium/state_trackers/dri/common/dri_screen.c
> +++ b/src/gallium/state_trackers/dri/common/dri_screen.c
> @@ -75,7 +75,7 @@ dri_fill_in_modes(struct dri_screen *screen,
>      uint8_t msaa_samples_array[5];
>      unsigned depth_buffer_factor;
>      unsigned back_buffer_factor;
> -   unsigned msaa_samples_factor;
> +   unsigned msaa_samples_factor, msaa_samples_max;
>      unsigned i;
>      struct pipe_screen *p_screen = screen->base.screen;
>      boolean pf_r5g6b5, pf_a8r8g8b8, pf_x8r8g8b8;
> @@ -89,6 +89,9 @@ dri_fill_in_modes(struct dri_screen *screen,
>      stencil_bits_array[0] = 0;
>      depth_buffer_factor = 1;
>
> +   msaa_samples_max =
> +      (screen->st_api->feature_mask&  ST_API_FEATURE_MS_VISUALS) ? 8 : 1;

Where does 8 come from?  The old value, below, was 4.  I don't know 
where that came from either.


> +
>      pf_x8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24X8_UNORM,
>   					    PIPE_TEXTURE_2D, 0,
>                                               PIPE_BIND_DEPTH_STENCIL);
> @@ -149,11 +152,11 @@ dri_fill_in_modes(struct dri_screen *screen,
>      /* also test color for msaa 2/4/6/8 - just assume it'll work for all depth buffers */
>      if (pf_r5g6b5) {
>         msaa_samples_factor = 1;
> -      for (i = 1; i<  5; i++) {
> +      for (i = 2; i<= msaa_samples_max; i += 2) {
>            if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_B5G6R5_UNORM,
> -						   PIPE_TEXTURE_2D, i*2,
> +						   PIPE_TEXTURE_2D, i,
>                                                      PIPE_BIND_RENDER_TARGET)) {
> -            msaa_samples_array[msaa_samples_factor] = i * 2;
> +            msaa_samples_array[msaa_samples_factor] = i;
>               msaa_samples_factor++;
>            }
>         }
> @@ -168,11 +171,11 @@ dri_fill_in_modes(struct dri_screen *screen,
>
>      if (pf_a8r8g8b8) {
>         msaa_samples_factor = 1;
> -      for (i = 1; i<  5; i++) {
> +      for (i = 2; i<= msaa_samples_max; i += 2) {
>            if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8A8_UNORM,
> -						   PIPE_TEXTURE_2D, i*2,
> +						   PIPE_TEXTURE_2D, i,
>                                                      PIPE_BIND_RENDER_TARGET)) {
> -            msaa_samples_array[msaa_samples_factor] = i * 2;
> +            msaa_samples_array[msaa_samples_factor] = i;
>               msaa_samples_factor++;
>            }
>         }
> @@ -190,11 +193,11 @@ dri_fill_in_modes(struct dri_screen *screen,
>
>      if (pf_x8r8g8b8) {
>         msaa_samples_factor = 1;
> -      for (i = 1; i<  5; i++) {
> +      for (i = 2; i<= msaa_samples_max; i += 2) {
>            if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8X8_UNORM,
> -						   PIPE_TEXTURE_2D, i*2,
> +						   PIPE_TEXTURE_2D, i,
>                                                      PIPE_BIND_RENDER_TARGET)) {
> -            msaa_samples_array[msaa_samples_factor] = i * 2;
> +            msaa_samples_array[msaa_samples_factor] = i;
>               msaa_samples_factor++;
>            }
>         }
> diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c
> index e88f5f1..660a7af 100644
> --- a/src/gallium/state_trackers/vega/vg_manager.c
> +++ b/src/gallium/state_trackers/vega/vg_manager.c
> @@ -369,6 +369,7 @@ static const struct st_api vg_api = {
>      "Vega " VEGA_VERSION_STRING,
>      ST_API_OPENVG,
>      ST_PROFILE_DEFAULT_MASK,
> +   0,
>      vg_api_destroy,
>      vg_api_get_proc_address,
>      vg_api_create_context,
> diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
> index d54b7ed..748624f 100644
> --- a/src/mesa/state_tracker/st_manager.c
> +++ b/src/mesa/state_tracker/st_manager.c
> @@ -891,6 +891,7 @@ static const struct st_api st_gl_api = {
>      ST_PROFILE_OPENGL_ES2_MASK |
>   #endif
>      0,
> +   0,
>      st_api_destroy,
>      st_api_get_proc_address,
>      st_api_create_context,


-Brian


More information about the mesa-dev mailing list