vulkan device selection layer

Dave Airlie requested to merge airlied/mesa:vk-device-select-layer into master

This is a first pass at bringing Bas's device selection layer into Mesa, and trying to make it work with DRI_PRIME and pick a correct default for X11/wayland/device sessions.

The current rules are to use a new MESA_VK_DEVICE_SELECT env var above all else, if that isn't set then it checks DRI_PRIME, tries to match against the fd from DRI3, and probes the boot_vga file (should we be using libpciaccess here?).

It is also currently very PCI only as vulkan doesn't expose enough to us for other devices. It suffers from one big problem with the vulkan loader/layers however.

Layers cannot enable extensions.

To get PCI bus info (to distinguish between two identical devices), it needs VK_KHR_get_physical_device_properties2 and VK_EXT_pci_bus_info. However unless the app enables the former in it's instance layer list, we can't use either of them in the layer currently.

We should find some way to address this shortcoming upstream.

Ideally we'd add a new phys device prop that was a sysfs path or something.

Edited by Dave Airlie

Merge request reports