drirc: add mesa_extension_override option
This allows specific per-application override. The existing MESA_EXTENSION_OVERRIDE env variable is kept. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13364>
This commit is contained in:
parent
50c983402e
commit
f5dc334b6d
|
@ -78,7 +78,8 @@ Core Mesa environment variables
|
|||
:envvar:`MESA_EXTENSION_OVERRIDE`
|
||||
can be used to enable/disable extensions. A value such as
|
||||
``GL_EXT_foo -GL_EXT_bar`` will enable the ``GL_EXT_foo`` extension
|
||||
and disable the ``GL_EXT_bar`` extension.
|
||||
and disable the ``GL_EXT_bar`` extension. Note that this will override
|
||||
extensions override configured using driconf.
|
||||
:envvar:`MESA_EXTENSION_MAX_YEAR`
|
||||
The ``GL_EXTENSIONS`` string returned by Mesa is sorted by extension
|
||||
year. If this variable is set to year X, only extensions defined on
|
||||
|
|
|
@ -41,6 +41,7 @@ DRI_CONF_SECTION_DEBUG
|
|||
DRI_CONF_FORCE_GL_RENDERER()
|
||||
DRI_CONF_OVERRIDE_VRAM_SIZE()
|
||||
DRI_CONF_GLX_EXTENSION_OVERRIDE()
|
||||
DRI_CONF_MESA_EXTENSION_OVERRIDE()
|
||||
DRI_CONF_INDIRECT_GL_EXTENSION_OVERRIDE()
|
||||
DRI_CONF_DISABLE_PROTECTED_CONTENT_CHECK(false)
|
||||
DRI_CONF_IGNORE_MAP_UNSYNCHRONIZED(false)
|
||||
|
|
|
@ -66,6 +66,7 @@ u_driconf_fill_st_options(struct st_config_options *options,
|
|||
query_bool_option(transcode_astc);
|
||||
query_string_option(force_gl_vendor);
|
||||
query_string_option(force_gl_renderer);
|
||||
query_string_option(mesa_extension_override);
|
||||
|
||||
driComputeOptionsSha1(optionCache, options->config_options_sha1);
|
||||
}
|
||||
|
|
|
@ -510,6 +510,7 @@ dri_destroy_screen(__DRIscreen * sPriv)
|
|||
|
||||
free(screen->options.force_gl_vendor);
|
||||
free(screen->options.force_gl_renderer);
|
||||
free(screen->options.mesa_extension_override);
|
||||
|
||||
/* The caller in dri_util preserves the fd ownership */
|
||||
free(screen);
|
||||
|
|
|
@ -231,6 +231,7 @@ stw_cleanup(void)
|
|||
|
||||
free(stw_dev->st_options.force_gl_vendor);
|
||||
free(stw_dev->st_options.force_gl_renderer);
|
||||
free(stw_dev->st_options.mesa_extension_override);
|
||||
driDestroyOptionCache(&stw_dev->option_cache);
|
||||
driDestroyOptionInfo(&stw_dev->option_info);
|
||||
|
||||
|
|
|
@ -243,6 +243,7 @@ struct st_config_options
|
|||
bool transcode_astc;
|
||||
char *force_gl_vendor;
|
||||
char *force_gl_renderer;
|
||||
char *mesa_extension_override;
|
||||
unsigned char config_options_sha1[20];
|
||||
};
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ one_time_fini(void)
|
|||
*/
|
||||
|
||||
static void
|
||||
one_time_init(void)
|
||||
one_time_init(const char *extensions_override)
|
||||
{
|
||||
GLuint i;
|
||||
|
||||
|
@ -281,7 +281,16 @@ one_time_init(void)
|
|||
|
||||
_mesa_locale_init();
|
||||
|
||||
_mesa_one_time_init_extension_overrides();
|
||||
const char *env_const = os_get_option("MESA_EXTENSION_OVERRIDE");
|
||||
if (env_const) {
|
||||
if (extensions_override &&
|
||||
strcmp(extensions_override, env_const)) {
|
||||
printf("Warning: MESA_EXTENSION_OVERRIDE used instead of driconf setting\n");
|
||||
}
|
||||
extensions_override = env_const;
|
||||
}
|
||||
|
||||
_mesa_one_time_init_extension_overrides(extensions_override);
|
||||
|
||||
_mesa_get_cpu_features();
|
||||
|
||||
|
@ -327,13 +336,13 @@ static void init_lock(void) {
|
|||
* defined.
|
||||
*/
|
||||
void
|
||||
_mesa_initialize(void)
|
||||
_mesa_initialize(const char *extensions_override)
|
||||
{
|
||||
call_once(&init_once, init_lock);
|
||||
|
||||
mtx_lock(&init_once_lock);
|
||||
if (!init_done) {
|
||||
one_time_init();
|
||||
one_time_init(extensions_override);
|
||||
init_done = true;
|
||||
}
|
||||
mtx_unlock(&init_once_lock);
|
||||
|
@ -1120,7 +1129,7 @@ _mesa_initialize_context(struct gl_context *ctx,
|
|||
_mesa_override_gl_version(ctx);
|
||||
|
||||
/* misc one-time initializations */
|
||||
_mesa_initialize();
|
||||
_mesa_initialize(NULL);
|
||||
|
||||
/* Plug in driver functions and context pointer here.
|
||||
* This is important because when we call alloc_shared_state() below
|
||||
|
|
|
@ -90,7 +90,7 @@ _mesa_initialize_visual( struct gl_config *v,
|
|||
/*@{*/
|
||||
|
||||
extern void
|
||||
_mesa_initialize(void);
|
||||
_mesa_initialize(const char *extensions_override);
|
||||
|
||||
extern GLboolean
|
||||
_mesa_initialize_context( struct gl_context *ctx,
|
||||
|
|
|
@ -223,11 +223,11 @@ free_unknown_extensions_strings(void)
|
|||
|
||||
|
||||
/**
|
||||
* \brief Initialize extension override tables based on \c MESA_EXTENSION_OVERRIDE
|
||||
* \brief Initialize extension override tables based on \c override
|
||||
*
|
||||
* This should be called one time early during first context initialization.
|
||||
|
||||
* \c MESA_EXTENSION_OVERRIDE is a space-separated list of extensions to
|
||||
* \c override is a space-separated list of extensions to
|
||||
* enable or disable. The list is processed thus:
|
||||
* - Enable recognized extension names that are prefixed with '+'.
|
||||
* - Disable recognized extension names that are prefixed with '-'.
|
||||
|
@ -235,9 +235,8 @@ free_unknown_extensions_strings(void)
|
|||
* - Collect unrecognized extension names in a new string.
|
||||
*/
|
||||
void
|
||||
_mesa_one_time_init_extension_overrides(void)
|
||||
_mesa_one_time_init_extension_overrides(const char *override)
|
||||
{
|
||||
const char *env_const = os_get_option("MESA_EXTENSION_OVERRIDE");
|
||||
char *env;
|
||||
char *ext;
|
||||
size_t offset;
|
||||
|
@ -246,12 +245,12 @@ _mesa_one_time_init_extension_overrides(void)
|
|||
memset(&_mesa_extension_override_enables, 0, sizeof(struct gl_extensions));
|
||||
memset(&_mesa_extension_override_disables, 0, sizeof(struct gl_extensions));
|
||||
|
||||
if (env_const == NULL) {
|
||||
if (override == NULL || override[0] == '\0') {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Copy env_const because strtok() is destructive. */
|
||||
env = strdup(env_const);
|
||||
/* Copy 'override' because strtok() is destructive. */
|
||||
env = strdup(override);
|
||||
|
||||
if (env == NULL)
|
||||
return;
|
||||
|
|
|
@ -47,7 +47,7 @@ struct gl_extensions;
|
|||
|
||||
extern void _mesa_enable_sw_extensions(struct gl_context *ctx);
|
||||
|
||||
extern void _mesa_one_time_init_extension_overrides(void);
|
||||
extern void _mesa_one_time_init_extension_overrides(const char *override);
|
||||
|
||||
extern void _mesa_init_extensions(struct gl_extensions *extentions);
|
||||
|
||||
|
|
|
@ -903,7 +903,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
_mesa_initialize();
|
||||
_mesa_initialize(attribs->options.mesa_extension_override);
|
||||
|
||||
/* Create a hash table for the framebuffer interface objects
|
||||
* if it has not been created for this st manager.
|
||||
|
|
|
@ -251,6 +251,10 @@
|
|||
#define DRI_CONF_TRANSCODE_ASTC(def) \
|
||||
DRI_CONF_OPT_B(transcode_astc, def, "Transcode ASTC formats to DXTC if unsupported")
|
||||
|
||||
#define DRI_CONF_MESA_EXTENSION_OVERRIDE() \
|
||||
DRI_CONF_OPT_S_NODEF(mesa_extension_override, \
|
||||
"Allow enabling/disabling a list of extensions")
|
||||
|
||||
#define DRI_CONF_GLX_EXTENSION_OVERRIDE() \
|
||||
DRI_CONF_OPT_S_NODEF(glx_extension_override, \
|
||||
"Allow enabling/disabling a list of GLX extensions")
|
||||
|
|
Loading…
Reference in New Issue