[Mesa-dev] [PATCH 4/7] dri: Move API version validation into dri/common.

Kenneth Graunke kenneth at whitecape.org
Thu Sep 26 21:11:00 PDT 2013


On 09/26/2013 08:35 PM, Eric Anholt wrote:
> i965, i915, radeon, r200, swrast, and nouveau were mostly trying to do the
> same logic, except where they failed to.  Notably, swrast had code that
> appeared to try to enable GLES1/2 but forgot to set api_mask (thus
> preventing any gles context from being created), and the non-intel drivers
> didn't support MESA_GL_VERSION_OVERRIDE.
> 
> nouveau still relies on _mesa_compute_version(), because I don't know what
> its limits actually are, and gallium drivers don't declare limits up front
> at all.  I think I've heard talk about doing so, though.
> ---
>  src/gallium/state_trackers/dri/common/dri_screen.c | 13 +++++
>  src/gallium/state_trackers/dri/drm/dri2.c          |  8 ---
>  src/mesa/drivers/dri/common/dri_util.c             | 68 +++++++++++++++++++++-
>  src/mesa/drivers/dri/common/dri_util.h             |  5 ++
>  src/mesa/drivers/dri/i915/intel_context.c          | 44 --------------
>  src/mesa/drivers/dri/i915/intel_screen.c           | 36 +++---------
>  src/mesa/drivers/dri/i915/intel_screen.h           |  5 --
>  src/mesa/drivers/dri/i965/intel_context.c          | 44 --------------
>  src/mesa/drivers/dri/i965/intel_screen.c           | 44 +++++---------
>  src/mesa/drivers/dri/i965/intel_screen.h           |  5 --
>  src/mesa/drivers/dri/nouveau/nouveau_context.c     | 23 --------
>  src/mesa/drivers/dri/nouveau/nouveau_screen.c      | 12 ++++
>  src/mesa/drivers/dri/r200/r200_context.c           | 14 -----
>  src/mesa/drivers/dri/radeon/radeon_screen.c        |  3 +
>  src/mesa/drivers/dri/swrast/swrast.c               | 20 ++-----
>  15 files changed, 125 insertions(+), 219 deletions(-)
> 
> diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
> index 779741e..ff61b56 100644
> --- a/src/gallium/state_trackers/dri/common/dri_screen.c
> +++ b/src/gallium/state_trackers/dri/common/dri_screen.c
> @@ -438,6 +438,19 @@ dri_init_screen_helper(struct dri_screen *screen,
>  
>     dri_postprocessing_init(screen);
>  
> +   /* gallium drivers don't declare what version of GL they support, so we
> +    * check the computed Mesa context version after context creation and fail
> +    * out then.
> +    */
> +   if (screen->st_api->profile_mask & ST_PROFILE_DEFAULT_MASK)
> +      screen->sPriv->max_gl_compat_version = 21;

Eh...shouldn't this be 30?

Otherwise, this patch looks good to me.  I remember being really unhappy
with the amount of code duplication when all this was added.  This seems
like a good way to consolidate it.  And you get MESA_GL_VERSION_OVERRIDE
support in all drivers, and fix version checking bugs too...


More information about the mesa-dev mailing list