[Intel-gfx] [PATCH i-g-t] tests/initial_state: Add a test to capture the state of the GPU

Chris Wilson chris at chris-wilson.co.uk
Fri May 12 13:17:29 UTC 2017


On Fri, May 12, 2017 at 04:08:48PM +0300, Martin Peres wrote:
> The commit name "Add a test to capture the state of the GPU" should
> likely be renamed to "Add a test that checks the current state of
> the driver".
> 
> On 12/05/17 14:07, Marta Lofstedt wrote:
> >When running testlist for CI iot would be good to know if
> 
> iot -> it
> 
> >the state of the GPU is as expected. This adds a subtest to check
> >if the GPU is wedged.
> 
> This is not mandatory, but how about adding:
> 
> "When coupled with piglit's abort-on feature, this makes the piglit
> results contain the reason for the abort when the driver's initial
> state is unacceptable, improving debuggability"
> 
> With the commit title and the typo fixed, the patch is:
> Acked-by: Martin Peres <martin.peres at linux.intel.com>
> 
> >
> >Signed-off-by: Marta Lofstedt <marta.lofstedt at intel.com>
> >---
> >  tests/Makefile.sources                |  1 +
> >  tests/initial_state.c                 | 52 +++++++++++++++++++++++++++++++++++
> >  tests/intel-ci/extended.testlist      |  1 +
> >  tests/intel-ci/fast-feedback.testlist |  1 +
> >  4 files changed, 55 insertions(+)
> >  create mode 100644 tests/initial_state.c
> >
> >diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> >index 9553e4d9..32431a05 100644
> >--- a/tests/Makefile.sources
> >+++ b/tests/Makefile.sources
> >@@ -152,6 +152,7 @@ TESTS_progs_M = \
> >  	vgem_basic \
> >  	vgem_slow \
> >  	meta_test \
> >+	initial_state \
> >  	$(NULL)
> >  if HAVE_CHAMELIUM
> >diff --git a/tests/initial_state.c b/tests/initial_state.c
> >new file mode 100644
> >index 00000000..1c5d9a74
> >--- /dev/null
> >+++ b/tests/initial_state.c
> >@@ -0,0 +1,52 @@
> >+/*
> >+ * Copyright © 2017 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.
> >+ *
> >+ */
> >+
> >+#include <stdio.h>
> >+#include <string.h>
> >+#include "igt.h"
> >+
> >+/*
> >+ * The purpose of this test is to capture the
> >+ * state of the GPU before running a testlist.
> >+ *
> >+ * Note, this test currently only checks if
> >+ * i915 is wedged. But, it could be extended to report
> >+ * on other bad initial states.
> >+ */
> >+
> >+static void is_wedged(void)
> >+{
> >+	char buf[128];
> >+	int fd = drm_open_driver(DRIVER_INTEL);
> >+
> >+	igt_debugfs_read(fd, "i915_wedged", buf);

The ABI for testing whether the device is wedged before use is
gem_throttle(). This is encapsulated into igt_require_gem() and any test
that depends upon execution on the GPU should be checking for GEM first.

This test should just be igt_gem_require(drm_open_driver(DRIVER_INTEL));
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list