felixdoerre / primus_vk

Vulkan GPU-offloading layer
BSD 2-Clause "Simplified" License
230 stars 17 forks source link

vkGetPhysicalDeviceSurfaceFormats2KHR error in vulkaninfo #76

Closed zimudec closed 4 years ago

zimudec commented 4 years ago

I have had problems starting vulkan with the latest versions of steam-manjaro, and I had to downgrade to previous versions to avoid the problem.

Something similar has happened to me with libglvnd, where I have also had to downgrade.

I saw that when I run pvkrun vulkaninfo, it throws me the following:

ERROR: [Loader Message] Code 0 : /usr/lib32/libvulkan_intel.so: wrong ELF class: ELFCLASS32 INTEL-MESA: warning: Ivy Bridge Vulkan support is incomplete ERROR at /build/vulkan-tools/src/Vulkan-Tools-1.2.151/vulkaninfo/vulkaninfo.h:245:vkGetPhysicalDeviceSurfaceFormats2KHR failed with ERROR_INITIALIZATION_FAILED

I think it may have to do with it. I have not found anything related on the web, and I need guidance.

felixdoerre commented 4 years ago

On my system this error is caused by the following behavior.

For me, changing the vulkan version to 1.2 in the primus_vk.json solved the problem in vulkaninfo. I didn't experience any problems with a real-world application though, so I didn't check further.

Can you try, if changing the version to 1.2here helps you?

crbble commented 4 years ago

I also had this problem and changing the version to 1.2 in _/usr/share/vulkan/implicit_layer.d/primusvk.json worked for me. Without this change DXVK with WINE did not work.

felixdoerre commented 4 years ago

Strange, I am running several wine/dxvk applications without problem. At least on master, dxvk currently only requests vulkan 1.1: https://github.com/doitsujin/dxvk/blob/ea53923406e3bfe3a6bc1e2452254773855e7ed0/src/dxvk/dxvk_instance.cpp#L122

But whatever, version 1.2 is in any case the "correct" version for primus_vk.json

zimudec commented 4 years ago

I effectively made the change and vulkaninfo no longer returns an error.

However, even though you have made that change, the latest version of steam-manjaro (1.0.0.66-1) still shows an error when trying to run vulkan:

PrimusVK: Searching for display GPU:
PrimusVK: 0x56731a60: 
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) HD Graphics 4000 (IVB GT2)
PrimusVK:   Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0x56731a60.
PrimusVK: No device for the rendering GPU found. Is the correct driver installed?
PrimusVK: VK_ICD_FILENAMES not set
vkCreateInstance failed with error -3
BInit - Unable to initialize Vulkan!
[0929/203723.960952:INFO:crash_reporting.cc(270)] Crash reporting enabled for process: renderer
[0929/203724.054021:INFO:crash_reporting.cc(270)] Crash reporting enabled for process: renderer
[0929/203724.172321:INFO:crash_reporting.cc(270)] Crash reporting enabled for process: renderer
Installing breakpad exception handler for appid(steam)/version(1599174997)

I go back to the previous version (1.0.0.61-7) and pvkrun with vulkan, steam and optimus works without problems.

I'm going to open a new issue, as it seems to be a different error.

felixdoerre commented 4 years ago

So this issue is solved then?

zimudec commented 4 years ago

yes, the vulkaninfo command error is fixed!

jarbus commented 3 years ago

On my system this error is caused by the following behavior.

  • primusrun/optirun powers on the dedicated graphics card
  • vulkaninfo explicitly requests vulkan api 1.2
  • The vulkan-info speficied in the primus_vk layer-json file is 1.1
  • The loader skips the primus_vk layer
  • Now the loader directly contacts the dedicated graphics card and asks for supported surface formats
  • The nvidia driver is confused, as it is asked to talk to the primary X-Server (which runs on intel graphics) which is didn't know about before.

For me, changing the vulkan version to 1.2 in the primus_vk.json solved the problem in vulkaninfo. I didn't experience any problems with a real-world application though, so I didn't check further.

Can you try, if changing the version to 1.2here helps you?

Thank you so much, this fixed it for me as well!!!