Skip to content

HDR washed out colours when running gamescope on a separate terminal #1404

Description

@Virkkunen

My system info:

  • NVIDIA RTX 3080 LHR
  • Linux endeavour 6.9.7-2-cachyos
  • nvidia-dkms 555.58-2
  • egl-wayland 2:1.1.13-2
  • gamescope version 3.14.22-5-gb44ea3c
  • KDE Plasma version 6.1.1
  • KDE Frameworks version 6.3.0
  • Qt version 6.8.0
  • Kernel modules nvidia nvidia_drm.modeset=1 nvidia_drm.fbdev=1 nvidia_uvm nvidia.NVreg_PreserveVideoMemoryAllocations=1

Title can be a bit confusing, but here's the situation:

When I run a HDR capable game with the following launch options:

gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 --hdr-sdr-content-nits 300 -f -e --mangoapp -- gamemoderun %command%

I'm able to have HDR working without issues. The logs show the following:

xdg_backend: PreferredMetadata: Red: 0.708 0.292, Green: 0.17 0.797, Blue: 0.131 0.046, White: 0.3127 0.329, Max Luminance: 1015 nits, Min Luminance: 0 nits, Max Full Frame Luminance: 351 nits
josh edid: Patching res 800x1280 -> 3840x2160
pipewire: renegotiating stream params (size: 3840x2160)
gamemodeauto: 
wlserver: [types/wlr_compositor.c:771] New wlr_surface 0x61b093b1c810 (res 0x61b093b49df0)
[Gamescope WSI] Creating Gamescope surface: xid: 0x1400081
[Gamescope WSI] Atom of T was wrong type. Expected XCB_ATOM_CARDINAL.
wlserver: [types/wlr_compositor.c:771] New wlr_surface 0x61b093bc6580 (res 0x61b093b5c9e0)
[Gamescope WSI] Made gamescope surface for xid: 0x1400081
[Gamescope WSI] Surface state:
  steam app id:                  1778820
  window xid:                    0x1400081
  wayland surface res id:        5
  layer client flags:            0x4
  server hdr output enabled:     true
  hdr formats exposed to client: true
xwm: got the same buffer committed twice, ignoring.
[Gamescope WSI] Creating swapchain for xid: 0x1400081 - minImageCount: 3 - format: VK_FORMAT_A2B10G10R10_UNORM_PACK32 - colorspace: VK_COLOR_SPACE_SRGB_NONLINEAR_KHR - flip: true
[Gamescope WSI] Created swapchain for xid: 0x1400081 - imageCount: 3

As you can see, the HDR info is being properly passed on to my display/compositor. The following pictures were taken with ISO 100 23mm F1.8 1/20s WB 6000K (the pictures might not look good but trust me, HDR is on and working perfectly here)

20240704_094945
20240704_095639

Also note that mangohud displays HDR: ON

image

The problem with running games this way is that both Steam Overlay and Steam Input do not work at all. A workaround is to create a gamescope window on a separate terminal, and connect the game to that display. So I run this on a terminal, to create my gamescope window:

gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 --hdr-sdr-content-nits 300 -f --mangoapp

This creates gamescope as display :1, so on my game launch options I use:

DISPLAY=:1 gamemoderun %command%

However, HDR does not work this way. Logs only show:

xdg_backend: PreferredMetadata: Red: 0.708 0.292, Green: 0.17 0.797, Blue: 0.131 0.046, White: 0.3127 0.329, Max Luminance: 1015 nits, Min Luminance: 0 nits, Max Full Frame Luminance: 351 nits
pipewire: renegotiating stream params (size: 1440x2560)
pipewire: renegotiating stream params (size: 3840x2160)

And I'm unable to enable HDR on the game's settings. There is a workaround for this, which is to manually set some env flags for both the window and gamescope:

DXVK_HDR=1 gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 --hdr-sdr-content-nits 300 -f --mangoapp

And the launch parameters

ENABLE_HDR_WSI=1 DXVK_HDR=1 DISPLAY=:1 gamemoderun %command%

This way, I'm able to enable HDR on my game, but it seems that it's just forcing HDR to be enabled without passing the correct information to my display, as shown by the logs and the pictures (taken with the same configuration as the previous ones). Mangohud/mangoapp also do not display the HDR status, probably because it isn't actually working:

xdg_backend: PreferredMetadata: Red: 0.708 0.292, Green: 0.17 0.797, Blue: 0.131 0.046, White: 0.3127 0.329, Max Luminance: 1015 nits, Min Luminance: 0 nits, Max Full Frame Luminance: 351 nits
josh edid: Patching res 800x1280 -> 3840x2160
pipewire: renegotiating stream params (size: 3840x2160)

20240704_095425
20240704_095524


Let me know if I'm missing any logs or info that could be useful (and how to take them)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions