kms_rotation_crc: Remove useless comments
[platform/upstream/intel-gpu-tools.git] / tests / drv_missed_irq_hang
1 #!/bin/bash
2 #
3 # Testcase: Simulate missed breadcrumb interrupts
4 #
5
6 SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
7 . $SOURCE_DIR/drm_lib.sh
8
9 oldpath=`pwd`
10
11 cd $i915_dfs_path
12
13 function check_for_missed_irq {
14         if test `cat i915_ring_missed_irq` = 0x00000000; then
15                 echo "missed interrupts undetected"
16                 exit 1
17         fi
18 }
19
20 function check_for_hang {
21         if cat i915_error_state | grep -v "no error state collected" > /dev/null ; then
22                 echo "gpu hang reported"
23                 exit 2
24         fi
25 }
26
27 if [ ! -f i915_ring_missed_irq ] ; then
28         echo "kernel doesn't support interrupt masking"
29         exit 77
30 fi
31
32 # clear error state first
33 echo > i915_error_state
34 check_for_hang
35
36 echo 0xf > i915_ring_test_irq
37 echo "Interrupts masked"
38 if test `cat i915_ring_test_irq` != 0x0000000f; then
39         echo "Failed to set interrupt mask"
40         exit 3
41 fi
42
43 (cd $oldpath; $SOURCE_DIR/gem_exec_blt) > /dev/null
44
45 check_for_missed_irq
46 check_for_hang
47
48 (cd $oldpath; $SOURCE_DIR/gem_exec_blt) > /dev/null
49
50 check_for_hang
51
52 echo 0 > i915_ring_test_irq
53 echo "Interrupts unmasked"
54 if test `cat i915_ring_test_irq` != 0x00000000; then
55         echo "Failed to clear interrupt mask"
56         exit 3
57 fi
58
59 (cd $oldpath; $SOURCE_DIR/gem_exec_blt) > /dev/null
60
61 check_for_hang
62
63 echo 0 > i915_ring_missed_irq
64 echo "Cleared missed interrupts"
65 if test `cat i915_ring_missed_irq` != 0x00000000; then
66         echo "Failed to clear missed interrupts"
67         exit 3
68 fi
69
70 exit 0