Gamescope session flickers heavily

 programs.gamescope = {
    enable = true;
    package = pkgs.unstable.gamescope;
  };
  programs.steam = {
    gamescopeSession = {
      enable = true;
      env = {
        WLR_RENDERER = "vulkan";
        DXVK_HDR = "1";
        ENABLE_GAMESCOPE_WSI = "1";
        WINE_FULLSCREEN_FSR = "1";
        # Games allegedly prefer X11
        SDL_VIDEODRIVER = "x11";
      };
      args = [
        "--xwayland-count 2"
        "--expose-wayland"

        "-e" # Enable steam integration
        "--steam"

        "--adaptive-sync"
        "--hdr-enabled"
        "--hdr-itm-enable"

        # External monitor
        "--prefer-output HDMI-A-1"
        "--output-width 2560"
        "--output-height 1440"
        # "-r 75"

        # Laptop display
        # "--prefer-output eDP-1"
        # "--output-width 2560"
        # "--output-height 1600"
        # "-r 120"
        
        "--prefer-vk-device" # lspci -nn | grep VGA
        "1002:73ef" # Dedicated
        # 1002:1681 # Integrated
      ];
    };
  };

I am all AMD hardware. Also, I am not sure what I am doing. In some of my experiments (like the current config) it will show a loading screen, then a black square on a white background will appear and the whole thing starts to flicker horribly. In others (not sure how to reproduce them even), it will load Steam and everything, but every mouse move causes the screen to go black.

I was looking at these configs for clues, but no luck!

Trying to run it from shell script (note: using different display port here, but it’s the same monitor):

export WLR_RENDERER="vulkan"
export DXVK_HDR="1"
export ENABLE_GAMESCOPE_WSI="1"
export WINE_FULLSCREEN_FSR="1"
export SDL_VIDEODRIVER="x11"

gamescope --xwayland-count 2 \
  --expose-wayland \
  -e \
  --steam \
  --adaptive-sync \
  --hdr-enabled \
  --hdr-itm-enable \
  --prefer-output DP-3 \
  --output-width 2560 \
  --output-height 1440 \
  --prefer-vk-device 1002:73ef

Output:

No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
Your Wayland compositor does NOT support wp_presentation/presentation-time which is required for VK_KHR_present_wait and VK_KHR_present_id.
Please complain to your compositor vendor for support. Falling back to X11 window with less accurate present wait.
vulkan: selecting physical device 'AMD Radeon RX 6800S (RADV NAVI23)': queue family 1 (general queue family 0)
vulkan: physical device supports DRM format modifiers
wlserver: [backend/headless/backend.c:67] Creating headless backend
vulkan: supported DRM formats for sampling usage:
vulkan:   AR24 (0x34325241)
vulkan:   XR24 (0x34325258)
vulkan:   AB24 (0x34324241)
vulkan:   XB24 (0x34324258)
vulkan:   RG16 (0x36314752)
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)
vulkan: Creating Gamescope nested swapchain with format 44 and colorspace 0
wlserver: Running compositor on wayland display 'gamescope-0'
wlserver: [backend/headless/backend.c:17] Starting headless backend
wlserver: [xwayland/server.c:108] Starting Xwayland on :1
wlserver: [xwayland/server.c:108] Starting Xwayland on :2
DRI driver not from this Mesa build ('23.1.9' vs '24.0.2')
failed to bind extensions
DRI driver not from this Mesa build ('23.1.9' vs '24.0.2')
failed to bind extensions
DRI driver not from this Mesa build ('23.1.9' vs '24.0.2')
DRI driver not from this Mesa build ('23.1.9' vs '24.0.2')
failed to bind extensions
failed to bind extensions
DRI driver not from this Mesa build ('23.1.9' vs '24.0.2')
failed to bind extensions
DRI driver not from this Mesa build ('23.1.9' vs '24.0.2')
failed to bind extensions
couldn't create gbm device
couldn't create gbm device
EGL setup failed, disabling glamor
Failed to initialize glamor, falling back to sw
EGL setup failed, disabling glamor
Failed to initialize glamor, falling back to sw
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Could not resolve keysym XF86CameraAccessEnable
> Warning:          Could not resolve keysym XF86CameraAccessDisable
> Warning:          Could not resolve keysym XF86CameraAccessToggle
> Warning:          Could not resolve keysym XF86NextElement
> Warning:          Could not resolve keysym XF86PreviousElement
> Warning:          Could not resolve keysym XF86AutopilotEngageToggle
> Warning:          Could not resolve keysym XF86MarkWaypoint
> Warning:          Could not resolve keysym XF86Sos
> Warning:          Could not resolve keysym XF86NavChart
> Warning:          Could not resolve keysym XF86FishingChart
> Warning:          Could not resolve keysym XF86SingleRangeRadar
> Warning:          Could not resolve keysym XF86DualRangeRadar
> Warning:          Could not resolve keysym XF86RadarOverlay
> Warning:          Could not resolve keysym XF86TraditionalSonar
> Warning:          Could not resolve keysym XF86ClearvuSonar
> Warning:          Could not resolve keysym XF86SidevuSonar
> Warning:          Could not resolve keysym XF86NavInfo
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Could not resolve keysym XF86CameraAccessEnable
> Warning:          Could not resolve keysym XF86CameraAccessDisable
> Warning:          Could not resolve keysym XF86CameraAccessToggle
> Warning:          Could not resolve keysym XF86NextElement
> Warning:          Could not resolve keysym XF86PreviousElement
> Warning:          Could not resolve keysym XF86AutopilotEngageToggle
> Warning:          Could not resolve keysym XF86MarkWaypoint
> Warning:          Could not resolve keysym XF86Sos
> Warning:          Could not resolve keysym XF86NavChart
> Warning:          Could not resolve keysym XF86FishingChart
> Warning:          Could not resolve keysym XF86SingleRangeRadar
> Warning:          Could not resolve keysym XF86DualRangeRadar
> Warning:          Could not resolve keysym XF86RadarOverlay
> Warning:          Could not resolve keysym XF86TraditionalSonar
> Warning:          Could not resolve keysym XF86ClearvuSonar
> Warning:          Could not resolve keysym XF86SidevuSonar
> Warning:          Could not resolve keysym XF86NavInfo
Errors from xkbcomp are not fatal to the X server
Errors from xkbcomp are not fatal to the X server
wlserver: [types/wlr_compositor.c:692] New wlr_surface 0x26e1930 (res 0x26db9c0)
wlserver: [types/wlr_compositor.c:692] New wlr_surface 0x26d1150 (res 0x26dbea0)
wlserver: [xwayland/server.c:273] Xserver is ready
wlserver: [xwayland/server.c:273] Xserver is ready
pipewire: stream state changed: connecting
pipewire: stream state changed: paused
pipewire: stream available on node ID: 82
vblank: Using timerfd.
^Cgamescope: Received Interrupt signal, attempting shutdown!
xwm: X11 I/O error