Merge lp:~pieq/checkbox/fix-1622477-amdgpu-pro-jobs-update into lp:checkbox

Proposed by Pierre Equoy
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 4492
Merged at revision: 4492
Proposed branch: lp:~pieq/checkbox/fix-1622477-amdgpu-pro-jobs-update
Merge into: lp:checkbox
Diff against target: 190 lines (+26/-23)
3 files modified
providers/plainbox-provider-checkbox/bin/graphics_env (+6/-6)
providers/plainbox-provider-checkbox/jobs/graphics.txt.in (+13/-10)
providers/plainbox-provider-checkbox/jobs/suspend-graphics.txt.in (+7/-7)
To merge this branch: bzr merge lp:~pieq/checkbox/fix-1622477-amdgpu-pro-jobs-update
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Paul Larson Approve
Review via email: mp+305453@code.launchpad.net

Description of the change

The amdgpu-pro drivers are based on the open source amdgpu drivers (so udev shows the same driver name for both amdgpu and amdgpu-pro installs), but use a dedicated script (amdgpu-pro-px) to switch between integrated and discrete GPUs.

We adapt the existing jobs and scripts to take this into account, based on Sylvain's modification to graphics_card resource job that allows to show 'amdgpu-pro' as driver name when the amdgpu-pro metapackage is present on the system.

To test:

launch checkbox and select the appropriate graphic jobs. On Xenial, using a device with amdgpu open source drivers, the DRI_PRIME=1 prefix method should still be started, but on a device with amdgpu-pro drivers (aka Hybrid drivers, semi-open source and semi-proprietary), the same job as nVidia cards should be launched, inviting the user to manually switch to the integrated/discrete GPU using the appropriate tool (amdgpu-pro-px).

To post a comment you must log in.
4492. By Pierre Equoy

providers:checkbox: Adapt graphics jobs to take amdgpu-pro drivers into account

The amdgpu-pro drivers are based on the open source amdgpu drivers (so udev
shows the same driver name for both amdgpu and amdgpu-pro installs), but use a
dedicated script (amdgpu-pro-px) to switch between integrated and discrete GPUs.

We adapt the existing jobs and scripts to take this into account, based on
Sylvain's modification to graphics_card resource job that allows to show
'amdgpu-pro' as driver name when the amdgpu-pro metapackage is present on the
system.

Fixes: https://bugs.launchpad.net/plainbox-provider-certification-client/+bug/1622477

Revision history for this message
Paul Larson (pwlars) wrote :

I don't have this sort of graphics card, but as a sanity check it looks ok, and I tried running it on my system with intel graphics to make sure it didn't do anything unexpected. +1 but it would certainly be good to get someone to run it who can confirm it works with the intended hardware too.

