From 7628493a7e7acaba93d607db008a59ec8fa8eebe Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Tue, 28 Nov 2017 13:22:04 +0100 Subject: [PATCH] gfx_test: Update i915 binding in wrapper script Always load i915 even if it wasn't loaded before. Also, force `modeset=1` as that's our use case and we might have booted with `i915.modeset=0`. Last but not least, search for the correct vtcon* entry in sysfs instead of guessing, and always unbind it (i.e. unbind the dummy driver when we want to switch back to i915). Change-Id: Ib62a05a3621aef2992372a6d3acad1196a363a95 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/22715 Reviewed-by: Stefan Reinauer Tested-by: Stefan Reinauer --- gfxtest/gfx_test.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/gfxtest/gfx_test.sh b/gfxtest/gfx_test.sh index 01154430a0..3cd5ce28be 100755 --- a/gfxtest/gfx_test.sh +++ b/gfxtest/gfx_test.sh @@ -35,10 +35,15 @@ prepare_vt() { while [ `fgconsole` -eq $orig_vt ]; do :; done # take i915 out of charge - echo 0 >/sys/devices/virtual/vtconsole/vtcon1/bind + for vtcon in /sys/devices/virtual/vtconsole/vtcon*; do + if grep -q frame\ buffer $vtcon/name >/dev/null 2>&1; then + echo 0 >$vtcon/bind + break + fi + done # try unloading it - if lsmod | grep -q i915 && modprobe -r i915 >/dev/null 2>&1; then + if modprobe -r i915 >/dev/null 2>&1; then reload_i915=1 fi } @@ -46,12 +51,17 @@ prepare_vt() { restore_vt() { # reload i915 if [ $reload_i915 -eq 1 ]; then - modprobe i915 + modprobe i915 modeset=1 + else + # put i915 back in charge + for vtcon in /sys/devices/virtual/vtconsole/vtcon*; do + if grep -q dummy $vtcon/name >/dev/null 2>&1; then + echo 0 >$vtcon/bind + break + fi + done fi - # put i915 back in charge - echo 1 >/sys/devices/virtual/vtconsole/vtcon1/bind - # return to original VT chvt $orig_vt }