ValveSoftware / gamescope

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

vulkan: vkCreateDevice failed (VkResult: -7) #991

Open konradmb opened 1 year ago

konradmb commented 1 year ago

Compiled from master

$ gamescope
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
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
MESA-INTEL: warning: Haswell Vulkan support is incomplete
vulkan: selecting physical device 'Intel(R) HD Graphics 4400 (HSW GT2)': queue family 0 (general queue family 0)
vulkan: physical device supports DRM format modifiers
vulkan: vkCreateDevice failed (VkResult: -7)
Failed to initialize Vulkan

git bisect:

git bisect start
# status: waiting for both good and bad commits
# good: [c5269642a293ce5e91d3d644ee15a3f3bcc3c5f3] build: fix ci
git bisect good c5269642a293ce5e91d3d644ee15a3f3bcc3c5f3
# status: waiting for bad commit, 1 good commit known
# bad: [d1eb70bb1a17072b48f7545af0fcf5f16d677aee] steamcompmgr: Overwrite SDL_VIDEODRIVER before nested app launch
git bisect bad d1eb70bb1a17072b48f7545af0fcf5f16d677aee
# good: [659e55011fdf2ebb3bd5d06b7b31761fde398ae9] steamcompmgr: Default SDR content brightness to 203
git bisect good 659e55011fdf2ebb3bd5d06b7b31761fde398ae9
# good: [38d2f04ba97f6ac152ea87bdb937c584a1650166] steamcompmgr: Fix lut3d output override check
git bisect good 38d2f04ba97f6ac152ea87bdb937c584a1650166
# good: [95368ea7eff78f5c474c76d3a20d368780e8a9f2] protocol: Add presentation-time xml + build
git bisect good 95368ea7eff78f5c474c76d3a20d368780e8a9f2
# good: [2aa742b0805114a5999dc571f227098ffd392f43] reshade: Fix GAMESCOPE_SDR_ON_HDR_NITS define
git bisect good 2aa742b0805114a5999dc571f227098ffd392f43
# bad: [42343857f05be32bc4c33156e235c3ae42e26c63] layer: Limit max number of past present timings
git bisect bad 42343857f05be32bc4c33156e235c3ae42e26c63
# bad: [476ca5d835e74ad5ccf39a1d5ace119faf4009c9] layer: Only override window when we can bypass
git bisect bad 476ca5d835e74ad5ccf39a1d5ace119faf4009c9
# bad: [5151250d9433f978429cf7572b5159394c082355] main: Use SDL_VIDEODRIVER wayland by default, force on present wait
git bisect bad 5151250d9433f978429cf7572b5159394c082355
# good: [3fa5e7a61616390139567035d5596a6f32410d4d] reshade: Hook up "mousepoint" uniform
git bisect good 3fa5e7a61616390139567035d5596a6f32410d4d
# bad: [1bb7ef50ba6b44811ea7349df4365fec41652aee] layer: Implement VK_GOOGLE_display_timing + present wait/id for nested
git bisect bad 1bb7ef50ba6b44811ea7349df4365fec41652aee
# good: [fc6e2295060ae853cfc6e9c3bafb5080eef3ee7f] layer: Implement GetPhysicalDeviceSurfaceCapabilities2KHR
git bisect good fc6e2295060ae853cfc6e9c3bafb5080eef3ee7f
# first bad commit: [1bb7ef50ba6b44811ea7349df4365fec41652aee] layer: Implement VK_GOOGLE_display_timing + present wait/id for nested
misyltoad commented 1 year ago

Is your Mesa version too old to support present wait + wayland?

konradmb commented 1 year ago

No, I don't think so. I've checked just now with mesa-git, same error.

$ glxinfo -B
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel (0x8086)
    Device: Mesa Intel(R) HD Graphics 4400 (HSW GT2) (0xa16)
    Version: 23.3.0
    Accelerated: yes
    Video memory: 1536MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) HD Graphics 4400 (HSW GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 23.3.0-devel
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 23.3.0-devel
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 23.3.0-devel
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
$ dnf info mesa
Last metadata expiration check: 0:00:20 ago on Tue Oct 17 14:34:22 2023.
Available Packages
Name         : mesa
Version      : 23.3.0
Release      : 0.3.20231017.10.d6613de.fc38
Architecture : src
Size         : 29 M
Source       : None
Repository   : copr:copr.fedorainfracloud.org:xxmitsu:mesa-git
Summary      : Mesa 3D Graphics Library, git version
URL          : http://www.mesa3d.org
License      : MIT
Description  : Mesa 3D Graphics Library, git version.

Name         : mesa
Version      : 23.3.0
Release      : 0.3.20231017.10.d6613de.fc38
Architecture : src
Size         : 29 M
Source       : None
Repository   : copr:copr.fedorainfracloud.org:xxmitsu:mesa-git:ml
Summary      : Mesa 3D Graphics Library, git version
URL          : http://www.mesa3d.org
License      : MIT
Description  : Mesa 3D Graphics Library, git version.
$ ./build-master/src/gamescope            
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
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
MESA-INTEL: warning: Haswell Vulkan support is incomplete
vulkan: selecting physical device 'Intel(R) HD Graphics 4400 (HSW GT2)': queue family 0 (general queue family 0)
vulkan: physical device supports DRM format modifiers
vulkan: vkCreateDevice failed (VkResult: -7)
Failed to initialize Vulkan
uristdwarf commented 1 year ago

I can confirm this also happens on a AMD Graphics Card as well.

$ gamescope -- supertuxkart
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
vulkan: selecting physical device 'AMD Radeon RX 570 Series': queue family 1 (general queue family 0)
vulkan: physical device supports DRM format modifiers
vulkan: vkCreateDevice failed (VkResult: -7)
Failed to initialize Vulkan
$
$ glxinfo -B
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: AMD (0x1002)
    Device: AMD Radeon RX 570 Series (polaris10, LLVM 16.0.6, DRM 3.54, 6.5.7-arch1-1) (0x67df)
    Version: 23.2.1
    Accelerated: yes
    Video memory: 8192MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
Memory info (GL_ATI_meminfo):
    VBO free memory - total: 6970 MB, largest block: 6970 MB
    VBO free aux. memory - total: 7232 MB, largest block: 7232 MB
    Texture free memory - total: 6970 MB, largest block: 6970 MB
    Texture free aux. memory - total: 7232 MB, largest block: 7232 MB
    Renderbuffer free memory - total: 6970 MB, largest block: 6970 MB
    Renderbuffer free aux. memory - total: 7232 MB, largest block: 7232 MB
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 8192 MB
    Total available memory: 16141 MB
    Currently available dedicated video memory: 6970 MB
OpenGL vendor string: AMD
OpenGL renderer string: AMD Radeon RX 570 Series (polaris10, LLVM 16.0.6, DRM 3.54, 6.5.7-arch1-1)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 23.2.1-arch1.2
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 23.2.1-arch1.2
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 23.2.1-arch1.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

$
gbpi commented 1 year ago

Same is happening for me on Intel HD 4000 with 3.12.6 and 3.12.7, if I downgrade to 3.12.5 it works.

uristdwarf commented 1 year ago

I can confirm this also happens on a AMD Graphics Card as well.

Follow up on this: I tried testing an earlier version as well, and that led me to another error, which lead me to the solution. The problem was that amdvlk was still installed for some reason and was conflicting with radv. After removing amdvlk it now works on both master and the latest version tag.

ninjaquick commented 1 year ago

I can confirm this also happens on a AMD Graphics Card as well.

Follow up on this: I tried testing an earlier version as well, and that led me to another error, which lead me to the solution. The problem was that amdvlk was still installed for some reason and was conflicting with radv. After removing amdvlk it now works on both master and the latest version tag.

I am on a fresh arch install, no amdvlk - only radv is present - and am getting OP's error.

[owner@Turin ~]$ glxinfo -B
name of display: :1
display: :1  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: AMD (0x1002)
    Device: AMD Radeon RX 6900 XT (navi21, LLVM 16.0.6, DRM 3.54, 6.5.7-2-cachyos-lto) (0x73bf)
    Version: 23.3.0
    Accelerated: yes
    Video memory: 16384MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
Memory info (GL_ATI_meminfo):
    VBO free memory - total: 15274 MB, largest block: 15274 MB
    VBO free aux. memory - total: 15861 MB, largest block: 15861 MB
    Texture free memory - total: 15274 MB, largest block: 15274 MB
    Texture free aux. memory - total: 15861 MB, largest block: 15861 MB
    Renderbuffer free memory - total: 15274 MB, largest block: 15274 MB
    Renderbuffer free aux. memory - total: 15861 MB, largest block: 15861 MB
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 16384 MB
    Total available memory: 32391 MB
    Currently available dedicated video memory: 15274 MB
OpenGL vendor string: AMD
OpenGL renderer string: AMD Radeon RX 6900 XT (navi21, LLVM 16.0.6, DRM 3.54, 6.5.7-2-cachyos-lto)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 23.3.0-devel (git-9c2212f9b3)
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 23.3.0-devel (git-9c2212f9b3)
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 23.3.0-devel (git-9c2212f9b3)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

Update

Resolved by downgrading gamescope from 3.12.7 to 3.12.6.

HaydonBaddock commented 1 year ago

I can confirm that uninstalling amdvlk fixed this issue for me. I tried first downgrading gamescope to 3.12.6 and that did nothing.

Toorero commented 1 year ago

I can indeed confirm that despite specifically loading the radeon driver via AMD_VULKAN_ICD=RADV it still doesn't fix the issue. Only after completely uninstalling the amdvlk drivers it fixed my problem.

Still a bug though. I think this should be fixed or at least mentioned somewhere.

caseif commented 1 year ago

I can also confirm that uninstalling AMDVLK fixed the issue despite there not being any reason Gamescope should have been attempting to use it. I didn't attempt downgrading gamescope before resolving the problem but will try confirming that once I have some more time.

DianaNites commented 12 months ago

If setcap has been run on the binary it counts as "elevated" so user controls of what to load are ignored, like VK_ICD_FILENAMES and AMD_VULKAN_ICD, so it will default to AMDVLK, also causing this error.

https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderLayerInterface.md#exception-for-elevated-privileges

https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderInterfaceArchitecture.md#elevated-privilege-caveats

vabenil commented 11 months ago

I have the same error on Intel, I don't have amdvlk installed. As far as I know the only vulkan driver I have installed is vulkan-intel:

EDIT: I tested and gamescope works as expected until version 3.12.5 in version 3.12.6 it breaks for me and I get the same error as OP:

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
vulkan: selecting physical device 'Intel(R) HD Graphics 5500 (BDW GT2)': queue family 0 (general queue family 0)
vulkan: physical device supports DRM format modifiers
vulkan: vkCreateDevice failed (VkResult: -7)
Failed to initialize Vulkan

Mesa info:

[ vabenil@arch-pc: ~/Downloads ]$ glxinfo -B
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel (0x8086)
    Device: Mesa Intel(R) HD Graphics 5500 (BDW GT2) (0x1616)
    Version: 23.3.1
    Accelerated: yes
    Video memory: 3808MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) HD Graphics 5500 (BDW GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 23.3.1-arch1.1
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 23.3.1-arch1.1
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 23.3.1-arch1.1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
Sandelinos commented 11 months ago

I have the same issue on 2 systems.

System 1:

The gamescope packaged by Debian works fine since it's version 3.11.49 but the gamescope in Flatpak is broken. Downgrading the flatpak to 3.12.5 fixes it. (flatpak update --commit=9e2ba1b79351dde28e2984b75b11701cbfba1444ba1b0260b61f45ad159c8c74 org.freedesktop.Platform.VulkanLayer.gamescope/x86_64/23.08) I also tried compiling gamescope 3.12.5, 3.12.6 and 3.12.7 from source and 3.12.5 worked fine while 3.12.{6,7} crashed with vkCreateDevice failed, which confirms that the issue was introduced between 3.12.5 and 3.12.6.

System 2:

The gamescope packaged by Arch and the flatpak are both broken. Downgrading the flatpak (as above) fixes it and downgrading the Arch packaged gamescope to 3.12.5-1 from https://archive.archlinux.org/packages/g/gamescope/ fixes that. Versions 3.12.6-1 and above crash with vulkan: vkCreateDevice failed (VkResult: -7)

gbpi commented 11 months ago

It seems the minimum Vulkan version has been bumped up to 1.2, which leaves out early AMD GCN cards and Intel 4000 series.

TheW0LVERIN3 commented 11 months ago

But radv supports vulkan 1.3 on everything except GCN 1(GFX6) where it supports all required extensions for vulkan 1.3 except for VK_EXT_scalar_block_layout which is a required extension for vulkan 1.2. Does gamescope require/use VK_EXT_scalar_block_layout? source: https://mesamatrix.net/

sharkautarch commented 10 months ago

But radv supports vulkan 1.3 on everything except GCN 1(GFX6) where it supports all required extensions for vulkan 1.3 except for VK_EXT_scalar_block_layout which is a required extension for vulkan 1.2. Does gamescope require/use VK_EXT_scalar_block_layout? source: https://mesamatrix.net/

Since most of the people in this issue have said that gamescope 3.12.5 works ok, but 3.12.6 gives you the error, I looked at the changes made from 3.12.5->3.12.6 : https://github.com/ValveSoftware/gamescope/compare/a8471d81b36ea1d9dc90a7d35f9ad0631feaf1ae...ValveSoftware:gamescope:d11567122daaba250860c24219810931ace4ce5c#diff-0ca179f8adb820354aba0b6a063350f9e32689950ead39e8bbeca021fa8ba0e0R3033

not sure if this is the sole issue, but it seems like version 3.12.6 actually bumped the vulkan version to 1.3

but I'm not sure if the minimum vulkan version is actually the issue, since everyone in this issue is getting VkResult: -7 aka VK_ERROR_EXTENSION_NOT_PRESENT

also, it looks like gamescope 3.12.6 also adds VkPhysicalDeviceVulkan13Features features13 (which it only uses to try to set .dynamicRendering=true) when running CVulkanDevice::createDevice(), which probably also causes createDevice() to fail when running w/ gpus that don't support vulkan 1.3

Though I will say that gamescope version 3.12.6 also adds the extensions VK_KHR_PRESENT_ID_EXTENSION_NAME (aka VK_KHR_present_id) and VK_KHR_PRESENT_WAIT_EXTENSION_NAME (aka VK_KHR_present_wait) to the required vulkan extensions. Not sure how to look up online whether a specific gpu supports either of the two present extensions, because even though I've ran the lastest versions of gamescope (built from the ValveSoftware/master) w/ my intel igpu perfectly fine, neither of the two extensions show up when I run vulkaninfo...

ngiololollo commented 10 months ago

I have the same issue, gamescope 3.13.19-1 packaged by Arch linux

vblank: Using timerfd.
wlserver: [backend/headless/backend.c:67] Creating headless backend
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
vulkan: selecting physical device 'Intel(R) Iris(R) Graphics 6100 (BDW GT3)': queue family 0 (general queue family 0)
vulkan: physical device supports DRM format modifiers
vulkan: vkCreateDevice failed (VkResult: -7)
Failed to initialize

glxinfo -B

name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel (0x8086)
    Device: Mesa Intel(R) Iris(R) Graphics 6100 (BDW GT3) (0x162b)
    Version: 23.3.4
    Accelerated: yes
    Video memory: 7848MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) Iris(R) Graphics 6100 (BDW GT3)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 23.3.4-arch1.2
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 23.3.4-arch1.2
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 23.3.4-arch1.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
sharkautarch commented 10 months ago

