Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Shanayara opened this issue Nov 30, 2023 · 65 comments
Closed

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

Shanayara opened this issue Nov 30, 2023 · 65 comments
Labels

Comments

@Shanayara
Copy link

Shanayara commented Nov 30, 2023

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

  • Steam Deck OLED

Additional information

No response

@Shanayara Shanayara added the bug:unconfirmed Someone works on identifying the issue label Nov 30, 2023
@arielj
Copy link
Collaborator

arielj commented Nov 30, 2023

Are you sure this is heroic's issue? I don't think we control the HDR support (that's probably on the game, wine, and dxvk or one of those to control). It would be interesting if you can run the same game using Lutris for example.

@helifax
Copy link

helifax commented Nov 30, 2023

I can report the same thing.
One thing i can add though is that the native game (CP2077) runs perfectly fine in HDR PQ10 native (I am using a Samsung Odyssey OLED G9).
Regarding the SteamDeck Oled, I just got it today.. so I cannot comment in which runtime the issue is.

@Shanayara
Copy link
Author

@arielj I can't really tell, I am not super knowledgable about how everything is put together there and I don't personally use Lutris. But someone mentioned that it's an issue that might exist in Lutris as well, for similar reasons of using an internal Mesa version from Flatpak instead of Valve's Mesa. Which is from my understanding something you might control because the way your flatpak is put together decides whether you use Flatpak's Mesa or a system-installed one?

@flavioislima
Copy link
Member

@arielj I can't really tell, I am not super knowledgable about how everything is put together there and I don't personally use Lutris. But someone mentioned that it's an issue that might exist in Lutris as well, for similar reasons of using an internal Mesa version from Flatpak instead of Valve's Mesa. Which is from my understanding something you might control because the way your flatpak is put together decides whether you use Flatpak's Mesa or a system-installed one?

This is not a Heroic issue. The Steam OS is the one that decides which Mesa version will be used.

You can try to maybe enable the steam runtime and see if it fixes or follow some online tutorial on how to use Mesa-GIT with flatpak and then pass the environment variables on the game settings on Heroic. I would follow these steps to see if it fixes, but other than that we can close this since it is not a Heroic issue.

@helifax
Copy link

helifax commented Dec 1, 2023

Ok.. I was able to get HDR to work correctly both in Cyberpunk 2077 and Witcher 3 from GoG:

  • Downloaded using Heroic.
  • In steam desktop mode, I added the games as non-steam games
  • Under compatibility tab (properties) I hit override and used Proton 8
  • Restarted the SteamDeck so it boots in game mode. (HDR is disabled in-game if launched from Desktop mode).
  • Started the games and HDR was available. Both HDR PQ 10 and Srgb are working fine and you can calibrate them.

So it seems that when launched through Steam Game Mode it works correctly but not from Heroic and not in Desktop Mode.

@Shanayara
Copy link
Author

I can confirm that the method @helifax proposes works fine. The downside of course being that this disables all of Heroic's features, i.e. there is no seperate wine prefix used and savegame cloud sync no longer works.

Does that not show that it's a Heroic issue, @flavioislima? I mean, SteamOS can apparently run the game fine with HDR when just launched directly. But Heroic is there to build stuff around that to make it more convenient to use, and clearly something there is what breaks the HDR.

I tried your suggestion to launch it with Steam Runtime but inside gamescope ("game mode" UI) this fails, with the Heroic logs saying that no running instance of Steam was detected. Is that supposed to be that way? In Desktop mode I can run games with Steam Runtime enabled, but that's pointless because Desktop mode has no HDR support.

@flavioislima
Copy link
Member

I can confirm that the method @helifax proposes works fine. The downside of course being that this disables all of Heroic's features, i.e. there is no seperate wine prefix used and savegame cloud sync no longer works.

Does that not show that it's a Heroic issue, @flavioislima? I mean, SteamOS can apparently run the game fine with HDR when just launched directly. But Heroic is there to build stuff around that to make it more convenient to use, and clearly something there is what breaks the HDR.

I tried your suggestion to launch it with Steam Runtime but inside gamescope ("game mode" UI) this fails, with the Heroic logs saying that no running instance of Steam was detected. Is that supposed to be that way? In Desktop mode I can run games with Steam Runtime enabled, but that's pointless because Desktop mode has no HDR support.

Yeah, Steam itself has their own way of implementing the HDR.

We are trying to build gamescope with HDR support for the flatpak, this might solve the issue, but let's see.

@rakonkido
Copy link

Fwiw, the Chiaki4Deck folks figured out a way to get HDR working through Flatpak: streetpea/chiaki-ng#93

@jptrzy
Copy link

jptrzy commented Dec 6, 2023

I have the same issue on my sd oled

@yoyossef
Copy link

FYI: Chiaki4Deck released HDR support (with flatpak) now https://github.com/streetpea/chiaki4deck/releases/tag/v1.5.0

@Freewheelin123
Copy link

Ok.. I was able to get HDR to work correctly both in Cyberpunk 2077 and Witcher 3 from GoG:

  • Downloaded using Heroic.
  • In steam desktop mode, I added the games as non-steam games
  • Under compatibility tab (properties) I hit override and used Proton 8
  • Restarted the SteamDeck so it boots in game mode. (HDR is disabled in-game if launched from Desktop mode).
  • Started the games and HDR was available. Both HDR PQ 10 and Srgb are working fine and you can calibrate them.

So it seems that when launched through Steam Game Mode it works correctly but not from Heroic and not in Desktop Mode.

I tried these instructions yesterday with Cyberpunk 2077 (downloaded from Epic through Heroic) and it works absolutely fine.

@mashinboo
Copy link

  • tried it with assassin Creed mirage and hdr enables but then disables itself when you exit and return to the image calibration screen in game mode. The HDR calibration doesn't enable either.
    Tried the steps suggested by Halifax Post

@QaAndreii
Copy link

QaAndreii commented Jan 10, 2024

The method indicated here works, but, unfortunately, games from EGS often require additional “torment” in the form of installing an EGS client (when you run the added .exe in Steam, it complains about the lack of an EGS client). Is there any timeline for trying to implement hdr for flatpak or maybe just re-open this issue for easier tracking by users (you can also change it from a bug to a feature request if it doesn’t fit the bug criteria)?

@flavioislima
Copy link
Member

We are working on this.

@flavioislima
Copy link
Member

flavioislima commented Jan 10, 2024

This is the Flatpak PR that should fix this issue, I will merge it soon and then Heroic Flatpak will ask for an update on Discover or any other store and then you guys can test. I don't have a Steam Deck oled to test yet.

flathub/com.heroicgameslauncher.hgl#115

@flavioislima flavioislima reopened this Jan 10, 2024
@flavioislima
Copy link
Member

flavioislima commented Jan 10, 2024

The PR was merged and the update was published so keep an eye on discover for updates and let us know if it worked.

@QaAndreii
Copy link

QaAndreii commented Jan 10, 2024

The PR was merged and the update was published so keep an eye on discover for updates and let us know if it worked.

I now had refresh 2.12.0 available in discover, is this it? Also, will it be necessary to reinstall the game or delete it and add it to Steam again? So far I tried it after updating to refresh, without changing anything, it does not work the same, that is, everything becomes faded (the game Guardian's of the Galaxy from EGS)
UPDATE - tried simple re-add game to Steam - no success (maybe it wasn't needed update or this game damned).

@flavioislima
Copy link
Member

The PR was merged and the update was published so keep an eye on discover for updates and let us know if it worked.

I now had refresh 2.12.0 available in discover, is this it? Also, will it be necessary to reinstall the game or delete it and add it to Steam again? So far I tried it after updating to refresh, without changing anything, it does not work the same, that is, everything becomes faded (the game Guardian's of the Galaxy from EGS).

Just update to the refreshed version. Nothing else needed I believe.

I know some games needs to have DXVK_HDR=1 as an env variable for HDR to work though, and on latest proton experimental as well.

@flavioislima
Copy link
Member

The PR was merged and the update was published so keep an eye on discover for updates and let us know if it worked.

So far I tried it after updating to refresh, without changing anything, it does not work the same, that is, everything becomes faded (the game Guardian's of the Galaxy from EGS).

I don't really know why it would be 'faded' like you said. Have you enabled HDR on the Game settings that appear when the game is launched?

@QaAndreii
Copy link

QaAndreii commented Jan 10, 2024

The PR was merged and the update was published so keep an eye on discover for updates and let us know if it worked.

I now had refresh 2.12.0 available in discover, is this it? Also, will it be necessary to reinstall the game or delete it and add it to Steam again? So far I tried it after updating to refresh, without changing anything, it does not work the same, that is, everything becomes faded (the game Guardian's of the Galaxy from EGS).

Just update to the refreshed version. Nothing else needed I believe.

I know some games needs to have DXVK_HDR=1 as an env variable for HDR to work though, and on latest proton experimental as well.

Here are the changes that I tried (some of the advice is from here, some from the hdr reddit thread on steam deck oled):

  1. at first I just used proton ge 8.25
  2. then I added env variables (as mentioned for this game on reddit) DXVK_HDR=1 PROTON_ENABLE_AMD_AGS=1 - unsuccessful
  3. Next updated heroic launcher, re-launch on ge 8.25 and the specified env variables - unsuccessful.
  4. Removed env variables - unsuccessful.
  5. Changed proton to experimental - unsuccessful.
  6. Added env variables (both DXVK_HDR=1 PROTON_ENABLE_AMD_AGS=1) - unsuccessful
  7. Then left only DXVK_HDR=1 - also unsuccessful

@QaAndreii
Copy link

The PR was merged and the update was published so keep an eye on discover for updates and let us know if it worked.

So far I tried it after updating to refresh, without changing anything, it does not work the same, that is, everything becomes faded (the game Guardian's of the Galaxy from EGS).

I don't really know why it would be 'faded' like you said. Have you enabled HDR on the Game settings that appear when the game is launched?

Yes, I switch, the colors immediately become “faded”. The color becomes different from the standard SDR picture (just like it was before the heroic launcher update). At the same time, the hdr mode itself does not turn on the Steam deck oled (when it works there is information in the overlay and the brightness changes to hdr brightness in the settings side panel)

@QaAndreii
Copy link

QaAndreii commented Jan 10, 2024

PXL_20240110_193928322
PXL_20240110_193913600

This is what I mean by “faded” colors (where there are more “saturated” colors - hdr is turned off in the game settings). And in the second image - this is how hdr content is usually displayed when hdr mode is not enabled on the device. Sorry for the level of my English (working with a translator).

@flavioislima
Copy link
Member

No need to sorry the english is fine.

Yeah, I also tried here on my monitor, not OLED but has HDR, and I see no difference with this new build.
So we will keep investigating to try to figure it out.

I wonder if even on Steam Deck we need to enable Gamescope with the HDR options or not, because I believe that every game launched on gamemode will use gamescope by default.

@flavioislima
Copy link
Member

@QaAndreii can you try one more thing?
Can you install Lutris and Bottles and see if HDR works with them? so then we can maybe have a hint on what we are missing.

@QaAndreii
Copy link

@QaAndreii can you try one more thing? Can you install Lutris and Bottles and see if HDR works with them? so then we can maybe have a hint on what we are missing.

I haven't used them, but I'll try. Went to look and read some manual.

@QaAndreii
Copy link

QaAndreii commented Jan 10, 2024

@QaAndreii can you try one more thing? Can you install Lutris and Bottles and see if HDR works with them? so then we can maybe have a hint on what we are missing.

I haven't used lutris before, but I still managed to hate it in just a few hours... In Guardian of the Galaxy, HDR doesn't work either. I haven’t tried Bottles (I’m afraid I’ll encounter the same interesting “quest”... either crashes or an incomprehensible error 256...).

@rakonkido
Copy link

rakonkido commented Jan 11, 2024

Can you install Lutris and Bottles and see if HDR works with them

HDR through Lutris on Steam Deck does not work as they have not implemented Gamescope HDR support in the Flatpak. Should be the same for Bottles.

Also, I can confirm all of @QaAndreii's reports, but I found the problem. Skip to the end of this post for the solution.

Testing process: I updated Heroic Games Launcher and also tested Guardians of the Galaxy, a reference point since I've tested the Steam version and know it works perfectly with HDR. To get the EGS version working better you might want -nolauncher in the game's additional arguments in Heroic. I think PROTON_ENABLE_AMD_AGS=1 (and thus Proton itself) is only needed when there's a launcher.

When launching in Game Mode, it displays the following error:

CreateSwapchainKHR: Creating swapchain for non-Gamescope swapchain.
Hooking has failed somewhere!
You may have a bad Vulkan layer interfering.
Press OK to try to power through this error, or Cancel to stop.

If I press OK, I get an almost identical error but instead saying QueuePresentKHR: Attempting to present to a non-hooked swapchain. If I press OK on that, I see the loading screen and the game proceeds as normal. This error only appears in Game Mode.

(I can get rid of these errors by reverting to an earlier version of Gamescope Flatpak -- e.g. flatpak update --commit=0b3543a920d07271426945f9ebde207de89232475d6f6ba8bf98ff7cb3f2590e runtime/org.freedesktop.Platform.VulkanLayer.gamescope/x86_64/23.08 -- but I'd prefer to still run the latest version for the purposes of this test.)

If I go to Settings and enable HDR, I see washed-out colors. Much like my experience trying to run Diablo IV through Lutris, this probably indicates that the game is able to detect the display's HDR capability and tries to display it in HDR, but the HDR colors aren't getting passed through properly, resulting in a washed-out appearance. (Usually, a game that detects your display doesn't support HDR won't even allow you to enable it.) I can also see through the Quick Access Menu's brightness slider that it's not displaying in HDR mode.

I tested under the following conditions:

  • Wine-GE-latest with no env variables - fail
  • Wine-GE-latest with DXVK_HDR=1 - fail
  • Proton Experimental with DXVK_HDR=1 and PROTON_ENABLE_AMD_AGS=1 - fail

As a next step, I went to the logs generated by Heroic and saw:

[Gamescope WSI] Failed to connect to gamescope socket: gamescope-0. Bypass layer will be unavailable

The Chiaki4deck thread referenced earlier also referenced this error. The solution is:

  • In desktop mode, go to Settings > Flatpak Permissions Settings
  • Under Filesystem, add xdg-run/gamescope-0. You can keep it as read-only.

Next I retried Guardians of the Galaxy using the last configuration I had tested earlier (Proton Experimental with the two env variables). Now HDR is working (colors aren't washed out, and QAM shows HDR is truly enabled), plus I'm no longer seeing the CreateSwapchainKHR error on launch.

@flavioislima
Copy link
Member

@flavioislima is there a way to make this a dependency of Heroic?

Good question.
I honestly thought we never needed it since SD comes with Gamescope and Steam uses it on gaming mode, but I guess I was wrong. I checked now on my Deck and Heroic cannot find gamescope, and I believe we are adding a gamescope path on the flatpak manifest. So either the path has changes or it wont work like this.

I will try to see if it is possible to add it as a dependency.

but it is good to see that you guys made it work, so we are close to a full resolution now :)

@flavioislima
Copy link
Member

I need to read about gamescope, I don’t quite understand why it is required. Valve seems to have their own, the system one is not from flatpak, or simply flatpak applications cannot use it?

It is required because X11 and Wayland doesn't have native support for HDR yes, I mean when using Desktop mode with plasma on the Deck for instance.

Gamescope has it is way to handle HDR so we need it to make it work for now.
I believe that this year all major Linux DEs will have it so it will work without it, but for now it is required.

@rakonkido
Copy link

Previously I had to add /usr/bin to the filesystem overrides to allow Heroic Flatpak to access the system-level Gamescope, but this is not ideal since Flatpak is meant to isolate the program from the system. Adding Gamescope Flatpak resolves this issue; I was able to remove the /usr/bin override without any loss of functionality.

@flavioislima
Copy link
Member

Previously I had to add /usr/bin to the filesystem overrides to allow Heroic Flatpak to access the system-level Gamescope, but this is not ideal since Flatpak is meant to isolate the program from the system. Adding Gamescope Flatpak resolves this issue; I was able to remove the /usr/bin override without any loss of functionality.

I am not sure if it works, even if you add those with Flatseal Flatpak still does not uses it afaik, those are 'forbidden' paths.

Btw, after installing Gamescope, did you need to enable it on the games settings in Heroic?

@m3e-g
Copy link
Contributor

m3e-g commented Jan 11, 2024

I didn't need to enable anything inside HGL to make it work

@rakonkido
Copy link

Same, I also didn't need to change anything in the game's HGL settings (besides -nolauncher for GotG, but not sure if that's actually needed). This should be shown in the Heroic log I posted earlier.

@flavioislima
Copy link
Member

@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
Copy link

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.

@mashinboo
Copy link

mashinboo commented Jan 11, 2024

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
Copy link
Member

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
Copy link

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
Copy link

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.

</pre>

@rakonkido
Copy link

@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
Copy link
Member

@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.

@flavioislima flavioislima pinned this issue Jan 23, 2024
@flavioislima flavioislima added solved and removed bug:unconfirmed Someone works on identifying the issue labels Jan 23, 2024
@flavioislima flavioislima changed the title HDR not functioning on Steam Deck OLED [Solved] HDR not functioning on Steam Deck OLED Jan 23, 2024
@roschi02
Copy link

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
Copy link

Slothoncrack commented Aug 5, 2024

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
Copy link

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
Copy link

@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
Copy link

roschi02 commented Nov 3, 2024

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.

@Clonkex
Copy link

Clonkex commented Nov 27, 2024

Why is this issue closed? I received my brand new Steam Deck OLED a few days ago. I installed Heroic and Witcher 3 and found that launching from desktop made for a subpar experience (it didn't recognise the controller), so I added Witcher 3 to Steam and launched from game mode only to discover the HDR was broken.

Doing flatpak install gamescope and picking the 23.08 version then restarting back into game mode fixed it. Why is that necessary? Is it not something Heroic can fix itself? If it can't handle the problem itself, can it not automatically instruct the user on how to solve it? I tried reading through this issue but it's very long and I don't know much about how Flatpak works.

@rakonkido
Copy link

Yeah I feel the pain too. I've been trying once in a while when I found the time, but I've so far been unable to find a way to give Heroic access to the system level gamescope without causing other things to break.

I know it can be done (I've seen it done in other Flatpaks), but the relative generality of Heroic (and Lutris) has made it difficult to find a solution that works for so many different configurations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests