feat: added compatibility with ChimeraOS configuration and device-quirks

Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
2025-07-09 21:25:14 +05:00
parent cf0b11ea3e
commit 960b808457
2 changed files with 94 additions and 3 deletions

View File

@ -1,13 +1,48 @@
# PortProtonQt session # PortProtonQt session
This project is not affiliated with Valve (wide inspiration was taken from This project is not affiliated with Valve (wide inspiration was taken from
their work on the SteamDeck). This configuration depends on [gamescope-session](https://raw.githubusercontent.com/ChimeraOS/gamescope-session) from the ChimeraOS project. and [portprotonqt](https://git.linux-gaming.ru/Boria138/PortProtonQt) their work on the SteamDeck)
## Basic manual setup ## Basic manual setup
Copy this repository file structure into the appropriate places and you'll be Copy this repository file structure into the appropriate places and you'll be
able to start the session on any Display Manager of your choice. able to start the session on any Display Manager of your choice.
# User Configuration
The session sources environment from `~/.config/environment.d/*.conf` files.
The easiest way to configure the session is to create `~/.config/environment.d/gamescope-session-plus.conf`
and set variables there:
```bash
# Size of the screen. If not set gamescope will detect native resolution from drm.
SCREEN_HEIGHT=2160
SCREEN_WIDTH=3840
# Internal render size of the screen. If not set, will be the same as SCREEN_HEIGHT and SCREEN_WIDTH.
INTERNAL_WIDTH=1280
INTERNAL_HEIGHT=800
# Orientation adjustment of panel, possible values: left, right
ORIENTATION=left
# Enable VRR
ADAPTIVE_SYNC=1
# Treat the internal panel as an external monitor
PANEL_TYPE=external
# Set priority of display connectors
OUTPUT_CONNECTOR='*,DSI-1'
# Set the specific values allowed for refresh rates
CUSTOM_REFRESH_RATES=40,50,60
# DRM mode generation algorithm (cvt, fixed)
# TODO: what is this ?
DRM_MODE=fixed
```
# License & Contributing # License & Contributing
The project is licensed under GPL v3 license. If you want to contribute, The project is licensed under GPL v3 license. If you want to contribute,

View File

@ -1,5 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
gamescope_has_option() {
if (gamescope --help 2>&1 | grep -e "$1" > /dev/null); then
return 0
fi
return 1
}
# Source device quirks if exists
if [ -f /usr/share/gamescope-session-plus/device-quirks ]; then
. /usr/share/gamescope-session-plus/device-quirks
fi
# Source user configuration from ~/.config/environment.d # Source user configuration from ~/.config/environment.d
set -a set -a
for i in "${HOME}"/.config/environment.d/*.conf; do for i in "${HOME}"/.config/environment.d/*.conf; do
@ -8,12 +21,55 @@ done
set +a set +a
# Gamescope parameters # Gamescope parameters
GAMESCOPE_PARAMS="" : "${OUTPUT_CONNECTOR:=*,eDP-1}"
GAMESCOPE_PARAMS="--prefer-output $OUTPUT_CONNECTOR"
# Check if NVK driver is in use # Check if NVK driver is in use
if vulkaninfo 2>/dev/null | grep -i "driverName" | grep -q "NVK"; then if vulkaninfo 2>/dev/null | grep -i "driverName" | grep -q "NVK"; then
# Workaround for https://gitlab.freedesktop.org/mesa/mesa/-/issues/13478 # Workaround for https://gitlab.freedesktop.org/mesa/mesa/-/issues/13478
GAMESCOPE_PARAMS+=" --backend sdl -f" BACKEND="sdl"
GAMESCOPE_PARAMS+=" -f"
fi
if [ -n "$SCREEN_WIDTH" ] && [ -n "$SCREEN_HEIGHT" ]; then
GAMESCOPE_PARAMS+=" -W $SCREEN_WIDTH -H $SCREEN_HEIGHT"
fi
if [ -n "$INTERNAL_WIDTH" ] && [ -n "$INTERNAL_HEIGHT" ] ; then
GAMESCOPE_PARAMS+=" -w $INTERNAL_WIDTH -h $INTERNAL_HEIGHT"
fi
if [ -n "$DRM_MODE" ] ; then
GAMESCOPE_PARAMS+=" --generate-drm-mode $DRM_MODE"
fi
if [ -n "$ORIENTATION" ] ; then
GAMESCOPE_PARAMS+=" --force-orientation $ORIENTATION"
fi
if [ -n "$ADAPTIVE_SYNC" ]; then
GAMESCOPE_PARAMS+=" --adaptive-sync"
fi
if [ -n "$PANEL_TYPE" ] && gamescope_has_option "--force-panel-type"; then
GAMESCOPE_PARAMS+=" --force-panel-type $PANEL_TYPE"
fi
if [ -n "$CUSTOM_REFRESH_RATES" ] && gamescope_has_option "--custom-refresh-rates"; then
GAMESCOPE_PARAMS+=" --custom-refresh-rates $CUSTOM_REFRESH_RATES"
fi
if [ -n "$USE_ROTATION_SHADER" ] && gamescope_has_option "--use-rotation-shader"; then
GAMESCOPE_PARAMS+=" --use-rotation-shader $USE_ROTATION_SHADER"
fi
if [ -n "$BACKEND" ] && gamescope_has_option "--backend"; then
GAMESCOPE_PARAMS+=" --backend $BACKEND"
fi
if [ -f "$CURSOR_FILE" ]; then
# Use specified cursor if file exists
GAMESCOPE_PARAMS+=" --cursor ${CURSOR_FILE}"
fi fi
# Prefer a specific Vulkan adapter if defined # Prefer a specific Vulkan adapter if defined