[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

intel-gpu-tools: Changes to 'upstream-unstable'



 NEWS                                                    |   37 
 README                                                  |    2 
 assembler/gen8_disasm.c                                 |    5 
 benchmarks/gem_latency.c                                |    1 
 configure.ac                                            |   18 
 docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml |    1 
 lib/Makefile.am                                         |    7 
 lib/Makefile.sources                                    |   12 
 lib/drm_mm_selftests.h                                  |   24 
 lib/drmtest.c                                           |    2 
 lib/drmtest.h                                           |    7 
 lib/i915_live_selftests.h                               |   19 
 lib/i915_mock_selftests.h                               |   20 
 lib/i915_pciids.h                                       |   42 
 lib/igt.h                                               |    1 
 lib/igt_aux.c                                           |  107 
 lib/igt_aux.h                                           |   18 
 lib/igt_chamelium.c                                     | 1346 +++++++++
 lib/igt_chamelium.h                                     |  103 
 lib/igt_core.c                                          |    3 
 lib/igt_core.h                                          |   38 
 lib/igt_debugfs.c                                       |  352 +-
 lib/igt_debugfs.h                                       |   20 
 lib/igt_draw.c                                          |    6 
 lib/igt_dummyload.c                                     |   20 
 lib/igt_fb.c                                            |    6 
 lib/igt_gt.c                                            |   20 
 lib/igt_gt.h                                            |    2 
 lib/igt_kmod.c                                          |  253 +
 lib/igt_kmod.h                                          |   39 
 lib/igt_kms.c                                           |  724 +++-
 lib/igt_kms.h                                           |  120 
 lib/igt_sysfs.c                                         |   92 
 lib/igt_sysfs.h                                         |    4 
 lib/igt_vc4.c                                           |    2 
 lib/intel_batchbuffer.c                                 |    4 
 lib/intel_chipset.h                                     |    2 
 lib/intel_device_info.c                                 |   35 
 lib/intel_os.c                                          |    3 
 lib/ioctl_wrappers.c                                    |  112 
 lib/ioctl_wrappers.h                                    |   32 
 lib/stubs/drm/intel_bufmgr.c                            |   71 
 lib/stubs/drm/intel_bufmgr.h                            |    2 
 lib/sw_sync.c                                           |  263 +
 lib/sw_sync.h                                           |   51 
 m4/ax_gcc_func_attribute.m4                             |  226 +
 man/Makefile.am                                         |    4 
 man/intel_bios_dumper.rst                               |    2 
 man/intel_bios_reader.rst                               |   69 
 man/intel_vbt_decode.rst                                |   69 
 overlay/gpu-perf.h                                      |    4 
 overlay/gpu-top.h                                       |    2 
 overlay/igfx.c                                          |    9 
 overlay/x11/x11-overlay.c                               |   13 
 scripts/run-tests.sh                                    |   10 
 tests/Makefile.am                                       |    5 
 tests/Makefile.sources                                  |   13 
 tests/chamelium.c                                       |  750 +++++
 tests/drm_mm.c                                          |   17 
 tests/drv_hangman.c                                     |  231 -
 tests/drv_missed_irq.c                                  |   77 
 tests/drv_module_reload.c                               |   14 
 tests/drv_selftest.c                                    |   24 
 tests/drv_suspend.c                                     |    2 
 tests/eviction_common.c                                 |   23 
 tests/feat_profile.json                                 |    7 
 tests/gem_busy.c                                        |  146 
 tests/gem_close_race.c                                  |    7 
 tests/gem_concurrent_all.c                              |   28 
 tests/gem_cpu_reloc.c                                   |    7 
 tests/gem_create.c                                      |    2 
 tests/gem_cs_prefetch.c                                 |    5 
 tests/gem_cs_tlb.c                                      |    6 
 tests/gem_ctx_bad_exec.c                                |    2 
 tests/gem_ctx_create.c                                  |    7 
 tests/gem_ctx_exec.c                                    |    5 
 tests/gem_ctx_switch.c                                  |    6 
 tests/gem_ctx_thrash.c                                  |   10 
 tests/gem_eio.c                                         |    5 
 tests/gem_evict_alignment.c                             |    5 
 tests/gem_evict_everything.c                            |    5 
 tests/gem_exec_alignment.c                              |   10 
 tests/gem_exec_async.c                                  |   11 
 tests/gem_exec_bad_domains.c                            |    5 
 tests/gem_exec_basic.c                                  |    7 
 tests/gem_exec_big.c                                    |   10 
 tests/gem_exec_blt.c                                    |    4 
 tests/gem_exec_create.c                                 |    3 
 tests/gem_exec_faulting_reloc.c                         |    5 
 tests/gem_exec_fence.c                                  |   34 
 tests/gem_exec_flush.c                                  |   17 
 tests/gem_exec_gttfill.c                                |   11 
 tests/gem_exec_latency.c                                |  246 +
 tests/gem_exec_lut_handle.c                             |   11 
 tests/gem_exec_nop.c                                    |  167 +
 tests/gem_exec_parallel.c                               |    7 
 tests/gem_exec_params.c                                 |   29 
 tests/gem_exec_parse.c                                  |  133 
 tests/gem_exec_reloc.c                                  |  384 +-
 tests/gem_exec_reuse.c                                  |  237 +
 tests/gem_exec_schedule.c                               |   27 
 tests/gem_exec_store.c                                  |   21 
 tests/gem_exec_suspend.c                                |   13 
 tests/gem_exec_whisper.c                                |   31 
 tests/gem_fenced_exec_thrash.c                          |    5 
 tests/gem_gtt_hog.c                                     |    7 
 tests/gem_linear_blits.c                                |    5 
 tests/gem_lut_handle.c                                  |    8 
 tests/gem_madvise.c                                     |   20 
 tests/gem_mmap.c                                        |    2 
 tests/gem_mmap_gtt.c                                    |  109 
 tests/gem_mmap_wc.c                                     |    2 
 tests/gem_mocs_settings.c                               |    6 
 tests/gem_persistent_relocs.c                           |    4 
 tests/gem_pin.c                                         |    8 
 tests/gem_ppgtt.c                                       |    2 
 tests/gem_pwrite_pread.c                                |    4 
 tests/gem_readwrite.c                                   |    4 
 tests/gem_reloc_overflow.c                              |   13 
 tests/gem_reloc_vs_gpu.c                                |    7 
 tests/gem_render_linear_blits.c                         |   12 
 tests/gem_render_tiled_blits.c                          |   12 
 tests/gem_request_retire.c                              |    9 
 tests/gem_reset_stats.c                                 |    4 
 tests/gem_ring_sync_loop.c                              |    5 
 tests/gem_ringfill.c                                    |  246 +
 tests/gem_shrink.c                                      |    8 
 tests/gem_softpin.c                                     |   17 
 tests/gem_spin_batch.c                                  |   86 
 tests/gem_storedw_loop.c                                |    4 
 tests/gem_streaming_writes.c                            |   12 
 tests/gem_sync.c                                        |   19 
 tests/gem_tiled_blits.c                                 |    1 
 tests/gem_tiled_fence_blits.c                           |    1 
 tests/gem_userptr_blits.c                               |  158 -
 tests/gem_wait.c                                        |  103 
 tests/gen7_forcewake_mt.c                               |    3 
 tests/intel-ci/fast-feedback.testlist                   |   45 
 tests/kms_addfb_basic.c                                 |    4 
 tests/kms_atomic.c                                      |  323 +-
 tests/kms_atomic_transition.c                           |  274 +
 tests/kms_busy.c                                        |  236 +
 tests/kms_ccs.c                                         |  310 ++
 tests/kms_chv_cursor_fail.c                             |   22 
 tests/kms_crtc_background_color.c                       |    4 
 tests/kms_cursor_crc.c                                  |   56 
 tests/kms_cursor_legacy.c                               |  492 +--
 tests/kms_draw_crc.c                                    |    7 
 tests/kms_fbc_crc.c                                     |   74 
 tests/kms_fence_pin_leak.c                              |   22 
 tests/kms_flip.c                                        |   29 
 tests/kms_flip_event_leak.c                             |   21 
 tests/kms_frontbuffer_tracking.c                        |   99 
 tests/kms_legacy_colorkey.c                             |    4 
 tests/kms_mmap_write_crc.c                              |   31 
 tests/kms_mmio_vs_cs_flip.c                             |   46 
 tests/kms_panel_fitting.c                               |   16 
 tests/kms_pipe_b_c_ivb.c                                |   12 
 tests/kms_pipe_color.c                                  |   28 
 tests/kms_pipe_crc_basic.c                              |   45 
 tests/kms_plane.c                                       |  100 
 tests/kms_plane_lowres.c                                |  363 ++
 tests/kms_plane_multiple.c                              |  280 +
 tests/kms_plane_scaling.c                               |   15 
 tests/kms_properties.c                                  |   10 
 tests/kms_psr_sink_crc.c                                |   52 
 tests/kms_pwrite_crc.c                                  |   31 
 tests/kms_rmfb.c                                        |    2 
 tests/kms_rotation_crc.c                                |  269 +
 tests/kms_setmode.c                                     |   36 
 tests/kms_sink_crc_basic.c                              |    2 
 tests/kms_tv_load_detect.c                              |   91 
 tests/kms_universal_plane.c                             |   50 
 tests/kms_vblank.c                                      |   48 
 tests/perf.c                                            | 2381 ++++++++++++++++
 tests/prime_busy.c                                      |    4 
 tests/prime_mmap_kms.c                                  |   50 
 tests/prime_vgem.c                                      |    1 
 tests/sw_sync.c                                         |  938 ++++++
 tests/testdisplay.c                                     |    1 
 tools/.gitignore                                        |    4 
 tools/Makefile.am                                       |    6 
 tools/Makefile.sources                                  |   13 
 tools/aubdump.c                                         |    3 
 tools/intel_bios.h                                      |    3 
 tools/intel_bios_reader                                 |binary
 tools/intel_bios_reader.c                               | 1880 ------------
 tools/intel_display_poller.c                            |   10 
 tools/intel_dp_compliance.c                             | 1105 +++++++
 tools/intel_dp_compliance.h                             |   35 
 tools/intel_dp_compliance_hotplug.c                     |  124 
 tools/intel_guc_logger.c                                |    2 
 tools/intel_gvtg_test.c                                 |  354 ++
 tools/intel_opregion_decode.c                           |    2 
 tools/intel_vbt_decode.c                                | 1888 ++++++++++++
 tools/registers/cherryview                              |    1 
 tools/registers/skl_display.txt                         |   12 
 tools/registers/valleyview                              |    1 
 tools/registers/vlv_cck.txt                             |   11 
 199 files changed, 16118 insertions(+), 4454 deletions(-)

New commits:
commit bb97a0542adf2ae2adab946b2e3fee396d54063a
Author: Petri Latvala <petri.latvala@intel.com>
Date:   Mon Mar 13 15:47:13 2017 +0200

    Update NEWS, bump version to 1.18.
    
    Signed-off-by: Petri Latvala <petri.latvala@intel.com>

diff --git a/NEWS b/NEWS
index 1f824bd..bb893a3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,40 @@
+Release 1.18 (2017-03-13)
+-------------------------
+
+Library changes:
+
+- Various changes to library functions so that they don't assume Intel
+  hardware. (Lyude)
+
+- Added helper functions for managing synchronization primitives.
+  (Robert Foss)
+
+- Added support for the new generic CRC capture kernel ABI. (Tomeu
+  Vizoso)
+
+- Added Geminilake platform support. (Ander Conselvan de Oliveira)
+
+- Added helpers for sysfs hotplug events. (Lyude)
+
+- Added support for hotplug testing with the Chamelium device (Lyude)
+
+Tools changes:
+
+- intel_dp_compliance: New tool for running automated DisplayPort
+  compliance tests. (Manasi Navare)
+
+- Renamed intel_bios_reader to intel_vbt_decode. (Jani Nikula)
+
+- intel_gvtg_test: New tool for setting up GVT-g guests based on
+  KVMGT. (Terrence Xu)
+
+Test changes:
+
+- Multiple new tests.
+
+
+And many other bug fixes and improvements.
+
 Release 1.17 (2016-12-02)
 -------------------------
 
diff --git a/configure.ac b/configure.ac
index 407fddf..12b0ab0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
 
 AC_PREREQ([2.60])
 AC_INIT([intel-gpu-tools],
-	[1.17],
+	[1.18],
 	[https://bugs.freedesktop.org/enter_bug.cgi?product=DRI&component=IGT],
 	[intel-gpu-tools])
 

commit 7ab5c97924bf971a348ff4a1768da624ba2f564c
Author: Petri Latvala <petri.latvala@intel.com>
Date:   Fri Mar 10 16:20:33 2017 +0200

    Always expose IGT subtests for known kernel selftests
    
    Even when the running kernel does not support selftests, make subtest
    enumeration list known kselftests. The list is generated using
    selftest listing headers copied from the kernel.
    
    If the running kernel gains new selftest subtests, they are listed
    even without copying the headers over and rebuilding IGT.
    
    v2: Use correct names for the testcases
    
    Signed-off-by: Petri Latvala <petri.latvala@intel.com>

diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 4b8ea81..86b7896 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -493,30 +493,54 @@ void igt_kselftest_fini(struct igt_kselftest *tst)
 	kmod_module_unref(tst->kmod);
 }
 
+static void mocklist_mark_entry(struct igt_kselftest_mockentry *mocklist,
+				const char *name)
+{
+	struct igt_kselftest_mockentry *me;
+
+	for (me = mocklist; me->name != NULL; ++me) {
+		if (!strcmp(me->name, name)) {
+			me->do_mock = false;
+			return;
+		}
+	}
+}
+
 void igt_kselftests(const char *module_name,
 		    const char *options,
 		    const char *result,
-		    const char *filter)
+		    const char *filter,
+		    struct igt_kselftest_mockentry *mocklist)
 {
 	struct igt_kselftest tst;
 	IGT_LIST(tests);
 	struct igt_kselftest_list *tl, *tn;
+	struct igt_kselftest_mockentry *me;
 
-	igt_require(igt_kselftest_init(&tst, module_name) == 0);
-	igt_fixture
-		igt_require(igt_kselftest_begin(&tst) == 0);
+	if (igt_kselftest_init(&tst, module_name) == 0) {
+		igt_fixture
+			igt_require(igt_kselftest_begin(&tst) == 0);
 
-	igt_kselftest_get_tests(tst.kmod, filter, &tests);
-	igt_list_for_each_safe(tl, tn, &tests, link) {
-		igt_subtest_f("%s", tl->name)
-			igt_kselftest_execute(&tst, tl, options, result);
-		free(tl);
-	}
+		igt_kselftest_get_tests(tst.kmod, filter, &tests);
+		igt_list_for_each_safe(tl, tn, &tests, link) {
+			igt_subtest_f("%s", tl->name)
+				igt_kselftest_execute(&tst, tl, options, result);
+			mocklist_mark_entry(mocklist, tl->name);
+			free(tl);
+		}
 
-	igt_fixture {
-		igt_kselftest_end(&tst);
-		igt_require(!igt_list_empty(&tests));
+		igt_fixture {
+			igt_kselftest_end(&tst);
+			igt_require(!igt_list_empty(&tests));
+		}
+
+		igt_kselftest_fini(&tst);
 	}
 
-	igt_kselftest_fini(&tst);
+	/* Expose subtests for anything the above didn't already generate. */
+	for (me = mocklist; me->name != NULL; ++me) {
+		if (me->do_mock)
+			igt_subtest(me->name)
+				igt_skip("Kernel selftest not present");
+	}
 }
diff --git a/lib/igt_kmod.h b/lib/igt_kmod.h
index 10cd3a2..d49e9d4 100644
--- a/lib/igt_kmod.h
+++ b/lib/igt_kmod.h
@@ -35,10 +35,16 @@ int igt_kmod_unload(const char *mod_name, unsigned int flags);
 int igt_i915_driver_load(const char *opts);
 int igt_i915_driver_unload(void);
 
+struct igt_kselftest_mockentry {
+	const char *name;
+	bool do_mock;
+};
+
 void igt_kselftests(const char *module_name,
 		    const char *module_options,
 		    const char *result_option,
-		    const char *filter);
+		    const char *filter,
+		    struct igt_kselftest_mockentry* mocklist);
 
 struct igt_kselftest {
 	struct kmod_module *kmod;
diff --git a/tests/drm_mm.c b/tests/drm_mm.c
index 2052b11..2a3212e 100644
--- a/tests/drm_mm.c
+++ b/tests/drm_mm.c
@@ -28,5 +28,20 @@ IGT_TEST_DESCRIPTION("Basic sanity check of DRM's range manager (struct drm_mm)"
 
 igt_main
 {
-	igt_kselftests("test-drm_mm", NULL, NULL, NULL);
+	/*
+	 * Set of subtest names that are always exposed by IGT,
+	 * regardless of the running kernel's capabilities. Selftests
+	 * that the kernel has but are not on these lists are also
+	 * exposed. This is a known intentional violation of the
+	 * general rule that subtest enumeration must not change
+	 * depending on the runtime environment.
+	 */
+	struct igt_kselftest_mockentry drm_mm_testlist[] = {
+#define selftest(n, x) { .name = #n, .do_mock = true },
+#include "drm_mm_selftests.h"
+#undef selftest
+		{ NULL, false }
+	};
+
+	igt_kselftests("test-drm_mm", NULL, NULL, NULL, drm_mm_testlist);
 }
diff --git a/tests/drv_selftest.c b/tests/drv_selftest.c
index 96dd8bf..d9b58d5 100644
--- a/tests/drv_selftest.c
+++ b/tests/drv_selftest.c
@@ -28,6 +28,27 @@ IGT_TEST_DESCRIPTION("Basic unit tests for i915.ko");
 
 igt_main
 {
-	igt_kselftests("i915", "mock_selftests=-1", NULL, "mock");
-	igt_kselftests("i915", "live_selftests=-1", "live_selftests", "live");
+	/*
+	 * Set of subtest names that are always exposed by IGT,
+	 * regardless of the running kernel's capabilities. Selftests
+	 * that the kernel has but are not on these lists are also
+	 * exposed. This is a known intentional violation of the
+	 * general rule that subtest enumeration must not change
+	 * depending on the runtime environment.
+	 */
+	struct igt_kselftest_mockentry i915_mock_testlist[] = {
+#define selftest(n, x) { .name = "mock_" #n, .do_mock = true },
+#include "i915_mock_selftests.h"
+#undef selftest
+		{ NULL, false }
+	};
+	struct igt_kselftest_mockentry i915_live_testlist[] = {
+#define selftest(n, x) { .name = "live_" #n, .do_mock = true },
+#include "i915_live_selftests.h"
+#undef selftest
+		{ NULL, false }
+	};
+
+	igt_kselftests("i915", "mock_selftests=-1", NULL, "mock", i915_mock_testlist);
+	igt_kselftests("i915", "live_selftests=-1", "live_selftests", "live", i915_live_testlist);
 }

commit 5ca0da9f53023b9fcfd327a5f43bc7b0916b24b1
Author: Petri Latvala <petri.latvala@intel.com>
Date:   Fri Mar 10 13:18:19 2017 +0200

    lib: Add i915 and drm-mm selftest headers from the kernel
    
    Copied as of commit
    
     commit 496b575e3ccbf6fbe57a674c721af43dc8826361
     Author: Chris Wilson <chris@chris-wilson.co.uk>
     Date:   Mon Feb 13 17:15:58 2017 +0000
    
        drm/i915: Add initial selftests for hang detection and resets
    
    The headers are used to enumerate available tests when the running
    kernel does not support selftests.
    
    v2: Also add them to Makefile.sources
    
    Signed-off-by: Petri Latvala <petri.latvala@intel.com>

diff --git a/lib/Makefile.sources b/lib/Makefile.sources
index 6348487..151c3d9 100644
--- a/lib/Makefile.sources
+++ b/lib/Makefile.sources
@@ -83,6 +83,9 @@ lib_source_list =	 	\
 	uwildmat/uwildmat.c	\
 	igt_kmod.c		\
 	igt_kmod.h		\
+	drm_mm_selftests.h      \
+	i915_live_selftests.h   \
+	i915_mock_selftests.h   \
 	$(NULL)
 
 if HAVE_CHAMELIUM
diff --git a/lib/drm_mm_selftests.h b/lib/drm_mm_selftests.h
new file mode 100644
index 0000000..37bbdac
--- /dev/null
+++ b/lib/drm_mm_selftests.h
@@ -0,0 +1,24 @@
+/* List each unit test as selftest(name, function)
+ *
+ * The name is used as both an enum and expanded as igt__name to create
+ * a module parameter. It must be unique and legal for a C identifier.
+ *
+ * Tests are executed in order by igt/drm_mm
+ */
+selftest(sanitycheck, igt_sanitycheck) /* keep first (selfcheck for igt) */
+selftest(init, igt_init)
+selftest(debug, igt_debug)
+selftest(reserve, igt_reserve)
+selftest(insert, igt_insert)
+selftest(replace, igt_replace)
+selftest(insert_range, igt_insert_range)
+selftest(align, igt_align)
+selftest(align32, igt_align32)
+selftest(align64, igt_align64)
+selftest(evict, igt_evict)
+selftest(evict_range, igt_evict_range)
+selftest(bottomup, igt_bottomup)
+selftest(topdown, igt_topdown)
+selftest(color, igt_color)
+selftest(color_evict, igt_color_evict)
+selftest(color_evict_range, igt_color_evict_range)
diff --git a/lib/i915_live_selftests.h b/lib/i915_live_selftests.h
new file mode 100644
index 0000000..18b174d
--- /dev/null
+++ b/lib/i915_live_selftests.h
@@ -0,0 +1,19 @@
+/* List each unit test as selftest(name, function)
+ *
+ * The name is used as both an enum and expanded as subtest__name to create
+ * a module parameter. It must be unique and legal for a C identifier.
+ *
+ * The function should be of type int function(void). It may be conditionally
+ * compiled using #if IS_ENABLED(DRM_I915_SELFTEST).
+ *
+ * Tests are executed in order by igt/drv_selftest
+ */
+selftest(sanitycheck, i915_live_sanitycheck) /* keep first (igt selfcheck) */
+selftest(uncore, intel_uncore_live_selftests)
+selftest(requests, i915_gem_request_live_selftests)
+selftest(objects, i915_gem_object_live_selftests)
+selftest(dmabuf, i915_gem_dmabuf_live_selftests)
+selftest(coherency, i915_gem_coherency_live_selftests)
+selftest(gtt, i915_gem_gtt_live_selftests)
+selftest(contexts, i915_gem_context_live_selftests)
+selftest(hangcheck, intel_hangcheck_live_selftests)
diff --git a/lib/i915_mock_selftests.h b/lib/i915_mock_selftests.h
new file mode 100644
index 0000000..be9a9eb
--- /dev/null
+++ b/lib/i915_mock_selftests.h
@@ -0,0 +1,20 @@
+/* List each unit test as selftest(name, function)
+ *
+ * The name is used as both an enum and expanded as subtest__name to create
+ * a module parameter. It must be unique and legal for a C identifier.
+ *
+ * The function should be of type int function(void). It may be conditionally
+ * compiled using #if IS_ENABLED(DRM_I915_SELFTEST).
+ *
+ * Tests are executed in order by igt/drv_selftest
+ */
+selftest(sanitycheck, i915_mock_sanitycheck) /* keep first (igt selfcheck) */
+selftest(scatterlist, scatterlist_mock_selftests)
+selftest(uncore, intel_uncore_mock_selftests)
+selftest(breadcrumbs, intel_breadcrumbs_mock_selftests)
+selftest(requests, i915_gem_request_mock_selftests)
+selftest(objects, i915_gem_object_mock_selftests)
+selftest(dmabuf, i915_gem_dmabuf_mock_selftests)
+selftest(vma, i915_vma_mock_selftests)
+selftest(evict, i915_gem_evict_mock_selftests)
+selftest(gtt, i915_gem_gtt_mock_selftests)

commit 9ac59bcc14d146400ae1b8d3df36d53cd7678991
Author: Tomi Sarvela <tomi.p.sarvela@intel.com>
Date:   Mon Mar 13 13:53:10 2017 +0200

    scripts/run-tests.sh: Support testlist files
    
    This patch passes igt scripts/run-tests.sh -T option to piglit runner
    as --test-list.
    
    Restrictions to the option usage come from the piglit side:
    - only last --test-list is processed
    - no test regex inclusions or exclusions are processed if --test-list
    exists
    
    Signed-off-by: Tomi Sarvela <tomi.p.sarvela@intel.com>
    Reviewed-by: Petri Latvala <petri.latvala@intel.com>

diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh
index bc2528c..7b8de74 100755
--- a/scripts/run-tests.sh
+++ b/scripts/run-tests.sh
@@ -57,6 +57,8 @@ function print_help {
 	echo "  -s              create html summary"
 	echo "  -t <regex>      only include tests that match the regular expression"
 	echo "                  (can be used more than once)"
+	echo "  -T <filename>   run tests listed in testlist"
+	echo "                  (overrides -t and -x)"
 	echo "  -v              enable verbose mode"
 	echo "  -x <regex>      exclude tests that match the regular expression"
 	echo "                  (can be used more than once)"
@@ -81,7 +83,7 @@ function list_tests {
 	done
 }
 
-while getopts ":dhlr:st:vx:Rn" opt; do
+while getopts ":dhlr:st:T:vx:Rn" opt; do
 	case $opt in
 		d) download_piglit; exit ;;
 		h) print_help; exit ;;
@@ -89,6 +91,7 @@ while getopts ":dhlr:st:vx:Rn" opt; do
 		r) RESULTS="$OPTARG" ;;
 		s) SUMMARY="html" ;;
 		t) FILTER="$FILTER -t $OPTARG" ;;
