Heroic-Games-Launcher / HeroicGamesLauncher

A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.
https://heroicgameslauncher.com
GNU General Public License v3.0
8.19k stars 429 forks source link

[Solved] HDR not functioning on Steam Deck OLED #3281

Closed Shanayara closed 9 months ago

Shanayara commented 11 months ago

Describe the bug

A lot of people have recently gotten their shiny new Steam Deck OLEDs and tried out different HDR-capable games on it; certainly, many users of Heroic are Steam Deck users.

When installing and running HDR-capable games through Heroic (for instance, the Battle.net version of Diablo IV or the GOG version of Cyberpunk 2077), the games do correctly pick up that the screen is HDR capable and allow us to enable the specific options in game. But this results in an extremely distorted image (greyed out in the case of HDR PQ, and very oversaturated in the case of HDR scRGB), and the Steam Deck quick settings not even putting the little "HDR" badge next to the Brigthness setting, like it does in Steam games that are HDR capable and work without any problems.

Using a different version of Wine-GE/Proton-GE doesn't change the issue, I tried a bunch of them including latest and experimental. From what other people have mentioned about this issue on the internet (e.g. on Reddit), the problem might be related to Heroic not using the native Steam Deck's Mesa from Valve, but using Flatpak's Mesa instead.

Add logs

(16:25:45) INFO:    [Legendary]:        Legendary location: /app/bin/heroic/resources/app.asar.unpacked/build/bin/linux/legendary
(16:25:45) INFO:    [Gog]:              GOGDL location: /app/bin/heroic/resources/app.asar.unpacked/build/bin/linux/gogdl
(16:25:45) INFO:    [Connection]:       Connectivity: check-online
(16:25:45) INFO:    [Connection]:       Pinging external endpoints
(16:25:46) INFO:    [Backend]:          DRM module staus {
  "oimompecagnajdejgnnjijobebaeigek": {
    "name": "Widevine Content Decryption Module",
    "status": "new",
    "version": "4.10.2710.0"
  }
}
(16:25:46) INFO:    [Backend]:          Heroic started via Steam-Deck gamemode. Switching to fullscreen
(16:25:46) WARNING: [Backend]:          Failed to register protocol with OS.
(16:25:46) INFO:    [Legendary]:        Running command: LEGENDARY_CONFIG_PATH=/home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/legendaryConfig/legendary /app/bin/heroic/resources/app.asar.unpacked/build/bin/linux/legendary --version
(16:25:46) INFO:    [Gog]:              Running command: /app/bin/heroic/resources/app.asar.unpacked/build/bin/linux/gogdl --auth-config-path /home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/gog_store/auth.json --version
(16:25:46) INFO:    [Nile]:             Running command: NILE_CONFIG_PATH=/home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/nile_config /app/bin/heroic/resources/app.asar.unpacked/build/bin/linux/nile --version
(16:25:46) INFO:    [Backend]:          
System Information:
CPU: 8x AMD Custom APU 0405
Memory: 15.53 GB (used: 3.7 GB)
GPUs:
  GPU 0:
    Name: Advanced Micro Devices, Inc. [AMD/ATI] undefined
    IDs: D=1435 V=1002 SD=0123 SV=1002
    Driver: amdgpu
OS: SteamOS 3.5.7 holo (linux)

The current system is a Steam Deck (model: OLED)
We are running inside a Flatpak container

Software Versions:
  Heroic: 2.11.0 Kumachi
  Legendary: 0.20.33 Undue Alarm
  gogdl: 0.7.3
  Nile: 1.0.0 Jonathan Joestar

(16:25:46) INFO:    [Connection]:       Connectivity: online
(16:25:46) INFO:    [Gog]:              Checking if login is valid
(16:25:46) INFO:    [Gog]:              Running command: /app/bin/heroic/resources/app.asar.unpacked/build/bin/linux/gogdl --auth-config-path /home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/gog_store/auth.json auth
(16:25:46) INFO:    [Backend]:          Loading Screen Ready
(16:25:46) INFO:    [Frontend]:         Refreshing undefined Library
(16:25:46) WARNING: [Backend]:          refresh not implemented on Sideload Library Manager
(16:25:46) INFO:    [Gog]:              Running command: /app/bin/heroic/resources/app.asar.unpacked/build/bin/linux/gogdl --auth-config-path /home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/gog_store/auth.json auth
(16:25:46) INFO:    [Legendary]:        Refreshing library...
(16:25:46) INFO:    [Legendary]:        Refreshing Epic Games...
(16:25:46) INFO:    [Legendary]:        Game list updated, got 247 games & DLCs
(16:25:46) INFO:    [Backend]:          Frontend Ready
(16:25:46) INFO:    [Gog]:              Getting GOG library
(16:25:46) INFO:    [Gog]:              Running command: /app/bin/heroic/resources/app.asar.unpacked/build/bin/linux/gogdl --auth-config-path /home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/gog_store/auth.json auth
(16:25:47) INFO:    [Backend]:          Checking for current version changelog
(16:25:48) INFO:    [Winetricks]:       Downloading Winetricks
(16:25:49) WARNING: [Winetricks]:       Error Downloading Winetricks Error: timeout of 1000ms exceeded
    at createError (/app/bin/heroic/resources/app.asar/node_modules/axios/lib/core/createError.js:16:15)
    at RedirectableRequest.handleRequestTimeout (/app/bin/heroic/resources/app.asar/node_modules/axios/lib/adapters/http.js:369:16)
    at RedirectableRequest.emit (node:events:514:28)
    at Timeout.<anonymous> (/app/bin/heroic/resources/app.asar/node_modules/follow-redirects/index.js:179:12)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)
