@@ -833,6 +833,53 @@ check_selinux () {
833
833
}
834
834
export -f check_selinux
835
835
836
+ check_vendor_gpu () {
837
+ if [[ $PW_GPU_USE != disabled ]] ; then
838
+ case " ${PW_GPU_USE,,} " in
839
+ * nvidia* )
840
+ if [[ -d /sys/bus/pci/drivers/nvidia ]] ; then export NVIDIA_IN_USE=1
841
+ elif [[ -d /sys/bus/pci/drivers/nouveau ]] ; then export NOUVEAU_IN_USE=1
842
+ fi
843
+ ;;
844
+ * amd* )
845
+ export AMD_IN_USE=1
846
+ ;;
847
+ * intel* )
848
+ export INTEL_IN_USE=1
849
+ ;;
850
+ esac
851
+ fi
852
+ if [[ -z $NVIDIA_IN_USE && -z $NOUVEAU_IN_USE && -z $AMD_IN_USE && -z $INTEL_IN_USE ]] ; then
853
+ if command -v glxinfo & > /dev/null ; then
854
+ glxinfo -B & > " ${PW_TMPFS_PATH} /glxinfo.tmp"
855
+ case " $( < " ${PW_TMPFS_PATH} /glxinfo.tmp" tr ' [:upper:]' ' [:lower:]' ) " in
856
+ * nvidia* )
857
+ if [[ -d /sys/bus/pci/drivers/nvidia ]] ; then export NVIDIA_IN_USE=1
858
+ elif [[ -d /sys/bus/pci/drivers/nouveau ]] ; then export NOUVEAU_IN_USE=1
859
+ fi
860
+ ;;
861
+ * amd* )
862
+ export AMD_IN_USE=1
863
+ ;;
864
+ * intel* )
865
+ export INTEL_IN_USE=1
866
+ ;;
867
+ esac
868
+ else
869
+ [[ -d /sys/bus/pci/drivers/nvidia ]] && export NVIDIA_IN_USE=1
870
+ [[ -d /sys/bus/pci/drivers/nouveau ]] && export NOUVEAU_IN_USE=1
871
+ [[ -d /sys/bus/pci/drivers/amdgpu ]] && export AMD_IN_USE=1
872
+ [[ -d /sys/bus/pci/drivers/i915 ]] && export INTEL_IN_USE=1
873
+ fi
874
+ fi
875
+ if [[ -n $NVIDIA_IN_USE ]] ; then echo ' nvidia'
876
+ elif [[ -n $NOUVEAU_IN_USE ]] ; then echo ' nouveau'
877
+ elif [[ -n $AMD_IN_USE ]] ; then echo ' amd'
878
+ elif [[ -n $INTEL_IN_USE ]] ; then echo ' intel'
879
+ else echo ' '
880
+ fi
881
+ }
882
+
836
883
background_pid () {
837
884
local arg1 arg2 arg3 PID
838
885
arg1=$1 # --start или --end
@@ -3265,11 +3312,7 @@ start_portwine () {
3265
3312
fi
3266
3313
3267
3314
# https://github.com/flathub/net.lutris.Lutris/pull/368#issuecomment-1751381312
3268
- if [[ " ${PW_GPU_USE,,} " =~ nvidia ]] \
3269
- || [[ $( glxinfo | grep " OpenGL renderer" | grep -i nvidia) ]]
3270
- then
3271
- export WEBKIT_DISABLE_DMABUF_RENDERER=1
3272
- fi
3315
+ [[ $( check_vendor_gpu) == nvidia ]] && export WEBKIT_DISABLE_DMABUF_RENDERER=1
3273
3316
3274
3317
if check_gamescope_session ; then
3275
3318
export PW_GAMEMODERUN_SLR=" "
@@ -3462,7 +3505,7 @@ start_portwine () {
3462
3505
then
3463
3506
export LIBGL_KOPPER_DRI2=" 1"
3464
3507
fi
3465
- if [[ -d /sys/bus/pci/drivers/ nouveau ]] ; then
3508
+ if [[ $( check_vendor_gpu ) == nouveau ]] ; then
3466
3509
export NOUVEAU_USE_ZINK=" 1"
3467
3510
fi
3468
3511
;;
@@ -3979,18 +4022,18 @@ start_portwine () {
3979
4022
|| check_gamescope_session
3980
4023
then
3981
4024
export vk_xwayland_wait_ready=" false"
3982
- if [[ -d /sys/bus/pci/drivers/amdgpu ]] ; then
4025
+ if [[ $( check_vendor_gpu ) == amd ]] ; then
3983
4026
export RADV_DEBUG+=" nodcc "
3984
4027
export AMD_DEBUG=" nodcc"
3985
4028
if [[ ! $( < " ${PW_TMPFS_PATH} /vulkaninfo.tmp" ) =~ VK_EXT_image_drm_format_modifier ]] ; then
3986
4029
export R600_DEBUG=" nodcc"
3987
4030
grep -e ' --backend' " ${PW_TMPFS_PATH} /gamescope.tmp" & > /dev/null && PW_GS_BACKEND_SDL=" 1"
3988
4031
fi
3989
4032
fi
3990
- if [[ -d /sys/bus/pci/drivers/i915 ]] ; then
4033
+ if [[ $( check_vendor_gpu ) == intel ]] ; then
3991
4034
export INTEL_DEBUG=" norbc"
3992
4035
fi
3993
- if [[ -d /sys/bus/pci/drivers/ nvidia ]] ; then
4036
+ if [[ $( check_vendor_gpu ) == nvidia ]] ; then
3994
4037
PW_GAMESCOPE_VARIABLES_BEFORE+=" __GL_THREADED_OPTIMIZATIONS=0 "
3995
4038
PW_GAMESCOPE_VARIABLES_AFTER+=" __GL_THREADED_OPTIMIZATIONS=1 "
3996
4039
fi
0 commit comments