+		T) FILTER="$FILTER --test-list $OPTARG" ;;
 		v) VERBOSE="-v" ;;
 		x) EXCLUDE="$EXCLUDE -x $OPTARG" ;;
 		R) RESUME="true" ;;

commit 90c883ce651dc74671086fdf8229902ebde593e7
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Mar 10 20:09:26 2017 +0000

    lib: Shrink all i915 caches before measuring avail memory
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/lib/intel_os.c b/lib/intel_os.c
index 0f9af63..924ac7e 100644
--- a/lib/intel_os.c
+++ b/lib/intel_os.c
@@ -51,6 +51,7 @@
 #include "intel_io.h"
 #include "drmtest.h"
 #include "igt_aux.h"
+#include "igt_debugfs.h"
 
 /**
  * intel_get_total_ram_mb:
@@ -295,6 +296,8 @@ void intel_purge_vm_caches(void)
 {
 	int fd;
 
+	igt_drop_caches_set(DROP_SHRINK_ALL);
+
 	fd = open("/proc/sys/vm/drop_caches", O_WRONLY);
 	if (fd >= 0) {
 		/* BIT(2): Be quiet. Cannot be combined with other operations,

commit e8eb9afd4c53e67d834f520a42a641adb874a463
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Mar 8 13:09:00 2017 +0000

    igt: Exercise the shrinker
    
    Introduce a new fork helper that spawns a process that just repeatedly
    calls i915_gem_shrink_all() and watch what happens as we try to use
    objects that have been shrunk.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 5117dbe..7ee279a 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -349,6 +349,45 @@ void igt_stop_signal_helper(void)
 	sig_stat = 0;
 }
 
+static struct igt_helper_process shrink_helper;
+static void __attribute__((noreturn)) shrink_helper_process(pid_t pid)
+{
+	while (1) {
+		igt_drop_caches_set(DROP_SHRINK_ALL);
+		usleep(1000 * 1000 / 50);
+		if (kill(pid, 0)) /* Parent has died, so must we. */
+			exit(0);
+	}
+}
+
+/**
+ * igt_fork_shrink_helper:
+ *
+ * Fork a child process using #igt_fork_helper to force all available objects
+ * to be paged out (via i915_gem_shrink()).
+ *
+ * This is useful to exercise swapping paths, without requiring us to hit swap.
+ *
+ * This should only be used from an igt_fixture.
+ */
+void igt_fork_shrink_helper(void)
+{
+	assert(!igt_only_list_subtests());
+	igt_require(igt_drop_caches_has(DROP_SHRINK_ALL));
+	igt_fork_helper(&shrink_helper)
+		shrink_helper_process(getppid());
+}
+
+/**
+ * igt_stop_shrink_helper:
+ *
+ * Stops the child process spawned with igt_fork_shrink_helper().
+ */
+void igt_stop_shrink_helper(void)
+{
+	igt_stop_helper(&shrink_helper);
+}
+
 #if HAVE_UDEV
 #include <libudev.h>
 
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index cb54ca5..13f6f15 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -51,6 +51,9 @@ extern int num_trash_bos;
 void igt_fork_signal_helper(void);
 void igt_stop_signal_helper(void);
 