@ngiololollo I looked up your intel gpu on https://vulkan.gpuinfo.org/displayreport.php?id=27018#extensions, and according to the extensions list in the report, your gpu doesn't seem to support VK_KHR_present_id or VK_KHR_present_wait which gamescope currently requires since version 3.12.6

EDIT: I looked up my igpu on https://vulkan.gpuinfo.org, and realized that the website doesn't list VK_KHR_present_id or VK_KHR_present_wait in the extension list, even though running vulkan hardware caps viewer on my computer shows VK_KHR_present_wait and VK_KHR_present_id as being supported, and I am able to run the latest version of gamescope on my igpu. So perhaps https://vulkan.gpuinfo.org doesn't show whether any gpus support VK_KHR_present_id or VK_KHR_present_wait???

also, I just noticed there was an issue posted about VK_KHR_present_id/VK_KHR_present_wait not being detected w/ vulkaninfo/vulkan hardware caps viewer for people on wayland?!?!? https://github.com/KhronosGroup/Vulkan-Tools/issues/757 not sure if that's still an issue people are having... (probably not an issue with gamescope)

EDIT EDIT: looks like present wait support for wayland was merged five days ago (?) https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27275 tho I'm not sure if means that VK_KHR_present_id/VK_KHR_present_wait was not working on wayland and thus causing this error for versions of mesa before said merge???