review: Approve
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Thanks for the addition of amdgpu pro instructions. +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'providers/plainbox-provider-checkbox/bin/graphics_env'
2--- providers/plainbox-provider-checkbox/bin/graphics_env 2016-06-28 22:31:22 +0000
3+++ providers/plainbox-provider-checkbox/bin/graphics_env 2016-09-12 10:27:46 +0000
4@@ -6,16 +6,16 @@
5 # This script has to be sourced in order to set an environment variable that
6 # is used by the open source AMD driver to trigger the use of discrete GPU.
7
8-VENDOR_SLUG=$1
9+DRIVER=$1
10 INDEX=$2
11 UBUNTU_CODENAME=`lsb_release -c | awk {'print $2'}`
12
13 # We only want to set the DRI_PRIME env variable on Xenial (16.04) systems
14-# running more than 1 GPU.
15-if [[ $UBUNTU_CODENAME == "xenial" ]]; then
16- NB_GPU=`udev_resource -l VIDEO | grep -oP -m1 '\d+'`
17- if [ $NB_GPU -gt 1 ]; then
18- if [[ $VENDOR_SLUG == *AMD* ]]; then
19+# with more than 1 GPU running the amdgpu driver.
20+if [[ $DRIVER == "amdgpu" ]]; then
21+ if [[ $UBUNTU_CODENAME == "xenial" ]]; then
22+ NB_GPU=`udev_resource -l VIDEO | grep -oP -m1 '\d+'`
23+ if [ $NB_GPU -gt 1 ]; then
24 if [ $INDEX -gt 1 ]; then
25 # See https://wiki.archlinux.org/index.php/PRIME
26 echo "Setting up PRIME GPU offloading for AMD discrete GPU"
27
28=== modified file 'providers/plainbox-provider-checkbox/jobs/graphics.txt.in'
29--- providers/plainbox-provider-checkbox/jobs/graphics.txt.in 2016-06-28 22:31:22 +0000
30+++ providers/plainbox-provider-checkbox/jobs/graphics.txt.in 2016-09-12 10:27:46 +0000
31@@ -4,7 +4,7 @@
32 category_id: 2013.com.canonical.plainbox::graphics
33 id: graphics/{index}_driver_version_{product_slug}
34 command:
35- source graphics_env {vendor_slug} {index}
36+ source graphics_env {driver} {index}
37 graphics_driver
38 estimated_duration: 0.5
39 _description: Parses Xorg.0.Log and discovers the running X driver and version for the {vendor} {product} graphics card
40@@ -106,7 +106,7 @@
41 requires:
42 device.category == 'VIDEO'
43 command:
44- source graphics_env {vendor_slug} {index}
45+ source graphics_env {driver} {index}
46 resolution_test --horizontal 800 --vertical 600
47 estimated_duration: 0.331
48 _summary: Test that {vendor} {product} meets minimum resolution requirement
49@@ -124,7 +124,7 @@
50 device.category == 'VIDEO'
51 package.name == 'zenity'
52 command:
53- source graphics_env {vendor_slug} {index}
54+ source graphics_env {driver} {index}
55 maxi="$(xrandr -q |grep -A 1 "connected\( primary\)* [0-9]" |tail -1 |awk '{{print $1}}')"
56 now="$(python3 -c 'from gi.repository import Gdk; screen=Gdk.Screen.get_default(); geo = screen.get_monitor_geometry(screen.get_primary_monitor()); print(geo.width, "x", geo.height, sep="")')"
57 test "$maxi" != "$now" && notify="\nPlease switch to the maximum resolution \nfor every graphic tests"
58@@ -188,7 +188,7 @@
59 package.name == 'xorg'
60 package.name == 'gir1.2-gst-plugins-base-0.10' or package.name == 'gir1.2-gst-plugins-base-1.0'
61 command:
62- source graphics_env {vendor_slug} {index}
63+ source graphics_env {driver} {index}
64 gst_pipeline_test -t 2 'videotestsrc ! videoconvert ! autovideosink' || gst_pipeline_test -t 2 'videotestsrc ! ffmpegcolorspace ! autovideosink'
65 _summary: Test that video can be displayed with {vendor} {product}
66 _description:
67@@ -215,7 +215,7 @@
68 requires: package.name == 'xorg'
69 depends: graphics/VESA_drivers_not_in_use
70 command:
71- source graphics_env {vendor_slug} {index}
72+ source graphics_env {driver} {index}
73 xrandr_cycle --screenshot-dir $PLAINBOX_SESSION_SHARE
74 estimated_duration: 250.000
75 _summary: Test resolution cycling for {vendor} {product}
76@@ -234,7 +234,7 @@
77 id: graphics/{index}_rotation_{product_slug}
78 depends: graphics/xorg-version
79 command:
80- source graphics_env {vendor_slug} {index}
81+ source graphics_env {driver} {index}
82 rotation_test_using_dbus
83 estimated_duration: 20.000
84 _summary: Test rotation for {vendor} {product}
85@@ -254,7 +254,7 @@
86 id: graphics/{index}_compiz_check_{product_slug}
87 requires: package.name == 'nux-tools'
88 command:
89- source graphics_env {vendor_slug} {index}
90+ source graphics_env {driver} {index}
91 ! /usr/lib/nux/unity_support_test -c -p 2>&1 | ansi_parser | grep -e ":\(\s\+\)no$" -ie "error"
92 estimated_duration: 0.130
93 _description: Check that {vendor} {product} hardware is able to run compiz
94@@ -278,7 +278,7 @@
95 id: graphics/{index}_glxgears_{product_slug}
96 requires: package.name == 'mesa-utils'
97 command:
98- source graphics_env {vendor_slug} {index}
99+ source graphics_env {driver} {index}
100 glxgears
101 true
102 _summary: Test that glxgears works for {vendor} {product}
103@@ -412,7 +412,7 @@
104 category_id: 2013.com.canonical.plainbox::graphics
105 id: graphics/{index}_switch_card_{product_slug}_xenial
106 requires:
107- device.driver in ['nouveau', 'nvidia']
108+ graphics_card.driver in ['nouveau', 'nvidia', 'amdgpu-pro']
109 lsb.codename == 'xenial'
110 _summary: Test GPU switching for {vendor} {product}
111 _description:
112@@ -421,7 +421,10 @@
113 _steps:
114 Note: If your system is already running with the {vendor} {product} card, then please mark this test as "passed" and proceed.
115 .
116- 1. Using the appropriate tool (e.g. NVidia settings), switch your system to use the {vendor} {product} graphics card. This will require restarting your session.
117+ 1. Using the appropriate tool (e.g. NVidia settings, amdgpu-pro-px), switch your system to use the {vendor} {product} graphics card. This will require restarting your session.
118+ If using amdgpu-pro drivers, use the following command to switch to:
119+ - integrated GPU: sudo /opt/amdgpu-pro/bin/amdgpu-pro-px --mode powersaving
120+ - discrete GPU: sudo /opt/amdgpu-pro/bin/amdgpu-pro-px --mode performance
121 2. Once the session restarts, please restart this testing program and select "continue" when prompted for a resume action.
122 3. Don't answer the verification question until the system has restarted with the {vendor} {product} card enabled.
123 _verification:
124
125=== modified file 'providers/plainbox-provider-checkbox/jobs/suspend-graphics.txt.in'
126--- providers/plainbox-provider-checkbox/jobs/suspend-graphics.txt.in 2016-06-28 22:31:22 +0000
127+++ providers/plainbox-provider-checkbox/jobs/suspend-graphics.txt.in 2016-09-12 10:27:46 +0000
128@@ -7,7 +7,7 @@
129 estimated_duration: 1.2
130 _description: Record the current resolution before suspending.
131 command:
132- source graphics_env {vendor_slug} {index}
133+ source graphics_env {driver} {index}
134 xrandr -q |grep '*'| awk '{{print $1}}' > $PLAINBOX_SESSION_SHARE/{index}_resolution_before_suspend.txt
135
136 unit: template
137@@ -53,7 +53,7 @@
138 depends: suspend/{index}_resolution_before_suspend_{product_slug}_xenial
139 _description: Test to see that we have the same resolution after resuming as before.
140 command:
141- source graphics_env {vendor_slug} {index}
142+ source graphics_env {driver} {index}
143 xrandr -q |grep '*'| awk '{{print $1}}' | diff $PLAINBOX_SESSION_SHARE/{index}_resolution_before_suspend.txt -
144
145 unit: template
146@@ -80,7 +80,7 @@
147 after: suspend/{index}_suspend_after_switch_to_card_{product_slug}_xenial
148 estimated_duration: 120.0
149 command:
150- source graphics_env {vendor_slug} {index}
151+ source graphics_env {driver} {index}
152 xrandr_cycle --keyword={index}_after_suspend --screenshot-dir $PLAINBOX_SESSION_SHARE
153 _description:
154 PURPOSE:
155@@ -107,7 +107,7 @@
156 after: suspend/{index}_suspend_after_switch_to_card_{product_slug}_xenial
157 requires: package.name == 'nux-tools'
158 command:
159- source graphics_env {vendor_slug} {index}
160+ source graphics_env {driver} {index}
161 ! /usr/lib/nux/unity_support_test -c -p 2>&1 | ansi_parser | grep -e ":\(\s\+\)no$" -ie "error"
162 estimated_duration: 0.130
163 _description: Check that {product} hardware is able to run compiz after suspend
164@@ -121,7 +121,7 @@
165 after: suspend/{index}_suspend_after_switch_to_card_{product_slug}_xenial
166 requires: package.name == 'mesa-utils'
167 command:
168- source graphics_env {vendor_slug} {index}
169+ source graphics_env {driver} {index}
170 glxgears
171 true
172 _summary: Test that glxgears works for {vendor} {product} after suspend
173@@ -145,7 +145,7 @@
174 package.name == 'xorg'
175 package.name == 'gir1.2-gst-plugins-base-0.10' or package.name == 'gir1.2-gst-plugins-base-1.0'
176 command:
177- source graphics_env {vendor_slug} {index}
178+ source graphics_env {driver} {index}
179 gst_pipeline_test -t 2 'videotestsrc ! videoconvert ! autovideosink' || gst_pipeline_test -t 2 'videotestsrc ! ffmpegcolorspace ! autovideosink'
180 _summary: Test that video can be displayed after suspend with {vendor} {product}
181 _description:
182@@ -163,7 +163,7 @@
183 id: suspend/{index}_driver_version_after_suspend_{product_slug}_xenial
184 after: suspend/{index}_suspend_after_switch_to_card_{product_slug}_xenial
185 command:
186- source graphics_env {vendor_slug} {index}
187+ source graphics_env {driver} {index}
188 graphics_driver
189 estimated_duration: 0.500
190 _description: Parses Xorg.0.Log and discovers the running X driver and version after suspend for the {vendor} {product} graphics card

Subscribers

People subscribed via source and target branches