mesa/src/intel/vulkan
Jason Ekstrand d96345de98 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 <jason@jlekstrand.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
2016-10-21 09:30:20 -07:00
..
tests anv: fold the tests' makefile 2016-05-01 08:38:04 +01:00
.gitignore anv: Suffix the intel_icd file with the host CPU 2016-10-21 09:30:20 -07:00
anv_allocator.c anv: port to using new u_vector shared helper. 2016-10-19 09:05:25 +10:00
anv_batch_chain.c anv: move to using vk_alloc helpers. 2016-10-19 09:05:26 +10:00
anv_blorp.c anv: Use blorp for subpass clears 2016-10-14 15:39:41 -07:00
anv_cmd_buffer.c anv: move to using vk_alloc helpers. 2016-10-19 09:05:26 +10:00
anv_descriptor_set.c anv: move to using vk_alloc helpers. 2016-10-19 09:05:26 +10:00
anv_device.c anv: move to using vk_alloc helpers. 2016-10-19 09:05:26 +10:00
anv_dump.c anv/cmd_buffer: Move Begin/End/Execute to genX_cmd_buffer.c 2016-10-17 17:41:35 -07:00
anv_entrypoints_gen.py anv: Make entrypoint resolution take a gen_device_info 2016-10-14 15:40:39 -07:00
anv_formats.c anv/formats: Fix build on gcc-4 and earlier 2016-10-03 15:45:28 +03:00
anv_gem.c anv: remove define _DEFAULT_SOURCE 2016-05-23 12:09:11 +01:00
anv_gem_stubs.c anv: remove define _DEFAULT_SOURCE 2016-05-23 12:09:11 +01:00
anv_genX.h anv/cmd_buffer: Move descriptor flushing into genX_cmd_buffer.c 2016-10-17 17:41:35 -07:00
anv_image.c anv: move to using vk_alloc helpers. 2016-10-19 09:05:26 +10:00
anv_intel.c anv: move to using vk_alloc helpers. 2016-10-19 09:05:26 +10:00
anv_nir.h anv: use correct header guards 2016-10-14 11:53:41 +01:00
anv_nir_apply_dynamic_offsets.c anv/pipeline: Only do buffer bounds checks if robustBufferAccess is enabled 2016-05-19 21:18:59 -07:00
anv_nir_apply_pipeline_layout.c anv/pipeline: Store the (set, binding, index) tripple in the bind map 2016-06-10 09:43:07 -07:00
anv_nir_lower_push_constants.c nir: Switch the arguments to nir_foreach_function 2016-04-28 15:54:48 -07:00
anv_pass.c anv: move to using vk_alloc helpers. 2016-10-19 09:05:26 +10:00
anv_pipeline.c anv: move to using vk_alloc helpers. 2016-10-19 09:05:26 +10:00
anv_pipeline_cache.c anv: move to using vk_alloc helpers. 2016-10-19 09:05:26 +10:00
anv_private.h anv: drop unused zero macro. 2016-10-20 10:53:37 +10:00
anv_query.c anv: move to using vk_alloc helpers. 2016-10-19 09:05:26 +10:00
anv_util.c anv: port to using new u_vector shared helper. 2016-10-19 09:05:25 +10:00
anv_wsi.c anv/wsi: remove all anv references from WSI common code 2016-10-19 10:15:43 +10:00
anv_wsi_wayland.c anv/wsi: remove all anv references from WSI common code 2016-10-19 10:15:43 +10:00
anv_wsi_x11.c anv/wsi: remove all anv references from WSI common code 2016-10-19 10:15:43 +10:00
dev_icd.json.in Move the intel vulkan driver to src/intel/vulkan 2016-02-18 10:37:59 -08:00
gen7_cmd_buffer.c anv/cmd_buffer: Unify flush_compute_state across gens 2016-10-17 17:41:35 -07:00
gen7_pipeline.c anv: move to using vk_alloc helpers. 2016-10-19 09:05:26 +10:00
gen8_cmd_buffer.c anv/cmd_buffer: Unify flush_compute_state across gens 2016-10-17 17:41:35 -07:00
gen8_pipeline.c anv: move to using vk_alloc helpers. 2016-10-19 09:05:26 +10:00
genX_blorp_exec.c anv: Get rid of anv_cmd_buffer_emit_state_base_address 2016-10-17 17:41:35 -07:00
genX_cmd_buffer.c anv/cmd_buffer: Move descriptor flushing into genX_cmd_buffer.c 2016-10-17 17:41:35 -07:00
genX_pipeline.c anv: move to using vk_alloc helpers. 2016-10-19 09:05:26 +10:00
genX_pipeline_util.h anv: replace , with ; in anv_batch_emit() 2016-10-17 18:16:38 +01:00
genX_state.c anv: move to using vk_alloc helpers. 2016-10-19 09:05:26 +10:00
intel_icd.json.in anv: Add a --disable-vulkan-icd-full-driver-path option 2016-08-25 10:32:31 +10:00
Makefile.am anv: Suffix the intel_icd file with the host CPU 2016-10-21 09:30:20 -07:00
Makefile.sources anv: move to using shared wsi code 2016-10-19 10:15:43 +10:00
TODO anv: turn on samplerAnisotropy in VkPhysicalDeviceFeatures 2016-10-10 09:25:38 +01:00
vk_format_info.h anv: use correct header guards 2016-10-14 11:53:41 +01:00