(16:25:49) INFO:    [Backend]:          Launching Cyberpunk 2077 (1423049311)
(16:25:49) INFO:    [Backend]:          Downloading saves for Cyberpunk 2077
(16:25:49) INFO:    [Gog]:              Running command: /app/bin/heroic/resources/app.asar.unpacked/build/bin/linux/gogdl --auth-config-path /home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/gog_store/auth.json auth
(16:25:49) INFO:    [Backend]:          Preventing machine to sleep
(16:25:50) INFO:    [Gog]:              Syncing saves for Cyberpunk 2077
(16:25:50) INFO:    [Gog]:              Syncing saves for Cyberpunk 2077: /app/bin/heroic/resources/app.asar.unpacked/build/bin/linux/gogdl --auth-config-path /home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/gog_store/auth.json save-sync "/home/deck/Games/Heroic/Prefixes/default/Cyberpunk 2077/pfx/dosdevices/c:/users/steamuser/Saved Games/CD Projekt Red/Cyberpunk 2077" 1423049311 --token <redacted> --os windows --ts 1701355832.371268 --name saves --skip-upload
(16:25:51) INFO:    [WineDownloader]:   Updating wine versions info
(16:25:51) INFO:    [WineDownloader]:   Fetching upstream information...
(16:25:51) INFO:    [Legendary]:        Running command: LEGENDARY_CONFIG_PATH=/home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/legendaryConfig/legendary /app/bin/heroic/resources/app.asar.unpacked/build/bin/linux/legendary list --third-party
(16:25:51) INFO:    [Backend]:          Starting the Download Queue
(16:25:52) INFO:    [Gog]:              Saved username to config file
(16:25:53) INFO:    [Backend]:          AreWeAntiCheatYet data downloaded
(16:25:56) INFO:    [Gog]:              Running command: /app/bin/heroic/resources/app.asar.unpacked/build/bin/linux/gogdl --auth-config-path /home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/gog_store/auth.json auth
(16:25:58) INFO:    [Backend]:          Saves for Cyberpunk 2077 downloaded
(16:25:58) INFO:    [Backend]:          Preventing display from sleep
(16:25:58) INFO:    [Backend]:          Checking if wine version exists: Wine - Wine-GE-latest
(16:25:59) INFO:    [Backend]:          Checking if wine version exists: Wine - Wine-GE-latest
(16:25:59) INFO:    [Backend]:          Checking if wine version exists: Wine - Wine-GE-latest
(16:25:59) INFO:    [Backend]:          Checking if wine version exists: Wine - Wine-GE-latest
(16:25:59) DEBUG:   [Backend]:          Running Wine command: wineboot --init
(16:26:05) INFO:    [DXVKInstaller]:    installing dxvk on... /home/deck/Games/Heroic/Prefixes/default/Cyberpunk 2077
(16:26:05) INFO:    [DXVKInstaller]:    dxvk already installed!
(16:26:05) INFO:    [DXVKInstaller]:    installing dxvk-nvapi on... /home/deck/Games/Heroic/Prefixes/default/Cyberpunk 2077
(16:26:05) INFO:    [DXVKInstaller]:    dxvk-nvapi already installed!
(16:26:05) INFO:    [DXVKInstaller]:    installing vkd3d on... /home/deck/Games/Heroic/Prefixes/default/Cyberpunk 2077
(16:26:05) INFO:    [DXVKInstaller]:    vkd3d already installed!
(16:26:05) INFO:    [Gog]:              Launching Cyberpunk 2077: WINEDLLOVERRIDES=winemenubuilder.exe=d LD_LIBRARY_PATH=/home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/tools/wine/Wine-GE-latest/lib64:/home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/tools/wine/Wine-GE-latest/lib HEROIC_APP_NAME=1423049311 HEROIC_APP_RUNNER=gog HEROIC_APP_SOURCE=gog DOTNET_BUNDLE_EXTRACT_BASE_DIR= DOTNET_ROOT= WINEPREFIX="/home/deck/Games/Heroic/Prefixes/default/Cyberpunk 2077" WINE_FULLSCREEN_FSR=0 WINEESYNC=1 WINEFSYNC=1 DXVK_ENABLE_NVAPI=1 DXVK_NVAPI_ALLOW_OTHER_DRIVERS=1 ORIG_LD_LIBRARY_PATH= GST_PLUGIN_SYSTEM_PATH_1_0=/home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/tools/wine/Wine-GE-latest/lib64/gstreamer-1.0:/home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/tools/wine/Wine-GE-latest/lib/gstreamer-1.0 WINEDLLPATH=/home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/tools/wine/Wine-GE-latest/lib64/wine:/home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/tools/wine/Wine-GE-latest/lib/wine /app/bin/heroic/resources/app.asar.unpacked/build/bin/linux/gogdl --auth-config-path /home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/gog_store/auth.json launch "/home/deck/Games/Heroic/Cyberpunk 2077" 1423049311 --wine /home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/tools/wine/Wine-GE-latest/bin/wine --platform windows
(16:26:06) INFO:    [WineDownloader]:   wine versions updated
(16:28:08) INFO:    [Gog]:              Saved games data
(16:28:08) WARNING: [Backend]:          listUpdateableGames not implemented on Sideload Library Manager
(16:28:10) INFO:    [Gog]:              Found 0 game(s) to update
(16:28:10) INFO:    [Legendary]:        Checking for game updates: LEGENDARY_CONFIG_PATH=/home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/legendaryConfig/legendary /app/bin/heroic/resources/app.asar.unpacked/build/bin/linux/legendary list --third-party
(16:28:36) INFO:    [Legendary]:        Found 0 games to update
(16:28:59) INFO:    [Backend]:          Stopping Display Power Saver Blocker
(16:28:59) INFO:    [Gog]:              Running command: /app/bin/heroic/resources/app.asar.unpacked/build/bin/linux/gogdl --auth-config-path /home/deck/.var/app/com.heroicgameslauncher.hgl/config/heroic/gog_store/auth.json auth

