godot: Vulkan: Editor freezes when system wakes up from sleep


Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.


Godot version

4.0.dev (5179124f)

System information

Linux 5.13.13, Ryzen 5800X, GTX 1060, Vulkan

Issue description

When my Linux system goes to sleep and later wakes up, any currently running Godot 4.0.dev editors are completely frozen, and I need to kill -9 their processes.

Steps to reproduce

  • Start the editor with any project
  • Put the system to sleep
  • Wake the system up from sleep
  • Godot editor is now entirely frozen

Minimal reproduction project

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 17 (8 by maintainers)

Most upvoted comments

Given how this isn’t a Godot-specific issue and large sweeping changes are required to support suspend on Linux, it’s fair to document this for now.

This definitely seems to be a wider problem than Godot. I booted up Valheim on Pop! OS and put my computer into sleep mode. The Vulkan version of Valheim behaved just like Godot 4 (entire window stopped rendering), whereas OpenGL version of Valheim behaved more like Godot 3 (2D UI continued to render, but 3D meshes were completely black)

Also since I don’t think it was mentioned in this thread yet: this problem affects not just the editor but any games made with Godot as well

Regarding NVIDIA GPUs, it seems this is currently a limitation of the driver. There is an experimental option you can enable to copy VRAM to RAM before suspending: https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Preserve_video_memory_after_suspend

This also explains why the issue could only be reproduced on NVIDIA GPUs so far.

Can anyone try this and see if it works?

I am also experiencing this issue with the recently released godot 4 alpha build. So far, this issue has happened every time I have slept/resumed my system.

Godot Engine v4.0.alpha1.official.31a7ddbf8 Linux 5.15.16-1-MANJARO x86_64; GNOME Shell 41.3 Vulkan API 1.2.202 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce MX150

Godot Engine v3.4.2.stable.official.45eaa2daf does not have the same problem for me and I haven’t noticed any material problems like the one @hmans mentioned.

As @fwsGonzo said, the editor still responds to mouse clicks, but the window shows a ghost of the last rendered content. Also, a project does not need to be opened (stay at project manager window) before sleeping/resuming breaks godot’s window rendering.

Running from the terminal shows lots of these errors whenever a re-render event is triggered (such as resizing the window or hovering over components inside):

ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
   at: swap_buffers (drivers/vulkan/vulkan_context.cpp:1956)
ERROR: Vulkan: Did not create swapchain successfully.
   at: prepare_buffers (drivers/vulkan/vulkan_context.cpp:1880)

I also saw this error in one of my tests, but it may not be related.

ERROR: Condition "!material" is true.
   at: material_set_shader (servers/rendering/renderer_rd/renderer_storage_rd.cpp:1570)

Lspci shows:

01:00.0 3D controller: NVIDIA Corporation GP108M [GeForce MX150] (rev a1)
        Subsystem: Lenovo ThinkPad T480
        Flags: bus master, fast devsel, latency 0, IRQ 159
        Memory at dc000000 (32-bit, non-prefetchable) [size=16M]
        Memory at 80000000 (64-bit, prefetchable) [size=256M]
        Memory at 90000000 (64-bit, prefetchable) [size=32M]
        I/O ports at d000 [size=128]
        Capabilities: [60] Power Management version 3
        Capabilities: [68] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Capabilities: [78] Express Endpoint, MSI 00
        Capabilities: [100] Virtual Channel
        Capabilities: [250] Latency Tolerance Reporting
        Capabilities: [258] L1 PM Substates
        Capabilities: [128] Power Budgeting <?>
        Capabilities: [420] Advanced Error Reporting
        Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 <?>
        Capabilities: [900] Secondary PCI Express
        Kernel driver in use: nvidia
        Kernel modules: nouveau, nvidia_drm, nvidia

See also https://github.com/godotengine/godot/issues/41559.

@hmans Can you reproduce this with Godot 3.3.3?

Note that in general, NVIDIA + suspend on Linux is not very reliable. Open source drivers generally fare better here, but there are no viable open source drivers available for Maxwell 2 and newer GPUs due to NVIDIA’s signed firmware requirement.