summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-10-20 15:46:21 -0700
committerEmil Velikov <[email protected]>2016-10-24 09:54:28 +0100
commitabf5327b86e53e664f312b3b441d0505d2b40032 (patch)
tree224e4de4302a0b321b04b5e5201c5079bf0f0f84 /src
parentd0d3e721d02cc49693cc7518de9691bba2a7e471 (diff)
anv: Suffix the intel_icd file with the host CPU
Vulkan has a multi-arch problem... The idea behind the Vulkan loader is that you have a little json file on your disk that tells the loader where to find drivers. The loader looks for these json files in standard locations, and then goes and loads the my_driver.so's that they specify. This allows you as a driver implementer to put their driver wherever on the disk they want so long as the ICD points in the right place. For a multi-arch system, however, you may have multiple libvulkan_intel.so files installed that the loader needs to pick depending on architecture. Since the ICD file format does not specify any architecture information, you can't tell the loader where to find the 32-bit version vs. the 64-bit version. The way that packagers have been dealing with this is to place libvulkan_intel.so in the top level lib directory and provide just a name (and no path) to the loader. It will then use the regular system search paths and find the correct driver. While this solution works fine for distro-installed Vulkan drivers, it doesn't work so well for user-installed drivers because they may put it in /opt or $HOME/.local or some other more exotic location. In this case, you can't use an ICD json file with just a library name because it doesn't know where to find it; you also have to add that to your library lookup path via LD_LIBRARY_PATH or similar. This patch handles both use-cases by taking advantage of the fact that the loader dlopen()s each of the drivers and, if one dlopen() calls fails, it silently continues on to open other drivers. By suffixing the icd file, we can provide two different json files: intel_icd.x86_64.json and intel_icd.i686.json with different paths. Since dlopen() will only succeed on the libvulkan_intel.so of the right arch, the loader will happily ignore the others and load that one. This allows us to properly handle multi-arch while still providing a full path so user installs will work fine. I tested this on my Fedora 25 machine with 32 and 64-bit builds of our Vulkan driver installed and 32 and 64-bit builds of crucible. It seems to work just fine. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Cc: "13.0" <[email protected]> (cherry picked from commit d96345de989c8f9a0328cdc3588bfe186154c8ea) Squashed with commit: anv: Always use the full driver path in the intel_icd.*.json Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Cc: "13.0" <[email protected]> (cherry picked from commit 7ea4ef8849c5cc158adbdff1187b91f591552196) Squashed with commit: configure: Get rid of the --disable-vulkan-icd-full-driver-path flag Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Cc: "13.0" <[email protected]> (cherry picked from commit 3f05fc62f924c051bdb883482452fb37650d5768)
Diffstat (limited to 'src')
-rw-r--r--src/intel/vulkan/.gitignore1
-rw-r--r--src/intel/vulkan/Makefile.am9
-rw-r--r--src/intel/vulkan/intel_icd.json.in (renamed from src/intel/vulkan/intel_icd.json)2
3 files changed, 9 insertions, 3 deletions
diff --git a/src/intel/vulkan/.gitignore b/src/intel/vulkan/.gitignore
index bde5cd82f40..725a8584624 100644
--- a/src/intel/vulkan/.gitignore
+++ b/src/intel/vulkan/.gitignore
@@ -3,3 +3,4 @@
/anv_entrypoints.h
/anv_timestamp.h
/dev_icd.json
+/intel_icd.*.json
diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am
index 6e171887f57..7bf68a0fe2c 100644
--- a/src/intel/vulkan/Makefile.am
+++ b/src/intel/vulkan/Makefile.am
@@ -152,7 +152,7 @@ EXTRA_DIST = \
$(top_srcdir)/include/vulkan/vk_icd.h \
anv_entrypoints_gen.py \
dev_icd.json.in \
- intel_icd.json
+ intel_icd.json.in
libvulkan_intel_la_LIBADD = $(VULKAN_LIB_DEPS)
@@ -167,7 +167,7 @@ libvulkan_intel_la_LDFLAGS = \
icdconfdir = @VULKAN_ICD_INSTALL_DIR@
-icdconf_DATA = intel_icd.json
+icdconf_DATA = intel_icd.@[email protected]
# The following is used for development purposes, by setting VK_ICD_FILENAMES.
noinst_DATA = dev_icd.json
@@ -176,6 +176,11 @@ dev_icd.json : dev_icd.json.in
-e "s#@build_libdir@#${abs_top_builddir}/${LIB_DIR}#" \
< $(srcdir)/dev_icd.json.in > $@
+intel_icd.@[email protected] : intel_icd.json.in
+ $(AM_V_GEN) $(SED) \
+ -e "s#@install_libdir@#${libdir}#" \
+ < $(srcdir)/intel_icd.json.in > $@
+
# Libvulkan with dummy gem. Used for unit tests.
libvulkan_test_la_SOURCES = $(VULKAN_GEM_STUB_FILES)
libvulkan_test_la_LIBADD = $(VULKAN_LIB_DEPS)
diff --git a/src/intel/vulkan/intel_icd.json b/src/intel/vulkan/intel_icd.json.in
index 277c14ec444..d9b363a9762 100644
--- a/src/intel/vulkan/intel_icd.json
+++ b/src/intel/vulkan/intel_icd.json.in
@@ -1,7 +1,7 @@
{
"file_format_version": "1.0.0",
"ICD": {
- "library_path": "libvulkan_intel.so",
+ "library_path": "@install_libdir@/libvulkan_intel.so",
"abi_versions": "1.0.3"
}
}