driconf: Support selection by Vulkan applicationName.
This adds applicationName + version through like engineName. Rationale: A game (World War Z) includes the store name in the executable name, so has multiple executable names. CC: <mesa-stable@lists.freedesktop.org> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6120>
This commit is contained in:
parent
f88b9eb9c5
commit
a1d4721e21
|
@ -628,6 +628,8 @@ static void radv_init_dri_options(struct radv_instance *instance)
|
||||||
driParseConfigFiles(&instance->dri_options,
|
driParseConfigFiles(&instance->dri_options,
|
||||||
&instance->available_dri_options,
|
&instance->available_dri_options,
|
||||||
0, "radv", NULL,
|
0, "radv", NULL,
|
||||||
|
instance->applicationName,
|
||||||
|
instance->applicationVersion,
|
||||||
instance->engineName,
|
instance->engineName,
|
||||||
instance->engineVersion);
|
instance->engineVersion);
|
||||||
}
|
}
|
||||||
|
@ -655,6 +657,11 @@ VkResult radv_CreateInstance(
|
||||||
if (pCreateInfo->pApplicationInfo) {
|
if (pCreateInfo->pApplicationInfo) {
|
||||||
const VkApplicationInfo *app = pCreateInfo->pApplicationInfo;
|
const VkApplicationInfo *app = pCreateInfo->pApplicationInfo;
|
||||||
|
|
||||||
|
instance->applicationName =
|
||||||
|
vk_strdup(&instance->alloc, app->pApplicationName,
|
||||||
|
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||||
|
instance->applicationVersion = app->applicationVersion;
|
||||||
|
|
||||||
instance->engineName =
|
instance->engineName =
|
||||||
vk_strdup(&instance->alloc, app->pEngineName,
|
vk_strdup(&instance->alloc, app->pEngineName,
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||||
|
@ -791,6 +798,7 @@ void radv_DestroyInstance(
|
||||||
}
|
}
|
||||||
|
|
||||||
vk_free(&instance->alloc, instance->engineName);
|
vk_free(&instance->alloc, instance->engineName);
|
||||||
|
vk_free(&instance->alloc, instance->applicationName);
|
||||||
|
|
||||||
VG(VALGRIND_DESTROY_MEMPOOL(instance));
|
VG(VALGRIND_DESTROY_MEMPOOL(instance));
|
||||||
|
|
||||||
|
|
|
@ -334,6 +334,8 @@ struct radv_instance {
|
||||||
|
|
||||||
uint32_t apiVersion;
|
uint32_t apiVersion;
|
||||||
|
|
||||||
|
char * applicationName;
|
||||||
|
uint32_t applicationVersion;
|
||||||
char * engineName;
|
char * engineName;
|
||||||
uint32_t engineVersion;
|
uint32_t engineVersion;
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ pipe_loader_load_options(struct pipe_loader_device *dev)
|
||||||
|
|
||||||
driParseOptionInfo(&dev->option_info, xml_options);
|
driParseOptionInfo(&dev->option_info, xml_options);
|
||||||
driParseConfigFiles(&dev->option_cache, &dev->option_info, 0,
|
driParseConfigFiles(&dev->option_cache, &dev->option_info, 0,
|
||||||
dev->driver_name, NULL, NULL, 0);
|
dev->driver_name, NULL, NULL, 0, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
|
@ -251,7 +251,7 @@ drm_create_adapter( int fd,
|
||||||
|
|
||||||
driParseOptionInfo(&defaultInitOptions, __driConfigOptionsNine);
|
driParseOptionInfo(&defaultInitOptions, __driConfigOptionsNine);
|
||||||
driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0,
|
driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0,
|
||||||
"nine", NULL, NULL, 0);
|
"nine", NULL, NULL, 0, NULL, 0);
|
||||||
if (driCheckOption(&userInitOptions, "throttle_value", DRI_INT)) {
|
if (driCheckOption(&userInitOptions, "throttle_value", DRI_INT)) {
|
||||||
throttling_value_user = driQueryOptioni(&userInitOptions, "throttle_value");
|
throttling_value_user = driQueryOptioni(&userInitOptions, "throttle_value");
|
||||||
if (throttling_value_user == -1)
|
if (throttling_value_user == -1)
|
||||||
|
|
|
@ -776,6 +776,8 @@ VkResult anv_CreateInstance(
|
||||||
driParseOptionInfo(&instance->available_dri_options, anv_dri_options_xml);
|
driParseOptionInfo(&instance->available_dri_options, anv_dri_options_xml);
|
||||||
driParseConfigFiles(&instance->dri_options, &instance->available_dri_options,
|
driParseConfigFiles(&instance->dri_options, &instance->available_dri_options,
|
||||||
0, "anv", NULL,
|
0, "anv", NULL,
|
||||||
|
instance->app_info.app_name,
|
||||||
|
instance->app_info.app_version,
|
||||||
instance->app_info.engine_name,
|
instance->app_info.engine_name,
|
||||||
instance->app_info.engine_version);
|
instance->app_info.engine_version);
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ static char *loader_get_dri_config_driver(int fd)
|
||||||
|
|
||||||
driParseOptionInfo(&defaultInitOptions, __driConfigOptionsLoader);
|
driParseOptionInfo(&defaultInitOptions, __driConfigOptionsLoader);
|
||||||
driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0,
|
driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0,
|
||||||
"loader", kernel_driver, NULL, 0);
|
"loader", kernel_driver, NULL, 0, NULL, 0);
|
||||||
if (driCheckOption(&userInitOptions, "dri_driver", DRI_STRING)) {
|
if (driCheckOption(&userInitOptions, "dri_driver", DRI_STRING)) {
|
||||||
char *opt = driQueryOptionstr(&userInitOptions, "dri_driver");
|
char *opt = driQueryOptionstr(&userInitOptions, "dri_driver");
|
||||||
/* not an empty string */
|
/* not an empty string */
|
||||||
|
@ -217,7 +217,7 @@ static char *loader_get_dri_config_device_id(void)
|
||||||
|
|
||||||
driParseOptionInfo(&defaultInitOptions, __driConfigOptionsLoader);
|
driParseOptionInfo(&defaultInitOptions, __driConfigOptionsLoader);
|
||||||
driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0,
|
driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0,
|
||||||
"loader", NULL, NULL, 0);
|
"loader", NULL, NULL, 0, NULL, 0);
|
||||||
if (driCheckOption(&userInitOptions, "device_id", DRI_STRING))
|
if (driCheckOption(&userInitOptions, "device_id", DRI_STRING))
|
||||||
prime = strdup(driQueryOptionstr(&userInitOptions, "device_id"));
|
prime = strdup(driQueryOptionstr(&userInitOptions, "device_id"));
|
||||||
driDestroyOptionCache(&userInitOptions);
|
driDestroyOptionCache(&userInitOptions);
|
||||||
|
|
|
@ -150,7 +150,7 @@ driCreateNewScreen2(int scrn, int fd,
|
||||||
/* Option parsing before ->InitScreen(), as some options apply there. */
|
/* Option parsing before ->InitScreen(), as some options apply there. */
|
||||||
driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions);
|
driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions);
|
||||||
driParseConfigFiles(&psp->optionCache, &psp->optionInfo, psp->myNum,
|
driParseConfigFiles(&psp->optionCache, &psp->optionInfo, psp->myNum,
|
||||||
"dri2", NULL, NULL, 0);
|
"dri2", NULL, NULL, 0, NULL, 0);
|
||||||
|
|
||||||
*driver_configs = psp->driver->InitScreen(psp);
|
*driver_configs = psp->driver->InitScreen(psp);
|
||||||
if (*driver_configs == NULL) {
|
if (*driver_configs == NULL) {
|
||||||
|
|
|
@ -445,7 +445,7 @@ intelInitContext(struct intel_context *intel,
|
||||||
0, sizeof(ctx->TextureFormatSupported));
|
0, sizeof(ctx->TextureFormatSupported));
|
||||||
|
|
||||||
driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache,
|
driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache,
|
||||||
sPriv->myNum, "i915", NULL, NULL, 0);
|
sPriv->myNum, "i915", NULL, NULL, 0, NULL, 0);
|
||||||
intel->maxBatchSize = 4096;
|
intel->maxBatchSize = 4096;
|
||||||
|
|
||||||
/* Estimate the size of the mappable aperture into the GTT. There's an
|
/* Estimate the size of the mappable aperture into the GTT. There's an
|
||||||
|
|
|
@ -862,7 +862,7 @@ brw_process_driconf_options(struct brw_context *brw)
|
||||||
driOptionCache *options = &brw->optionCache;
|
driOptionCache *options = &brw->optionCache;
|
||||||
driParseConfigFiles(options, &brw->screen->optionCache,
|
driParseConfigFiles(options, &brw->screen->optionCache,
|
||||||
brw->driContext->driScreenPriv->myNum,
|
brw->driContext->driScreenPriv->myNum,
|
||||||
"i965", NULL, NULL, 0);
|
"i965", NULL, NULL, 0, NULL, 0);
|
||||||
|
|
||||||
if (INTEL_DEBUG & DEBUG_NO_HIZ) {
|
if (INTEL_DEBUG & DEBUG_NO_HIZ) {
|
||||||
brw->has_hiz = false;
|
brw->has_hiz = false;
|
||||||
|
|
|
@ -2545,7 +2545,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *dri_screen)
|
||||||
|
|
||||||
driParseOptionInfo(&options, brw_config_options.xml);
|
driParseOptionInfo(&options, brw_config_options.xml);
|
||||||
driParseConfigFiles(&screen->optionCache, &options, dri_screen->myNum,
|
driParseConfigFiles(&screen->optionCache, &options, dri_screen->myNum,
|
||||||
"i965", NULL, NULL, 0);
|
"i965", NULL, NULL, 0, NULL, 0);
|
||||||
driDestroyOptionCache(&options);
|
driDestroyOptionCache(&options);
|
||||||
|
|
||||||
screen->driScrnPriv = dri_screen;
|
screen->driScrnPriv = dri_screen;
|
||||||
|
|
|
@ -216,7 +216,7 @@ GLboolean r200CreateContext( gl_api api,
|
||||||
* the default textures.
|
* the default textures.
|
||||||
*/
|
*/
|
||||||
driParseConfigFiles (&rmesa->radeon.optionCache, &screen->optionCache,
|
driParseConfigFiles (&rmesa->radeon.optionCache, &screen->optionCache,
|
||||||
screen->driScreen->myNum, "r200", NULL, NULL, 0);
|
screen->driScreen->myNum, "r200", NULL, NULL, 0, NULL, 0);
|
||||||
rmesa->radeon.initialMaxAnisotropy = driQueryOptionf(&rmesa->radeon.optionCache,
|
rmesa->radeon.initialMaxAnisotropy = driQueryOptionf(&rmesa->radeon.optionCache,
|
||||||
"def_max_anisotropy");
|
"def_max_anisotropy");
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ r100CreateContext( gl_api api,
|
||||||
* the default textures.
|
* the default textures.
|
||||||
*/
|
*/
|
||||||
driParseConfigFiles (&rmesa->radeon.optionCache, &screen->optionCache,
|
driParseConfigFiles (&rmesa->radeon.optionCache, &screen->optionCache,
|
||||||
screen->driScreen->myNum, "radeon", NULL, NULL, 0);
|
screen->driScreen->myNum, "radeon", NULL, NULL, 0, NULL, 0);
|
||||||
rmesa->radeon.initialMaxAnisotropy = driQueryOptionf(&rmesa->radeon.optionCache,
|
rmesa->radeon.initialMaxAnisotropy = driQueryOptionf(&rmesa->radeon.optionCache,
|
||||||
"def_max_anisotropy");
|
"def_max_anisotropy");
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,10 @@ TODO: document the other workarounds.
|
||||||
<!ATTLIST device driver CDATA #IMPLIED>
|
<!ATTLIST device driver CDATA #IMPLIED>
|
||||||
<!ELEMENT application (option+)>
|
<!ELEMENT application (option+)>
|
||||||
<!ATTLIST application name CDATA #REQUIRED
|
<!ATTLIST application name CDATA #REQUIRED
|
||||||
executable CDATA #REQUIRED
|
executable CDATA #IMPLIED
|
||||||
sha1 CDATA #IMPLIED>
|
sha1 CDATA #IMPLIED
|
||||||
|
application_name_match CDATA #IMPLIED
|
||||||
|
application_versions CDATA #IMPLIED>
|
||||||
<!ELEMENT engine (option+)>
|
<!ELEMENT engine (option+)>
|
||||||
|
|
||||||
<!-- engine_name_match: A regexp matching the engine name -->
|
<!-- engine_name_match: A regexp matching the engine name -->
|
||||||
|
|
|
@ -715,7 +715,9 @@ struct OptConfData {
|
||||||
const char *driverName, *execName;
|
const char *driverName, *execName;
|
||||||
const char *kernelDriverName;
|
const char *kernelDriverName;
|
||||||
const char *engineName;
|
const char *engineName;
|
||||||
|
const char *applicationName;
|
||||||
uint32_t engineVersion;
|
uint32_t engineVersion;
|
||||||
|
uint32_t applicationVersion;
|
||||||
uint32_t ignoringDevice;
|
uint32_t ignoringDevice;
|
||||||
uint32_t ignoringApp;
|
uint32_t ignoringApp;
|
||||||
uint32_t inDriConf;
|
uint32_t inDriConf;
|
||||||
|
@ -782,10 +784,20 @@ parseAppAttr(struct OptConfData *data, const XML_Char **attr)
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
const XML_Char *exec = NULL;
|
const XML_Char *exec = NULL;
|
||||||
const XML_Char *sha1 = NULL;
|
const XML_Char *sha1 = NULL;
|
||||||
|
const XML_Char *application_name_match = NULL;
|
||||||
|
const XML_Char *application_versions = NULL;
|
||||||
|
driOptionInfo version_ranges = {
|
||||||
|
.type = DRI_INT,
|
||||||
|
};
|
||||||
|
|
||||||
for (i = 0; attr[i]; i += 2) {
|
for (i = 0; attr[i]; i += 2) {
|
||||||
if (!strcmp (attr[i], "name")) /* not needed here */;
|
if (!strcmp (attr[i], "name")) /* not needed here */;
|
||||||
else if (!strcmp (attr[i], "executable")) exec = attr[i+1];
|
else if (!strcmp (attr[i], "executable")) exec = attr[i+1];
|
||||||
else if (!strcmp (attr[i], "sha1")) sha1 = attr[i+1];
|
else if (!strcmp (attr[i], "sha1")) sha1 = attr[i+1];
|
||||||
|
else if (!strcmp (attr[i], "application_name_match"))
|
||||||
|
application_name_match = attr[i+1];
|
||||||
|
else if (!strcmp (attr[i], "application_versions"))
|
||||||
|
application_versions = attr[i+1];
|
||||||
else XML_WARNING("unknown application attribute: %s.", attr[i]);
|
else XML_WARNING("unknown application attribute: %s.", attr[i]);
|
||||||
}
|
}
|
||||||
if (exec && strcmp (exec, data->execName)) {
|
if (exec && strcmp (exec, data->execName)) {
|
||||||
|
@ -814,6 +826,20 @@ parseAppAttr(struct OptConfData *data, const XML_Char **attr)
|
||||||
data->ignoringApp = data->inApp;
|
data->ignoringApp = data->inApp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (application_name_match) {
|
||||||
|
regex_t re;
|
||||||
|
|
||||||
|
if (regcomp (&re, application_name_match, REG_EXTENDED|REG_NOSUB) == 0) {
|
||||||
|
if (regexec (&re, data->applicationName, 0, NULL, 0) == REG_NOMATCH)
|
||||||
|
data->ignoringApp = data->inApp;
|
||||||
|
regfree (&re);
|
||||||
|
} else
|
||||||
|
XML_WARNING ("Invalid application_name_match=\"%s\".", application_name_match);
|
||||||
|
}
|
||||||
|
if (application_versions) {
|
||||||
|
if (parseRanges (&version_ranges, application_versions) &&
|
||||||
|
!valueInRanges (&version_ranges, data->applicationVersion))
|
||||||
|
data->ignoringApp = data->inApp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1103,6 +1129,7 @@ void
|
||||||
driParseConfigFiles(driOptionCache *cache, const driOptionCache *info,
|
driParseConfigFiles(driOptionCache *cache, const driOptionCache *info,
|
||||||
int screenNum, const char *driverName,
|
int screenNum, const char *driverName,
|
||||||
const char *kernelDriverName,
|
const char *kernelDriverName,
|
||||||
|
const char *applicationName, uint32_t applicationVersion,
|
||||||
const char *engineName, uint32_t engineVersion)
|
const char *engineName, uint32_t engineVersion)
|
||||||
{
|
{
|
||||||
char *home;
|
char *home;
|
||||||
|
@ -1114,6 +1141,8 @@ driParseConfigFiles(driOptionCache *cache, const driOptionCache *info,
|
||||||
userData.screenNum = screenNum;
|
userData.screenNum = screenNum;
|
||||||
userData.driverName = driverName;
|
userData.driverName = driverName;
|
||||||
userData.kernelDriverName = kernelDriverName;
|
userData.kernelDriverName = kernelDriverName;
|
||||||
|
userData.applicationName = applicationName ? applicationName : "";
|
||||||
|
userData.applicationVersion = applicationVersion;
|
||||||
userData.engineName = engineName ? engineName : "";
|
userData.engineName = engineName ? engineName : "";
|
||||||
userData.engineVersion = engineVersion;
|
userData.engineVersion = engineVersion;
|
||||||
userData.execName = util_get_process_name();
|
userData.execName = util_get_process_name();
|
||||||
|
|
|
@ -104,10 +104,11 @@ void driParseOptionInfo (driOptionCache *info,
|
||||||
/** \brief Initialize option cache from info and parse configuration files
|
/** \brief Initialize option cache from info and parse configuration files
|
||||||
*
|
*
|
||||||
* To be called in <driver>CreateContext. screenNum, driverName,
|
* To be called in <driver>CreateContext. screenNum, driverName,
|
||||||
* kernelDriverName and engineName select device sections. */
|
* kernelDriverName, applicationName and engineName select device sections. */
|
||||||
void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
|
void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
|
||||||
int screenNum, const char *driverName,
|
int screenNum, const char *driverName,
|
||||||
const char *kernelDriverName,
|
const char *kernelDriverName,
|
||||||
|
const char *applicationName, uint32_t applicationVersion,
|
||||||
const char *engineName, uint32_t engineVersion);
|
const char *engineName, uint32_t engineVersion);
|
||||||
/** \brief Destroy option info
|
/** \brief Destroy option info
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue