diff options
author | Qiang Yu <[email protected]> | 2018-08-06 11:19:26 +0800 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2018-08-17 17:16:32 +0100 |
commit | 3bbe180b982639554685c997ff51a7cbbf3247e6 (patch) | |
tree | 60c412653a73d6ee25471e2a977ad47bfa8e80a8 /src/util | |
parent | e8b91e99e9965fa717be25da66fba0cdc3aef5dc (diff) |
xmlconfig: add kernel_driver device attribute
This attribute can be used by loader to apply different
option to device use specific kernel driver.
Signed-off-by: Qiang Yu <[email protected]>
Acked-by: Michel Dänzer <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/xmlconfig.c | 10 | ||||
-rw-r--r-- | src/util/xmlconfig.h | 7 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/util/xmlconfig.c b/src/util/xmlconfig.c index 68ce5cee921..5264f2598b4 100644 --- a/src/util/xmlconfig.c +++ b/src/util/xmlconfig.c @@ -691,6 +691,7 @@ struct OptConfData { driOptionCache *cache; int screenNum; const char *driverName, *execName; + const char *kernelDriverName; uint32_t ignoringDevice; uint32_t ignoringApp; uint32_t inDriConf; @@ -715,14 +716,17 @@ static void parseDeviceAttr(struct OptConfData *data, const XML_Char **attr) { uint32_t i; - const XML_Char *driver = NULL, *screen = NULL; + const XML_Char *driver = NULL, *screen = NULL, *kernel = NULL; for (i = 0; attr[i]; i += 2) { if (!strcmp (attr[i], "driver")) driver = attr[i+1]; else if (!strcmp (attr[i], "screen")) screen = attr[i+1]; + else if (!strcmp (attr[i], "kernel_driver")) kernel = attr[i+1]; else XML_WARNING("unknown device attribute: %s.", attr[i]); } if (driver && strcmp (driver, data->driverName)) data->ignoringDevice = data->inDevice; + else if (kernel && (!data->kernelDriverName || strcmp (kernel, data->kernelDriverName))) + data->ignoringDevice = data->inDevice; else if (screen) { driOptionValue screenNum; if (!parseValue (&screenNum, DRI_INT, screen)) @@ -976,7 +980,8 @@ parseConfigDir(struct OptConfData *data, const char *dirname) void driParseConfigFiles(driOptionCache *cache, const driOptionCache *info, - int screenNum, const char *driverName) + int screenNum, const char *driverName, + const char *kernelDriverName) { char *home; struct OptConfData userData; @@ -986,6 +991,7 @@ driParseConfigFiles(driOptionCache *cache, const driOptionCache *info, userData.cache = cache; userData.screenNum = screenNum; userData.driverName = driverName; + userData.kernelDriverName = kernelDriverName; userData.execName = util_get_process_name(); parseConfigDir(&userData, DATADIR "/drirc.d"); diff --git a/src/util/xmlconfig.h b/src/util/xmlconfig.h index f7683a650e0..cc8c6ef098f 100644 --- a/src/util/xmlconfig.h +++ b/src/util/xmlconfig.h @@ -102,10 +102,11 @@ void driParseOptionInfo (driOptionCache *info, const char *configOptions); /** \brief Initialize option cache from info and parse configuration files * - * To be called in <driver>CreateContext. screenNum and driverName select - * device sections. */ + * To be called in <driver>CreateContext. screenNum, driverName and + * kernelDriverName select device sections. */ void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info, - int screenNum, const char *driverName); + int screenNum, const char *driverName, + const char *kernelDriverName); /** \brief Destroy option info * * To be called in <driver>DestroyScreen */ |