Closed Shanayara closed 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
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.
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 !
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.
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 thePATH
so that the Flatpak application can find executables located in those directories within its sandbox.However, including
/usr/bin
in thePATH
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.
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.
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.
@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
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.
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
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!
I do have a follow up question here: What will happen if i update steamOS to 3.6.*? Will gamescope HDR then break again?
@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.
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:
Remove the update prevention:
flatpak mask --remove org.freedesktop.Platform.VulkanLayer.gamescope
Uninstall the current version of Gamescope:
flatpak uninstall org.freedesktop.Platform.VulkanLayer.gamescope
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.
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
Steps to reproduce
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: Cyberpunk 2077 HDR calibration menu with HDR PQ enabled, colors are washed out: Cyberpunk 2077 intro move with HDR scRGB enabled, colors are extremely oversatured:
Heroic Version
Latest Stable (Flatpak)
System Information
Additional information
No response