Mesa (main): wgl: Parse driconf options

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 10 15:35:39 UTC 2021


Module: Mesa
Branch: main
Commit: 35ec7e8b8ea7edbcb79ff53abeef5809f90f72f8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=35ec7e8b8ea7edbcb79ff53abeef5809f90f72f8

Author: Jesse Natalie <jenatali at microsoft.com>
Date:   Sun Aug  1 08:41:35 2021 -0700

wgl: Parse driconf options

Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>
Reviewed-by: Charmaine Lee <charmainel at vmware.com>
Reviewed-by: Neha Bhende <bhenden at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12158>

---

 src/gallium/frontends/wgl/meson.build   |  1 +
 src/gallium/frontends/wgl/stw_context.c |  3 ++-
 src/gallium/frontends/wgl/stw_device.c  | 22 ++++++++++++++++++++++
 src/gallium/frontends/wgl/stw_device.h  |  7 ++++++-
 4 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/src/gallium/frontends/wgl/meson.build b/src/gallium/frontends/wgl/meson.build
index ce6e9883e00..c10acc401d2 100644
--- a/src/gallium/frontends/wgl/meson.build
+++ b/src/gallium/frontends/wgl/meson.build
@@ -54,4 +54,5 @@ libwgl = static_library(
   include_directories : [
     inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_mapi, inc_mesa,
   ],
+  dependencies : [idep_xmlconfig],
 )
diff --git a/src/gallium/frontends/wgl/stw_context.c b/src/gallium/frontends/wgl/stw_context.c
index 71b2ede10f9..dce1966ed9d 100644
--- a/src/gallium/frontends/wgl/stw_context.c
+++ b/src/gallium/frontends/wgl/stw_context.c
@@ -38,7 +38,6 @@
 #include "util/compiler.h"
 #include "util/u_memory.h"
 #include "util/u_atomic.h"
-#include "frontend/api.h"
 #include "hud/hud_context.h"
 
 #include "gldrv.h"
@@ -271,6 +270,8 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, DHGLRC hShareContext,
       goto no_st_ctx;
    }
 
+   attribs.options = stw_dev->st_options;
+
    ctx->st = stw_dev->stapi->create_context(stw_dev->stapi,
          stw_dev->smapi, &attribs, &ctx_err, shareCtx ? shareCtx->st : NULL);
    if (ctx->st == NULL)
diff --git a/src/gallium/frontends/wgl/stw_device.c b/src/gallium/frontends/wgl/stw_device.c
index b33d9e8cdcf..4539a45d661 100644
--- a/src/gallium/frontends/wgl/stw_device.c
+++ b/src/gallium/frontends/wgl/stw_device.c
@@ -31,6 +31,8 @@
 #include "util/u_debug.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
+#include "util/u_driconf.h"
+#include "util/driconf.h"
 #include "pipe/p_screen.h"
 
 #include "stw_device.h"
@@ -98,6 +100,20 @@ init_screen(const struct stw_winsys *stw_winsys, HDC hdc)
    return true;
 }
 
+static void
+init_options()
+{
+   const driOptionDescription gallium_driconf[] = {
+      #include "pipe-loader/driinfo_gallium.h"
+   };
+
+   driParseOptionInfo(&stw_dev->option_info, gallium_driconf, ARRAY_SIZE(gallium_driconf));
+   driParseConfigFiles(&stw_dev->option_cache, &stw_dev->option_info, 0,
+      "", NULL, NULL, NULL, 0, NULL, 0);
+   
+   u_driconf_fill_st_options(&stw_dev->st_options, &stw_dev->option_cache);
+}
+
 boolean
 stw_init(const struct stw_winsys *stw_winsys)
 {
@@ -161,6 +177,7 @@ stw_init_screen(HDC hdc)
          LeaveCriticalSection(&stw_dev->screen_mutex);
          return false;
       }
+      init_options();
       stw_pixelformat_init();
    }
 
@@ -205,6 +222,11 @@ stw_cleanup(void)
       return;
    }
 
+   free(stw_dev->st_options.force_gl_vendor);
+   free(stw_dev->st_options.force_gl_renderer);
+   driDestroyOptionCache(&stw_dev->option_cache);
+   driDestroyOptionInfo(&stw_dev->option_info);
+
    handle_table_destroy(stw_dev->ctx_table);
 
    stw_framebuffer_cleanup();
diff --git a/src/gallium/frontends/wgl/stw_device.h b/src/gallium/frontends/wgl/stw_device.h
index a0b0419e56e..a939269a0ef 100644
--- a/src/gallium/frontends/wgl/stw_device.h
+++ b/src/gallium/frontends/wgl/stw_device.h
@@ -30,13 +30,14 @@
 
 
 #include "pipe/p_compiler.h"
+#include "frontend/api.h"
 #include "util/u_handle_table.h"
 #include "util/u_dynarray.h"
+#include "util/xmlconfig.h"
 #include <GL/gl.h>
 #include "gldrv.h"
 #include "stw_pixelformat.h"
 
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -85,6 +86,10 @@ struct stw_device
    int refresh_rate;
    int swap_interval;
 
+   driOptionCache option_cache;
+   driOptionCache option_info;
+   struct st_config_options st_options;
+
    bool initialized;
 };
 



More information about the mesa-commit mailing list