+void igt_fork_shrink_helper(void);
+void igt_stop_shrink_helper(void);
+
 void igt_fork_hang_detector(int fd);
 void igt_stop_hang_detector(void);
 
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index e64d001..0a991a1 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -873,6 +873,28 @@ void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc)
  */
 
 /**
+ * igt_drop_caches_has:
+ * @val: bitmask for DROP_* values
+ *
+ * This queries the debugfs to see if it supports the full set of desired
+ * operations.
+ */
+bool igt_drop_caches_has(uint64_t val)
+{
+	FILE *file;
+	uint64_t mask;
+
+	mask = 0;
+	file = igt_debugfs_fopen("i915_gem_drop_caches", "r");
+	if (file) {
+		fscanf(file, "0x%" PRIx64, &mask);
+		fclose(file);
+	}
+
+	return (val & mask) == val;
+}
+
+/**
  * igt_drop_caches_set:
  * @val: bitmask for DROP_* values
  *
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index 5587ad4..aa59f8a 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -170,16 +170,25 @@ void igt_require_hpd_storm_ctl(void);
  */
 #define DROP_FREED 0x10
 /**
+ * DROP_SHRINK_ALL:
+ *
+ * Force all unpinned buffers to be evicted from their GTT and returned to the
+ * system.
+ */
+#define DROP_SHRINK_ALL 0x20
+/**
  * DROP_ALL:
  *
  * All of the above DROP_ flags combined.
  */
 #define DROP_ALL (DROP_UNBOUND | \
 		  DROP_BOUND | \
