[560.35.03] GTK4 apps background CPU usage with Vulkan renderer

Originally filed against the GTK project:

This was quickly identified as an nVidia driver issue.

As of gtk 4.16 the Vulkan rendering backend is used by default.

GTK4 apps are consuming unexpected CPU cycles while idle in the background when using the Vulkan backend.

This does not occur with the NGL renderer.

Steps to reproduce

  1. Launch a GTK4 app (e.g. GTK4-demo, Nautilus, gnome-text-editor) using the Vulkan backend
  2. Observe the CPU usage of a GTK4 window’s thread

Current behavior

CPU usage constantly hovering between 2-3%, even when the window is ‘idle’ in the background

Expected outcome

Minimal CPU usage when app is idle, similar to what’s seen when using the ngl renderer

Version information

  • Arch Linux | Kernel 6.11.5
  • Gnome-shell | Mutter 47.1
  • Wayland (meson_options: xwayland=false)
  • Gtk4 4.16.3
  • Mesa 24.2.5
  • nVidia 560.35.03
  • vulkan-icd-loader 1.3.295

Additional information

Here’s where things are spinning:

$ sudo strace -v -fp 9082
strace: Process 9082 attached with 11 threads
[pid  9094] openat(AT_FDCWD, "/proc/stat", O_RDONLY) = 42
[pid  9094] read(42, "cpu  34964 19 18870 9203976 5872"..., 299) = 299
[pid  9094] close(42)                   = 0
[pid  9094] clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=5000000},  <unfinished ...>
[pid  9100] <... restart_syscall resumed>) = -1 ETIMEDOUT (Connection timed out)
[pid  9100] futex(0x6322a993e0c0, FUTEX_WAKE_PRIVATE, 1) = 0
[pid  9100] futex(0x7cab2c000f58, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, {tv_sec=1729865521, tv_nsec=735347000}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid  9094] <... clock_nanosleep resumed>0x7cab613ffb80) = 0
[pid  9094] openat(AT_FDCWD, "/proc/stat", O_RDONLY) = 42
[pid  9094] read(42, "cpu  34965 19 18870 9203988 5872"..., 299) = 299
[pid  9094] close(42)                   = 0
[pid  9094] clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=5000000}, 0x7cab613ffb80) = 0
[pid  9094] openat(AT_FDCWD, "/proc/stat", O_RDONLY) = 42
[pid  9094] read(42, "cpu  34965 19 18870 9204001 5872"..., 299) = 299
[pid  9094] close(42)                   = 0
[pid  9094] clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=5000000},  <unfinished ...>
[pid  9100] <... futex resumed>)        = -1 ETIMEDOUT (Connection timed out)
[pid  9100] futex(0x6322a993e0c0, FUTEX_WAKE_PRIVATE, 1) = 0
[pid  9100] futex(0x7cab2c000f58, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, {tv_sec=1729865521, tv_nsec=745883000}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid  9094] <... clock_nanosleep resumed>0x7cab613ffb80) = 0
[pid  9094] openat(AT_FDCWD, "/proc/stat", O_RDONLY) = 42
[pid  9094] read(42, "cpu  34965 19 18870 9204014 5872"..., 299) = 299
[pid  9094] close(42)                   = 0
[pid  9094] clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=5000000}, 0x7cab613ffb80) = 0
[pid  9094] openat(AT_FDCWD, "/proc/stat", O_RDONLY) = 42
[pid  9094] read(42, "cpu  34965 19 18872 9204025 5872"..., 299) = 299
[pid  9094] close(42)                   = 0
[pid  9094] clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=5000000},  <unfinished ...>
[pid  9100] <... futex resumed>)        = -1 ETIMEDOUT (Connection timed out)

nvidia-bug-report-560.35.03.log (15.9 MB)

I’d imagine this would be considered a low-priority issue as it’s “only” unnecessary extra CPU usage.

Would be great to see any confirmation/ack from nVidia or others though.

As a non-gamer, productivity-focused type of user this is a dealbreaker for using to the default Vulkan GTK backend.

Same behavior with the latest 565 series beta driver:

I’ll try reporting the issue at the open module GitLab instance in hopes of getting this addressed prior to the next Production Branch driver release.

Unfortunately that issue tracker is only supposed to be used for problems with the open module that do not occur with the proprietary driver.