summaryrefslogtreecommitdiff
diff options
authorSylvain Pineau <sylvain.pineau@canonical.com>2018-05-16 11:18:44 +0200
committerSylvain Pineau <sylvain.pineau@canonical.com>2018-05-16 11:18:44 +0200
commit268a81fa5c7cd6505fc4f70c7bff2c795ea3a243 (patch)
tree6799cad8d84460ae85300f988610f2536a47bdb8
parentace333cce05785433e001d0301a1437503dcf2ad (diff)
graphics: Look for Xorg logs in $HOME on systems where X is running as non root
-rwxr-xr-xbin/graphics_driver5
-rwxr-xr-xbin/graphics_env2
-rw-r--r--units/graphics/jobs.pxu4
3 files changed, 7 insertions, 4 deletions
diff --git a/bin/graphics_driver b/bin/graphics_driver
index dfb5522..6d28f5a 100755
--- a/bin/graphics_driver
+++ b/bin/graphics_driver
@@ -361,7 +361,10 @@ def hybrid_graphics_check(xlog):
def main():
- xlog = XorgLog("/var/log/Xorg.0.log")
+ if os.path.isfile("/var/log/Xorg.0.log"):
+ xlog = XorgLog("/var/log/Xorg.0.log")
+ else:
+ xlog = XorgLog(os.path.expanduser("~/.local/share/xorg/Xorg.0.log"))
results = []
results.append(get_driver_info(xlog))
diff --git a/bin/graphics_env b/bin/graphics_env
index 9511560..89c761d 100755
--- a/bin/graphics_env
+++ b/bin/graphics_env
@@ -19,7 +19,7 @@ if [[ $DRIVER == "amdgpu" || $DRIVER == "radeon" ]]; 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 ! grep -q DRI3 /var/log/Xorg.0.log; then
+ 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}
diff --git a/units/graphics/jobs.pxu b/units/graphics/jobs.pxu
index 08bc7b3..88efe86 100644
--- a/units/graphics/jobs.pxu
+++ b/units/graphics/jobs.pxu
@@ -8,7 +8,7 @@ command:
source graphics_env {driver} {index}
graphics_driver
estimated_duration: 0.5
-_description: Parses Xorg.0.Log and discovers the running X driver and version for the {vendor} {product} graphics card
+_description: Parses Xorg.0.log and discovers the running X driver and version for the {vendor} {product} graphics card
_summary: Test X driver/version for {vendor} {product}
plugin: shell
@@ -205,7 +205,7 @@ _description:
plugin: shell
category_id: com.canonical.plainbox::graphics
id: graphics/VESA_drivers_not_in_use
-command: cat /var/log/Xorg.0.log | perl -e '$a=0;while(<>){$a++ if /Loading.*vesa_drv\.so/;$a-- if /Unloading.*vesa/&&$a}exit 1 if $a'
+command: cat /var/log/Xorg.0.log ~/.local/share/xorg/Xorg.0.log 2>&1 | perl -e '$a=0;while(<>){$a++ if /Loading.*vesa_drv\.so/;$a-- if /Unloading.*vesa/&&$a}exit 1 if $a'
estimated_duration: 0.011
_description: Check that VESA drivers are not in use
_summary: Test that VESA drivers are not in use