-
Notifications
You must be signed in to change notification settings - Fork 72
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
Generic Gamescope session tweaks #1168
base: master
Are you sure you want to change the base?
Conversation
may take awhile before this is ready to be reviewed/tested I'm currently running into a major bug that's breaking Gamescope FSR when I use this. (not sure how to really describe it's as if the game keeps changing resolution) This does not happen on the latest master so its something I did here I will try to look at it more in-depth this weekend, but it looks like this won't be as straight forward as I thought |
I haven't had time for a proper review or anything, and this PR is in draft, but I think the general idea makes sense. I have some notes though
I aim very torn on how this should be handled, and is really the main thing I wanted to note here before too much more work goes into it. The main thing we want to do here is to introduce a code path to include some (most?) of the Steam Deck Game Mode running behaviour but for other GameScope embedded sessions, like those on other handhelds running a GameScope session. We already have a variable that checks for a GameScope embedded session, it's called
This might be a wrong assumption! But if it is correct, then we could refactor as follows:
From looking at the code it seems like this is the general direction perhaps, but I wanted to call out that I think this is the best approach: Keep the Steam Deck-specific stuff as-is mostly, but change the logic that sets # Code could go from looking like this:
if [ "$ONSTEAMDECK" -eq 1 ]; then
if [ "$FIXGAMESCOPE" -eq 1 ]; then
# ...
fi
fi
# ... to looking like this:
if [ "$FIXGAMESCOPE" -eq 1 ]; then
# ...
fi This means functions that handle things like the tray indicator and stuff being turned off if we're in an embedded GameScope session will not be tied specifically to the condition Didn't review the code too in-depth or anything, but let me know if there's anything you want me to take a look at even while this PR is in draft. And let me know if that suggested approach doesn't make much sense and I can try to clarify or we can discuss further. I don't know how straightforward the changes overall will be, I appreciate too that the Steam Deck part of the code is not the most well-kept. So again I'm happy to discuss and help out however I can here. Hopefully this isn't all too difficult to untangle though :-) |
Also should say I really appreciate the initiative here! I think this is part of the Steam Deck integration that was a bit short-sighted, and it crossed my mind a few times for how we would handle this once SteamOS comes to the Desktop (SoonTM ValveTime, but it is coming eventually). This is an important step in that direction I feel like. I don't use my Steam Deck much, and don't plan on getting any other handhelds or using a GameScope session anytime soon, so this is not something I have a setup on hand to target with development. But it should benefit a lot of users who do! I should also clarify (normally would be an edit, but since I'm leaving an extra comment, I'll note it here too) that the reason as well that I'm interested in just using P.S. - I will probably merge #1111 first, and this PR might need a rebase. Hopefully not anything significant, but if there are headaches there, I can help out with trying to rebase :-) |
Yup totally agree with your approach. That's more or less what I was trying to do. Leave the steam deck specific stuff mostly untouched (the only thing I'm think of expanding is how it detects a steam deck rn it's looking in`/etc/os-release' for "steam deck" I'm thinking of changing that to look for "Valve" as the system manufacturer like this
That way the steam deck specific tweaks like the edited Though we still wouldn't want the dependencies stuff as pretty much every distro you would want to run on a handheld (bazzite, chimera, nobara,holo) already has all of STL hard deps including yad and innoextract. Only steamos doesn't have yad I think (or innoextract) So I would like to still leave a check for steamos For the dependencies stuff Or what if the user purposely set such a low resolution for an old game? Sure with FSR you don't really need to set your whole desktop to a low res but still |
Huh this is really strange but everything else that checks for
does not. And more importantly this line is not running so how is NVM those log messages in Are a little misleading now since I didn't have So it looks like it actually is passing all the
checks The only thing... there is actually no improvement from enabling all the STL tweaks to gamemode 😞 GUI is still scaled badly as in the above image, and actually, FSR is now broken (causes flickering. No idea why) So, the experience in game mode is actually worse now. I'll try to play with it a bit and see if I can fix yad sizing in Gamescope on the desktop. Otherwise, maybe I will reduce the scope of the PR to apply Steam deck tweaks regardless of OS and forget about game scope on the desktop |
GameScope tweaks probably don't need to apply on the desktop, I don't see any benefit there because you'd actually want the notifier and tray icon etc. The Steam Deck tweaks should only apply in GameScope embedded sessions. Unless I'm misunderstanding something? |
Oh no, when I said desktop, I was referring to running the steam game mode stuff outside of a portable system like the steam deck They we have a fix screen size and it should be easier to get everything sized correctly Really, that's all the Steam game mode tweaks come down to. Sizing yad correctly for the decks small screen and disabling options that you don't need/want in steam game mode like gamescope, mangohud, and feral gamemode There is also something for navigating the UI with a controller but never used that before, or know how to get that to work 😅 |
fix check for steam game mode and some scaling fixes for when in steam game mode
May be a dumb idea but maybe we can grab steam game modes gamescope resolution from it's command line arguments And set The added benefit of this is it will automatically uses the screen resolution the steam deck and other handhelds when running there |
I don't know if there's a way to get the GameScope resolution that way. But yeah you raise a good point, on desktops that use a GameScope embedded session they probably wouldn't want the window size set so small. I wonder if we need to set the size at all in a GameScope session. Can the SteamTinkerLaunch dialog even exceed the size of the GameScope window? I know GameScope handles dialog windows in some funky ways sometimes especially if they are dialogs without a typical "parent". |
Im not really worried so much about that as I am this apparently from looking at the logs and the code STL tries to detect the screen resolution and size yad accordingly here https://github.com/sonic2kk/steamtinkerlaunch/blob/c174a06f1b98d2aa523fe93e2afaed2713f46563/steamtinkerlaunch#L10604 but for some reason on steam gamescope (and I tried disabling FSR to see if it would help) it detected the screen resolution as a fraction of the real screen size. I think it was something like EDIT: this was the res I was seeing Im wondering if we gan grab the resolution arguments gamescope was run with using
and size yad to that Thats really the only benefit this PR will bring to gamescope session. The rest is just disabling options we don't want/need/can crash in a gamescope session |
We could possibly grab the resolution from that command by using # Get the GameScope command from pgrep
FIXGAMESCOPESTARTCMD="$( pgrep -a "$GAMESCOPE" | head -n1 )"
# ...
# There should probably be some check here where if there is no found GameScope start command to bail out
# ...
# 1280 and 720 are defaults if no value is returned for width and height respectively.
# We could replace these defaults with whatever the autodetected width and height variable is.
#
# Variable names can be whatever you want, just make sure the name you assign and the name in the argument match
THISISMYWIDTHVARIABLE="$( getGameScopeArg "$FIXGAMESCOPESTARTCMD" "-W" "$THISISMYWIDTHVARIABLE" "" "1280" "num")"
THISISMYHEIGHTVARIABLE="$( getGameScopeArg "$FIXGAMESCOPESTARTCMD" "-H" "$THISISMYHEIGHTVARIABLE" "" "720" "num")"
writelog "INFO" "${FUNCNAME[0]} - GameScope resolution from pgrep is '${THISISMYWIDTH}x${THISISMYHEIGHT}'" Note that we should make sure this only happens on embedded GameScope sessions, we don't want to change window sizing behaviour on the Desktop. |
So to clarify, the goal of this PR is still to:
|
For generic hardwarethis PR will only ensure the yad window takes up the full screen size and disable
For SteamdeckEDIT: ofc mangohud,gamemode, etc would also be disabled here the plan still is to try to get the more extensive sizing from Steamos to apply generically to all Steam decks This includes some CSS tweaks to make the scrollbar easier to use, and tweaks to the column and headers of yad If my screen sizing on generic hardware works like I expect it to I think we can remove the code that forces yad to the decks resolution https://github.com/sonic2kk/steamtinkerlaunch/blob/c174a06f1b98d2aa523fe93e2afaed2713f46563/steamtinkerlaunch#L2059 (maybe this can be expanded to all handheld PCs in the future, but the only way I can see this working is to code the values for several different devices hard, i.e., I don't like the idea of just applying tweaks to devices below a certain res.) maybe for bothIf I can figure out the gamepad support, I would like to decouple it from Steamers, but it's not a high priority, and from what I understand, it's a very hacky approach to getting gamepad support in STL. I would only put this behind the I think I will make that a separate PR if decide to work on that |
Thanks for the clarification. Right now I think that makes sense.
Yeah, personally I would not bother. I was considering stripping out the gamepad stuff because it's a bit too hacky to be useful imo. I also do not care for using GUI programs with a controller on SteamOS, and it is not something I think makes sense to shoehorn into a traditional keyboard and mouse program like SteamTinkerLaunch. |
if anything, maybe I should publish a steam input profile for STL on the deck controller and call it a day 😅 would be easier |
So, here is some good news: I was able to fix the YAD sizing by hard-coding my screen's resolution, so it looks like that indeed is the problem. For some reason, it's not detecting the correct resolution when running through the game scope. The bad news is I haven't been able to get it to auto-detect the resolution from the game scope arguments I tried (btw renamed function pollWinRes {
....
if [ "$GAMESCOPESESS" -eq 1 ]; then
# Get the GameScope command from pgrep
GAMESCOPESESSSTARTCMD="$( pgrep -a "$GAMESCOPE" | head -n1 )"
# ...
# There should probably be some check here where if there is no found GameScope start command to bail out
# ...
# 1280 and 720 are defaults if no value is returned for width and height respectively.
# We could replace these defaults with whatever the autodetected width and height variable is.
#
# Variable names can be whatever you want, just make sure the name you assign and the name in the argument match
GAMESCOPESESSX="$( getGameScopeArg "$GAMESCOPESESSSTARTCMD" "-W" "$GAMESCOPESESSX" "" "1280" "num")"
GAMESCOPESESSY="$( getGameScopeArg "$GAMESCOPESESSSTARTCMD" "-H" "$GAMESCOPESESSY" "" "720" "num")"
writelog "INFO" "${FUNCNAME[0]} - GameScope resolution from pgrep is '${GAMESCOPESESSX}x${GAMESCOPESESSY}'"
SCREENRES="${GAMESCOPESESSX}x${GAMESCOPESESSY}"
WINX="$GAMESCOPESESSX"
WINY="$GAMESCOPESESSY"
setGeom
else
SCREENRES="$(getScreenRes r)"
fi
.... but it looks like its not getting the anything from gamescope
|
Rename FIXGAMESCOPE to GAMESCOPESESS and preliminary work to fix resolution
Remove some unnecessary code introduced in the PR
oops this shouldn't have been removed
fix this shouldn't have been touched compared to master
Ahh, i see why its not working this is the gamecope cmd
so there is no resolution in the gamescope command. Apparently https://github.com/ChimeraOS/gamescope-session-steam (which is what all non steamos distros use to have a steame gamescope-session) gamescope grabs the Displays EDID and auto detects the resolution that way. luckily it stores all that information in
But on steamos that won't work and we will either have to hard code the resolution like it was before, or I think the code from the above reply would work on steamos as I believe the resolution is passed as an argument there something else I noticed is I am getting the flickering bug I mentioned before even if I comment out
On the latest master I do not have this issue. I have no idea what I could of introduced that causes this flickering that commenting out GAMESCOPESESS=1 doesn't fix (all my changes SHOULD be behind |
minor fixes and use gamescope-session-plus config file for gamescope resolution detection if available
Ok done. I got all parts of this PR implemented; all that is left is to
for the last two I am probably going to have to install steamos on my deck (I have bazzite) I have an extra nvme drive so ill try swapping it out or maybe I can install steamos to a microsd card or USB. I know you don't use STL on your deck @sonic2kk , but if you could (or anyone else with a deck on steamos) at least help with how the gamescope command looks like in steamos game mode that would be a tremendous help. you can check that by SSHing into the deck when its in gamemode and running The problem is that the original check of if grep -q "generate-drm-mode" <<< "$(pgrep -a "$GAMESCOPE")"; then doesn't work on bazzite as the gamescope cmd there is
So I need to find something that is in both steamos and chimera/bazzite/halo game scope commands. As for the flicker bug introduced ... I have no clue what is causing it and much less how to fix it I have no idea what it could be. I tried commenting out the That is the major hurdle to this getting merged. What good does improving gamescope session if you make it flicker in the process 😞 it is baffling as on master, it works fine, but on the PR, after the game launches, the screen starts flickering PS: What I ended up doing about the Resolution detection in the game scope is having two paths for getting the resolution.
|
Sorry, I've been slacking on taking a look at this PR and that's my bad. So the main things that need tested on this PR are:
|
Yup pretty much and no worries. I been really busy and haven't had much time to look into this. I should be able to do some steam deck testing next weekend. As for the flicker bug not really sure what could be causing that. I had the same thought of checking the resolution stuff but it doesn't seem to be that..... The other thing I thought was maybe disabling the Mangoapp options as I think the flicker seems to be coming from the HUD I think But I tried commenting out the relevant code. So not really sure. Might not be able to look into this two much this week as I'm a bit busy , but I will try to find some time. |
haven't goten steamos running on a vm and I apparently I would have to wipe my whole disk to reinstall it on my deck. but according to a fellow deck owner this should be the output on steamos
so on Steamos, it SHOULD have the resolution gamescope running within the command. or maybe it just always
not sure EDIT: it seems like it will always use that resolution and then its overridden by steam? same user reported the same gamescope args even when docked. but I already see some common stuff from Bazzite and Steamos we can use in the check. Best one seems the |
Steam Game Mode (also referred to as gamescope-session or steam-gamescope-session)
It is no longer limited to Steam OS.
This PR moves some of the Steam Game Mode-specific tweaks out of the check for Steam OS (but still in the same function. I am not sure if I should put it elsewhere, but it made sense to me to leave it there)
I also made the sizing fixes apply to all Steam decks, not just Steam OS.
Not all of the Steam deck tweaks are desirable outside of Steam OS, even when still running on a Steam deck (mainly the dependencies stuff)
Basically, it comes down to
non-steam deck hardware running some Steam OS-like distro (or using something like https://aur.archlinux.org/packages/gamescope-session-steam-git)
DXVK_HDR=1
Steam deck running some Steam OS like distro (ex bazzite)
This should do everything we currently do for Steam deck running Steam OS minus the dependencies stuff
DXVK_HDR=1