+		  DROP_SHRINK_ALL | \
 		  DROP_RETIRE | \
 		  DROP_ACTIVE | \
 		  DROP_FREED)
 
+bool igt_drop_caches_has(uint64_t val);
 void igt_drop_caches_set(uint64_t val);
 
 /*
diff --git a/tests/gem_concurrent_all.c b/tests/gem_concurrent_all.c
index 6ec461d..aecd5e2 100644
--- a/tests/gem_concurrent_all.c
+++ b/tests/gem_concurrent_all.c
@@ -1898,6 +1898,21 @@ igt_main
 				run_modes(name, c, modes, s, count);
 			}
 
+			snprintf(name, sizeof(name), "%s%s-%s",
+				 c->name, s->name, "shrink");
+			igt_subtest_group {
+				igt_fixture {
+					count = num_buffers(gem_mappable_aperture_size(),
+							    s, c, CHECK_RAM);
+
+					igt_fork_shrink_helper();
+				}
+				run_modes(name, c, modes, s, count);
+
+				igt_fixture
+					igt_stop_shrink_helper();
+			}
+
 			/* Use the entire mappable aperture, force swapping */
 			snprintf(name, sizeof(name), "%s%s-%s",
 				 c->name, s->name, "swap");
diff --git a/tests/gem_render_linear_blits.c b/tests/gem_render_linear_blits.c
index 13f76a5..acc3bd5 100644
--- a/tests/gem_render_linear_blits.c
+++ b/tests/gem_render_linear_blits.c
@@ -197,12 +197,22 @@ igt_main
 	/* the rest of the tests are too long for simulation */
 	igt_skip_on_simulation();
 