@ngiololollo if you are on wayland, maybe try installing mesa-git for now

ngiololollo commented 10 months ago

@sharkautarch i tried to install mesa-git but i have the same behaviour

TheW0LVERIN3 commented 10 months ago

@ngiololollo I looked up your intel gpu on https://vulkan.gpuinfo.org/displayreport.php?id=27018#extensions, and according to the extensions list in the report, your gpu doesn't seem to support VK_KHR_present_id or VK_KHR_present_wait which gamescope currently requires since version 3.12.6

Intel iris graphics 6100 doesn't use the intel anv vulkan driver on linux, it uses the split off hasvk driver because iris graphics 6100 is intel gen 8 architecture based. Hasvk has a lot less features and according to https://mesamatrix.net/ does not support VK_KHR_present_wait . So yes @ngiololollo 's igpu is unsupported by gamescope if gamescope requires VK_KHR_present_wait. However this is not the same issue as any of the other gpu's in this thread.

TheW0LVERIN3 commented 10 months ago

However this is not the same issue as any of the other gpu's in this thread.

Correction: Some, but not all, other people in this thread do seem to be in the same boat, stuck with the hasvk vulkan driver on pre gen 9 intel igpu hardware. As HASVK lacks VK_KHR_present_wait support, I guess gamescope won't work. Pinging those affected in this issue: @konradmb @gbpi @vabenil (and @Sandelinos (only your intel hd 4000 igpu system falls under this not your amd one)) and of course as previously pinged @ngiololollo

TheW0LVERIN3 commented 10 months ago

Btw, can we get/is there a list of vulkan extensions that gamescope requires. Because it would really help in debugging and confirming these types of issues.

On the AMD front(GCN2 to be specific): Does gamescope require VK_EXT_index_type_uint8? I'd prefer official word on this as that vulkan extension is the only thing I can find as to why RADV on GCN2 wouldn't support gamescope. If that's not it then bugs need to be filed.

sharkautarch commented 10 months ago

Btw, can we get/is there a list of vulkan extensions that gamescope requires. Because it would really help in debugging and confirming these types of issues.

On the AMD front(GCN2 to be specific): Does gamescope require VK_EXT_index_type_uint8? I'd prefer official word on this as that vulkan extension is the only thing I can find as to why RADV on GCN2 wouldn't support gamescope. If that's not it then bugs need to be filed.

I actually started some work on allowing gamescope to work on gpus that don't support certain features/extensions. Right now, I have a branch that currently falls back to vulkan 1.2 if vulkan 1.3 isn't supported: https://github.com/sharkautarch/gamescope/tree/gs_vk_1_2_comp Note: vulkan 1.2-only gpus currently are unable to run reshade on gamescope (should otherwise run normally, and still able to use gamescope's builtin-shaders tho) I think it should also be possible to allow gamescope to still work when VK_KHR_present_wait isn't supported, tho not entirely sure how much work that'll take...

sharkautarch commented 9 months ago

@konradmb @gbpi @vabenil @Sandelinos @ngiololollo I've just updated https://github.com/sharkautarch/gamescope/tree/gs_vk_1_2_comp to allow gamescope to work on gpus that don't support the present_wait extension

how to build:

Cloning from my fork and running setup:

git clone https://github.com/sharkautarch/gamescope
cd gamescope
git checkout gs_vk_1_2_comp
git submodule update --init --recursive
CXX=g++ CC=gcc meson setup --wipe build --buildtype=debugoptimized -Db_ndebug=true -Db_lto_threads=$(nproc) -Db_lto=true -Db_lto_mode=default

then if you want to build and install to system: meson install -C build

OR if you don't want to install my version of gamescope to system (/usr) directories:
ninja -C build

sharkautarch commented 8 months ago

@konradmb @gbpi @vabenil @Sandelinos @ngiololollo Update: I made a new branch targeted against latest gamescope upstream version: gs_vk_1_2_comp_target_HEAD Had to rewrite it against the recent backend refactors, but hopefully it'll still work ok w.r.t. devices that don't support vulkan 1.3 and/or present_wait

gbpi commented 8 months ago

@sharkautarch

Doesn't seem to work on Intel 4000.

vulkan: Failed to load vulkan module. (VkResult: -3)

sharkautarch commented 8 months ago

@sharkautarch

Doesn't seem to work on Intel 4000.

vulkan: Failed to load vulkan module. (VkResult: -3)

@gbpi Just pushed out a fix to the branch do a git pull to fetch the fix

gbpi commented 8 months ago

@sharkautarch Doesn't seem to work on Intel 4000. vulkan: Failed to load vulkan module. (VkResult: -3)

@gbpi Just pushed out a fix to the branch do a git pull to fetch the fix

Thanks.

Still getting an error, but a new error.

No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete
vulkan: selecting physical device 'Intel(R) HD Graphics 4000 (IVB GT2)': queue family 0 (general queue family 0)
Notice: GPU device does not support present_wait extension
continuing with present_wait disabled.

xdg_backend: Seat name: seat0
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete
vulkan: selecting physical device 'Intel(R) HD Graphics 4000 (IVB GT2)': queue family 0 (general queue family 0)
vulkan: physical device supports DRM format modifiers
vulkan: vkCreateDevice failed (VkResult: -8)
Failed to create backend.
sharkautarch commented 8 months ago

Replying to https://github.com/ValveSoftware/gamescope/issues/991#issuecomment-2031113257

Hmmm VkResult of -8 means VK_ERROR_FEATURE_NOT_PRESENT

Hmmm, there’s an unsupported vulkan device feature being requested @gbpi make sure you have vulkan validation layers installed (on arch it’s the vulkan-validation-layers package) Then run gamescope like so: VK_LOADER_LAYERS_ENABLE=*validation* gamescope … Hopefully the vulkan validation layers will tell us the specific unsupported vulkan device feature that’s being requested

gbpi commented 8 months ago

Hmmm VkResult of -8 means VK_ERROR_FEATURE_NOT_PRESENT

Hmmm, there’s an unsupported vulkan device feature being requested @gbpi make sure you have vulkan validation layers installed (on arch it’s the vulkan-validation-layers package) Then run gamescope like so: VK_LOADER_LAYERS_ENABLE=*validation* gamescope … Hopefully the vulkan validation layers will tell us the specific unsupported vulkan device feature that’s being requested

@sharkautarch Unfortunately no change in the error message.

sharkautarch commented 8 months ago

Hmmm VkResult of -8 means VK_ERROR_FEATURE_NOT_PRESENT Hmmm, there’s an unsupported vulkan device feature being requested @gbpi make sure you have vulkan validation layers installed (on arch it’s the vulkan-validation-layers package) Then run gamescope like so: VK_LOADER_LAYERS_ENABLE=*validation* gamescope … Hopefully the vulkan validation layers will tell us the specific unsupported vulkan device feature that’s being requested

@sharkautarch Unfortunately no change in the error message.

Ok, I looked through the feature support database for your specific intel igpu, and I've figured out what unsupported feature is being requested: uniformAndStorageBuffer8BitAccess

I'm pretty sure that gamescope no longer uses 8bit integers in the shader storage/uniforms/buffers so hopefully simply toggling that feature off will do the trick!

sharkautarch commented 8 months ago

@gbpi Ok, I've pushed out another fix that should hopefully fix the VK_ERROR_FEATURE_NOT_PRESENT error for you Haven't actually tested it though...

gbpi commented 8 months ago

@sharkautarch

Awesome, that runs. Thanks.

Colors are very washed out if I use FSR, but other filters are fine. Seems to peg a CPU core at 100% when started, regardless of filter, then settles down after a few minutes. Haven't done extensive testing yet.

Just double checked against the old 3.12.5 version, it does the high CPU load in the beginning too. I think it might go down a little sooner, but it doesn't seem to be a big deal. Never noticed it before.

sharkautarch commented 8 months ago

@Joshua-Ashton do you know if the washed-out colors w/ fsr that @gbpi mentioned are due to me removing the uniformAndStorageBuffer8BitAccess feature thingy? EDIT: I just realized that the uniformAndStorageBuffer8BitAccess feature was actually removed in a later upstream commit

sharkautarch commented 8 months ago

@gbpi Did you notice any higher cpu usage besides the initial spike at startup? If so: If you have some time for testing, on archlinux you can install the intel-oneapi-basekit package and then use the vtune profiler to find where the biggest hotspots are:

source $(find -name "setvars.sh" 2> /dev/null) intel64
vtune-gui

Then in vtune-gui, select the hotspot test, In the box that says executable, enter /usr/bin/gamescope And then in the params box enter — vkcube

The vtune-gui thing will probably say that you need to set a sysctl parameter So in a separate terminal window, you’ll just need to run: su And then: echo 0 > /path/or/something where /path/or/something is the path that vtune gui gives you

Let the profiling session run for just a minute or two, then press the (I think square shaped) stop button on the vtune gui. After vtune finalizes the results, click the thing on the bottom-right that either says show inline or hide inline and make sure show inline is selected. Then click the flamegraph tab There should be a bottom window with green rectangles and a timeline thingy Click+drag FROM the point in time where you have at least two rectangles on the timeline, dragging all the way to the right. Then release the drag, and in the menu that pops up, click filter in

Take a screenshot of the flamegraph Then click on the thingy near the bottom left of the vtune gui that says processes and select gamescope (if there are more than one, select the gamescope with the highest percentage) Then take a screenshot of the flamegraph again

Doing profiling on your own computer is helpful since cpu performance varies across different cpu models/architectures

gbpi commented 7 months ago

@gbpi Did you notice any higher cpu usage besides the initial spike at startup?

@sharkautarch

Seems to be just on startup. If it is just a couple minutes so I am not too worried about it, but would profiling help find out why?

sharkautarch commented 7 months ago

@gbpi Did you notice any higher cpu usage besides the initial spike at startup?

@sharkautarch

Seems to be just on startup. If it is just a couple minutes so I am not too worried about it, but would profiling help find out why?

It's hard to tell if the problem will be trivial to address, and since you're not bothered with it, it's probably not worth your time now that I think about it

Biaogo commented 4 months ago

I don't know what the problem is:

gamescope --expose-wayland -- glxgears
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
vulkan: selecting physical device 'NVIDIA GeForce RTX 3070 Ti Laptop GPU': queue family 0 (general queue family 0)
vulkan: physical device supports DRM format modifiers
vulkan: vkCreateDevice failed (VkResult: -7)
SDL_Vulkan_CreateSurface failed: VK_KHR_wayland_surface extension is not enabled in the Vulkan instance.terminate called without an active exception
fish: Job 1, 'gamescope --expose-wayland -- g…' terminated by signal SIGABRT (Abort)
sharkautarch commented 4 months ago

@Biaogo Are you running on a Wayland desktop? And what version is your nvidia driver? And also, does running gamescope without --expose-wayland work? What distro are you using? And lastly, what version of gamescope are you running?

Biaogo commented 4 months ago

@Biaogo Are you running on a Wayland desktop? And what version is your nvidia driver? And also, does running gamescope without --expose-wayland work? What distro are you using? And lastly, what version of gamescope are you running?

I using Hyprland, and i try nvidia-550.54.14 to 555.58.02, after removing --expose-wayland this it doesn't work either, I use artixlinux, tried gamescope 3.14.22 to 3.14.23, I can't install the old version manually because there will be dependency issues.

sharkautarch commented 4 months ago

@Biaogo I've heard that some people are having problems w/ running gamescope on Hyprland Try switching to a tty (alt+fn or something) and running gamescope from there: gamescope -- glxgears |& tee gamescope.log

GabeWelsh commented 4 months ago

@Biaogo https://wiki.archlinux.org/title/Wayland#NVIDIA_driver Have you enabled DRM KMS? I had the same vulkan: vkCreateDevice failed (VkResult: -7) issue before I did this.

Biaogo commented 4 months ago

@Biaogo I've heard that some people are having problems w/ running gamescope on Hyprland Try switching to a tty (alt+fn or something) and running gamescope from there: gamescope -- glxgears |& tee gamescope.log

$ cat gamescope.log
vulkan: selecting physical device 'NVIDIA GeForce RTX 3070 Ti Laptop GPU': queue family 2 (general queue family 0)
vulkan: physical device supports DRM format modifiers
vulkan: vkCreateDevice failed (VkResult: -7)
Failed to initialize Vulkan
Failed to create backend.

@Biaogo https://wiki.archlinux.org/title/Wayland#NVIDIA_driver Have you enabled DRM KMS? I had the same vulkan: vkCreateDevice failed (VkResult: -7) issue before I did this.

$ doas dmesg | grep drm
[    0.634565] ACPI: bus type drm_connector registered
[    0.640613] [drm] Initialized simpledrm 1.0.0 20200625 for simple-framebuffer.0 on minor 0
[    0.642175] simple-framebuffer simple-framebuffer.0: [drm] fb0: simpledrmdrmfb frame buffer device
[   10.552422] i915 0000:00:02.0: [drm] VT-d active for gfx access
[   10.599151] i915 0000:00:02.0: [drm] Using Transparent Hugepages
[   10.601573] i915 0000:00:02.0: [drm] Finished loading DMC firmware i915/adlp_dmc.bin (v2.20)
[   10.641215] i915 0000:00:02.0: [drm] [ENCODER:244:DDI B/PHY B] unusable PPS, disabling eDP
[   10.685484] i915 0000:00:02.0: [drm] GT0: GuC firmware i915/adlp_guc_70.bin version 70.20.0
[   10.685488] i915 0000:00:02.0: [drm] GT0: HuC firmware i915/tgl_huc.bin version 7.9.3
[   10.702884] i915 0000:00:02.0: [drm] GT0: HuC: authenticated for all workloads
[   10.703305] i915 0000:00:02.0: [drm] GT0: GUC: submission enabled
[   10.703309] i915 0000:00:02.0: [drm] GT0: GUC: SLPC enabled
[   10.703723] i915 0000:00:02.0: [drm] GT0: GUC: RC enabled
[   10.704598] i915 0000:00:02.0: [drm] Protected Xe Path (PXP) protected content support initialized
[   10.729199] [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
[   10.729201] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:01:00.0 on minor 0
[   12.001035] [drm] Initialized i915 1.6.0 20230929 for 0000:00:02.0 on minor 1
[   12.005893] fbcon: i915drmfb (fb0) is primary device
[   13.355006] i915 0000:00:02.0: [drm] fb0: i915drmfb frame buffer device
$ doas dmesg | grep nvidia
[   10.451978] nvidia: loading out-of-tree module taints kernel.
[   10.451984] nvidia: module license 'NVIDIA' taints kernel.
[   10.451986] nvidia: module verification failed: signature and/or required key missing - tainting kernel
[   10.451987] nvidia: module license taints kernel.
[   10.660583] nvidia-nvlink: Nvlink Core is being initialized, major device number 510
[   10.661541] nvidia 0000:01:00.0: enabling device (0000 -> 0003)
[   10.661644] nvidia 0000:01:00.0: vgaarb: VGA decodes changed: olddecodes=io+mem,decodes=none:owns=none
[   10.725435] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  555.58.02  Tue Jun 25 01:10:21 UTC 2024
[   10.729199] [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
[   10.729201] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:01:00.0 on minor 0
[   10.730834] nvidia_uvm: module uses symbols nvUvmInterfaceDisableAccessCntr from proprietary module nvidia, inheriting taint.
[   10.794796] nvidia-uvm: Loaded the UVM driver, major device number 508.
Biaogo commented 4 months ago

Replying to https://github.com/ValveSoftware/gamescope/issues/991#issuecomment-2222821956

After I switched to direct connection to the independent graphics card in the BIOS, this problem disappeared. It seems that Gamescope cannot be used in hybrid mode?

gamescope -- glxgears
vulkan: selecting physical device 'NVIDIA GeForce RTX 3070 Ti Laptop GPU': queue family 2 (general queue family 0)
vulkan: physical device supports DRM format modifiers
wlserver: [backend/headless/backend.c:67] Creating headless backend
xdg_backend: Seat name: Hyprland
vulkan: vkGetPhysicalDeviceFormatProperties2 returned zero modifiers for DRM format 0x38344241 (VkResult: 0)
vulkan: vkGetPhysicalDeviceFormatProperties2 returned zero modifiers for DRM format 0x38344258 (VkResult: 0)
vulkan: supported DRM formats for sampling usage:
vulkan:   AR24 (0x34325241)
vulkan:   XR24 (0x34325258)
vulkan:   AB24 (0x34324241)
vulkan:   XB24 (0x34324258)
vulkan:   RG16 (0x36314752)
vulkan:   AB4H (0x48344241)
vulkan:   XB4H (0x48344258)
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:17] Starting headless backend
wlserver: Successfully initialized libei for input emulation!
wlserver: [xwayland/server.c:107] Starting Xwayland on :1
wlserver: [types/wlr_compositor.c:771] New wlr_surface 0x5a0d4467d1c0 (res 0x5a0d43ed0000)
wlserver: [xwayland/server.c:272] Xserver is ready
pipewire: stream state changed: connecting
pipewire: stream state changed: paused
pipewire: stream available on node ID: 70
xwm: Embedded, no cursor set. Using left_ptr by default.
vblank: Using timerfd.
josh edid: Patching res 800x1280 -> 1280x720
pipewire: renegotiating stream params (size: 1280x780)
wlserver: [types/wlr_compositor.c:771] New wlr_surface 0x5a0d43ced4c0 (res 0x5a0d43f17460)
xwm: got the same buffer committed twice, ignoring.
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported maximum keycode 708, clipping.
>                   X11 cannot support keycodes above 255.
> Warning:          Could not resolve keysym XF86KbdInputAssistPrevgrou
> Warning:          Could not resolve keysym XF86KbdInputAssistNextgrou
Errors from xkbcomp are not fatal to the X server
pipewire: renegotiating stream params (size: 1269x769)
xdg_backend: Changed refresh to: 165.004hz
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
xdg_backend: Compositor released us but we were not acquired. Oh no.
640 frames in 5.0 seconds = 127.863 FPS
DocMAX commented 6 hours ago
[docmax@gpdwin4 ~$ glxinfo -B
name of display: :0.0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: AMD (0x1002)
    Device: AMD Radeon Graphics (radeonsi, rembrandt, LLVM 18.1.8, DRM 3.59, 6.12.1-arch1-1) (0x1681)
    Version: 24.2.7
    Accelerated: yes
    Video memory: 512MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
Memory info (GL_ATI_meminfo):
    VBO free memory - total: 53 MB, largest block: 53 MB
    VBO free aux. memory - total: 14762 MB, largest block: 14762 MB
    Texture free memory - total: 53 MB, largest block: 53 MB
    Texture free aux. memory - total: 14762 MB, largest block: 14762 MB
    Renderbuffer free memory - total: 53 MB, largest block: 53 MB
    Renderbuffer free aux. memory - total: 14762 MB, largest block: 14762 MB
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 512 MB
    Total available memory: 16197 MB
    Currently available dedicated video memory: 53 MB
OpenGL vendor string: AMD
OpenGL renderer string: AMD Radeon Graphics (radeonsi, rembrandt, LLVM 18.1.8, DRM 3.59, 6.12.1-arch1-1)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 24.2.7-arch1.1
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 24.2.7-arch1.1
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 24.2.7-arch1.1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

[docmax@gpdwin4 ~$ gamescope -- glxgears
[gamescope] [Info]  console: gamescope version 3.15.14 (gcc 14.2.1)
No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
[gamescope] [Info]  vulkan: selecting physical device 'AMD Radeon Graphics': queue family 1 (general queue family 0)
[gamescope] [Info]  vulkan: physical device supports DRM format modifiers
[gamescope] [Error] vulkan: vkCreateDevice failed (VkResult: -7)
terminate called without an active exception
Abgebrochen (Speicherabzug geschrieben)