summaryrefslogtreecommitdiff
diff options
authorPierre Equoy <pierre.equoy@canonical.com>2019-06-06 10:56:15 +0800
committerPierre Equoy <pierre.equoy@canonical.com>2019-06-06 10:56:15 +0800
commitb2c270147b33d63ffe44a3dddf312b90e58126c5 (patch)
tree959e9aefcef3c257d996250dbc8991b8baf2a9f3
parentfb9c8270ce3b8d24392db6b2c175311a86c52bb2 (diff)
bin: let PRIME offloading on AMD GPUs work on any Ubuntu release
When the script to set PRIME offloading on AMD GPUs was initially writted, we were still certifying Trusty (14.04) configs, and since Trusty didn't have this feature, we needed to bypass it. Now that all the Ubuntu releases we certify support AMD GPU offloading (i.e. DRI_PRIME=1 for amdgpu drivers), we get rid of the check on Ubuntu release. LP: #1831719
-rwxr-xr-xbin/graphics_env31
1 files changed, 14 insertions, 17 deletions
diff --git a/bin/graphics_env b/bin/graphics_env
index 89c761d..19385a5 100755
--- a/bin/graphics_env
+++ b/bin/graphics_env
@@ -8,26 +8,23 @@
DRIVER=$1
INDEX=$2
-UBUNTU_CODENAME=`lsb_release -c | awk {'print $2'}`
-# We only want to set the DRI_PRIME env variable on Xenial (16.04) systems
-# with more than 1 GPU running the amdgpu/radeon drivers.
+# We only want to set the DRI_PRIME env variable on systems with more than
+# 1 GPU running the amdgpu/radeon drivers.
if [[ $DRIVER == "amdgpu" || $DRIVER == "radeon" ]]; then
- if [[ $UBUNTU_CODENAME == "xenial" ]]; then
- NB_GPU=`udev_resource -l VIDEO | grep -oP -m1 '\d+'`
- if [ $NB_GPU -gt 1 ]; then
- if [ $INDEX -gt 1 ]; then
- # See https://wiki.archlinux.org/index.php/PRIME
- echo "Setting up PRIME GPU offloading for AMD discrete GPU"
- if ! cat /var/log/Xorg.0.log ~/.local/share/xorg/Xorg.0.log 2>&1 | grep -q DRI3; then
- PROVIDER_ID=`xrandr --listproviders | grep "Sink Output" | awk {'print $4'} | tail -1`
- SINK_ID=`xrandr --listproviders | grep "Source Output" | awk {'print $4'} | tail -1`
- xrandr --setprovideroffloadsink ${PROVIDER_ID} ${SINK_ID}
- fi
- export DRI_PRIME=1
- else
- export DRI_PRIME=
+ NB_GPU=`udev_resource -l VIDEO | grep -oP -m1 '\d+'`
+ if [ $NB_GPU -gt 1 ]; then
+ if [ $INDEX -gt 1 ]; then
+ # See https://wiki.archlinux.org/index.php/PRIME
+ echo "Setting up PRIME GPU offloading for AMD discrete GPU"
+ if ! cat /var/log/Xorg.0.log ~/.local/share/xorg/Xorg.0.log 2>&1 | grep -q DRI3; then
+ PROVIDER_ID=`xrandr --listproviders | grep "Sink Output" | awk {'print $4'} | tail -1`
+ SINK_ID=`xrandr --listproviders | grep "Source Output" | awk {'print $4'} | tail -1`
+ xrandr --setprovideroffloadsink ${PROVIDER_ID} ${SINK_ID}
fi
+ export DRI_PRIME=1
+ else
+ export DRI_PRIME=
fi
fi
fi