diff --git a/debian/extras/gamescope-resolution-configurator b/debian/extras/gamescope-resolution-configurator new file mode 100755 index 0000000..56c8db7 --- /dev/null +++ b/debian/extras/gamescope-resolution-configurator @@ -0,0 +1,83 @@ +#!/usr/bin/sh +DEFAULT_RESOLUTION=$(xdpyinfo | awk '/dimensions/{print $2}') + +# Steam Deck Default +SCREEN_WIDTH=1280 +SCREEN_HEIGHT=800 + +# Sometimes gamescope's DRM-retrieved resolution values +# don't work well with what gamescope actually allows, +# and can result in a "verifying installation" hang. +# To fix that we have to make some adjustments for +# those values to ones gamescope accepts. + + +# 32:9 +if [[ $DEFAULT_RESOLUTION == 5120x1440 ]]; then + SCREEN_WIDTH=5120 + SCREEN_HEIGHT=1440 +fi +if [[ $DEFAULT_RESOLUTION == 3840x1080 ]]; then + SCREEN_WIDTH=3840 + SCREEN_HEIGHT=1080 +fi + +# 21:9 +if [[ $DEFAULT_RESOLUTION == 3440x1440 ]]; then + SCREEN_WIDTH=3440 + SCREEN_HEIGHT=1440 +fi +if [[ $DEFAULT_RESOLUTION == 2160x1080 ]]; then + SCREEN_WIDTH=2160 + SCREEN_HEIGHT=1080 +fi + +# 16:10 +# gamescope is not friendly to 16:10 aspect ratio other than it's default 1280x800, so we have to do some conversion: + +if [[ $DEFAULT_RESOLUTION == 3840x2400 ]]; then + SCREEN_WIDTH=3840 + SCREEN_HEIGHT=2160 +fi + +# Oddly enough many 2560x1600 laptops dont support 2560x1440, so we have to drop them down to 1920x1080 +if [[ $DEFAULT_RESOLUTION == 2560x1600 ]]; then + SCREEN_WIDTH=1920 + SCREEN_HEIGHT=1080 +fi +if [[ $DEFAULT_RESOLUTION == 1920x1200 ]]; then + SCREEN_WIDTH=1920 + SCREEN_HEIGHT=1080 +fi + +# 16:9 +if [[ $DEFAULT_RESOLUTION == 3840x2160 ]]; then + SCREEN_WIDTH=3840 + SCREEN_HEIGHT=2160 +fi +if [[ $DEFAULT_RESOLUTION == 2560x1440 ]]; then + SCREEN_WIDTH=2560 + SCREEN_HEIGHT=1440 +fi +if [[ $DEFAULT_RESOLUTION == 1920x1080 ]]; then + SCREEN_WIDTH=1920 + SCREEN_HEIGHT=1080 +fi +if [[ $DEFAULT_RESOLUTION == 1280x720 ]]; then + SCREEN_WIDTH=1280 + SCREEN_HEIGHT=720 +fi + +#Quirk for framework laptop: +if [[ $DEFAULT_RESOLUTION == 2256x1504 ]]; then + SCREEN_WIDTH=2160 + SCREEN_HEIGHT=1080 +fi + +CONFIG=$HOME/.config/environment.d/gamescope-session.conf +if [ ! -d $HOME/.config/environment.d/ ]; then + echo "Creating $CONFIG" + mkdir -p $HOME/.config/environment.d/ + echo 'SCREEN_WIDTH='$SCREEN_WIDTH > $CONFIG + echo 'SCREEN_HEIGHT='$SCREEN_HEIGHT >> $CONFIG +fi diff --git a/debian/rules b/debian/rules index b682b43..79bcec9 100755 --- a/debian/rules +++ b/debian/rules @@ -1,8 +1,10 @@ #!/usr/bin/make -f override_dh_install: + dh_install rm -rfv debian/gamescope-session/usr/share/wayland-sessions/gamescope-session.desktop cp -rfv debian/extras/zwayland-gamescope-session.desktop debian/gamescope-session/usr/share/wayland-sessions/ + cp -rfv debian/extras/gamescope-resolution-configurator debian/gamescope-session/usr/bin/gamescope-resolution-configurator %: dh $@ diff --git a/patches/0001-update-to-work-on-nobara-with-hdr.patch b/patches/0001-update-to-work-on-nobara-with-hdr.patch index 352ac02..e771155 100644 --- a/patches/0001-update-to-work-on-nobara-with-hdr.patch +++ b/patches/0001-update-to-work-on-nobara-with-hdr.patch @@ -1,34 +1,42 @@ -From 9611d3d68b659a1328836f77fc209eb6db534320 Mon Sep 17 00:00:00 2001 -From: GloriousEggroll -Date: Wed, 11 Jan 2023 10:08:19 -0700 -Subject: [PATCH] update to work on nobara with hdr - ---- - usr/share/gamescope-session/gamescope-session-script | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -diff --git a/usr/share/gamescope-session/gamescope-session-script b/usr/share/gamescope-session/gamescope-session-script -index 5c99641..7f3982a 100755 ---- a/usr/share/gamescope-session/gamescope-session-script -+++ b/usr/share/gamescope-session/gamescope-session-script -@@ -1,4 +1,7 @@ --#!/bin/bash -+#!/usr/bin/bash +diff -ru b/gamescope-session-script a/gamescope-session-script +--- b/gamescope-session-script 2023-04-27 17:22:14.428995862 +0300 ++++ a/gamescope-session-script 2023-04-27 17:21:30.549189166 +0300 +@@ -7,6 +7,13 @@ + export INTEL_DEBUG=norbc + export mesa_glthread=true + ++# Set Gamescope args ++export GAMESCOPE_EXTRA_LAUNCH_ARGS='--hdr-enabled --hdr-itm-enable' ++export GAMESCOPE_BASE_LAUNCH_ARGS='--xwayland-count 2 -O *,eDP-1 --default-touch-mode 4 --hide-cursor-delay 3000 --fade-out-duration 200':$GAMESCOPE_EXTRA_LAUNCH_ARGS + +export ENABLE_GAMESCOPE_WSI=1 +export DXVK_HDR=1 ++ + # Some environment variables by default (taken from Deck session) + export SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0 - # Fix intel color corruption - # might come with some performance degradation but is better than a corrupted -@@ -169,6 +172,8 @@ if [ -z "$GAMESCOPECMD" ] ; then - fi - GAMESCOPECMD="/usr/bin/gamescope \ - $CURSOR \ -+ --hdr-enabled \ -+ --hdr-itm-enable \ - -e \ - $RESOLUTION \ - --xwayland-count 2 \ --- -2.39.2 - +@@ -184,22 +191,14 @@ + $CURSOR \ + -e \ + $RESOLUTION \ +- --xwayland-count 2 \ +- -O *,eDP-1 \ +- --default-touch-mode 4 \ +- --hide-cursor-delay 3000 \ +- --fade-out-duration 200 \ ++ $GAMESCOPE_EXTRA_LAUNCH_ARGS \ + -R $socket -T $stats" + else + GAMESCOPECMD="/usr/bin/gamescope \ + $CURSOR \ + -e \ + $RESOLUTION \ +- --xwayland-count 2 \ +- -O *,eDP-1 \ +- --default-touch-mode 4 \ +- --hide-cursor-delay 3000 \ +- --fade-out-duration 200 \ ++ $GAMESCOPE_EXTRA_LAUNCH_ARGS \ + --prefer-vk-device $VULKAN_ADAPTER \ + -R $socket -T $stats" + fi