Steps to reproduce

  1. Install Heroic through "Discover" on freshly set up Steam Deck OLED
  2. Install and open any HDR-capable game via Heroic on a Steam Deck OLED
  3. Run the game from within Steam Deck mode -> HDR option shows up in the game's settings (in Desktop mode it's not available)
  4. Enable HDR setting in game
  5. Screen displays either washed out (HDR10 PQ) or oversaturated (HDR10 scRGB), and not actually displayed in HDR.

Expected behavior

Enabling HDR should correctly switch the screen mode to HDR, like it works in Steam games. Or HDR should not be allowed to be enabled in the first place (like on Steam Deck LCD).

Screenshots

Diablio IV login screen with HDR enabled, colors are washed out: washedout_diabloIV Cyberpunk 2077 HDR calibration menu with HDR PQ enabled, colors are washed out: washedout_hdrPQ_cyberpunk2077 Cyberpunk 2077 intro move with HDR scRGB enabled, colors are extremely oversatured: oversaturated_hdr_scRGB_cyberpunk2077

Heroic Version

Latest Stable (Flatpak)

System Information

Additional information

No response

flavioislima commented 9 months ago

@m3e-g @rakonkido That makes it things even more difficult to understand. 😅 Why the need to install gamescope if it is not enabled? 🤷🏽

Well, I guess is better not to think to much on that, the important thing is that it works, ahahahah

rakonkido commented 9 months ago

I'm not experienced with Heroic, Flatpak, or Gamescope, but my current mental model of what's going on is that:

If you're testing HDR on desktop Linux with Flatpak Heroic, I'd guess you probably do need to enable Gamescope via Heroic, to ensure that it's calling the Gamescope Flatpak, not your system-level Flatpak.

mashinboo commented 9 months ago

Can confirm that after installing gamescope through the provided install link listed in this thread, my copy of Assasins Creed :Mirage, purchased through the epic games store now properly displays HDR on the steamdeck oled model. I didnt need to do anything else to the games settings, just install gamescope and HGL detected it and it just worked.

I feel like if possible future versions of HGL should auto install gamescope during its setup process.

The support for this issue was fantastic you guys really killed it !

flavioislima commented 9 months ago

