On 2021-01-08 11:22 a.m., Witold Baryluk wrote:
True, that a lot of applications don't properly inspect physical devices list.
(I do have some patches to various tools and examples to fix it,
they are already in review by respective projects).
Thanks for doing that, though I'm afraid it's a game of whack-a-mole.
And it is also correct, that the order might be somehow random,
i.e. depended on file system readdir entries order.
However, Mesa's device_selection layer (enabled implicitly and automatically),
will preferentially re-order devices, and that makes all apps
by default that are not smart about it, use non-CPU devices.
Lavapipe will always be considered last.
On my development machine, vulkaninfo lists these devices:
GPU id : 0 (AMD RADV NAVI14 (ACO)):
GPU id : 1 (llvmpipe (LLVM 11.0.1, 256 bits)):
GPU id : 2 (AMD RADV NAVI14 (ACO)):
GPU id : 3 (llvmpipe (LLVM 12.0.0, 256 bits)):
Devices 0 & 1 are from /usr/share/vulkan/icd.d/ (the mesa-vulkan-drivers
package), devices 2 & 3 are from /usr/local/share/vulkan/icd.d/ (my
local Mesa build).
Now imagine a system where the GPU isn't supported by the packaged
drivers yet, but a developer is working on adding that support. It looks
like this could result in lavapipe from the system packages getting
preferred over the local-built HW driver.
Addressing this might require changes to the Vulkan loader, which should
allow addressing these issues completely without the Mesa
device_selection layer.
(In this particular scenario, just enumerating devices from
/usr/local/share/vulkan/icd.d/ before /usr/share/vulkan/icd.d/ should be
enough, which I'd argue should be done anyway :)
The displayed warning was just in the wrong place, it is displayed
even if lavapipe is not used, merely instantiated for device enumeration,
which is wrong. Patch to fix this is trivial, and already in review upstream:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8377
Thanks, that should prevent a lot of confusion.
There's still at least one other case where shipping lavapipe could be
an issue: If a system didn't have any Vulkan support before (e.g.
because the GPU is too old for Vulkan support), it could now start using
lavapipe. I suspect this is what's going on in Fedora bug reports such
as https://bugzilla.redhat.com/show_bug.cgi?id=1912159 "pidgin crashes
with mesa-vulkan-drivers-20.3.2-1.fc33".
--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and X developer