ValveSoftware / gamescope

SteamOS session compositing window manager
Other
3.2k stars 214 forks source link

vkCreateDevice failed (VkResult: -8) with gamescope >= 3.13.0 #1454

Open michaelneverwins opened 4 months ago

michaelneverwins commented 4 months ago

If I build gamescope from tag 3.12.5 on Linux Mint 22, it seems to work. Meanwhile, 3.12.6 and 3.12.7 actually fail to build with

../src/reshade_effect_manager.cpp:17:10: fatal error: stb_image_resize.h: No such file or directory

but that may not be worth investigating as it doesn't occur with 3.13.0, which builds successfully and then fails to run:

No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
wlserver: [backend/headless/backend.c:68] Creating headless backend
WARNING: radv is not a conformant Vulkan implementation, testing use only.
vulkan: selecting physical device 'AMD Radeon HD 7900 Series (RADV TAHITI)': queue family 1 (general queue family 0)
vulkan: physical device does not support DRM format modifiers
vulkan: vkCreateDevice failed (VkResult: -8)
Failed to initialize Vulkan

This is also the case with all newer versions I've tried, including 3.14.24:

[gamescope] [Info]  console: gamescope version 3.14.24
No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
WARNING: radv is not a conformant Vulkan implementation, testing use only.
[gamescope] [Info]  vulkan: selecting physical device 'AMD Radeon HD 7900 Series (RADV TAHITI)': queue family 1 (general queue family 0)
[gamescope] [Info]  vulkan: physical device does not support DRM format modifiers
[gamescope] [Error] vulkan: vkCreateDevice failed (VkResult: -8)
terminate called without an active exception
Aborted (core dumped)

You can see there that my GPU is old, and this is probably the most relevant information about my system. It's my understanding that Vulkan support for this card is incomplete. It may be the case that it simply isn't supported by gamescope anymore (although it apparently was), in which case I'm not sure whether it would be considered a bug/regression or just a sad consequence of still using old hardware.

Note that "physical device does not support DRM format modifiers" is logged with version 3.12.5 as well, and it works anyway:

No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
wlserver: [backend/headless/backend.c:68] Creating headless backend
WARNING: radv is not a conformant Vulkan implementation, testing use only.
vulkan: selecting physical device 'AMD Radeon HD 7900 Series (RADV TAHITI)': queue family 1
vulkan: physical device does not support DRM format modifiers
vulkan: supported DRM formats for sampling usage:
vulkan:   AR24 (0x34325241)
vulkan:   XR24 (0x34325258)
vulkan:   AB24 (0x34324241)
vulkan:   XB24 (0x34324258)
vulkan:   NV12 (0x3231564E)
vulkan:   AB4H (0x48344241)
vulkan:   XB4H (0x48344258)
vulkan:   AB48 (0x38344241)
vulkan:   XB48 (0x38344258)
vulkan:   AB30 (0x30334241)
vulkan:   XB30 (0x30334258)
vulkan:   AR30 (0x30335241)
vulkan:   XR30 (0x30335258)
wlserver: Running compositor on wayland display 'gamescope-0'
wlserver: [backend/headless/backend.c:16] Starting headless backend
wlserver: [xwayland/server.c:108] Starting Xwayland on :1
...

Therefore I assume the relevant part of newer versions' output is this:

vulkan: vkCreateDevice failed (VkResult: -8)

I had seen the same thing with the Flatpak version of gamescope on Linux Mint 21.3. I don't have any Flatpak packages installed right now, but at the time, I had noticed that gamescope had stopped working in Bottles, and had fixed it by undoing updates to the gamescope package:

sudo flatpak update --system --commit 9e2ba1b79351dde28e2984b75b11701cbfba1444ba1b0260b61f45ad159c8c74 org.freedesktop.Platform.VulkanLayer.gamescope//23.08
flatpak mask --system org.freedesktop.Platform.VulkanLayer.gamescope//23.08

If I remember correctly, this had effectively put gamescope at a pre-3.13.0 version whereas the update that broke it was post-3.13.0, so it seems the problem I'm having with gamescope 3.13.0 and later as compiled on my own system is the same as what I saw with the Flatpak build.

If I'm stuck with 3.12.5 until I get around to that long-overdue hardware upgrade, then so be it. However, any insight would be appreciated.

sharkautarch commented 4 months ago

Looks like (VkResult: -8) corresponds to: VK_ERROR_FEATURE_NOT_PRESENT So must be due to an unsupported vulkan feature. I was thinking it may be dynamic rendering, but looking at your gpu's vulkan info: https://vulkan.gpuinfo.org/displayreport.php?id=17692 looks like dynamic rendering is supported

I noticed that shaderFloat16 is unsupported, but gamescope only enables that feature if it detects that the gpu supports it, so probably something else...

But I have found one feature that's used in gamescope and is unsupported by your gpu: scalarBlockLayout Looks like the shaders are currently using this feature w/ GL_EXT_scalar_block_layout @Joshua-Ashton I know you had previously rewrote the shader blit data so as not to require int8 support, ofc it's your decision as to whether to rewrite stuff again to not require support of scalarBlockLayout. Seems like it'll be a bit of a pain to have to deal with alignment if not making use of scalarBlockLayout... :/

