Update gamescope-session/usr/share/gamescope-session-plus/gamescope-session-plus
This commit is contained in:
parent
47155dfee3
commit
9bebb2c6b5
@ -1,21 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"
|
||||||
|
|
||||||
declare -r CLIENT=$1
|
declare -r CLIENT=$1
|
||||||
declare -r CLIENT_CONFIG_DIR_USR=/usr/share/gamescope-session-plus/sessions.d
|
declare -r CLIENT_CONFIG_DIR_USR=/usr/share/gamescope-session-plus/sessions.d
|
||||||
declare -r CLIENT_CONFIG_DIR_ETC=/etc/gamescope-session-plus/sessions.d
|
declare -r CLIENT_CONFIG_DIR_ETC=/etc/gamescope-session-plus/sessions.d
|
||||||
declare -r CLIENT_CONFIG_DIR_LOCAL="${XDG_CONFIG_HOME:-$HOME/.config}/gamescope-session-plus/sessions.d"
|
declare -r CLIENT_CONFIG_DIR_LOCAL="${XDG_CONFIG_HOME:-$HOME/.config}/gamescope-session-plus/sessions.d"
|
||||||
|
|
||||||
# Reset power-profiles-daemon/TuneD to balanced if the current profile is power save, this allows desktop control without greatly harming gaming performance.
|
|
||||||
if command -v tuned-adm > /dev/null; then
|
|
||||||
if grep -qz "powersave" <<< "$(tuned-adm active)"; then
|
|
||||||
tuned-adm profile balanced
|
|
||||||
fi
|
|
||||||
elif command -v powerprofilesctl > /dev/null; then
|
|
||||||
if grep -qz "power-saver" <<< "$(powerprofilesctl get)"; then
|
|
||||||
powerprofilesctl set balanced
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# default empty session recovery function
|
# default empty session recovery function
|
||||||
short_session_recover() {
|
short_session_recover() {
|
||||||
:
|
:
|
||||||
@ -26,8 +19,24 @@ post_gamescope_start() {
|
|||||||
:
|
:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# default empty function to run after client exits
|
||||||
|
post_client_shutdown() {
|
||||||
|
:
|
||||||
|
}
|
||||||
|
|
||||||
|
get_gamescope_binary() {
|
||||||
|
if [ -n "$GAMESCOPE_BIN" ]; then
|
||||||
|
echo $GAMESCOPE_BIN
|
||||||
|
elif /usr/libexec/gamescope-sdl-workaround && command -v /usr/bin/gamescope-legacy > /dev/null; then
|
||||||
|
# GPUs that require the SDL backend
|
||||||
|
echo "/usr/bin/gamescope-legacy"
|
||||||
|
else
|
||||||
|
echo "/usr/bin/gamescope"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
gamescope_has_option() {
|
gamescope_has_option() {
|
||||||
if (gamescope --help 2>&1 | grep -e "$1" > /dev/null); then
|
if ($(get_gamescope_binary) --help 2>&1 | grep -e "$1" > /dev/null); then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -40,6 +49,15 @@ gamescope_has_option() {
|
|||||||
export INTEL_DEBUG=norbc
|
export INTEL_DEBUG=norbc
|
||||||
export mesa_glthread=true
|
export mesa_glthread=true
|
||||||
|
|
||||||
|
# This should be used by default by gamescope. Cannot hurt to force it anyway.
|
||||||
|
# Reported better framelimiting with this enabled
|
||||||
|
if /usr/libexec/gamescope-sdl-workaround; then
|
||||||
|
# Skip on legacy hardware
|
||||||
|
export ENABLE_GAMESCOPE_WSI=0
|
||||||
|
else
|
||||||
|
export ENABLE_GAMESCOPE_WSI=1
|
||||||
|
fi
|
||||||
|
|
||||||
# Force Qt applications to run under xwayland
|
# Force Qt applications to run under xwayland
|
||||||
export QT_QPA_PLATFORM=xcb
|
export QT_QPA_PLATFORM=xcb
|
||||||
|
|
||||||
@ -72,6 +90,11 @@ touch "$GAMESCOPE_PATCHED_EDID_FILE"
|
|||||||
# and Gamescope will use for now.
|
# and Gamescope will use for now.
|
||||||
export GAMESCOPE_NV12_COLORSPACE=k_EStreamColorspace_BT601
|
export GAMESCOPE_NV12_COLORSPACE=k_EStreamColorspace_BT601
|
||||||
|
|
||||||
|
# Workaround older versions of vkd3d-proton setting this
|
||||||
|
# too low (desc.BufferCount), resulting in symptoms that are potentially like
|
||||||
|
# swapchain starvation.
|
||||||
|
export VKD3D_SWAPCHAIN_LATENCY_FRAMES=3
|
||||||
|
|
||||||
# Initially write no_display to our config file
|
# Initially write no_display to our config file
|
||||||
# so we don't get mangoapp showing up before Steam initializes
|
# so we don't get mangoapp showing up before Steam initializes
|
||||||
# on OOBE and stuff.
|
# on OOBE and stuff.
|
||||||
@ -95,14 +118,6 @@ export GAMESCOPE_LIMITER_FILE=$(mktemp /tmp/gamescope-limiter.XXXXXXXX)
|
|||||||
# Temporary crutch until dummy plane interactions / etc are figured out
|
# Temporary crutch until dummy plane interactions / etc are figured out
|
||||||
export GAMESCOPE_DISABLE_ASYNC_FLIPS=1
|
export GAMESCOPE_DISABLE_ASYNC_FLIPS=1
|
||||||
|
|
||||||
# Make Qt apps use the styling and behaviour of the desktop session
|
|
||||||
# This fixes some missing icons and unreadable text with Qt desktop apps in gamescope
|
|
||||||
if [[ ${BASE_IMAGE_NAME} == 'silverblue' ]]; then
|
|
||||||
export QT_QPA_PLATFORM_THEME=gtk2
|
|
||||||
else
|
|
||||||
export QT_QPA_PLATFORM_THEME=kde
|
|
||||||
fi
|
|
||||||
|
|
||||||
ulimit -n 524288
|
ulimit -n 524288
|
||||||
|
|
||||||
# Source device quirks if exists
|
# Source device quirks if exists
|
||||||
@ -191,21 +206,11 @@ if [ -z "$GAMESCOPECMD" ]; then
|
|||||||
ADAPTIVE_SYNC_OPTION="--adaptive-sync"
|
ADAPTIVE_SYNC_OPTION="--adaptive-sync"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FORCE_COMPOSITION_OPTION=""
|
|
||||||
if [ -n "$FORCE_COMPOSITION" ]; then
|
|
||||||
FORCE_COMPOSITION_OPTION="--force-composition"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PANEL_TYPE_OPTION=""
|
PANEL_TYPE_OPTION=""
|
||||||
if [ -n "$PANEL_TYPE" ] && gamescope_has_option "--force-panel-type"; then
|
if [ -n "$PANEL_TYPE" ] && gamescope_has_option "--force-panel-type"; then
|
||||||
PANEL_TYPE_OPTION="--force-panel-type $PANEL_TYPE"
|
PANEL_TYPE_OPTION="--force-panel-type $PANEL_TYPE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BYPASS_STEAM_RESOLUTION_OPTION=""
|
|
||||||
if [ ! -n "$DONT_BYPASS_RESOLUTION" ] && gamescope_has_option "--bypass-steam-resolution"; then
|
|
||||||
BYPASS_STEAM_RESOLUTION_OPTION="--bypass-steam-resolution"
|
|
||||||
fi
|
|
||||||
|
|
||||||
CUSTOM_REFRESH_RATES_OPTION=""
|
CUSTOM_REFRESH_RATES_OPTION=""
|
||||||
if [ -n "$CUSTOM_REFRESH_RATES" ] && gamescope_has_option "--custom-refresh-rates"; then
|
if [ -n "$CUSTOM_REFRESH_RATES" ] && gamescope_has_option "--custom-refresh-rates"; then
|
||||||
CUSTOM_REFRESH_RATES_OPTION="--custom-refresh-rates $CUSTOM_REFRESH_RATES"
|
CUSTOM_REFRESH_RATES_OPTION="--custom-refresh-rates $CUSTOM_REFRESH_RATES"
|
||||||
@ -217,36 +222,28 @@ if [ -z "$GAMESCOPECMD" ]; then
|
|||||||
BACKEND_OPTION="--backend $BACKEND"
|
BACKEND_OPTION="--backend $BACKEND"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DISABLE_TOUCH_CLICK_OPTION=""
|
HDR_OPTIONS=""
|
||||||
if [ -n "$DISABLE_TOUCH_CLICK" ] && gamescope_has_option "--disable-touch-click"; then
|
if [ "$ENABLE_GAMESCOPE_HDR" == "1" ] && [ "$ENABLE_GAMESCOPE_WSI" == "1" ] && gamescope_has_option "--hdr-enabled" && gamescope_has_option "--hdr-itm-enable"; then
|
||||||
DISABLE_TOUCH_CLICK_OPTION="--disable-touch-click"
|
HDR_OPTIONS="--hdr-enabled --hdr-itm-enable"
|
||||||
fi
|
export ENABLE_HDR_WSI=1
|
||||||
|
export DXVK_HDR=1
|
||||||
|
fi
|
||||||
|
|
||||||
MURA_OPTION=""
|
if [ -n "$GAMESCOPE_HDR_NITS" ] && gamescope_has_option "--hdr-itm-sdr-nits" && gamescope_has_option "--hdr-sdr-content-nits"; then
|
||||||
if [ -n "$MURA" ] && gamescope_has_option "--mura-map"; then
|
HDR_OPTIONS="$HDR_OPTIONS --hdr-itm-sdr-nits $GAMESCOPE_HDR_NITS --hdr-sdr-content-nits $GAMESCOPE_HDR_NITS"
|
||||||
MURA_OPTION="--mura-map $MURA"
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
TOUCH_GESTURES_OPTION=""
|
GAMESCOPECMD="$(get_gamescope_binary) \
|
||||||
if [ -n "$TOUCH_GESTURES" ] && gamescope_has_option "--touch-gestures"; then
|
|
||||||
TOUCH_GESTURES_OPTION="--touch-gestures"
|
|
||||||
fi
|
|
||||||
|
|
||||||
GAMESCOPECMD="/usr/bin/gamescope \
|
|
||||||
$CURSOR \
|
$CURSOR \
|
||||||
$RESOLUTION \
|
$RESOLUTION \
|
||||||
$INTERNAL_RESOLUTION \
|
$INTERNAL_RESOLUTION \
|
||||||
$DRM_MODE_OPTION \
|
|
||||||
$ORIENTATION_OPTION \
|
$ORIENTATION_OPTION \
|
||||||
|
$DRM_MODE_OPTION \
|
||||||
$ADAPTIVE_SYNC_OPTION \
|
$ADAPTIVE_SYNC_OPTION \
|
||||||
$FORCE_COMPOSITION_OPTION \
|
|
||||||
$PANEL_TYPE_OPTION \
|
$PANEL_TYPE_OPTION \
|
||||||
$BYPASS_STEAM_RESOLUTION_OPTION \
|
|
||||||
$CUSTOM_REFRESH_RATES_OPTION \
|
$CUSTOM_REFRESH_RATES_OPTION \
|
||||||
$BACKEND_OPTION \
|
$BACKEND_OPTION \
|
||||||
$DISABLE_TOUCH_CLICK_OPTION \
|
$HDR_OPTIONS \
|
||||||
$MURA_OPTION \
|
|
||||||
$TOUCH_GESTURES_OPTION \
|
|
||||||
--prefer-output $OUTPUT_CONNECTOR \
|
--prefer-output $OUTPUT_CONNECTOR \
|
||||||
--xwayland-count $XWAYLAND_COUNT \
|
--xwayland-count $XWAYLAND_COUNT \
|
||||||
--default-touch-mode $TOUCH_MODE \
|
--default-touch-mode $TOUCH_MODE \
|
||||||
@ -266,7 +263,7 @@ fi
|
|||||||
# Attempt to fallback to a desktop session if something goes wrong too many times
|
# Attempt to fallback to a desktop session if something goes wrong too many times
|
||||||
short_session_tracker_file="/tmp/chimeraos-short-session-tracker"
|
short_session_tracker_file="/tmp/chimeraos-short-session-tracker"
|
||||||
short_session_duration=60
|
short_session_duration=60
|
||||||
short_session_count_before_reset=3
|
short_session_count_before_reset=5
|
||||||
SECONDS=0
|
SECONDS=0
|
||||||
|
|
||||||
short_session_count=$(wc <"$short_session_tracker_file" -l)
|
short_session_count=$(wc <"$short_session_tracker_file" -l)
|
||||||
@ -281,30 +278,18 @@ if [[ "$short_session_count" -ge "$short_session_count_before_reset" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Log rotate the last session
|
# Start gamescope compositor and background it
|
||||||
if [ -f "${HOME}"/.${CLIENT}-stdout.log ]; then
|
$GAMESCOPECMD &
|
||||||
cp "${HOME}"/.${CLIENT}-stdout.log "${HOME}"/.${CLIENT}-stdout.log.old
|
|
||||||
fi
|
|
||||||
if [ -f "${HOME}"/.gamescope-stdout.log ]; then
|
|
||||||
cp "${HOME}"/.gamescope-stdout.log "${HOME}"/.gamescope-stdout.log.old
|
|
||||||
fi
|
|
||||||
if [ -f "${HOME}"/.gamescope-cmd.log ]; then
|
|
||||||
cp "${HOME}"/.gamescope-cmd.log "${HOME}"/.gamescope-cmd.log.old
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start gamescope compositor, log it's output and background it
|
|
||||||
echo $GAMESCOPECMD >"${HOME}"/.gamescope-cmd.log
|
|
||||||
$GAMESCOPECMD >"${HOME}"/.gamescope-stdout.log 2>&1 &
|
|
||||||
gamescope_pid="$!"
|
gamescope_pid="$!"
|
||||||
|
|
||||||
if read -r -t 15 response_x_display response_wl_display <> "$socket"; then
|
if read -r -t 3 response_x_display response_wl_display <>"$socket"; then
|
||||||
export DISPLAY="$response_x_display"
|
export DISPLAY="$response_x_display"
|
||||||
export GAMESCOPE_WAYLAND_DISPLAY="$response_wl_display"
|
export GAMESCOPE_WAYLAND_DISPLAY="$response_wl_display"
|
||||||
# We're done!
|
# We're done!
|
||||||
else
|
else
|
||||||
echo "gamescope failed" >>"$short_session_tracker_file"
|
echo "gamescope failed" >>"$short_session_tracker_file"
|
||||||
kill -9 "$gamescope_pid"
|
kill -9 "$gamescope_pid"
|
||||||
wait
|
wait -n "$gamescope_pid"
|
||||||
exit 1
|
exit 1
|
||||||
# Systemd or Session manager will have to restart session
|
# Systemd or Session manager will have to restart session
|
||||||
fi
|
fi
|
||||||
@ -320,18 +305,16 @@ fi
|
|||||||
# If we have mangoapp binary start it
|
# If we have mangoapp binary start it
|
||||||
if command -v mangoapp >/dev/null; then
|
if command -v mangoapp >/dev/null; then
|
||||||
(while true; do
|
(while true; do
|
||||||
mangoapp >"${HOME}"/.mangoapp-stdout.log 2>&1
|
mangoapp
|
||||||
done) &
|
done) &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start discover-overlay if discord is installed
|
# Handle Galileo Mura Correction
|
||||||
if command -v discover-overlay > /dev/null && grep -q "com.discordapp.Discord" <<< $(/usr/bin/flatpak list --app --columns=application); then
|
# This is applied here and not in device-quirks because it must be called after gamescope has started.
|
||||||
env DISPLAY=:0 discover-overlay 2>&1 &
|
if [[ ":Galileo:" =~ ":$SYS_ID:" ]]; then
|
||||||
fi
|
if command -v galileo-mura-setup > /dev/null; then
|
||||||
|
galileo-mura-setup &
|
||||||
# If the Sunshine service is enabled, restart it
|
fi
|
||||||
if systemctl is-enabled --user sunshine.service; then
|
|
||||||
systemctl restart --user sunshine.service 2>&1 &
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For compatibility with older user configuration overrides
|
# For compatibility with older user configuration overrides
|
||||||
@ -340,7 +323,7 @@ if [ -n "$STEAMCMD" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Start client application
|
# Start client application
|
||||||
$CLIENTCMD >"${HOME}/.${CLIENT}-stdout.log" 2>&1
|
$CLIENTCMD
|
||||||
|
|
||||||
if [[ "$SECONDS" -lt "$short_session_duration" ]]; then
|
if [[ "$SECONDS" -lt "$short_session_duration" ]]; then
|
||||||
echo "${CLIENT} failed" >>"$short_session_tracker_file"
|
echo "${CLIENT} failed" >>"$short_session_tracker_file"
|
||||||
@ -348,6 +331,8 @@ else
|
|||||||
rm "$short_session_tracker_file"
|
rm "$short_session_tracker_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
post_client_shutdown
|
||||||
|
|
||||||
# When the client exits, kill gamescope nicely
|
# When the client exits, kill gamescope nicely
|
||||||
kill $gamescope_pid
|
kill $gamescope_pid
|
||||||
|
|
||||||
@ -390,4 +375,4 @@ for job in $(jobs -p); do
|
|||||||
ps -p "$job" >&2
|
ps -p "$job" >&2
|
||||||
fi
|
fi
|
||||||
kill -9 "$job"
|
kill -9 "$job"
|
||||||
done
|
done
|
Loading…
x
Reference in New Issue
Block a user