[Intel-gfx] [PATCH 2/5] tests: estbalish drv_ prefix
Daniel Vetter
daniel.vetter at ffwll.ch
Sat Nov 2 13:04:33 CET 2013
Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
tests/.gitignore | 2 +-
tests/Makefile.am | 10 +--
tests/NAMING-CONVENTION | 2 +
tests/ZZ_hangman | 70 -------------------
tests/ZZ_missed_irq | 72 -------------------
tests/debugfs_reader | 9 ---
tests/drv_debugfs_reader | 9 +++
tests/drv_hangman | 70 +++++++++++++++++++
tests/drv_missed_irq_hang | 72 +++++++++++++++++++
tests/drv_module_reload | 50 ++++++++++++++
tests/drv_suspend.c | 171 ++++++++++++++++++++++++++++++++++++++++++++++
tests/gem_suspend.c | 171 ----------------------------------------------
tests/module_reload | 50 --------------
13 files changed, 380 insertions(+), 378 deletions(-)
delete mode 100755 tests/ZZ_hangman
delete mode 100755 tests/ZZ_missed_irq
delete mode 100755 tests/debugfs_reader
create mode 100755 tests/drv_debugfs_reader
create mode 100755 tests/drv_hangman
create mode 100755 tests/drv_missed_irq_hang
create mode 100755 tests/drv_module_reload
create mode 100644 tests/drv_suspend.c
delete mode 100644 tests/gem_suspend.c
delete mode 100755 tests/module_reload
diff --git a/tests/.gitignore b/tests/.gitignore
index 8ca254983d8a..8df08364a4ca 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,6 +1,7 @@
# Please keep sorted alphabetically
ddi_compute_wrpll
debugfs_pipe_crc
+drv_suspend
drm_get_client_auth
drm_vma_limiter
drm_vma_limiter_cached
@@ -74,7 +75,6 @@ gem_storedw_loop_bsd
gem_storedw_loop_render
gem_storedw_loop_vebox
gem_stress
-gem_suspend
gem_threaded_access_tiled
gem_tiled_blits
gem_tiled_fence_blits
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e496d69d14a4..94cdcd02f814 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -18,6 +18,7 @@ endif
TESTS_progs_M = \
debugfs_pipe_crc \
+ drv_suspend \
gem_basic \
gem_caching \
gem_concurrent_blit \
@@ -47,7 +48,6 @@ TESTS_progs_M = \
gem_ringfill \
gem_set_tiling_vs_blt \
gem_storedw_batches_loop \
- gem_suspend \
gem_tiled_blits \
gem_tiled_partial_pwrite_pread \
gem_write_read_ring_switch \
@@ -131,14 +131,14 @@ TESTS_scripts_M = \
TESTS_scripts = \
debugfs_emon_crash \
- debugfs_reader \
- module_reload \
+ drv_debugfs_reader \
+ drv_hangman \
+ drv_missed_irq_hang \
+ drv_module_reload \
sysfs_edid_timing \
sysfs_l3_parity \
test_rte_check \
tools_test \
- ZZ_hangman \
- ZZ_missed_irq \
$(NULL)
# This target contains testcases which support automagic subtest enumeration
diff --git a/tests/NAMING-CONVENTION b/tests/NAMING-CONVENTION
index 4ae98481ebeb..c22e4cf8a7fa 100644
--- a/tests/NAMING-CONVENTION
+++ b/tests/NAMING-CONVENTION
@@ -17,6 +17,8 @@ gem_: Used for all kinds of GEM tests.
prime_: Used for buffer sharing tests, both for self-importing (used by
dri3/wayland) and actual multi-gpu tests.
+drv_: Tests for overall driver behaviour like module reload, s/r, debugfs files.
+
gen3_: Used by Chris' gen3 specific tiling/fencing tests. Generally tests that
only run on some platforms don't have a specific prefix but just skip on
platforms where the test doesn't apply.
diff --git a/tests/ZZ_hangman b/tests/ZZ_hangman
deleted file mode 100755
index 6b310bc9a7b5..000000000000
--- a/tests/ZZ_hangman
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/bin/bash
-#
-# Testcase: Simulate gpu hang
-#
-# This check uses the stop_rings facility to exercise the gpu hang code.
-# by reading /sys/kernel/debug/dri/0/i915_emon_status too quickly
-#
-
-SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
-. $SOURCE_DIR/drm_lib.sh
-
-oldpath=`pwd`
-
-cd $i915_dfs_path
-
-if [ ! -f i915_ring_stop ] ; then
- echo "kernel doesn't support ring stopping"
- exit 77
-fi
-
-function check_iface {
- dir="$1"
- file="$2"
- mandatory="$3"
-
- [ -z "$dir" ] && return
-
- path="$dir/$file"
- echo checking ${path}
-
- if [ ! -f "$path" ] ; then
- if [ $mandatory != 0 ] ; then
- echo "'${path}' not found";
- exit 1;
- else
- echo "${path} not mandatory";
- return;
- fi
- fi
-
- if cat "$path" | grep -v "no error state collected" > /dev/null ; then
- echo "gpu hang detected"
- exit 2
- fi
-
- echo 0xf > i915_ring_stop
- echo "rings stopped"
-
- (cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
-
- if cat "$path" | grep -v "no error state collected" > /dev/null ; then
- echo "gpu hang correctly detected"
- else
- echo "gpu hang not detected"
- exit 3
- fi
-
-# clear error state
- echo > "$path"
-
- if cat "$path" | grep -v "no error state collected" > /dev/null ; then
- echo "gpu hang still present"
- exit 4
- fi
-}
-
-check_iface "$i915_dfs_path" i915_error_state 1
-check_iface "$i915_sfs_path" error 0
-
-exit 0
diff --git a/tests/ZZ_missed_irq b/tests/ZZ_missed_irq
deleted file mode 100755
index a99dc80c57ae..000000000000
--- a/tests/ZZ_missed_irq
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/bash
-#
-# Testcase: Simulate missed breadcrumb interrupts
-#
-
-SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
-. $SOURCE_DIR/drm_lib.sh
-
-oldpath=`pwd`
-
-cd $i915_dfs_path
-
-echo $SOURCE_DIR
-
-function check_for_missed_irq {
- if test `cat i915_ring_missed_irq` = 0x00000000; then
- echo "missed interrupts undetected"
- exit 1
- fi
-}
-
-function check_for_hang {
- if cat i915_error_state | grep -v "no error state collected" > /dev/null ; then
- echo "gpu hang reported"
- exit 2
- fi
-}
-
-if [ ! -f i915_ring_missed_irq ] ; then
- echo "kernel doesn't support interrupt masking"
- exit 77
-fi
-
-# clear error state first
-echo > i915_error_state
-check_for_hang
-
-echo 0xf > i915_ring_test_irq
-echo "Interrupts masked"
-if test `cat i915_ring_test_irq` != 0x0000000f; then
- echo "Failed to set interrupt mask"
- exit 3
-fi
-
-(cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
-
-check_for_missed_irq
-check_for_hang
-
-(cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
-
-check_for_hang
-
-echo 0 > i915_ring_test_irq
-echo "Interrupts unmasked"
-if test `cat i915_ring_test_irq` != 0x00000000; then
- echo "Failed to clear interrupt mask"
- exit 3
-fi
-
-(cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
-
-check_for_hang
-
-echo 0 > i915_ring_missed_irq
-echo "Cleared missed interrupts"
-if test `cat i915_ring_missed_irq` != 0x00000000; then
- echo "Failed to clear missed interrupts"
- exit 3
-fi
-
-exit 0
diff --git a/tests/debugfs_reader b/tests/debugfs_reader
deleted file mode 100755
index 9e2845ebc2bd..000000000000
--- a/tests/debugfs_reader
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
-. $SOURCE_DIR/drm_lib.sh
-
-# read everything we can
-cat $i915_dfs_path/* > /dev/null 2>&1
-
-exit 0
diff --git a/tests/drv_debugfs_reader b/tests/drv_debugfs_reader
new file mode 100755
index 000000000000..9e2845ebc2bd
--- /dev/null
+++ b/tests/drv_debugfs_reader
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
+. $SOURCE_DIR/drm_lib.sh
+
+# read everything we can
+cat $i915_dfs_path/* > /dev/null 2>&1
+
+exit 0
diff --git a/tests/drv_hangman b/tests/drv_hangman
new file mode 100755
index 000000000000..6b310bc9a7b5
--- /dev/null
+++ b/tests/drv_hangman
@@ -0,0 +1,70 @@
+#!/bin/bash
+#
+# Testcase: Simulate gpu hang
+#
+# This check uses the stop_rings facility to exercise the gpu hang code.
+# by reading /sys/kernel/debug/dri/0/i915_emon_status too quickly
+#
+
+SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
+. $SOURCE_DIR/drm_lib.sh
+
+oldpath=`pwd`
+
+cd $i915_dfs_path
+
+if [ ! -f i915_ring_stop ] ; then
+ echo "kernel doesn't support ring stopping"
+ exit 77
+fi
+
+function check_iface {
+ dir="$1"
+ file="$2"
+ mandatory="$3"
+
+ [ -z "$dir" ] && return
+
+ path="$dir/$file"
+ echo checking ${path}
+
+ if [ ! -f "$path" ] ; then
+ if [ $mandatory != 0 ] ; then
+ echo "'${path}' not found";
+ exit 1;
+ else
+ echo "${path} not mandatory";
+ return;
+ fi
+ fi
+
+ if cat "$path" | grep -v "no error state collected" > /dev/null ; then
+ echo "gpu hang detected"
+ exit 2
+ fi
+
+ echo 0xf > i915_ring_stop
+ echo "rings stopped"
+
+ (cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
+
+ if cat "$path" | grep -v "no error state collected" > /dev/null ; then
+ echo "gpu hang correctly detected"
+ else
+ echo "gpu hang not detected"
+ exit 3
+ fi
+
+# clear error state
+ echo > "$path"
+
+ if cat "$path" | grep -v "no error state collected" > /dev/null ; then
+ echo "gpu hang still present"
+ exit 4
+ fi
+}
+
+check_iface "$i915_dfs_path" i915_error_state 1
+check_iface "$i915_sfs_path" error 0
+
+exit 0
diff --git a/tests/drv_missed_irq_hang b/tests/drv_missed_irq_hang
new file mode 100755
index 000000000000..a99dc80c57ae
--- /dev/null
+++ b/tests/drv_missed_irq_hang
@@ -0,0 +1,72 @@
+#!/bin/bash
+#
+# Testcase: Simulate missed breadcrumb interrupts
+#
+
+SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
+. $SOURCE_DIR/drm_lib.sh
+
+oldpath=`pwd`
+
+cd $i915_dfs_path
+
+echo $SOURCE_DIR
+
+function check_for_missed_irq {
+ if test `cat i915_ring_missed_irq` = 0x00000000; then
+ echo "missed interrupts undetected"
+ exit 1
+ fi
+}
+
+function check_for_hang {
+ if cat i915_error_state | grep -v "no error state collected" > /dev/null ; then
+ echo "gpu hang reported"
+ exit 2
+ fi
+}
+
+if [ ! -f i915_ring_missed_irq ] ; then
+ echo "kernel doesn't support interrupt masking"
+ exit 77
+fi
+
+# clear error state first
+echo > i915_error_state
+check_for_hang
+
+echo 0xf > i915_ring_test_irq
+echo "Interrupts masked"
+if test `cat i915_ring_test_irq` != 0x0000000f; then
+ echo "Failed to set interrupt mask"
+ exit 3
+fi
+
+(cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
+
+check_for_missed_irq
+check_for_hang
+
+(cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
+
+check_for_hang
+
+echo 0 > i915_ring_test_irq
+echo "Interrupts unmasked"
+if test `cat i915_ring_test_irq` != 0x00000000; then
+ echo "Failed to clear interrupt mask"
+ exit 3
+fi
+
+(cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
+
+check_for_hang
+
+echo 0 > i915_ring_missed_irq
+echo "Cleared missed interrupts"
+if test `cat i915_ring_missed_irq` != 0x00000000; then
+ echo "Failed to clear missed interrupts"
+ exit 3
+fi
+
+exit 0
diff --git a/tests/drv_module_reload b/tests/drv_module_reload
new file mode 100755
index 000000000000..c1fd395731ca
--- /dev/null
+++ b/tests/drv_module_reload
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# Testcase: Reload the drm module
+#
+# ... we've broken this way too often :(
+#
+
+SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
+. $SOURCE_DIR/drm_lib.sh
+
+# no other drm service should be running, so we can just unbind
+
+# vtcon0 is vga, vtcon1 fbcon and let's pray that won't change due to boot load
+# time changes
+if ! echo 0 > /sys/class/vtconsole/vtcon1/bind ; then
+ echo -e "no kms unload support"
+ echo "please enable CONFIG_VT_HW_CONSOLE_BINDING in the kernel"
+ exit 77
+fi
+
+# The sound driver uses our power well
+pkill alsactl
+rmmod snd_hda_intel &> /dev/null
+
+#ignore errors in ips - gen5 only
+rmmod intel_ips &> /dev/null
+rmmod i915
+#ignore errors in intel-gtt, often built-in
+rmmod intel-gtt &> /dev/null
+# drm may be used by other devices (nouveau, radeon, udl, etc)
+rmmod drm_kms_helper &> /dev/null
+rmmod drm &> /dev/null
+
+if lsmod | grep i915 &> /dev/null ; then
+ echo WARNING: i915.ko still loaded!
+ exitcode=1
+else
+ echo module successfully unloaded
+ exitcode=0
+fi
+
+modprobe i915
+echo 1 > /sys/class/vtconsole/vtcon1/bind
+
+modprobe snd_hda_intel
+
+# try to run something
+$SOURCE_DIR/gem_exec_nop > /dev/null && echo "module successfully loaded again"
+
+exit $exitcode
diff --git a/tests/drv_suspend.c b/tests/drv_suspend.c
new file mode 100644
index 000000000000..e526e2a21916
--- /dev/null
+++ b/tests/drv_suspend.c
@@ -0,0 +1,171 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Daniel Vetter <daniel.vetter at ffwll.ch>
+ *
+ */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include "drm.h"
+#include "i915_drm.h"
+#include "drmtest.h"
+
+#define OBJECT_SIZE (16*1024*1024)
+
+static void
+test_fence_restore(int fd, bool tiled2untiled)
+{
+ uint32_t handle1, handle2, handle_tiled;
+ uint32_t *ptr1, *ptr2, *ptr_tiled;
+ int i;
+
+ /* We wall the tiled object with untiled canary objects to make sure
+ * that we detect tile leaking in both directions. */
+ handle1 = gem_create(fd, OBJECT_SIZE);
+ handle2 = gem_create(fd, OBJECT_SIZE);
+ handle_tiled = gem_create(fd, OBJECT_SIZE);
+
+ /* Access the buffer objects in the order we want to have the laid out. */
+ ptr1 = gem_mmap(fd, handle1, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+ igt_assert(ptr1 != MAP_FAILED);
+ for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
+ ptr1[i] = i;
+
+ ptr_tiled = gem_mmap(fd, handle_tiled, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+ igt_assert(ptr_tiled != MAP_FAILED);
+ if (tiled2untiled)
+ gem_set_tiling(fd, handle_tiled, I915_TILING_X, 2048);
+ for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
+ ptr_tiled[i] = i;
+
+ ptr2 = gem_mmap(fd, handle2, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+ igt_assert(ptr2 != MAP_FAILED);
+ for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
+ ptr2[i] = i;
+
+ if (tiled2untiled)
+ gem_set_tiling(fd, handle_tiled, I915_TILING_NONE, 2048);
+ else
+ gem_set_tiling(fd, handle_tiled, I915_TILING_X, 2048);
+
+ igt_system_suspend_autoresume();
+
+ printf("checking the first canary object\n");
+ for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
+ igt_assert(ptr1[i] == i);
+
+ printf("checking the second canary object\n");
+ for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
+ igt_assert(ptr2[i] == i);
+
+ gem_close(fd, handle1);
+ gem_close(fd, handle2);
+ gem_close(fd, handle_tiled);
+
+ munmap(ptr1, OBJECT_SIZE);
+ munmap(ptr2, OBJECT_SIZE);
+ munmap(ptr_tiled, OBJECT_SIZE);
+}
+
+static void
+test_debugfs_reader(void)
+{
+ struct igt_helper_process reader = {};
+ reader.use_SIGKILL = true;
+
+ igt_fork_helper(&reader) {
+ static const char dfs_base[] = "/sys/kernel/debug/dri";
+ static char tmp[1024];
+
+ snprintf(tmp, sizeof(tmp) - 1,
+ "while true; do find %s/%i/ -type f | xargs cat &> /dev/null; done",
+ dfs_base, drm_get_card());
+ assert(execl("/bin/sh", "sh", "-c", tmp, (char *) NULL) != -1);
+ }
+
+ sleep(1);
+
+ igt_system_suspend_autoresume();
+
+ sleep(1);
+
+ igt_stop_helper(&reader);
+}
+
+static void
+test_sysfs_reader(void)
+{
+ struct igt_helper_process reader = {};
+ reader.use_SIGKILL = true;
+
+ igt_fork_helper(&reader) {
+ static const char dfs_base[] = "/sys/class/drm/card";
+ static char tmp[1024];
+
+ snprintf(tmp, sizeof(tmp) - 1,
+ "while true; do find %s%i*/ -type f | xargs cat &> /dev/null; done",
+ dfs_base, drm_get_card());
+ assert(execl("/bin/sh", "sh", "-c", tmp, (char *) NULL) != -1);
+ }
+
+ sleep(1);
+
+ igt_system_suspend_autoresume();
+
+ sleep(1);
+
+ igt_stop_helper(&reader);
+}
+
+int fd;
+
+igt_main
+{
+ igt_skip_on_simulation();
+
+ igt_fixture
+ fd = drm_open_any();
+
+ igt_subtest("fence-restore-tiled2untiled")
+ test_fence_restore(fd, true);
+
+ igt_subtest("fence-restore-untiled")
+ test_fence_restore(fd, false);
+
+ igt_subtest("debugfs-reader")
+ test_debugfs_reader();
+
+ igt_subtest("sysfs-reader")
+ test_sysfs_reader();
+
+ igt_fixture
+ close(fd);
+}
diff --git a/tests/gem_suspend.c b/tests/gem_suspend.c
deleted file mode 100644
index e526e2a21916..000000000000
--- a/tests/gem_suspend.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright © 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
- * Authors:
- * Daniel Vetter <daniel.vetter at ffwll.ch>
- *
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include "drm.h"
-#include "i915_drm.h"
-#include "drmtest.h"
-
-#define OBJECT_SIZE (16*1024*1024)
-
-static void
-test_fence_restore(int fd, bool tiled2untiled)
-{
- uint32_t handle1, handle2, handle_tiled;
- uint32_t *ptr1, *ptr2, *ptr_tiled;
- int i;
-
- /* We wall the tiled object with untiled canary objects to make sure
- * that we detect tile leaking in both directions. */
- handle1 = gem_create(fd, OBJECT_SIZE);
- handle2 = gem_create(fd, OBJECT_SIZE);
- handle_tiled = gem_create(fd, OBJECT_SIZE);
-
- /* Access the buffer objects in the order we want to have the laid out. */
- ptr1 = gem_mmap(fd, handle1, OBJECT_SIZE, PROT_READ | PROT_WRITE);
- igt_assert(ptr1 != MAP_FAILED);
- for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
- ptr1[i] = i;
-
- ptr_tiled = gem_mmap(fd, handle_tiled, OBJECT_SIZE, PROT_READ | PROT_WRITE);
- igt_assert(ptr_tiled != MAP_FAILED);
- if (tiled2untiled)
- gem_set_tiling(fd, handle_tiled, I915_TILING_X, 2048);
- for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
- ptr_tiled[i] = i;
-
- ptr2 = gem_mmap(fd, handle2, OBJECT_SIZE, PROT_READ | PROT_WRITE);
- igt_assert(ptr2 != MAP_FAILED);
- for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
- ptr2[i] = i;
-
- if (tiled2untiled)
- gem_set_tiling(fd, handle_tiled, I915_TILING_NONE, 2048);
- else
- gem_set_tiling(fd, handle_tiled, I915_TILING_X, 2048);
-
- igt_system_suspend_autoresume();
-
- printf("checking the first canary object\n");
- for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
- igt_assert(ptr1[i] == i);
-
- printf("checking the second canary object\n");
- for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++)
- igt_assert(ptr2[i] == i);
-
- gem_close(fd, handle1);
- gem_close(fd, handle2);
- gem_close(fd, handle_tiled);
-
- munmap(ptr1, OBJECT_SIZE);
- munmap(ptr2, OBJECT_SIZE);
- munmap(ptr_tiled, OBJECT_SIZE);
-}
-
-static void
-test_debugfs_reader(void)
-{
- struct igt_helper_process reader = {};
- reader.use_SIGKILL = true;
-
- igt_fork_helper(&reader) {
- static const char dfs_base[] = "/sys/kernel/debug/dri";
- static char tmp[1024];
-
- snprintf(tmp, sizeof(tmp) - 1,
- "while true; do find %s/%i/ -type f | xargs cat &> /dev/null; done",
- dfs_base, drm_get_card());
- assert(execl("/bin/sh", "sh", "-c", tmp, (char *) NULL) != -1);
- }
-
- sleep(1);
-
- igt_system_suspend_autoresume();
-
- sleep(1);
-
- igt_stop_helper(&reader);
-}
-
-static void
-test_sysfs_reader(void)
-{
- struct igt_helper_process reader = {};
- reader.use_SIGKILL = true;
-
- igt_fork_helper(&reader) {
- static const char dfs_base[] = "/sys/class/drm/card";
- static char tmp[1024];
-
- snprintf(tmp, sizeof(tmp) - 1,
- "while true; do find %s%i*/ -type f | xargs cat &> /dev/null; done",
- dfs_base, drm_get_card());
- assert(execl("/bin/sh", "sh", "-c", tmp, (char *) NULL) != -1);
- }
-
- sleep(1);
-
- igt_system_suspend_autoresume();
-
- sleep(1);
-
- igt_stop_helper(&reader);
-}
-
-int fd;
-
-igt_main
-{
- igt_skip_on_simulation();
-
- igt_fixture
- fd = drm_open_any();
-
- igt_subtest("fence-restore-tiled2untiled")
- test_fence_restore(fd, true);
-
- igt_subtest("fence-restore-untiled")
- test_fence_restore(fd, false);
-
- igt_subtest("debugfs-reader")
- test_debugfs_reader();
-
- igt_subtest("sysfs-reader")
- test_sysfs_reader();
-
- igt_fixture
- close(fd);
-}
diff --git a/tests/module_reload b/tests/module_reload
deleted file mode 100755
index c1fd395731ca..000000000000
--- a/tests/module_reload
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/bash
-#
-# Testcase: Reload the drm module
-#
-# ... we've broken this way too often :(
-#
-
-SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
-. $SOURCE_DIR/drm_lib.sh
-
-# no other drm service should be running, so we can just unbind
-
-# vtcon0 is vga, vtcon1 fbcon and let's pray that won't change due to boot load
-# time changes
-if ! echo 0 > /sys/class/vtconsole/vtcon1/bind ; then
- echo -e "no kms unload support"
- echo "please enable CONFIG_VT_HW_CONSOLE_BINDING in the kernel"
- exit 77
-fi
-
-# The sound driver uses our power well
-pkill alsactl
-rmmod snd_hda_intel &> /dev/null
-
-#ignore errors in ips - gen5 only
-rmmod intel_ips &> /dev/null
-rmmod i915
-#ignore errors in intel-gtt, often built-in
-rmmod intel-gtt &> /dev/null
-# drm may be used by other devices (nouveau, radeon, udl, etc)
-rmmod drm_kms_helper &> /dev/null
-rmmod drm &> /dev/null
-
-if lsmod | grep i915 &> /dev/null ; then
- echo WARNING: i915.ko still loaded!
- exitcode=1
-else
- echo module successfully unloaded
- exitcode=0
-fi
-
-modprobe i915
-echo 1 > /sys/class/vtconsole/vtcon1/bind
-
-modprobe snd_hda_intel
-
-# try to run something
-$SOURCE_DIR/gem_exec_nop > /dev/null && echo "module successfully loaded again"
-
-exit $exitcode
--
1.8.4.rc3
More information about the Intel-gfx
mailing list