I'm not experienced with Heroic, Flatpak, or Gamescope, but my current mental model of what's going on is that:

* when you enable Gamescope in Heroic, it launches the game inside its own nested Gamescope instance. But Game Mode on SteamOS already runs all software in Gamescope. So it should never be necessary to manually enable Gamescope in Heroic on Steam Deck, as this would be double-nesting a Gamescope instance.

* adding the Gamescope Flatpak is necessary because, due to Flatpak's isolation, a game running inside Flatpak can't communicate with the system-level Gamescope's bypass layer for passing HDR colors through to the display.

If you're testing HDR on desktop Linux with Flatpak Heroic, I'd guess you probably do need to enable Gamescope via Heroic, to ensure that it's calling the Gamescope Flatpak, not your system-level Flatpak.

The first point makes sense, the second one I am not sure because other binaries installed on the system works fine. Check this line, this is where we update the path for the flatpak app: https://github.com/flathub/com.heroicgameslauncher.hgl/blob/master/com.heroicgameslauncher.hgl.yml#L22C1-L22C233 - --env=PATH=/app/bin:/app/utils/bin:/usr/bin:/usr/lib/extensions/vulkan/MangoHud/bin:/usr/lib/extensions/vulkan/gamescope/bin:/usr/lib/extensions/vulkan/OBSVkCapture/bin:/app/bin/heroic/resources/app.asar.unpacked/build/bin/linux So Heroic should be able to access the gamescope that comes on the steam deck UNLESS it is on another path or on a forbidden folder.

rakonkido commented 9 months ago

Asked ChatGPT:

The line - --env=PATH=/app/bin:/app/utils/bin:/usr/bin in a Flatpak manifest does not grant the Flatpak application direct access to the system-level /usr/bin directory. Flatpak applications are designed to run in an isolated environment, and by default, they cannot access system-level directories or binaries outside of their sandbox.

The line you've mentioned is modifying the PATH environment variable within the Flatpak sandbox. It is specifying the directories where the Flatpak application should look for executables when you run commands inside the Flatpak sandbox. In this case, it adds /app/bin and /app/utils/bin to the PATH so that the Flatpak application can find executables located in those directories within its sandbox.

However, including /usr/bin in the PATH within the Flatpak sandbox does not grant access to the actual /usr/bin directory on your host system. The Flatpak runtime provides its own filesystem namespace and isolates the application from the host system's directories, including /usr/bin.

So, while the line you mentioned modifies the PATH for the Flatpak application, it doesn't break the isolation model, and the application won't have direct access to system-level directories like /usr/bin. Instead, it allows the Flatpak application to find and execute executables that are bundled within the Flatpak itself or installed in the sandboxed environment.

QaAndreii commented 9 months ago

Asked ChatGPT:

I asked him about access to system directories. This may be useful, for example detecting the presence and directory of the system gamescope and using this "portal" to interact with it (assuming if it works). And so, the current solution (installing flatpak gamescope) is more than suitable for my use cases.

ChatGPT about "portals"
In general, Flatpak is designed to provide isolation for applications, preventing direct access to system directories. This is done to ensure system security and stability. The use of isolated runtimes and sandboxes implies that applications do not have direct access to system directories such as /usr/bin.

However, if you need to grant access to specific resources, you can utilize Flatpak portals. Portals in Flatpak are a mechanism for providing applications with limited access to host system resources, such as files, camera, network resources, and so on.

To grant access to the system /usr/bin or other system directories, you would likely need to use the appropriate portal. For example, the --filesystem portal can be used to provide the application with access to specific directories on the host system. However, it's crucial to prioritize security and restrict access only to necessary resources.

Details on how to use portals can be found in the official Flatpak documentation or relevant guides.

    
rakonkido commented 9 months ago

@flavioislima

The first point makes sense, the second one I am not sure because other binaries installed on the system works fine. Check this line, this is where we update the path for the flatpak app: https://github.com/flathub/com.heroicgameslauncher.hgl/blob/master/com.heroicgameslauncher.hgl.yml#L22C1-L22C233 - --env=PATH=/app/bin:/app/utils/bin:/usr/bin:/usr/lib/extensions/vulkan/MangoHud/bin:/usr/lib/extensions/vulkan/gamescope/bin:/usr/lib/extensions/vulkan/OBSVkCapture/bin:/app/bin/heroic/resources/app.asar.unpacked/build/bin/linux So Heroic should be able to access the gamescope that comes on the steam deck UNLESS it is on another path or on a forbidden folder.

