xmlconfig: add kernel_driver device attribute
authorQiang Yu <Qiang.Yu@amd.com>
Mon, 6 Aug 2018 03:19:26 +0000 (11:19 +0800)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 17 Aug 2018 16:16:32 +0000 (17:16 +0100)
This attribute can be used by loader to apply different
option to device use specific kernel driver.

Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
Acked-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/gallium/auxiliary/pipe-loader/pipe_loader.c
src/gallium/targets/d3dadapter9/drm.c
src/loader/loader.c
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/i915/intel_context.c
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/intel_screen.c
src/mesa/drivers/dri/r200/r200_context.c
src/mesa/drivers/dri/radeon/radeon_context.c
src/util/xmlconfig.c
src/util/xmlconfig.h

index e7cf9f86d996f8414da28aff2e3fd398a5ec547f..6fd15527e53fe21cb5c43191a36b05d12ffbf95f 100644 (file)
@@ -108,7 +108,7 @@ pipe_loader_load_options(struct pipe_loader_device *dev)
 
    driParseOptionInfo(&dev->option_info, xml_options);
    driParseConfigFiles(&dev->option_cache, &dev->option_info, 0,
-                       dev->driver_name);
+                       dev->driver_name, NULL);
 }
 
 char *
index 9c5bd8a15b22471cd773a4fe4317a6f59bcba0d1..85b3e10633e208bbe8f271a86fdf6278d6c18092 100644 (file)
@@ -252,7 +252,7 @@ drm_create_adapter( int fd,
         ctx->base.throttling = FALSE;
 
     driParseOptionInfo(&defaultInitOptions, __driConfigOptionsNine);
-    driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0, "nine");
+    driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0, "nine", NULL);
     if (driCheckOption(&userInitOptions, "throttle_value", DRI_INT)) {
         throttling_value_user = driQueryOptioni(&userInitOptions, "throttle_value");
         if (throttling_value_user == -1)
index 28a4c5855c99f40e2ce1b67e982c414bcbbc674c..9480be97fd0d77afdf434a0612228fb624a1ac04 100644 (file)
@@ -118,7 +118,7 @@ static char *loader_get_dri_config_device_id(void)
    char *prime = NULL;
 
    driParseOptionInfo(&defaultInitOptions, __driConfigOptionsLoader);
-   driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0, "loader");
+   driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0, "loader", NULL);
    if (driCheckOption(&userInitOptions, "device_id", DRI_STRING))
       prime = strdup(driQueryOptionstr(&userInitOptions, "device_id"));
    driDestroyOptionCache(&userInitOptions);
index be7b6e5535df69cf4d1c295f65f6a76fa4fd0c40..ac3a04bceff8b7f522ae4457a0a5c74e83e20e05 100644 (file)
@@ -148,7 +148,7 @@ driCreateNewScreen2(int scrn, int fd,
 
     /* Option parsing before ->InitScreen(), as some options apply there. */
     driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions);
-    driParseConfigFiles(&psp->optionCache, &psp->optionInfo, psp->myNum, "dri2");
+    driParseConfigFiles(&psp->optionCache, &psp->optionInfo, psp->myNum, "dri2", NULL);
 
     *driver_configs = psp->driver->InitScreen(psp);
     if (*driver_configs == NULL) {
index f22ebbd7ac2b3be188462e08864320159d7d238b..9a6e49dd82790d1fae94c19c03985e699d358c17 100644 (file)
@@ -448,7 +448,7 @@ intelInitContext(struct intel_context *intel,
          0, sizeof(ctx->TextureFormatSupported));
 
    driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache,
-                       sPriv->myNum, "i915");
+                       sPriv->myNum, "i915", NULL);
    intel->maxBatchSize = 4096;
 
    /* Estimate the size of the mappable aperture into the GTT.  There's an
index 136f1325c6ebd364c353024c55fd21957407dd6f..0d0b95e78a5ae354c43c4d9b8df56e2a797ca95f 100644 (file)
@@ -790,7 +790,8 @@ brw_process_driconf_options(struct brw_context *brw)
 
    driOptionCache *options = &brw->optionCache;
    driParseConfigFiles(options, &brw->screen->optionCache,
-                       brw->driContext->driScreenPriv->myNum, "i965");
+                       brw->driContext->driScreenPriv->myNum,
+                       "i965", NULL);
 
    int bo_reuse_mode = driQueryOptioni(options, "bo_reuse");
    switch (bo_reuse_mode) {
index f1c195c5d14e577a76e34aa6ce118248847340a0..2222e57bbf4e424cd3f78ebf6a9396545d6b029b 100644 (file)
@@ -2442,7 +2442,8 @@ __DRIconfig **intelInitScreen2(__DRIscreen *dri_screen)
    memset(&options, 0, sizeof(options));
 
    driParseOptionInfo(&options, brw_config_options.xml);
-   driParseConfigFiles(&screen->optionCache, &options, dri_screen->myNum, "i965");
+   driParseConfigFiles(&screen->optionCache, &options, dri_screen->myNum,
+                       "i965", NULL);
    driDestroyOptionCache(&options);
 
    screen->driScrnPriv = dri_screen;
index 9417dfc8a7ba95df9a02790761352f17deebc255..cfdc9b84e870535b817fc71339f7265199041602 100644 (file)
@@ -216,7 +216,7 @@ GLboolean r200CreateContext( gl_api api,
     * the default textures.
     */
    driParseConfigFiles (&rmesa->radeon.optionCache, &screen->optionCache,
-                       screen->driScreen->myNum, "r200");
+                       screen->driScreen->myNum, "r200", NULL);
    rmesa->radeon.initialMaxAnisotropy = driQueryOptionf(&rmesa->radeon.optionCache,
                                                        "def_max_anisotropy");
 
index 28ced814e590b9361abd2c6ec0ca397378460f1d..e1e87640ef09839b176cd26eff0ec1b018e4910b 100644 (file)
@@ -183,7 +183,7 @@ r100CreateContext( gl_api api,
     * the default textures.
     */
    driParseConfigFiles (&rmesa->radeon.optionCache, &screen->optionCache,
-                       screen->driScreen->myNum, "radeon");
+                       screen->driScreen->myNum, "radeon", NULL);
    rmesa->radeon.initialMaxAnisotropy = driQueryOptionf(&rmesa->radeon.optionCache,
                                                  "def_max_anisotropy");
 
index 68ce5cee921aa4e80322b8d7dac0efcf9f5ac299..5264f2598b4f06e7a6ffaba9409eaa1d8968ab67 100644 (file)
@@ -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");
index f7683a650e0df92eedcbd12771db99d493c3a12a..cc8c6ef098f4dfeadb219a4f6afc4cdac7e54304 100644 (file)
@@ -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 */