loader: Change incompatible driver warning to debug level#1937
loader: Change incompatible driver warning to debug level#1937akien-mga wants to merge 1 commit into
Conversation
|
Author akien-mga not on autobuild list. Waiting for curator authorization before starting CI build. |
1 similar comment
|
Author akien-mga not on autobuild list. Waiting for curator authorization before starting CI build. |
Some Linux distros (at least Fedora 44) ship Mesa's Dozen driver, even though it's not compatible as is on Linux. So the loader would systematically warn about it, and Vulkan application users are confused by the message: ``` terminator_CreateInstance: Received return code -9 from call to vkCreateInstance in ICD /usr/lib64/libvulkan_dzn.so. Skipping this driver. ```
cc76967 to
67370e2
Compare
|
Author akien-mga not on autobuild list. Waiting for curator authorization before starting CI build. |
1 similar comment
|
Author akien-mga not on autobuild list. Waiting for curator authorization before starting CI build. |
| VkFlags log_level = VK_ERROR_INCOMPATIBLE_DRIVER == icd_result ? VULKAN_LOADER_DEBUG_BIT : VULKAN_LOADER_WARN_BIT; | ||
| loader_log(ptr_instance, log_level, 0, |
There was a problem hiding this comment.
I put this in a local variable as it was tricky otherwise to keep clang-format happy, the line would be slightly too long and it would throw 0, to its own line, which doesn't match the style used elsewhere.
Alternatively, this could be:
loader_log(ptr_instance,
VK_ERROR_INCOMPATIBLE_DRIVER == icd_result ? VULKAN_LOADER_DEBUG_BIT : VULKAN_LOADER_WARN_BIT,
0,
"terminator_CreateInstance: Received return code %i from call to vkCreateInstance in ICD %s. Skipping "
"this driver.",
icd_result, icd_term->scanned_icd->lib_name);|
This is a very crude fix because it downgrades error codes, the API mechanism for drivers to signal issues, from a user visible WARN to a often ignored INFO. Future issues with other drivers will be ignored as INFO level. Changing the error code from INCOMPATIBLE_DRIVER to INITIALIZATION_FAILED still means that the driver does nothing. The ultimate fix is to get distro's to not ship dozen. Fixing the problem at its source after all. It seems like dozen returns an error if it cannot satisfy some conditions upon initialization. A way to fix it without causing this error message would be for dozen to succeed vkCreateInstance, then return 0 physical devices. That would signal "hey, you loaded me but there is nothing useful for you here". There are existing environment variables in the loader that should help this. |
|
Thanks for the feedback. That makes sense.
I'm not familiar with the reasons why Fedora and maybe other distros ship dozen, but I suspect this is intentional. The spec file includes explicit conditionals for enabling D3D12: https://src.fedoraproject.org/rpms/mesa/blob/rawhide/f/mesa.spec
Right, I'm not deeply familiar with how other drivers are implemented but I suspect that other drivers which aren't compatible with my system handle it different from dozen, as they don't trigger this warning. E.g. I can open a Mesa issue to discuss this further. Closing the PR as it's not a proper solution. |
|
this should be fixed in mesa, not by not shipping dozen, but by fixing dozen to return the incompatible driver error code when it fails to find it's requirements. |
|
but it does appear to be returning INCOMPATIBLE_DRIVER which I thought was the correct thing to return to not print a warning |
|
if it should just fail to enumerate anything then we should probably just fix that in dozen, so file a mesa issue anyways |
Done: mesa/mesa#15699 |
Some Linux distros (at least Fedora 44) ship Mesa's Dozen driver, even though it's not compatible as is on Linux.
So the loader would systematically warn about it, and Vulkan application users are confused by the message:
Some additional context:
VK_ERROR_INITIALIZATION_FAILEDtoVK_ERROR_INCOMPATIBLE_DRIVERin Mesa: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38611VULKAN_LOADER_INFO_BITinstead ofDEBUG(Godot ignores both so that's good for me) and/or to write a custom message that's more intelligible now thatVK_ERROR_INCOMPATIBLE_DRIVERis special-cased.v1.4.341, as that's the version ofvulkan-headersI had packaged on Fedora 44, so it was more convenient. I expect it to work fine onmaintoo.