[Mesa-dev] [PATCH 3/5] Add a place to enable extensions that are common to all DRI drivers

Ian Romanick idr at freedesktop.org
Mon Jun 30 15:48:41 PDT 2014


On 06/13/2014 05:59 PM, Neil Roberts wrote:
> This adds a function called _mesa_init_driver_extensions that is called by all
> DRI-based drivers. The intention is that any extensions that are implemented
> directly by _mesa_init_driver_functions without any driver-specific
> entrypoints will be enabled here.

Ken and I talked about this a couple weeks back, but it seems that
neither one of us sent a message to the list.  My recollection is that
we both think this (and Jason's suggestion variation) is a bad idea.  We
don't want to enable new extensions, perhaps "surprisingly," on hardware
that nobody is building or testing.  We also don't want to gate landing
new feature work on testing old hardware.  For example, it's bad enough
that this work has been blocked waiting for reviews... I wouldn't want
to block it further waiting for someone to test r200.

The cost of adding (and maintaining) the enables in individual drivers
is really low.  Having the cost be non-zero means that somebody has to
think and do something before an extension gets enabled in a driver.  I
think that's a good thing.

> ---
>  src/mesa/drivers/common/driverfuncs.c          | 8 ++++++++
>  src/mesa/drivers/common/driverfuncs.h          | 2 ++
>  src/mesa/drivers/dri/i915/intel_extensions.c   | 3 +++
>  src/mesa/drivers/dri/i965/intel_extensions.c   | 3 +++
>  src/mesa/drivers/dri/nouveau/nouveau_context.c | 1 +
>  src/mesa/drivers/dri/r200/r200_context.c       | 2 ++
>  src/mesa/drivers/dri/radeon/radeon_context.c   | 2 ++
>  src/mesa/drivers/dri/swrast/swrast.c           | 1 +
>  8 files changed, 22 insertions(+)
> 
> diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
> index 6ece5d8..ee8b390 100644
> --- a/src/mesa/drivers/common/driverfuncs.c
> +++ b/src/mesa/drivers/common/driverfuncs.c
> @@ -326,3 +326,11 @@ _mesa_init_driver_state(struct gl_context *ctx)
>  
>     ctx->Driver.DrawBuffer(ctx, ctx->Color.DrawBuffer[0]);
>  }
> +
> +/**
> + * Enable extensions that are available for all DRI-based drivers.
> + */
> +void
> +_mesa_init_driver_extensions(struct gl_context *ctx)
> +{
> +}
> diff --git a/src/mesa/drivers/common/driverfuncs.h b/src/mesa/drivers/common/driverfuncs.h
> index 6b9a900..520c059 100644
> --- a/src/mesa/drivers/common/driverfuncs.h
> +++ b/src/mesa/drivers/common/driverfuncs.h
> @@ -33,5 +33,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver);
>  extern void
>  _mesa_init_driver_state(struct gl_context *ctx);
>  
> +extern void
> +_mesa_init_driver_extensions(struct gl_context *ctx);
>  
>  #endif
> diff --git a/src/mesa/drivers/dri/i915/intel_extensions.c b/src/mesa/drivers/dri/i915/intel_extensions.c
> index 76f608e..3a8744a 100644
> --- a/src/mesa/drivers/dri/i915/intel_extensions.c
> +++ b/src/mesa/drivers/dri/i915/intel_extensions.c
> @@ -31,6 +31,7 @@
>  #include "intel_context.h"
>  #include "intel_extensions.h"
>  #include "intel_reg.h"
> +#include "drivers/common/driverfuncs.h"
>  #include "utils.h"
>  
>  /**
> @@ -44,6 +45,8 @@ intelInitExtensions(struct gl_context *ctx)
>  
>     assert(intel->gen == 2 || intel->gen == 3);
>  
> +   _mesa_init_driver_extensions(ctx);
> +
>     ctx->Extensions.ARB_draw_elements_base_vertex = true;
>     ctx->Extensions.ARB_explicit_attrib_location = true;
>     ctx->Extensions.ARB_framebuffer_object = true;
> diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
> index 39d0ab5..fe47464 100644
> --- a/src/mesa/drivers/dri/i965/intel_extensions.c
> +++ b/src/mesa/drivers/dri/i965/intel_extensions.c
> @@ -31,6 +31,7 @@
>  #include "intel_batchbuffer.h"
>  #include "intel_reg.h"
>  #include "utils.h"
> +#include "drivers/common/driverfuncs.h"
>  
>  /**
>   * Test if we can use MI_LOAD_REGISTER_MEM from an untrusted batchbuffer.
> @@ -162,6 +163,8 @@ intelInitExtensions(struct gl_context *ctx)
>  
>     assert(brw->gen >= 4);
>  
> +   _mesa_init_driver_extensions(ctx);
> +
>     ctx->Extensions.ARB_buffer_storage = true;
>     ctx->Extensions.ARB_depth_buffer_float = true;
>     ctx->Extensions.ARB_depth_clamp = true;
> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
> index f8c8dc3..ad7ee86 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
> @@ -183,6 +183,7 @@ nouveau_context_init(struct gl_context *ctx, gl_api api,
>  	}
>  
>  	/* Enable any supported extensions. */
> +        _mesa_init_driver_extensions(ctx);
>  	ctx->Extensions.EXT_blend_color = true;
>  	ctx->Extensions.EXT_blend_minmax = true;
>  	ctx->Extensions.EXT_texture_filter_anisotropic = true;
> diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
> index 71dfcf3..93ca23d 100644
> --- a/src/mesa/drivers/dri/r200/r200_context.c
> +++ b/src/mesa/drivers/dri/r200/r200_context.c
> @@ -366,6 +366,8 @@ GLboolean r200CreateContext( gl_api api,
>     _math_matrix_ctr( &rmesa->tmpmat );
>     _math_matrix_set_identity( &rmesa->tmpmat );
>  
> +   _mesa_init_driver_extensions(ctx);
> +
>     ctx->Extensions.ARB_occlusion_query = true;
>     ctx->Extensions.ARB_point_sprite = true;
>     ctx->Extensions.ARB_texture_border_clamp = true;
> diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
> index 1ceb4ab..fd8e95b 100644
> --- a/src/mesa/drivers/dri/radeon/radeon_context.c
> +++ b/src/mesa/drivers/dri/radeon/radeon_context.c
> @@ -328,6 +328,8 @@ r100CreateContext( gl_api api,
>        _math_matrix_set_identity( &rmesa->tmpmat[i] );
>     }
>  
> +   _mesa_init_driver_extensions(ctx);
> +
>     ctx->Extensions.ARB_occlusion_query = true;
>     ctx->Extensions.ARB_texture_border_clamp = true;
>     ctx->Extensions.ARB_texture_cube_map = true;
> diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
> index 8881381..71e2184 100644
> --- a/src/mesa/drivers/dri/swrast/swrast.c
> +++ b/src/mesa/drivers/dri/swrast/swrast.c
> @@ -720,6 +720,7 @@ dri_create_context(gl_api api,
>      }
>  
>      _mesa_meta_init(mesaCtx);
> +    _mesa_init_driver_extensions(mesaCtx);
>      _mesa_enable_sw_extensions(mesaCtx);
>  
>      _mesa_compute_version(mesaCtx);
> 



More information about the mesa-dev mailing list