michaelneverwins commented 4 months ago

Thanks for looking into it, @sharkautarch.

As it turns out, I just noticed that I also can't use Zink for perhaps the same reason. It logs the following before failing to load:

WARNING: Some incorrect rendering might occur because the selected Vulkan device (AMD Radeon HD 7900 Series (RADV TAHITI)) doesn't support base Zink requirements: scalarBlockLayout OR EXT_scalar_block_layout

However, I definitely had used Zink before (and had confirmed it was working by way of MangoHud) on Linux Mint 21.3, so I'm guessing this requirement is new (or, rather, was added between whatever versions of Vulkan/Zink are used by Linux Mint 21.3 and by Linux Mint 22).

I certainly don't need Zink, and was just trying it for fun, but if all Vulkan-related things are eventually going to stop supporting my hardware, then... well, I might not get to keep using this GPU until it physically dies on me after all.

JustCauseWhyNot commented 3 months ago

I'm having the same issue with an rtx 4070S. If you need details from me I'll share what I can.

sharkautarch commented 3 months ago

@JustCauseWhyNot I took a look at your gpu’s vulkan feature support here: https://vulkan.gpuinfo.org/displayreport.php?id=32371#features_core_11

I couldn’t find any unsupported feature that I know is used in gamescope

It’s possible that your driver is missing a feature that’s reported as supported on the gpuinfo page

Try installing/building and running vulkan caps viewer from here: https://github.com/SaschaWillems/VulkanCapsViewer

JustCauseWhyNot commented 3 months ago

Here's what I get with vulkaninfo output which I hope is what you want.

❯ vulkaninfo >| vulkaninfo WARNING: [Loader Message] Code 0 : loader_add_layer_properties: 'layers' tag not supported until file version 1.0.1, but /usr/share/vulkan/implicit_layer.d/nvidia_layers.json is reporting version 1 vulkaninfo.txt

sharkautarch commented 3 months ago

@JustCauseWhyNot Weird, I don’t see any feature that’s both not supported by your gpu, and also used in gamescope… Does running gamescope -- glxgears also give you vulkan: vkCreateDevice failed (VkResult: -8)?

JustCauseWhyNot commented 3 months ago

Yes ish.

❯ gamescope -- glxgears
No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
wlserver: [backend/headless/backend.c:67] Creating headless backend
vulkan: selecting physical device 'NVIDIA GeForce RTX 4070 SUPER': queue family 2
vulkan: physical device supports DRM format modifiers
vulkan: vkCreateDevice failed (VkResult: -7)
Failed to initialize Vulkan
sharkautarch commented 3 months ago

Ah so it must be an unsupported vulkan extension that’s the issue… I’ll look to see if I can figure out what extension is the issue

sharkautarch commented 3 months ago

@JustCauseWhyNot Hmm I found that VK_EXT_external_memory_dma_buf seems to missing from the list of supported extensions reported by vulkaninfo which is weird since it should be supported Check if any of the fixes found here help you: https://forums.developer.nvidia.com/t/vk-ext-external-memory-dma-buf-missing-in-545/275834

I can’t find any other extension used by gamescope that’s not reported as a supported extension for your gpu, so I think the dma buf extension is the only one missing

JustCauseWhyNot commented 3 months ago

Ok it doesn't instant crash now, and glxgears runs fine. But in steam if I run gamescope for hoi4 and it's native linux version I get a lot of flickering. It flickers between black window, and the correct image at probably 16.6ms intervals, or less. And then it crashed before the game could boot into the main menu. Idk if this is a different issue.

I don't know what troubleshooting measures to take in order to get a log. I'm not sure if the proton-appid.log would be helpful, or if gamescope provides it's own log.

sharkautarch commented 3 months ago

@JustCauseWhyNot I've heard that nvidia is especially broken when running gamescope on wayland desktops. Are you still using X11 or wayland?

JustCauseWhyNot commented 3 months ago

Im using x11 still.

michaelneverwins commented 1 month ago

Just a follow-up to something I wrote in the original post:

I had noticed that gamescope had stopped working in Bottles, and had fixed it by undoing updates to the gamescope package:

sudo flatpak update --system --commit 9e2ba1b79351dde28e2984b75b11701cbfba1444ba1b0260b61f45ad159c8c74 org.freedesktop.Platform.VulkanLayer.gamescope//23.08
flatpak mask --system org.freedesktop.Platform.VulkanLayer.gamescope//23.08

This doesn't work anymore, because the current version of Bottles requires org.freedesktop.Platform.VulkanLayer.gamescope//24.08 which doesn't have the older version in its available commit history — and, in fact, neither does org.freedesktop.Platform.VulkanLayer.gamescope//23.08 anymore. So those whose hardware has the same limitations as mine shouldn't waste their time trying to repeat what I did with Flatpak. As far as I know, sufficiently old versions of gamescope are no longer available in Flatpak for use with Bottles.

For what it's worth (although I doubt it will help), I think the version I had used is from this GitHub commit (although the commit hash used by Flatpak isn't the same): https://github.com/flathub/org.freedesktop.Platform.VulkanLayer.gamescope/commit/6f4ad8b13dc188d3036aabad0b8cda6cea31a1a8