From aea93df97b1bfd38400197f1f160dcb8aa371869 Mon Sep 17 00:00:00 2001 From: RJ Trujillo Date: Sat, 9 Sep 2023 11:27:58 -0600 Subject: [PATCH 1/3] feat(hardware-setup): Enable amdgpu on supported systems Enable amdgpu on systems using the radeon driver. The arguments for Southern Islands and Sea Islands do not conflict so just enable both Do not block this based on image flavor as some people may be using mixed GPU systems that have both an AMD and Nvidia card --- .../shared/usr/bin/bazzite-hardware-setup | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup index d2220b6f..3e9ba3ba 100755 --- a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup +++ b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup @@ -83,6 +83,40 @@ elif [[ $IMAGE_NAME =~ "deck" ]]; then systemctl --global disable --now sdgyrodsu.service fi +if grep -qz "Kernel driver in use: radeon" <<< $(lspci -k | grep -A 3 -E "(VGA|3D)"); then + if [[ ! $KARGS =~ "radeon.si_support" ]]; then + NEEDED_KARGS="$NEEDED_KARGS --append=radeon.si_support=0" + fi + + if [[ ! $KARGS =~ "radeon.cik_support" ]]; then + NEEDED_KARGS="$NEEDED_KARGS --append=radeon.cik_support=0" + fi + + if [[ ! $KARGS =~ "amdgpu.si_support" ]]; then + NEEDED_KARGS="$NEEDED_KARGS --append=amdgpu.si_support=1" + fi + + if [[ ! $KARGS =~ "amdgpu.cik_support" ]]; then + NEEDED_KARGS="$NEEDED_KARGS --append=amdgpu.cik_support=1" + fi +elif grep -qvz "Kernel driver in use: amdgpu" <<< $(lspci -k | grep -A 3 -E "(VGA|3D)"); then + if [[ $KARGS =~ "radeon.si_support" ]]; then + NEEDED_KARGS="$NEEDED_KARGS --delete=radeon.si_support=0" + fi + + if [[ $KARGS =~ "radeon.cik_support" ]]; then + NEEDED_KARGS="$NEEDED_KARGS --delete=radeon.cik_support=0" + fi + + if [[ $KARGS =~ "amdgpu.si_support" ]]; then + NEEDED_KARGS="$NEEDED_KARGS --delete=amdgpu.si_support=1" + fi + + if [[ $KARGS =~ "amdgpu.cik_support" ]]; then + NEEDED_KARGS="$NEEDED_KARGS --delete=amdgpu.cik_support=1" + fi +fi + if [[ $IMAGE_FLAVOR = "nvidia" ]]; then echo "Checking for needed karg changes (Nvidia)" From 451b39359d3475aec925dc55d51e2f7b33b8a101 Mon Sep 17 00:00:00 2001 From: RJ Trujillo Date: Sat, 9 Sep 2023 12:37:24 -0600 Subject: [PATCH 2/3] chore(hardware-setup): Only retrieve GPU info once --- system_files/desktop/shared/usr/bin/bazzite-hardware-setup | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup index 3e9ba3ba..8aa6e4e0 100755 --- a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup +++ b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup @@ -25,6 +25,7 @@ fi # GLOBAL SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)" +GPU_ID=$(lspci -k | grep -A 3 -E "(VGA|3D)") KARGS=$(rpm-ostree kargs) NEEDED_KARGS="" echo "Current kargs: $KARGS" @@ -83,7 +84,7 @@ elif [[ $IMAGE_NAME =~ "deck" ]]; then systemctl --global disable --now sdgyrodsu.service fi -if grep -qz "Kernel driver in use: radeon" <<< $(lspci -k | grep -A 3 -E "(VGA|3D)"); then +if grep -qz "Kernel driver in use: radeon" <<< $GPU_ID; then if [[ ! $KARGS =~ "radeon.si_support" ]]; then NEEDED_KARGS="$NEEDED_KARGS --append=radeon.si_support=0" fi @@ -99,7 +100,7 @@ if grep -qz "Kernel driver in use: radeon" <<< $(lspci -k | grep -A 3 -E "(VGA|3 if [[ ! $KARGS =~ "amdgpu.cik_support" ]]; then NEEDED_KARGS="$NEEDED_KARGS --append=amdgpu.cik_support=1" fi -elif grep -qvz "Kernel driver in use: amdgpu" <<< $(lspci -k | grep -A 3 -E "(VGA|3D)"); then +elif grep -qvz "Kernel driver in use: amdgpu" <<< $GPU_ID; then if [[ $KARGS =~ "radeon.si_support" ]]; then NEEDED_KARGS="$NEEDED_KARGS --delete=radeon.si_support=0" fi From 1f8c80f67e5baa1f72a24783cf583fd0ae948e99 Mon Sep 17 00:00:00 2001 From: RJ Trujillo Date: Mon, 11 Sep 2023 08:02:43 -0600 Subject: [PATCH 3/3] fix(hardware-setup): Don't remove amdgpu kargs when no longer in use Could cause a potential loop --- .../shared/usr/bin/bazzite-hardware-setup | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup index 8aa6e4e0..dce57831 100755 --- a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup +++ b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup @@ -100,22 +100,6 @@ if grep -qz "Kernel driver in use: radeon" <<< $GPU_ID; then if [[ ! $KARGS =~ "amdgpu.cik_support" ]]; then NEEDED_KARGS="$NEEDED_KARGS --append=amdgpu.cik_support=1" fi -elif grep -qvz "Kernel driver in use: amdgpu" <<< $GPU_ID; then - if [[ $KARGS =~ "radeon.si_support" ]]; then - NEEDED_KARGS="$NEEDED_KARGS --delete=radeon.si_support=0" - fi - - if [[ $KARGS =~ "radeon.cik_support" ]]; then - NEEDED_KARGS="$NEEDED_KARGS --delete=radeon.cik_support=0" - fi - - if [[ $KARGS =~ "amdgpu.si_support" ]]; then - NEEDED_KARGS="$NEEDED_KARGS --delete=amdgpu.si_support=1" - fi - - if [[ $KARGS =~ "amdgpu.cik_support" ]]; then - NEEDED_KARGS="$NEEDED_KARGS --delete=amdgpu.cik_support=1" - fi fi if [[ $IMAGE_FLAVOR = "nvidia" ]]; then