Merge ~pieq/plainbox-provider-checkbox:fix-1831719-graphics_env-bionic into plainbox-provider-checkbox:master

Proposed by Pierre Equoy
Status: Merged
Approved by: Sylvain Pineau
Approved revision: b2c270147b33d63ffe44a3dddf312b90e58126c5
Merged at revision: 5bd50ef9f99b4cbc25b24b06a24af02365bf2bba
Proposed branch: ~pieq/plainbox-provider-checkbox:fix-1831719-graphics_env-bionic
Merge into: plainbox-provider-checkbox:master
Diff against target: 45 lines (+14/-17)
1 file modified
bin/graphics_env (+14/-17)
Reviewer Review Type Date Requested Status
Betty Lin (community) Approve
Checkbox Developers Pending
Review via email: mp+368426@code.launchpad.net

Description of the change

See commit message.

To test, using a device with and AMD discrete GPU and a bionic image using amdgpu open source drivers (such as stock Ubuntu), run a test plan with jobs like

graphics/{index}_glxgears_fullscreen_{product_slug}
graphics/{index}_video_{product_slug}

and make sure the phrase "Setting up PRIME GPU offloading for AMD discrete GPU" is shown in the output.

To post a comment you must log in.
Revision history for this message
Betty Lin (bettyl) wrote :

Test the update graphics_env, "Setting up PRIME GPU offloading for AMD discrete GPU" is shown in the output when running:
graphics/2_glxgears_*
graphics/2_glxgears_fullscreen_*
graphics/2_valid_opengl_renderer_*
graphics/2_video_*

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/graphics_env b/bin/graphics_env
2index 89c761d..19385a5 100755
3--- a/bin/graphics_env
4+++ b/bin/graphics_env
5@@ -8,26 +8,23 @@
6
7 DRIVER=$1
8 INDEX=$2
9-UBUNTU_CODENAME=`lsb_release -c | awk {'print $2'}`
10
11-# We only want to set the DRI_PRIME env variable on Xenial (16.04) systems
12-# with more than 1 GPU running the amdgpu/radeon drivers.
13+# We only want to set the DRI_PRIME env variable on systems with more than
14+# 1 GPU running the amdgpu/radeon drivers.
15 if [[ $DRIVER == "amdgpu" || $DRIVER == "radeon" ]]; then
16- if [[ $UBUNTU_CODENAME == "xenial" ]]; then
17- NB_GPU=`udev_resource -l VIDEO | grep -oP -m1 '\d+'`
18- if [ $NB_GPU -gt 1 ]; then
19- if [ $INDEX -gt 1 ]; then
20- # See https://wiki.archlinux.org/index.php/PRIME
21- echo "Setting up PRIME GPU offloading for AMD discrete GPU"
22- if ! cat /var/log/Xorg.0.log ~/.local/share/xorg/Xorg.0.log 2>&1 | grep -q DRI3; then
23- PROVIDER_ID=`xrandr --listproviders | grep "Sink Output" | awk {'print $4'} | tail -1`
24- SINK_ID=`xrandr --listproviders | grep "Source Output" | awk {'print $4'} | tail -1`
25- xrandr --setprovideroffloadsink ${PROVIDER_ID} ${SINK_ID}
26- fi
27- export DRI_PRIME=1
28- else
29- export DRI_PRIME=
30+ NB_GPU=`udev_resource -l VIDEO | grep -oP -m1 '\d+'`
31+ if [ $NB_GPU -gt 1 ]; then
32+ if [ $INDEX -gt 1 ]; then
33+ # See https://wiki.archlinux.org/index.php/PRIME
34+ echo "Setting up PRIME GPU offloading for AMD discrete GPU"
35+ if ! cat /var/log/Xorg.0.log ~/.local/share/xorg/Xorg.0.log 2>&1 | grep -q DRI3; then
36+ PROVIDER_ID=`xrandr --listproviders | grep "Sink Output" | awk {'print $4'} | tail -1`
37+ SINK_ID=`xrandr --listproviders | grep "Source Output" | awk {'print $4'} | tail -1`
38+ xrandr --setprovideroffloadsink ${PROVIDER_ID} ${SINK_ID}
39 fi
40+ export DRI_PRIME=1
41+ else
42+ export DRI_PRIME=
43 fi
44 fi
45 fi

Subscribers

People subscribed via source and target branches