Screen goes black for 1s when I change the active window

Hello,
I experience random black screens when using my computer (browsing the web, reading emails, discord).
Here is a list of events that have led to black screens

  • Changing workspaces in gnome
  • Playing a Twitch stream in full screen mode

The following error might be related (even if I have mesa driver installed):

avril 20 14:20:33 R0M1 armcord.desktop[5237]: Warning: vkCreateInstance: Found no drivers!
avril 20 14:20:33 R0M1 armcord.desktop[5237]: Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
avril 20 14:20:33 R0M1 armcord.desktop[5237]:     at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:101)
avril 20 14:20:33 R0M1 armcord.desktop[5237]:     at CreateVkInstance (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:493)
avril 20 14:20:33 R0M1 armcord.desktop[5237]:     at Initialize (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:379)
avril 20 14:20:33 R0M1 armcord.desktop[5237]:     at Create (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:301)
avril 20 14:20:33 R0M1 armcord.desktop[5237]:     at operator() (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:556)

I didn’t have this black screen problem until I updated my nixpkgs from commit 3030f185ba6a4bf4f18b87f345f104e6a6961f34 (Mar 9) to 5c24cf2f0a12ad855f444c30b2421d044120c66f (Apr 19).
The problem also appears with Wayland+Gnome 45.5 and Wayland+Plasma 6

My system:

➜  ~ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.8.7, NixOS, 24.05 (Uakari), 24.05.20240419.5c24cf2`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(romain): `"home-manager"`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/store/v4pcs3nzx54m5bmxd39win0rgl2d2hbx-source`

Hey,
I noticed you are running NixOS 24.05, that is not yet the stable release, so maybe that could be an issue.
Also, what hardware (mainly GPU) do you have. Maybe you need to specify drivers or include that hardware config from nixos-hardware

Hello,
I switched back to the old version and don’t have the issue any more. Nevertheless, here is my hardware:

OS: NixOS 24.05.20240309.3030f18 (Uakari) x86_64 
Host: ASUSTeK COMPUTER INC. PRIME H670-PLUS D4 
Kernel: 6.7.9 
Uptime: 2 hours, 16 mins 
Packages: 1745 (nix-system), 829 (nix-user) 
Shell: bash 5.2.26 
Resolution: 1920x1080 
DE: Plasma 6.0.1 (Wayland) 
WM: kwin 
Icons: breeze-dark [GTK2/3] 
Terminal: .konsole-wrappe 
CPU: 12th Gen Intel i5-12400 (12) @ 4.400GHz 
GPU: AMD ATI Radeon RX 6400/6500 XT/6500M 
Memory: 8681MiB / 15746MiB
➜  ~ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.7.9, NixOS, 24.05 (Uakari), 24.05.20240309.3030f18`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(romain): `"home-manager"`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/store/nra828scc8qs92b9pxra5csqzffb6hpl-source`

In my nix configuration file, I also have:

boot.initrd.kernelModules = [ "amdgpu" ];
services.xserver.enable = true;
services.xserver.videoDrivers = [ "amdgpu" ];