The system Gamescope is at /usr/bin/gamescope. I installed Heroic Flatpak on a fresh system that had Gamescope available at that path, but without the Gamescope Flatpak, and when opening the Gamescope tab for a game in Heroic I see the error message "We could not found gamescope on the PATH. Install it or add it to the PATH." Installing the Gamescope Flatpak immediately made this error go away. So I think it is the sandbox that was preventing access.

Btw, I guess we can close this issue now, as HDR has been working well for me through Heroic.

flavioislima commented 9 months ago

@flavioislima

The first point makes sense, the second one I am not sure because other binaries installed on the system works fine. Check this line, this is where we update the path for the flatpak app: https://github.com/flathub/com.heroicgameslauncher.hgl/blob/master/com.heroicgameslauncher.hgl.yml#L22C1-L22C233 - --env=PATH=/app/bin:/app/utils/bin:/usr/bin:/usr/lib/extensions/vulkan/MangoHud/bin:/usr/lib/extensions/vulkan/gamescope/bin:/usr/lib/extensions/vulkan/OBSVkCapture/bin:/app/bin/heroic/resources/app.asar.unpacked/build/bin/linux So Heroic should be able to access the gamescope that comes on the steam deck UNLESS it is on another path or on a forbidden folder.

The system Gamescope is at /usr/bin/gamescope. I installed Heroic Flatpak on a fresh system that had Gamescope available at that path, but without the Gamescope Flatpak, and when opening the Gamescope tab for a game in Heroic I see the error message "We could not found gamescope on the PATH. Install it or add it to the PATH." Installing the Gamescope Flatpak immediately made this error go away. So I think it is the sandbox that was preventing access.

Btw, I guess we can close this issue now, as HDR has been working well for me through Heroic.

Yes and Flatpak apps cannot access /usr/bin so this would never work.

Closing it. But I will pin in case someone needs help with that in the future.

roschi02 commented 5 months ago

I tried to set this up today. Unfortunately, the solutions in this thread just made Cyberpunk crash on startup. However, I was pointed in the right direction, and after a bit more research, I found the solution. After executing the following commands, the game work without any more tweaks. Thanks to @ColinKinloch for the solution. If you don't feel like going elsewhere for the commands, here they are:

Clone the repo:

git clone https://github.com/flathub/org.freedesktop.Platform.VulkanLayer.gamescope.git

Change directory

cd org.freedesktop.Platform.VulkanLayer.gamescope/

Checkout the correct version:

git checkout 2a8ab98c2881d5a1262712093d051434a1a7d6f4

Install the flatpak-builder flatpak:

flatpak install org.flatpak.Builder

Build and install gamescope:

flatpak run org.flatpak.Builder --user --jobs=4 --install ./_build ./org.freedesktop.Platform.VulkanLayer.gamescope.yml

Stop updates on the org.freedesktop.Platform.VulkanLayer.gamescope package:

flatpak mask --user org.freedesktop.Platform.VulkanLayer.gamescope
Slothoncrack commented 3 months ago

I've tried running the commands like @roschi02 described, but the build and install command returned me a SSL error for libevdev-1.13.1.tar.xz.

What worked as a solution to that was for me to download the libevdev-1.13.1.tar.xz file manually, then modify the modules/libevdev.yml file to point towards the local file, i.e.: url: file:///home/deck/Downloads/libevdev-1.13.1.tar.xz instead of before: url: http://freedesktop.org/software/libevdev/libevdev-1.13.1.tar.xz

Just leaving this here in case anyone else comes across this.

It worked perfectly fine for enabling HDR on my Cyberpunk Ultimate GOG install!

Slothoncrack commented 2 months ago

I do have a follow up question here: What will happen if i update steamOS to 3.6.*? Will gamescope HDR then break again?

roschi02 commented 2 months ago

@Slothoncrack I updated from the stable to the beta version yesterday, and it broke. This could be because I have many mods installed. I see no reason why it should break if you only use Gamescope, mainly because you forced the system to not update the package.

roschi02 commented 1 day ago

Updated Solution for Issues on Steam OS 3.6.*

If you are encountering problems starting games on the new Steam OS 3.6.* release, here’s what worked for me:

  1. Remove the update prevention:

    flatpak mask --remove org.freedesktop.Platform.VulkanLayer.gamescope
  2. Uninstall the current version of Gamescope:

    flatpak uninstall org.freedesktop.Platform.VulkanLayer.gamescope
  3. Install the 23.08 version of Gamescope:

    flatpak install gamescope

For additional context: I followed the steps above to get games running on earlier versions of Steam OS. If you're setting this up for the first time, you won’t need to remove the update prevention. Instead, you may only need to downgrade Gamescope to version 23.08 by uninstalling the existing version and then installing the working one.