[Mesa-dev] [PATCH 08/16] gallium: move driinfo XML to pipe_loader

Nicolai Hähnle nhaehnle at gmail.com
Fri Jun 30 12:45:49 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

We will switch to the pipe_loader loading the configuration options,
so that they can be passed to the driver independently of the state
tracker.

Put the description into its own file so that it can be merged easily
with driver-specific options in future commits.
---
 src/gallium/auxiliary/pipe-loader/Makefile.am      |  1 +
 src/gallium/auxiliary/pipe-loader/Makefile.sources |  3 +-
 .../auxiliary/pipe-loader/driinfo_gallium.h        | 34 +++++++++++++++++++
 src/gallium/auxiliary/pipe-loader/pipe_loader.c    |  5 +++
 src/gallium/auxiliary/pipe-loader/pipe_loader.h    |  2 ++
 src/gallium/state_trackers/dri/dri_screen.c        | 39 +---------------------
 6 files changed, 45 insertions(+), 39 deletions(-)
 create mode 100644 src/gallium/auxiliary/pipe-loader/driinfo_gallium.h

diff --git a/src/gallium/auxiliary/pipe-loader/Makefile.am b/src/gallium/auxiliary/pipe-loader/Makefile.am
index 8039a95..4ebfc97 100644
--- a/src/gallium/auxiliary/pipe-loader/Makefile.am
+++ b/src/gallium/auxiliary/pipe-loader/Makefile.am
@@ -1,17 +1,18 @@
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
 # XXX: check if we need the gallium/winsys include
 AM_CFLAGS = \
 	-I$(top_srcdir)/src/loader \
 	-I$(top_srcdir)/src/gallium/winsys \
+	-I$(top_builddir)/src/util \
 	$(GALLIUM_PIPE_LOADER_DEFINES) \
 	$(GALLIUM_CFLAGS) \
 	$(VISIBILITY_CFLAGS)
 
 noinst_LTLIBRARIES = \
 	libpipe_loader_static.la \
 	libpipe_loader_dynamic.la
 
 libpipe_loader_static_la_CFLAGS = \
 	$(AM_CFLAGS) \
diff --git a/src/gallium/auxiliary/pipe-loader/Makefile.sources b/src/gallium/auxiliary/pipe-loader/Makefile.sources
index d6e3c2c..66dd22c 100644
--- a/src/gallium/auxiliary/pipe-loader/Makefile.sources
+++ b/src/gallium/auxiliary/pipe-loader/Makefile.sources
@@ -1,8 +1,9 @@
 COMMON_SOURCES := \
 	pipe_loader.c \
 	pipe_loader.h \
 	pipe_loader_priv.h \
-	pipe_loader_sw.c
+	pipe_loader_sw.c \
+	driinfo_gallium.h
 
 DRM_SOURCES := \
 	pipe_loader_drm.c
diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
new file mode 100644
index 0000000..08153a9
--- /dev/null
+++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
@@ -0,0 +1,34 @@
+// DriConf options supported by all Gallium DRI drivers.
+DRI_CONF_SECTION_PERFORMANCE
+   DRI_CONF_MESA_GLTHREAD("false")
+   DRI_CONF_DISABLE_EXT_BUFFER_AGE("false")
+   DRI_CONF_DISABLE_OML_SYNC_CONTROL("false")
+DRI_CONF_SECTION_END
+
+DRI_CONF_SECTION_QUALITY
+   DRI_CONF_FORCE_S3TC_ENABLE("false")
+   DRI_CONF_PP_CELSHADE(0)
+   DRI_CONF_PP_NORED(0)
+   DRI_CONF_PP_NOGREEN(0)
+   DRI_CONF_PP_NOBLUE(0)
+   DRI_CONF_PP_JIMENEZMLAA(0, 0, 32)
+   DRI_CONF_PP_JIMENEZMLAA_COLOR(0, 0, 32)
+DRI_CONF_SECTION_END
+
+DRI_CONF_SECTION_DEBUG
+   DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false")
+   DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false")
+   DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
+   DRI_CONF_DISABLE_SHADER_BIT_ENCODING("false")
+   DRI_CONF_FORCE_GLSL_VERSION(0)
+   DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
+   DRI_CONF_ALLOW_GLSL_BUILTIN_VARIABLE_REDECLARATION("false")
+   DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION("false")
+   DRI_CONF_FORCE_GLSL_ABS_SQRT("false")
+   DRI_CONF_GLSL_CORRECT_DERIVATIVES_AFTER_DISCARD("false")
+DRI_CONF_SECTION_END
+
+DRI_CONF_SECTION_MISCELLANEOUS
+   DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER("false")
+   DRI_CONF_GLSL_ZERO_INIT("false")
+DRI_CONF_SECTION_END
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.c b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
index cd93648..bb65be1 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
@@ -24,35 +24,40 @@
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  **************************************************************************/
 
 #include "pipe_loader_priv.h"
 
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_string.h"
 #include "util/u_dl.h"
