From c70ccbd1748ef4020d9a86205bd4ec9ff2575ff6 Mon Sep 17 00:00:00 2001 From: HikariKnight <2557889+HikariKnight@users.noreply.github.com> Date: Tue, 25 Jun 2024 16:59:38 +0200 Subject: [PATCH 1/2] feat(tdpfix): add detection for multiple cards (#1279) --- .../deck/shared/usr/libexec/bazzite-tdpfix | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/system_files/deck/shared/usr/libexec/bazzite-tdpfix b/system_files/deck/shared/usr/libexec/bazzite-tdpfix index 0fe6cf13..09e348d7 100755 --- a/system_files/deck/shared/usr/libexec/bazzite-tdpfix +++ b/system_files/deck/shared/usr/libexec/bazzite-tdpfix @@ -1,17 +1,21 @@ #!/usr/bin/bash # This is a workaround for cards that somehow has their sysfs power1_cap permission set to 666 on boot # Which in turn makes steam directly set the TDP to 15W -POWER_CAP_PATH=$(find /sys/class/hwmon/*/ -name "power1_cap") +SYSFS_PATH=$(find /sys/class/hwmon/*/ -name "power1_cap") -# If the permissions are set to writable -if [ "$(stat -c %a "$POWER_CAP_PATH")" == "666" ]; then - chmod 644 "$POWER_CAP_PATH" - echo "fix: Permissions reset to 644 on $POWER_CAP_PATH" | systemd-cat -t bazzite-tdpfix -p warning -fi +# Loop through the SYSFS paths that has a "power1_cap" +for POWER_CAP_PATH in $SYSFS_PATH +do + # If the permissions are set to writable + if [ "$(stat -c %a "$POWER_CAP_PATH")" == "666" ]; then + chmod 644 "$POWER_CAP_PATH" + echo "fix: Permissions reset to 644 on $POWER_CAP_PATH" | systemd-cat -t bazzite-tdpfix -p warning + fi -# If TDP is 15W and default TDP is higher than 45W, set card to use default TDP -# This will then be handled by firmware or software afterwards as this is set once -if [ "$(cat "$POWER_CAP_PATH")" == "15000000" ] && [ "$(cat "${POWER_CAP_PATH}_default")" -gt "45000000" ]; then - "$(cat "${POWER_CAP_PATH}_default")" > "$POWER_CAP_PATH" - echo "fix: TDP reset to default on $POWER_CAP_PATH" | systemd-cat -t bazzite-tdpfix -p warning -fi + # If TDP is 15W and default TDP is higher than 45W, set card to use default TDP + # This will then be handled by firmware or software afterwards as this is set once + if [ "$(cat "$POWER_CAP_PATH")" == "15000000" ] && [ "$(cat "${POWER_CAP_PATH}_default")" -gt "45000000" ]; then + "$(cat "${POWER_CAP_PATH}_default")" > "$POWER_CAP_PATH" + echo "fix: TDP reset to default on $POWER_CAP_PATH" | systemd-cat -t bazzite-tdpfix -p warning + fi +done From 7848f42799f605a8790f21ed79fcebd26590bc2a Mon Sep 17 00:00:00 2001 From: HikariKnight <2557889+HikariKnight@users.noreply.github.com> Date: Tue, 25 Jun 2024 16:59:53 +0200 Subject: [PATCH 2/2] feat: add firstboot warning to users with polaris gpus (#1277) Only triggers if `/usr/libexec/bazzite-sdl-gpu-warn` exists (only does on handheld images) also triggers on any gpus defined in `/usr/libexec/gamescope-sdl-workaround` --- .../shared/usr/libexec/bazzite-sdl-gpu-warn | 38 +++++++++++++++++++ .../ublue-os/firstboot/launcher/autostart.sh | 7 ++++ 2 files changed, 45 insertions(+) create mode 100755 system_files/deck/shared/usr/libexec/bazzite-sdl-gpu-warn diff --git a/system_files/deck/shared/usr/libexec/bazzite-sdl-gpu-warn b/system_files/deck/shared/usr/libexec/bazzite-sdl-gpu-warn new file mode 100755 index 00000000..5a579f34 --- /dev/null +++ b/system_files/deck/shared/usr/libexec/bazzite-sdl-gpu-warn @@ -0,0 +1,38 @@ +#!/usr/bin/bash + +# The file to use for tracking if the warning has been shown +ACCEPTED="$HOME/.config/bazzite/gamescope-sdl-accepted" + +# Check if the check has already run +if [ -f "$ACCEPTED" ]; then + # Exit if user has already aknowledged the warning + exit 0 +fi + +# Show the SDL workaround warning if required +if /usr/libexec/gamescope-sdl-workaround; then + # Add 4 spaces if you want to start a new line, + # it makes the text easier to read in the dialog. + zenity --text-info --title="WARNING: Problematic GPU detected!" --checkbox="Understood, I made sure to have a controller connected." --width 560 --height 430 <<< " + This GPU requires a workaround to work in Game Mode Session! + It is applied automatically, however it means that + keyboard and mouse will not work AT ALL when using + Game Mode Session (Desktop Mode will not be affected) + + Please pair at least 1 bluetooth controller to the system now + so you can navigate Steam Game Mode. + + If you plan to use a wired controller or one with a non + bluetooth dongle, verify it is detected in Steam BEFORE rebooting!" + + # If the user mark the checkbox and clicks OK + # shellcheck disable=SC2181 + if [ "$?" == "0" ]; then + # Make the .config/bazzite folder if needed + if [ ! -d "$HOME/.config/bazzite" ]; then + mkdir "$HOME/.config/bazzite/" + fi + # Mark that the user has acknowledged the warning + touch "$ACCEPTED" + fi +fi diff --git a/system_files/desktop/shared/usr/share/ublue-os/firstboot/launcher/autostart.sh b/system_files/desktop/shared/usr/share/ublue-os/firstboot/launcher/autostart.sh index 21abc168..76c8c4b2 100755 --- a/system_files/desktop/shared/usr/share/ublue-os/firstboot/launcher/autostart.sh +++ b/system_files/desktop/shared/usr/share/ublue-os/firstboot/launcher/autostart.sh @@ -1,4 +1,11 @@ #!/usr/bin/bash +# Show a warning to people that need gamescope-sdl-workaround +# Only runs if the script file from the deck image exists +if [ -f "/usr/libexec/bazzite-sdl-gpu-warn" ]; then + # This will only show a warning if the user has not accepted the warning + /usr/libexec/bazzite-sdl-gpu-warn & +fi + # Simply launches the "yafti" GUI with the uBlue image's configuration. /usr/bin/yafti /usr/share/ublue-os/firstboot/yafti.yml