kms_rotation_crc: Remove useless comments
[platform/upstream/intel-gpu-tools.git] / tests / drm_lib.sh
1 #!/bin/sh
2 die() {
3         echo "$@"
4         exit 1
5 }
6
7 do_or_die() {
8         $@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit -1)
9 }
10
11 if [ -d /debug/dri ] ; then
12         debugfs_path=/debug/dri
13 fi
14
15 if [ -d /sys/kernel/debug/dri ] ; then
16         debugfs_path=/sys/kernel/debug/dri
17 fi
18
19 i915_dfs_path=x
20 for minor in `seq 0 16`; do
21         if [ -f $debugfs_path/$minor/i915_error_state ] ; then
22                 i915_dfs_path=$debugfs_path/$minor
23                 break
24         fi
25 done
26
27 if [ $i915_dfs_path = "x" ] ; then
28         die " i915 debugfs path not found."
29 fi
30
31 # read everything we can
32 if [ `cat $i915_dfs_path/clients | wc -l` -gt "2" ] ; then
33         [ -n "$DRM_LIB_ALLOW_NO_MASTER" ] || \
34                 die "ERROR: other drm clients running"
35 fi
36
37 i915_sfs_path=
38 if [ -d /sys/class/drm ] ; then
39     sysfs_path=/sys/class/drm
40     if [ -f $sysfs_path/card$minor/error ] ; then
41             i915_sfs_path="$sysfs_path/card$minor"
42     fi
43 fi
44 # sysfs may not exist as the 'error' is a new interface in 3.11
45
46 function drmtest_skip_on_simulation()
47 {
48         [ -n "$INTEL_SIMULATION" ] && exit 77
49 }
50
51 drmtest_skip_on_simulation