From 86b6f798c51f2f80971911490c81b706cf64e5e8 Mon Sep 17 00:00:00 2001 From: Vasiliy Stelmachenok <92667539+ventureoo@users.noreply.github.com> Date: Thu, 9 Jan 2025 06:20:34 +0000 Subject: [PATCH] profiles/graphic_drivers: Return workaround for RTD3 (#149) Signed-off-by: Vasiliy Stelmachenok --- profiles/pci/graphic_drivers/profiles.toml | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/profiles/pci/graphic_drivers/profiles.toml b/profiles/pci/graphic_drivers/profiles.toml index 132a703..fcd8e60 100644 --- a/profiles/pci/graphic_drivers/profiles.toml +++ b/profiles/pci/graphic_drivers/profiles.toml @@ -61,7 +61,24 @@ post_install = """ if ! lspci -d "10de:*:030x" -vm | grep -q 'Device:\\tTU.*'; then systemctl enable nvidia-powerd fi + systemctl enable switcheroo-control + + cat << 'EOF' >/etc/profile.d/nvidia-rtd3-workaround.sh +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +if [ -n "$(lspci -d "10de:*:0302")" ]; then + export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json +fi +EOF + + cat << 'EOF' | install -Dm755 /dev/stdin /usr/lib/systemd/user-environment-generators/20-nvidia-rtd3-workaround +#!/usr/bin/env sh +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +if [ -n "$(lspci -d "10de:*:0302")" ]; then + echo "__EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json" +fi +EOF + else # Add libva-nvidia-driver to profile echo "export LIBVA_DRIVER_NAME=nvidia" > /etc/profile.d/nvidia-vaapi.sh @@ -72,6 +89,8 @@ pre_remove = """ """ post_remove = """ rm -f /etc/profile.d/nvidia-vaapi.sh + rm -f /etc/profile.d/nvidia-rtd3-workaround.sh + rm -f /usr/lib/systemd/user-environment-generators/20-nvidia-rtd3-workaround """ [nvidia-dkms] @@ -117,6 +136,22 @@ post_install = """ device_type="$(cat /sys/devices/virtual/dmi/id/chassis_type)" if ((device_type >= 8 && device_type <= 11)); then systemctl enable switcheroo-control + + cat << 'EOF' >/etc/profile.d/nvidia-rtd3-workaround.sh +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +if [ -n "$(lspci -d "10de:*:0302")" ]; then + export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json +fi +EOF + + cat << 'EOF' | install -Dm755 /dev/stdin /usr/lib/systemd/user-environment-generators/20-nvidia-rtd3-workaround +#!/usr/bin/env sh +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +if [ -n "$(lspci -d "10de:*:0302")" ]; then + echo "__EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json" +fi +EOF + else # Add libva-nvidia-driver to profile echo "export LIBVA_DRIVER_NAME=nvidia" > /etc/profile.d/nvidia-vaapi.sh @@ -127,6 +162,8 @@ pre_remove = """ """ post_remove = """ rm -f /etc/profile.d/nvidia-vaapi.sh + rm -f /etc/profile.d/nvidia-rtd3-workaround.sh + rm -f /usr/lib/systemd/user-environment-generators/20-nvidia-rtd3-workaround """ [nvidia-dkms-470xx]