+#include "util/xmlpool.h"
 
 #ifdef _MSC_VER
 #include <stdlib.h>
 #define PATH_MAX _MAX_PATH
 #endif
 
 #define MODULE_PREFIX "pipe_"
 
 static int (*backends[])(struct pipe_loader_device **, int) = {
 #ifdef HAVE_LIBDRM
    &pipe_loader_drm_probe,
 #endif
    &pipe_loader_sw_probe
 };
 
+const char gallium_driinfo_xml[] =
+#include "driinfo_gallium.h"
+;
+
 int
 pipe_loader_probe(struct pipe_loader_device **devs, int ndev)
 {
    int i, n = 0;
 
    for (i = 0; i < ARRAY_SIZE(backends); i++)
       n += backends[i](&devs[n], MAX2(0, ndev - n));
 
    return n;
 }
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.h b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
index 969feac..d24480d 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.h
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
@@ -176,15 +176,17 @@ pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev);
 /**
  * Initialize a DRM device in an already opened fd.
  *
  * This function is platform-specific.
  *
  * \sa pipe_loader_probe
  */
 bool
 pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd);
 
+extern const char gallium_driinfo_xml[];
+
 #ifdef __cplusplus
 }
 #endif
 
 #endif /* PIPE_LOADER_H */
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index 3d86cce..2117dbb 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -23,78 +23,41 @@
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  **************************************************************************/
 /*
  * Author: Keith Whitwell <keithw at vmware.com>
  * Author: Jakob Bornecrantz <wallbraker at gmail.com>
  */
 
 #include "utils.h"
-#include "util/xmlpool.h"
 
 #include "dri_screen.h"
 #include "dri_context.h"
 
 #include "util/u_inlines.h"
 #include "pipe/p_screen.h"
 #include "pipe/p_format.h"
 #include "pipe-loader/pipe_loader.h"
 #include "state_tracker/st_gl_api.h" /* for st_gl_api_create */
 #include "state_tracker/drm_driver.h"
 
 #include "util/u_debug.h"
 #include "util/u_format_s3tc.h"
 
 #define MSAA_VISUAL_MAX_SAMPLES 32
 
 #undef false
 
 const __DRIconfigOptionsExtension gallium_config_options = {
    .base = { __DRI_CONFIG_OPTIONS, 1 },
-   .xml =
-
-   DRI_CONF_BEGIN
-      DRI_CONF_SECTION_PERFORMANCE
-         DRI_CONF_MESA_GLTHREAD("false")
-         DRI_CONF_DISABLE_EXT_BUFFER_AGE("false")
-         DRI_CONF_DISABLE_OML_SYNC_CONTROL("false")
-      DRI_CONF_SECTION_END
-
-      DRI_CONF_SECTION_QUALITY
-         DRI_CONF_FORCE_S3TC_ENABLE("false")
-         DRI_CONF_PP_CELSHADE(0)
-         DRI_CONF_PP_NORED(0)
-         DRI_CONF_PP_NOGREEN(0)
-         DRI_CONF_PP_NOBLUE(0)
-         DRI_CONF_PP_JIMENEZMLAA(0, 0, 32)
-         DRI_CONF_PP_JIMENEZMLAA_COLOR(0, 0, 32)
-      DRI_CONF_SECTION_END
-
-      DRI_CONF_SECTION_DEBUG
-         DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false")
-         DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false")
-         DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
-         DRI_CONF_DISABLE_SHADER_BIT_ENCODING("false")
-         DRI_CONF_FORCE_GLSL_VERSION(0)
-         DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
-         DRI_CONF_ALLOW_GLSL_BUILTIN_VARIABLE_REDECLARATION("false")
-         DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION("false")
-         DRI_CONF_FORCE_GLSL_ABS_SQRT("false")
-         DRI_CONF_GLSL_CORRECT_DERIVATIVES_AFTER_DISCARD("false")
-      DRI_CONF_SECTION_END
-
-      DRI_CONF_SECTION_MISCELLANEOUS
-         DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER("false")
-         DRI_CONF_GLSL_ZERO_INIT("false")
-      DRI_CONF_SECTION_END
-   DRI_CONF_END
+   .xml = gallium_driinfo_xml
 };
 
 #define false 0
 
 static void
 dri_fill_st_options(struct dri_screen *screen)
 {
    struct st_config_options *options = &screen->options;
    const struct driOptionCache *optionCache = &screen->optionCache;
 
-- 
2.9.3



More information about the mesa-dev mailing list