Open CNR0706 opened 1 month ago
same issue here, had installed amdgpu-pro for emulation purposes and this started happening.
Thank you for the workaround. It does not work in my case (perhaps because Vulkan Validation Layers are installed), however pointed to the sourcecode, so here is a quick hack to select the device by the highest API version.
diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp
index 63d34b3..a0cec50 100644
--- a/src/rendervulkan.cpp
+++ b/src/rendervulkan.cpp
@@ -325,10 +325,15 @@ bool CVulkanDevice::selectPhysDev(VkSurfaceKHR surface)
bTryComputeOnly = false;
}
+ uint32_t apiVersion = 0;
for (auto cphysDev : physDevs)
{
VkPhysicalDeviceProperties deviceProperties;
vk.GetPhysicalDeviceProperties(cphysDev, &deviceProperties);
+ vk_log.infof( "physical device '%s': API %u.%u.%u", deviceProperties.deviceName,
+ VK_VERSION_MAJOR(deviceProperties.apiVersion),
+ VK_VERSION_MINOR(deviceProperties.apiVersion),
+ VK_VERSION_PATCH(deviceProperties.apiVersion));
if (deviceProperties.apiVersion < VK_API_VERSION_1_2)
continue;
@@ -350,9 +355,11 @@ bool CVulkanDevice::selectPhysDev(VkSurfaceKHR surface)
if (generalIndex != ~0u || computeOnlyIndex != ~0u)
{
- // Select the device if it's the first one or the preferred one
- if (!m_physDev ||
- (g_preferVendorID == deviceProperties.vendorID && g_preferDeviceID == deviceProperties.deviceID))
+ // Search for the highest API version.
+ // However, ignore other devices if the preferred one provided.
+ if (apiVersion < deviceProperties.apiVersion &&
+ (!g_preferDeviceID ||
+ (g_preferVendorID == deviceProperties.vendorID && g_preferDeviceID == deviceProperties.deviceID)))
{
// if we have a surface, check that the queue family can actually present on it
if (surface) {
@@ -380,6 +387,8 @@ bool CVulkanDevice::selectPhysDev(VkSurfaceKHR surface)
if ( env_to_bool( getenv( "GAMESCOPE_FORCE_GENERAL_QUEUE" ) ) )
m_queueFamily = generalIndex;
+
+ apiVersion = deviceProperties.apiVersion;
}
}
}
It seems to work with and without --prefer-vk-device
specified. Please note, I am not considering this as solution, because it depends on Mesa version and shall occasionally select something wrong.
Just in case: to apply this on Gentoo save as a /etc/portage/patches/gui-wm/gamescope/search_highest_api.patch
so emerge gamescope
will pick it up.
System Report: https://gist.github.com/CNR0706/ddbeb3289f67d5c46a033a2def05f9c0 System Information: https://gist.github.com/CNR0706/0f1d02bf3f429fb9e2cc4b2e77bc4ebf Steam Runtime Diagnostics: https://gist.github.com/CNR0706/fb18e3b4ad0596fd8b9efc6b919f1900
When running Gamescope on a system that has AMDGPU-Pro's Vulkan driver or AMDVLK installed it fails to start because it is trying to make use of these drivers even when RADV is explicitly forced using $VK_DRIVER_FILES, $VK_ICD_FILENAMES or $AMD_VULKAN_ICD.
Console output:
It's sometimes possible to work around this by specifying
--prefer-vk-device
, but this seems to be dependent on the way the drivers are packaged. AMDVLK for example puts its ICD files into/etc/vulkan/icd.d
and this breaks the workaround entirely for some reason. Moving them manually to/usr/share/vulkan/icd.d
makes the workaround workaround again.AMDGPU-Pro's Vulkan implementation puts its files into
/usr/share/vulkan/icd.d
thus the workaround works normally.Console output with workaround:
I've been able to reproduce this issue on both Gentoo ~amd64 and openSuSE Tumbleweed.