summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/auxiliary/pipe-loader
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2018-10-23 06:36:00 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2018-10-23 06:36:00 +0000
commitb65fcab046d3a1b6b6ac315720df220925c5322e (patch)
treeff73dcc383ac0799c655ff6194cda9dacb75dde9 /lib/mesa/src/gallium/auxiliary/pipe-loader
parent18d6381c51e253e4c41c62619f80d9ce745b95c8 (diff)
Merge Mesa 17.3.9
Mesa 18.x needs an ld with build-id for at least the intel code Mesa 18.2 assumes linux only memfd syscalls in intel code Tested by matthieu@, kettenis@ and myself on a variety of hardware and architectures. ok kettenis@
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary/pipe-loader')
-rw-r--r--lib/mesa/src/gallium/auxiliary/pipe-loader/Makefile.in110
-rw-r--r--lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader.c66
-rw-r--r--lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader.h32
-rw-r--r--lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c160
-rw-r--r--lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h18
-rw-r--r--lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c11
6 files changed, 259 insertions, 138 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/pipe-loader/Makefile.in b/lib/mesa/src/gallium/auxiliary/pipe-loader/Makefile.in
index 3abeaa18d..d0c38f14e 100644
--- a/lib/mesa/src/gallium/auxiliary/pipe-loader/Makefile.in
+++ b/lib/mesa/src/gallium/auxiliary/pipe-loader/Makefile.in
@@ -54,25 +54,29 @@ target_triplet = @target@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/Makefile.sources $(top_srcdir)/bin/depcomp \
$(top_srcdir)/src/gallium/Automake.inc
-@HAVE_DRISW_TRUE@am__append_1 = \
+@HAVE_LIBDRM_TRUE@am__append_1 = \
+@HAVE_LIBDRM_TRUE@ $(LIBDRM_LIBS)
+
+@HAVE_DRISW_TRUE@am__append_2 = \
@HAVE_DRISW_TRUE@ $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la
-@HAVE_DRISW_KMS_TRUE@am__append_2 = \
+@HAVE_DRISW_KMS_TRUE@am__append_3 = \
@HAVE_DRISW_KMS_TRUE@ $(top_builddir)/src/gallium/winsys/sw/kms-dri/libswkmsdri.la \
@HAVE_DRISW_KMS_TRUE@ $(LIBDRM_LIBS)
-@HAVE_LIBDRM_TRUE@am__append_3 = \
+@HAVE_LIBDRM_TRUE@am__append_4 = \
@HAVE_LIBDRM_TRUE@ $(LIBDRM_CFLAGS)
-@HAVE_LIBDRM_TRUE@am__append_4 = \
+@HAVE_LIBDRM_TRUE@am__append_5 = \
@HAVE_LIBDRM_TRUE@ $(DRM_SOURCES)
-@HAVE_LIBDRM_TRUE@am__append_5 = \
+@HAVE_LIBDRM_TRUE@am__append_6 = \
@HAVE_LIBDRM_TRUE@ $(DRM_SOURCES)
subdir = src/gallium/auxiliary/pipe-loader
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_gnu_make.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
+ $(top_srcdir)/m4/ax_check_gnu_make.m4 \
$(top_srcdir)/m4/ax_check_python_mako_module.m4 \
$(top_srcdir)/m4/ax_gcc_builtin.m4 \
$(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
@@ -89,10 +93,11 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libpipe_loader_dynamic_la_DEPENDENCIES = \
- $(top_builddir)/src/loader/libloader.la
+ $(top_builddir)/src/loader/libloader.la \
+ $(top_builddir)/src/util/libxmlconfig.la
am__libpipe_loader_dynamic_la_SOURCES_DIST = pipe_loader.c \
pipe_loader.h pipe_loader_priv.h pipe_loader_sw.c \
- pipe_loader_drm.c
+ driinfo_gallium.h pipe_loader_drm.c
am__objects_1 = libpipe_loader_dynamic_la-pipe_loader.lo \
libpipe_loader_dynamic_la-pipe_loader_sw.lo
am__objects_2 = libpipe_loader_dynamic_la-pipe_loader_drm.lo
@@ -110,10 +115,11 @@ libpipe_loader_dynamic_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(libpipe_loader_dynamic_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
libpipe_loader_static_la_DEPENDENCIES = \
- $(top_builddir)/src/loader/libloader.la
+ $(top_builddir)/src/loader/libloader.la \
+ $(top_builddir)/src/util/libxmlconfig.la
am__libpipe_loader_static_la_SOURCES_DIST = pipe_loader.c \
pipe_loader.h pipe_loader_priv.h pipe_loader_sw.c \
- pipe_loader_drm.c
+ driinfo_gallium.h pipe_loader_drm.c
am__objects_4 = libpipe_loader_static_la-pipe_loader.lo \
libpipe_loader_static_la-pipe_loader_sw.lo
am__objects_5 = libpipe_loader_static_la-pipe_loader_drm.lo
@@ -177,6 +183,8 @@ AMDGPU_CFLAGS = @AMDGPU_CFLAGS@
AMDGPU_LIBS = @AMDGPU_LIBS@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+ANDROID_CFLAGS = @ANDROID_CFLAGS@
+ANDROID_LIBS = @ANDROID_LIBS@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
@@ -207,8 +215,6 @@ DLLTOOL = @DLLTOOL@
DLOPEN_LIBS = @DLOPEN_LIBS@
DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
-DRI3PROTO_CFLAGS = @DRI3PROTO_CFLAGS@
-DRI3PROTO_LIBS = @DRI3PROTO_LIBS@
DRIGL_CFLAGS = @DRIGL_CFLAGS@
DRIGL_LIBS = @DRIGL_LIBS@
DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@
@@ -221,10 +227,11 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGL_CFLAGS = @EGL_CFLAGS@
-EGL_CLIENT_APIS = @EGL_CLIENT_APIS@
EGL_LIB_DEPS = @EGL_LIB_DEPS@
EGL_NATIVE_PLATFORM = @EGL_NATIVE_PLATFORM@
EGREP = @EGREP@
+ETNAVIV_CFLAGS = @ETNAVIV_CFLAGS@
+ETNAVIV_LIBS = @ETNAVIV_LIBS@
EXEEXT = @EXEEXT@
EXPAT_CFLAGS = @EXPAT_CFLAGS@
EXPAT_LIBS = @EXPAT_LIBS@
@@ -251,6 +258,8 @@ GL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@
GL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@
GREP = @GREP@
HAVE_XF86VIDMODE = @HAVE_XF86VIDMODE@
+I915_CFLAGS = @I915_CFLAGS@
+I915_LIBS = @I915_LIBS@
INDENT = @INDENT@
INDENT_FLAGS = @INDENT_FLAGS@
INSTALL = @INSTALL@
@@ -258,45 +267,40 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTEL_CFLAGS = @INTEL_CFLAGS@
-INTEL_LIBS = @INTEL_LIBS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LD_NO_UNDEFINED = @LD_NO_UNDEFINED@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBATOMIC_LIBS = @LIBATOMIC_LIBS@
LIBCLC_INCLUDEDIR = @LIBCLC_INCLUDEDIR@
LIBCLC_LIBEXECDIR = @LIBCLC_LIBEXECDIR@
LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
LIBDRM_LIBS = @LIBDRM_LIBS@
LIBELF_CFLAGS = @LIBELF_CFLAGS@
LIBELF_LIBS = @LIBELF_LIBS@
+LIBGLVND_DATADIR = @LIBGLVND_DATADIR@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
-LIBSENSORS_LDFLAGS = @LIBSENSORS_LDFLAGS@
-LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@
-LIBSHA1_LIBS = @LIBSHA1_LIBS@
+LIBSENSORS_LIBS = @LIBSENSORS_LIBS@
LIBTOOL = @LIBTOOL@
+LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@
+LIBUNWIND_LIBS = @LIBUNWIND_LIBS@
LIB_DIR = @LIB_DIR@
LIB_EXT = @LIB_EXT@
LIPO = @LIPO@
-LLVM_BINDIR = @LLVM_BINDIR@
LLVM_CFLAGS = @LLVM_CFLAGS@
LLVM_CONFIG = @LLVM_CONFIG@
-LLVM_CPPFLAGS = @LLVM_CPPFLAGS@
LLVM_CXXFLAGS = @LLVM_CXXFLAGS@
LLVM_INCLUDEDIR = @LLVM_INCLUDEDIR@
LLVM_LDFLAGS = @LLVM_LDFLAGS@
-LLVM_LIBDIR = @LLVM_LIBDIR@
LLVM_LIBS = @LLVM_LIBS@
-LLVM_VERSION = @LLVM_VERSION@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
-MESA_LLVM = @MESA_LLVM@
MKDIR_P = @MKDIR_P@
MSVC2013_COMPAT_CFLAGS = @MSVC2013_COMPAT_CFLAGS@
MSVC2013_COMPAT_CXXFLAGS = @MSVC2013_COMPAT_CXXFLAGS@
@@ -312,13 +316,11 @@ NVVIEUX_CFLAGS = @NVVIEUX_CFLAGS@
NVVIEUX_LIBS = @NVVIEUX_LIBS@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OMX_CFLAGS = @OMX_CFLAGS@
-OMX_LIBS = @OMX_LIBS@
-OMX_LIB_INSTALL_DIR = @OMX_LIB_INSTALL_DIR@
+OMX_BELLAGIO_CFLAGS = @OMX_BELLAGIO_CFLAGS@
+OMX_BELLAGIO_LIBS = @OMX_BELLAGIO_LIBS@
+OMX_BELLAGIO_LIB_INSTALL_DIR = @OMX_BELLAGIO_LIB_INSTALL_DIR@
OPENCL_LIBNAME = @OPENCL_LIBNAME@
OPENCL_VERSION = @OPENCL_VERSION@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
OSMESA_LIB = @OSMESA_LIB@
OSMESA_LIB_DEPS = @OSMESA_LIB_DEPS@
OSMESA_PC_LIB_PRIV = @OSMESA_PC_LIB_PRIV@
@@ -338,8 +340,6 @@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
POSIX_SHELL = @POSIX_SHELL@
-PRESENTPROTO_CFLAGS = @PRESENTPROTO_CFLAGS@
-PRESENTPROTO_LIBS = @PRESENTPROTO_LIBS@
PTHREADSTUBS_CFLAGS = @PTHREADSTUBS_CFLAGS@
PTHREADSTUBS_LIBS = @PTHREADSTUBS_LIBS@
PTHREAD_CC = @PTHREAD_CC@
@@ -355,8 +355,6 @@ SED = @SED@
SELINUX_CFLAGS = @SELINUX_CFLAGS@
SELINUX_LIBS = @SELINUX_LIBS@
SET_MAKE = @SET_MAKE@
-SHA1_CFLAGS = @SHA1_CFLAGS@
-SHA1_LIBS = @SHA1_LIBS@
SHELL = @SHELL@
SIMPENROSE_CFLAGS = @SIMPENROSE_CFLAGS@
SIMPENROSE_LIBS = @SIMPENROSE_LIBS@
@@ -365,7 +363,8 @@ STRIP = @STRIP@
SWR_AVX2_CXXFLAGS = @SWR_AVX2_CXXFLAGS@
SWR_AVX_CXXFLAGS = @SWR_AVX_CXXFLAGS@
SWR_CXX11_CXXFLAGS = @SWR_CXX11_CXXFLAGS@
-TIMESTAMP_CMD = @TIMESTAMP_CMD@
+SWR_KNL_CXXFLAGS = @SWR_KNL_CXXFLAGS@
+SWR_SKX_CXXFLAGS = @SWR_SKX_CXXFLAGS@
VALGRIND_CFLAGS = @VALGRIND_CFLAGS@
VALGRIND_LIBS = @VALGRIND_LIBS@
VA_CFLAGS = @VA_CFLAGS@
@@ -373,25 +372,28 @@ VA_LIBS = @VA_LIBS@
VA_LIB_INSTALL_DIR = @VA_LIB_INSTALL_DIR@
VA_MAJOR = @VA_MAJOR@
VA_MINOR = @VA_MINOR@
-VC4_CFLAGS = @VC4_CFLAGS@
-VC4_LIBS = @VC4_LIBS@
+VC5_SIMULATOR_CFLAGS = @VC5_SIMULATOR_CFLAGS@
+VC5_SIMULATOR_LIBS = @VC5_SIMULATOR_LIBS@
VDPAU_CFLAGS = @VDPAU_CFLAGS@
VDPAU_LIBS = @VDPAU_LIBS@
VDPAU_LIB_INSTALL_DIR = @VDPAU_LIB_INSTALL_DIR@
VDPAU_MAJOR = @VDPAU_MAJOR@
VDPAU_MINOR = @VDPAU_MINOR@
VERSION = @VERSION@
-VG_LIB_DEPS = @VG_LIB_DEPS@
VISIBILITY_CFLAGS = @VISIBILITY_CFLAGS@
VISIBILITY_CXXFLAGS = @VISIBILITY_CXXFLAGS@
VL_CFLAGS = @VL_CFLAGS@
VL_LIBS = @VL_LIBS@
VULKAN_ICD_INSTALL_DIR = @VULKAN_ICD_INSTALL_DIR@
-WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
-WAYLAND_LIBS = @WAYLAND_LIBS@
+WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@
+WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@
+WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@
WAYLAND_SCANNER = @WAYLAND_SCANNER@
WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@
WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@
+WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@
+WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@
+WNO_OVERRIDE_INIT = @WNO_OVERRIDE_INIT@
X11_INCLUDES = @X11_INCLUDES@
XA_MAJOR = @XA_MAJOR@
XA_MINOR = @XA_MINOR@
@@ -410,9 +412,10 @@ XVMC_LIBS = @XVMC_LIBS@
XVMC_LIB_INSTALL_DIR = @XVMC_LIB_INSTALL_DIR@
XVMC_MAJOR = @XVMC_MAJOR@
XVMC_MINOR = @XVMC_MINOR@
-XXD = @XXD@
YACC = @YACC@
YFLAGS = @YFLAGS@
+ZLIB_CFLAGS = @ZLIB_CFLAGS@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -477,7 +480,8 @@ 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
@@ -524,17 +528,15 @@ GALLIUM_TARGET_CFLAGS = \
-I$(top_srcdir)/src/gallium/auxiliary \
-I$(top_srcdir)/src/gallium/drivers \
-I$(top_srcdir)/src/gallium/winsys \
+ -I$(top_builddir)/src/util/ \
+ -I$(top_builddir)/src/gallium/drivers/ \
$(DEFINES) \
$(PTHREAD_CFLAGS) \
$(LIBDRM_CFLAGS) \
$(VISIBILITY_CFLAGS)
-GALLIUM_COMMON_LIB_DEPS = \
- -lm \
- $(CLOCK_LIB) \
- $(PTHREAD_LIBS) \
- $(DLOPEN_LIBS)
-
+GALLIUM_COMMON_LIB_DEPS = -lm $(LIBUNWIND_LIBS) $(LIBSENSORS_LIBS) \
+ $(CLOCK_LIB) $(PTHREAD_LIBS) $(DLOPEN_LIBS) $(am__append_1)
GALLIUM_WINSYS_CFLAGS = \
-I$(top_srcdir)/src \
-I$(top_srcdir)/include \
@@ -546,13 +548,13 @@ GALLIUM_WINSYS_CFLAGS = \
GALLIUM_PIPE_LOADER_WINSYS_LIBS = \
$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
$(top_builddir)/src/gallium/winsys/sw/wrapper/libwsw.la \
- $(am__append_1) $(am__append_2)
+ $(am__append_2) $(am__append_3)
# XXX: check if we need the gallium/winsys include
AM_CFLAGS = -I$(top_srcdir)/src/loader \
- -I$(top_srcdir)/src/gallium/winsys \
+ -I$(top_srcdir)/src/gallium/winsys -I$(top_builddir)/src/util \
$(GALLIUM_PIPE_LOADER_DEFINES) $(GALLIUM_CFLAGS) \
- $(VISIBILITY_CFLAGS) $(am__append_3)
+ $(VISIBILITY_CFLAGS) $(am__append_4)
noinst_LTLIBRARIES = \
libpipe_loader_static.la \
libpipe_loader_dynamic.la
@@ -565,13 +567,15 @@ libpipe_loader_dynamic_la_CFLAGS = \
$(AM_CFLAGS) \
-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
-libpipe_loader_static_la_SOURCES = $(COMMON_SOURCES) $(am__append_4)
-libpipe_loader_dynamic_la_SOURCES = $(COMMON_SOURCES) $(am__append_5)
+libpipe_loader_static_la_SOURCES = $(COMMON_SOURCES) $(am__append_5)
+libpipe_loader_dynamic_la_SOURCES = $(COMMON_SOURCES) $(am__append_6)
libpipe_loader_static_la_LIBADD = \
- $(top_builddir)/src/loader/libloader.la
+ $(top_builddir)/src/loader/libloader.la \
+ $(top_builddir)/src/util/libxmlconfig.la
libpipe_loader_dynamic_la_LIBADD = \
- $(top_builddir)/src/loader/libloader.la
+ $(top_builddir)/src/loader/libloader.la \
+ $(top_builddir)/src/util/libxmlconfig.la
EXTRA_DIST = SConscript
all: all-am
diff --git a/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader.c b/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader.c
index 1ddfeba16..e7cf9f86d 100644
--- a/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader.c
+++ b/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader.c
@@ -31,6 +31,10 @@
#include "util/u_memory.h"
#include "util/u_string.h"
#include "util/u_dl.h"
+#include "util/xmlconfig.h"
+#include "util/xmlpool.h"
+
+#include <string.h>
#ifdef _MSC_VER
#include <stdlib.h>
@@ -46,6 +50,12 @@ static int (*backends[])(struct pipe_loader_device **, int) = {
&pipe_loader_sw_probe
};
+const char gallium_driinfo_xml[] =
+ DRI_CONF_BEGIN
+#include "driinfo_gallium.h"
+ DRI_CONF_END
+;
+
int
pipe_loader_probe(struct pipe_loader_device **devs, int ndev)
{
@@ -66,6 +76,16 @@ pipe_loader_release(struct pipe_loader_device **devs, int ndev)
devs[i]->ops->release(&devs[i]);
}
+void
+pipe_loader_base_release(struct pipe_loader_device **dev)
+{
+ driDestroyOptionCache(&(*dev)->option_cache);
+ driDestroyOptionInfo(&(*dev)->option_info);
+
+ FREE(*dev);
+ *dev = NULL;
+}
+
const struct drm_conf_ret *
pipe_loader_configuration(struct pipe_loader_device *dev,
enum drm_conf conf)
@@ -73,14 +93,52 @@ pipe_loader_configuration(struct pipe_loader_device *dev,
return dev->ops->configuration(dev, conf);
}
+void
+pipe_loader_load_options(struct pipe_loader_device *dev)
+{
+ if (dev->option_info.info)
+ return;
+
+ const char *xml_options = gallium_driinfo_xml;
+ const struct drm_conf_ret *xml_options_conf =
+ pipe_loader_configuration(dev, DRM_CONF_XML_OPTIONS);
+
+ if (xml_options_conf)
+ xml_options = xml_options_conf->val.val_pointer;
+
+ driParseOptionInfo(&dev->option_info, xml_options);
+ driParseConfigFiles(&dev->option_cache, &dev->option_info, 0,
+ dev->driver_name);
+}
+
+char *
+pipe_loader_get_driinfo_xml(const char *driver_name)
+{
+#ifdef HAVE_LIBDRM
+ char *xml = pipe_loader_drm_get_driinfo_xml(driver_name);
+#else
+ char *xml = NULL;
+#endif
+
+ if (!xml)
+ xml = strdup(gallium_driinfo_xml);
+
+ return xml;
+}
+
struct pipe_screen *
pipe_loader_create_screen(struct pipe_loader_device *dev)
{
- return dev->ops->create_screen(dev);
+ struct pipe_screen_config config;
+
+ pipe_loader_load_options(dev);
+ config.options = &dev->option_cache;
+
+ return dev->ops->create_screen(dev, &config);
}
struct util_dl_library *
-pipe_loader_find_module(struct pipe_loader_device *dev,
+pipe_loader_find_module(const char *driver_name,
const char *library_paths)
{
struct util_dl_library *lib;
@@ -95,10 +153,10 @@ pipe_loader_find_module(struct pipe_loader_device *dev,
if (len)
ret = util_snprintf(path, sizeof(path), "%.*s/%s%s%s",
len, library_paths,
- MODULE_PREFIX, dev->driver_name, UTIL_DL_EXT);
+ MODULE_PREFIX, driver_name, UTIL_DL_EXT);
else
ret = util_snprintf(path, sizeof(path), "%s%s%s",
- MODULE_PREFIX, dev->driver_name, UTIL_DL_EXT);
+ MODULE_PREFIX, driver_name, UTIL_DL_EXT);
if (ret > 0 && ret < sizeof(path)) {
lib = util_dl_open(path);
diff --git a/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader.h b/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader.h
index 690d088ed..b50114310 100644
--- a/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader.h
+++ b/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader.h
@@ -35,6 +35,7 @@
#include "pipe/p_compiler.h"
#include "state_tracker/drm_driver.h"
+#include "util/xmlconfig.h"
#ifdef __cplusplus
extern "C" {
@@ -65,6 +66,9 @@ struct pipe_loader_device {
char *driver_name;
const struct pipe_loader_ops *ops;
+
+ driOptionCache option_cache;
+ driOptionCache option_info;
};
/**
@@ -97,6 +101,24 @@ pipe_loader_configuration(struct pipe_loader_device *dev,
enum drm_conf conf);
/**
+ * Ensure that dev->option_cache is initialized appropriately for the driver.
+ *
+ * This function can be called multiple times.
+ *
+ * \param dev Device for which options should be loaded.
+ */
+void
+pipe_loader_load_options(struct pipe_loader_device *dev);
+
+/**
+ * Get the driinfo XML string used by the given driver.
+ *
+ * The returned string is heap-allocated.
+ */
+char *
+pipe_loader_get_driinfo_xml(const char *driver_name);
+
+/**
* Release resources allocated for a list of devices.
*
* Should be called when the specified devices are no longer in use to
@@ -180,6 +202,16 @@ pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev);
bool
pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd);
+/**
+ * Get the driinfo XML used for the DRM driver of the given name, if any.
+ *
+ * The returned string is heap-allocated.
+ */
+char *
+pipe_loader_drm_get_driinfo_xml(const char *driver_name);
+
+extern const char gallium_driinfo_xml[];
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index 2b7ab2757..810542101 100644
--- a/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -32,6 +32,7 @@
#include <fcntl.h>
#include <stdio.h>
+#include <string.h>
#include <xf86drm.h>
#include <unistd.h>
@@ -63,100 +64,105 @@ struct pipe_loader_drm_device {
static const struct pipe_loader_ops pipe_loader_drm_ops;
#ifdef GALLIUM_STATIC_TARGETS
-static const struct drm_conf_ret throttle_ret = {
- DRM_CONF_INT,
- {2},
-};
-
-static const struct drm_conf_ret share_fd_ret = {
- DRM_CONF_BOOL,
- {true},
-};
-
-static inline const struct drm_conf_ret *
-configuration_query(enum drm_conf conf)
-{
- switch (conf) {
- case DRM_CONF_THROTTLE:
- return &throttle_ret;
- case DRM_CONF_SHARE_FD:
- return &share_fd_ret;
- default:
- break;
- }
- return NULL;
-}
-
static const struct drm_driver_descriptor driver_descriptors[] = {
{
.driver_name = "i915",
.create_screen = pipe_i915_create_screen,
- .configuration = configuration_query,
- },
-#ifdef USE_VC4_SIMULATOR
- /* VC4 simulator and ILO (i965) are mutually exclusive (error at
- * configure). As the latter is unconditionally added, keep this one above
- * it.
- */
- {
- .driver_name = "i965",
- .create_screen = pipe_vc4_create_screen,
- .configuration = configuration_query,
- },
-#endif
- {
- .driver_name = "i965",
- .create_screen = pipe_ilo_create_screen,
- .configuration = configuration_query,
+ .configuration = pipe_default_configuration_query,
},
{
.driver_name = "nouveau",
.create_screen = pipe_nouveau_create_screen,
- .configuration = configuration_query,
+ .configuration = pipe_default_configuration_query,
},
{
.driver_name = "r300",
.create_screen = pipe_r300_create_screen,
- .configuration = configuration_query,
+ .configuration = pipe_default_configuration_query,
},
{
.driver_name = "r600",
.create_screen = pipe_r600_create_screen,
- .configuration = configuration_query,
+ .configuration = pipe_default_configuration_query,
},
{
.driver_name = "radeonsi",
.create_screen = pipe_radeonsi_create_screen,
- .configuration = configuration_query,
+ .configuration = pipe_radeonsi_configuration_query,
},
{
.driver_name = "vmwgfx",
.create_screen = pipe_vmwgfx_create_screen,
- .configuration = configuration_query,
+ .configuration = pipe_default_configuration_query,
},
{
.driver_name = "kgsl",
.create_screen = pipe_freedreno_create_screen,
- .configuration = configuration_query,
+ .configuration = pipe_default_configuration_query,
},
{
.driver_name = "msm",
.create_screen = pipe_freedreno_create_screen,
- .configuration = configuration_query,
+ .configuration = pipe_default_configuration_query,
+ },
+ {
+ .driver_name = "pl111",
+ .create_screen = pipe_pl111_create_screen,
+ .configuration = pipe_default_configuration_query,
},
{
.driver_name = "virtio_gpu",
.create_screen = pipe_virgl_create_screen,
- .configuration = configuration_query,
+ .configuration = pipe_default_configuration_query,
},
{
.driver_name = "vc4",
.create_screen = pipe_vc4_create_screen,
- .configuration = configuration_query,
+ .configuration = pipe_default_configuration_query,
+ },
+ {
+ .driver_name = "vc5",
+ .create_screen = pipe_vc5_create_screen,
+ .configuration = pipe_default_configuration_query,
+ },
+ {
+ .driver_name = "etnaviv",
+ .create_screen = pipe_etna_create_screen,
+ .configuration = pipe_default_configuration_query,
},
+ {
+ .driver_name = "imx-drm",
+ .create_screen = pipe_imx_drm_create_screen,
+ .configuration = pipe_default_configuration_query,
+ }
};
#endif
+static const struct drm_driver_descriptor *
+get_driver_descriptor(const char *driver_name, struct util_dl_library **plib)
+{
+#ifdef GALLIUM_STATIC_TARGETS
+ for (int i = 0; i < ARRAY_SIZE(driver_descriptors); i++) {
+ if (strcmp(driver_descriptors[i].driver_name, driver_name) == 0)
+ return &driver_descriptors[i];
+ }
+#else
+ *plib = pipe_loader_find_module(driver_name, PIPE_SEARCH_DIR);
+ if (!*plib)
+ return NULL;
+
+ const struct drm_driver_descriptor *dd =
+ (const struct drm_driver_descriptor *)
+ util_dl_get_proc_address(*plib, "driver_descriptor");
+
+ /* sanity check on the driver name */
+ if (dd && strcmp(dd->driver_name, driver_name) == 0)
+ return dd;
+#endif
+
+ return NULL;
+}
+
bool
pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd)
{
@@ -180,27 +186,13 @@ pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd)
if (!ddev->base.driver_name)
goto fail;
-#ifdef GALLIUM_STATIC_TARGETS
- for (int i = 0; i < ARRAY_SIZE(driver_descriptors); i++) {
- if (strcmp(driver_descriptors[i].driver_name, ddev->base.driver_name) == 0) {
- ddev->dd = &driver_descriptors[i];
- break;
- }
- }
+ struct util_dl_library **plib = NULL;
+#ifndef GALLIUM_STATIC_TARGETS
+ plib = &ddev->lib;
+#endif
+ ddev->dd = get_driver_descriptor(ddev->base.driver_name, plib);
if (!ddev->dd)
goto fail;
-#else
- ddev->lib = pipe_loader_find_module(&ddev->base, PIPE_SEARCH_DIR);
- if (!ddev->lib)
- goto fail;
-
- ddev->dd = (const struct drm_driver_descriptor *)
- util_dl_get_proc_address(ddev->lib, "driver_descriptor");
-
- /* sanity check on the driver name */
- if (!ddev->dd || strcmp(ddev->dd->driver_name, ddev->base.driver_name) != 0)
- goto fail;
-#endif
*dev = &ddev->base;
return true;
@@ -265,8 +257,7 @@ pipe_loader_drm_release(struct pipe_loader_device **dev)
close(ddev->fd);
FREE(ddev->base.driver_name);
- FREE(ddev);
- *dev = NULL;
+ pipe_loader_base_release(dev);
}
static const struct drm_conf_ret *
@@ -282,11 +273,34 @@ pipe_loader_drm_configuration(struct pipe_loader_device *dev,
}
static struct pipe_screen *
-pipe_loader_drm_create_screen(struct pipe_loader_device *dev)
+pipe_loader_drm_create_screen(struct pipe_loader_device *dev,
+ const struct pipe_screen_config *config)
{
struct pipe_loader_drm_device *ddev = pipe_loader_drm_device(dev);
- return ddev->dd->create_screen(ddev->fd);
+ return ddev->dd->create_screen(ddev->fd, config);
+}
+
+char *
+pipe_loader_drm_get_driinfo_xml(const char *driver_name)
+{
+ char *xml = NULL;
+ struct util_dl_library *lib = NULL;
+ const struct drm_driver_descriptor *dd =
+ get_driver_descriptor(driver_name, &lib);
+ if (!dd)
+ goto out;
+
+ const struct drm_conf_ret *conf = dd->configuration(DRM_CONF_XML_OPTIONS);
+ if (!conf)
+ goto out;
+
+ xml = strdup((const char *)conf->val.val_pointer);
+
+out:
+ if (lib)
+ util_dl_close(lib);
+ return xml;
}
static const struct pipe_loader_ops pipe_loader_drm_ops = {
diff --git a/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h b/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
index da2ca8c6e..699040d71 100644
--- a/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
+++ b/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
@@ -31,7 +31,8 @@
#include "pipe_loader.h"
struct pipe_loader_ops {
- struct pipe_screen *(*create_screen)(struct pipe_loader_device *dev);
+ struct pipe_screen *(*create_screen)(struct pipe_loader_device *dev,
+ const struct pipe_screen_config *config);
const struct drm_conf_ret *(*configuration)(struct pipe_loader_device *dev,
enum drm_conf conf);
@@ -40,10 +41,21 @@ struct pipe_loader_ops {
};
/**
- * Open the pipe driver module that handles a specified device.
+ * Open the pipe driver module that contains the specified driver.
*/
struct util_dl_library *
-pipe_loader_find_module(struct pipe_loader_device *dev,
+pipe_loader_find_module(const char *driver_name,
const char *library_paths);
+/**
+ * Free the base device structure.
+ *
+ * Implementations of pipe_loader_ops::release must call this.
+ *
+ * (*dev)->driver_name must be freed by the caller if it was allocated on the
+ * heap.
+ */
+void
+pipe_loader_base_release(struct pipe_loader_device **dev);
+
#endif /* PIPE_LOADER_PRIV_H */
diff --git a/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c b/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
index 0fbc78e38..84894c0ca 100644
--- a/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
+++ b/lib/mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
@@ -100,7 +100,7 @@ pipe_loader_sw_probe_init_common(struct pipe_loader_sw_device *sdev)
if (!sdev->dd)
return false;
#else
- sdev->lib = pipe_loader_find_module(&sdev->base, PIPE_SEARCH_DIR);
+ sdev->lib = pipe_loader_find_module("swrast", PIPE_SEARCH_DIR);
if (!sdev->lib)
return false;
@@ -270,7 +270,8 @@ fail:
static void
pipe_loader_sw_release(struct pipe_loader_device **dev)
{
- struct pipe_loader_sw_device *sdev = pipe_loader_sw_device(*dev);
+ MAYBE_UNUSED struct pipe_loader_sw_device *sdev =
+ pipe_loader_sw_device(*dev);
#ifndef GALLIUM_STATIC_TARGETS
if (sdev->lib)
@@ -282,8 +283,7 @@ pipe_loader_sw_release(struct pipe_loader_device **dev)
close(sdev->fd);
#endif
- FREE(sdev);
- *dev = NULL;
+ pipe_loader_base_release(dev);
}
static const struct drm_conf_ret *
@@ -294,7 +294,8 @@ pipe_loader_sw_configuration(struct pipe_loader_device *dev,
}
static struct pipe_screen *
-pipe_loader_sw_create_screen(struct pipe_loader_device *dev)
+pipe_loader_sw_create_screen(struct pipe_loader_device *dev,
+ const struct pipe_screen_config *config)
{
struct pipe_loader_sw_device *sdev = pipe_loader_sw_device(dev);
struct pipe_screen *screen;