-	igt_subtest("apperture-thrash") {
+	igt_subtest("aperture-thrash") {
 		count = 3 * gem_aperture_size(fd) / SIZE / 2;
 		intel_require_memory(count, SIZE, CHECK_RAM);
 		run_test(fd, count);
 	}
 
+	igt_subtest("aperture-shrink") {
+		igt_fork_shrink_helper();
+
+		count = 3 * gem_aperture_size(fd) / SIZE / 2;
+		intel_require_memory(count, SIZE, CHECK_RAM);
+		run_test(fd, count);
+
+		igt_stop_shrink_helper();
+	}
+
 	igt_subtest("swap-thrash") {
 		uint64_t swap_mb = intel_get_total_swap_mb();
 		igt_require(swap_mb > 0);
diff --git a/tests/gem_render_tiled_blits.c b/tests/gem_render_tiled_blits.c
index 9f0e588..aebbcb9 100644
--- a/tests/gem_render_tiled_blits.c
+++ b/tests/gem_render_tiled_blits.c
@@ -210,12 +210,22 @@ igt_main
 	/* the rest of the tests are too long for simulation */
 	igt_skip_on_simulation();
 
-	igt_subtest("apperture-thrash") {
+	igt_subtest("aperture-thrash") {
 		count = 3 * gem_aperture_size(fd) / SIZE / 2;
 		intel_require_memory(count, SIZE, CHECK_RAM);
 		run_test(fd, count);
 	}
 
+	igt_subtest("aperture-shrink") {
+		igt_fork_shrink_helper();
+
+		count = 3 * gem_aperture_size(fd) / SIZE / 2;
+		intel_require_memory(count, SIZE, CHECK_RAM);
+		run_test(fd, count);
+
+		igt_stop_shrink_helper();
+	}
+
 	igt_subtest("swap-thrash") {
 		uint64_t swap_mb = intel_get_total_swap_mb();
 		igt_require(swap_mb > 0);

commit df75b388f915c813e69b3139e16c45ffe956c58b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Mar 10 12:02:27 2017 +0000

    igt/gem_ringfill: Measure ringsize for quicker and deterministic testing
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/tests/gem_ringfill.c b/tests/gem_ringfill.c
index 4057ec2..b241982 100644
--- a/tests/gem_ringfill.c
+++ b/tests/gem_ringfill.c
@@ -33,6 +33,10 @@
 
 #include "igt.h"
 #include "igt_gt.h"
+#include "igt_vgem.h"
+
+#include <signal.h>
+#include <sys/ioctl.h>
 
 #define INTERRUPTIBLE 0x1
 #define HANG 0x2
@@ -43,6 +47,8 @@
 #define HIBERNATE 0x40
 #define NEWFD 0x80
 
+static unsigned int ring_size;
+
 static void check_bo(int fd, uint32_t handle)
 {
 	uint32_t *map;
@@ -58,7 +64,7 @@ static void check_bo(int fd, uint32_t handle)
 
 static void fill_ring(int fd,
 		      struct drm_i915_gem_execbuffer2 *execbuf,
-		      unsigned flags)
+		      unsigned flags, unsigned timeout)
 {
 	/* The ring we've been using is 128k, and each rendering op
 	 * will use at least 8 dwords:
@@ -76,9 +82,11 @@ static void fill_ring(int fd,
 	 * doing this, we aren't likely to with this test.
 	 */
 	igt_debug("Executing execbuf %d times\n", 128*1024/(8*4));
-	igt_while_interruptible(flags & INTERRUPTIBLE) {
-		for (int i = 0; i < 128*1024 / (8 * 4); i++)
-			gem_execbuf(fd, execbuf);
+	igt_until_timeout(timeout) {
+		igt_while_interruptible(flags & INTERRUPTIBLE) {
+			for (typeof(ring_size) i = 0; i < ring_size; i++)
+				gem_execbuf(fd, execbuf);
+		}
 	}
 }
 
@@ -160,7 +168,7 @@ static int setup_execbuf(int fd,
 	return 0;
 }
 
-static void run_test(int fd, unsigned ring, unsigned flags)
+static void run_test(int fd, unsigned ring, unsigned flags, unsigned timeout)
 {
 	const int gen = intel_gen(intel_get_drm_devid(fd));
 	struct drm_i915_gem_exec_object2 obj[2];
@@ -173,7 +181,7 @@ static void run_test(int fd, unsigned ring, unsigned flags)
 		      "MI_STORE_DATA broken on gen6 bsd\n");
 
 	if (flags & (SUSPEND | HIBERNATE))
-		run_test(fd, ring, 0);
+		run_test(fd, ring, 0, 0);
 
 	gem_quiescent_gpu(fd);
 	igt_require(setup_execbuf(fd, &execbuf, obj, reloc, ring) == 0);
@@ -198,7 +206,7 @@ static void run_test(int fd, unsigned ring, unsigned flags)
 				fd = drm_open_driver(DRIVER_INTEL);
 				setup_execbuf(fd, &execbuf, obj, reloc, ring);
 			}
-			fill_ring(fd, &execbuf, flags);
+			fill_ring(fd, &execbuf, flags, timeout);
 		}
 
 		if (flags & SUSPEND)
@@ -210,11 +218,11 @@ static void run_test(int fd, unsigned ring, unsigned flags)
 						      SUSPEND_TEST_NONE);
 
 		if (flags & NEWFD)
-			fill_ring(fd, &execbuf, flags);
+			fill_ring(fd, &execbuf, flags, timeout);
 
 		igt_waitchildren();
 	} else
-		fill_ring(fd, &execbuf, flags);
+		fill_ring(fd, &execbuf, flags, timeout);
 
 	if (flags & HANG)
 		igt_post_hang_ring(fd, hang);
@@ -227,7 +235,7 @@ static void run_test(int fd, unsigned ring, unsigned flags)
 	gem_quiescent_gpu(fd);
 
 	if (flags & (SUSPEND | HIBERNATE))
-		run_test(fd, ring, 0);
+		run_test(fd, ring, 0, 0);
 }
 
 static bool can_store_dword_imm(int fd)
@@ -235,27 +243,115 @@ static bool can_store_dword_imm(int fd)
 	return intel_gen(intel_get_drm_devid(fd)) > 2;
 }
 
+struct cork {
+	int device;
+	uint32_t handle;
+	uint32_t fence;
+};
+
+static void plug(int fd, struct cork *c)
+{
+	struct vgem_bo bo;
+	int dmabuf;
+
+	c->device = drm_open_driver(DRIVER_VGEM);
+
+	bo.width = bo.height = 1;
+	bo.bpp = 4;
+	vgem_create(c->device, &bo);
+	c->fence = vgem_fence_attach(c->device, &bo, VGEM_FENCE_WRITE);
+
+	dmabuf = prime_handle_to_fd(c->device, bo.handle);
+	c->handle = prime_fd_to_handle(fd, dmabuf);
+	close(dmabuf);
+}
+
+static void unplug(struct cork *c)
+{
+	vgem_fence_signal(c->device, c->fence);
+	close(c->device);
+}
+
+static void alarm_handler(int sig)
+{


Reply to: