34 Commits

Author SHA1 Message Date
Micah Fedke
c81d293aed convert drm_open_any*() calls to drm_open_driver*(DRIVER_INTEL) calls with cocci
Apply the new API to all call sites within the test suite using the following
semantic patch:

// Semantic patch for replacing drm_open_any* with arch-specific drm_open_driver* calls
@@
identifier i =~ "\bdrm_open_any\b";
@@
- i()
+ drm_open_driver(DRIVER_INTEL)

@@
identifier i =~ "\bdrm_open_any_master\b";
@@
- i()
+ drm_open_driver_master(DRIVER_INTEL)

@@
identifier i =~ "\bdrm_open_any_render\b";
@@
- i()
+ drm_open_driver_render(DRIVER_INTEL)

@@
identifier i =~ "\b__drm_open_any\b";
@@
- i()
+ __drm_open_driver(DRIVER_INTEL)

Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-11 14:39:43 +01:00
Thomas Wood
804e11f40d lib: add a single include header
Add a header that includes all the headers for the library. This allows
reorganisation of the library without affecting programs using it and
also simplifies the headers that need to be included to use the library.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-08-21 09:37:10 +01:00
Tim Gore
c221e09420 tests/gem_reset_stats : mask off ring_stop bits
Function check_gpu_ok checks to make sure that any hangs
have cleared by testing for (flags == 0). Some tests set
the STOP_RINGS_ALLOW_BAN and STOP_RINGS_ALLOW_ERRORS flags
but these do not get cleared by an individual ring reset,
(a feature added recently to the driver), leading the
check_gpu_ok function to think that the gpu is still hung.

So I mask the flags with STOP_RING_ALL, to ignore the mode
bits and look only at the bits that stop the rings.

Once gpu_check_ok sees that the gpu is not hung I write 0
to stop_rings in order to clear it completely. This is
because igt_set_stop_rings will only write to stop_rings
if either a) they are currently 0 or b) we are writing 0.
If we leave the mode bits set then subsequent calls to
igt_set_stop_rings to create hangs will fail.

Signed-off-by: Tim Gore <tim.gore@intel.com>
2015-06-05 08:53:04 +01:00
Matt Roper
07be8fec15 igt.cocci: Replace igt_assert() with igt_assert_CMP() where possible
The integer comparison macros give us better error output by including
the actual values that failed the comparison.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-03-06 18:06:10 +01:00
Daniel Vetter
3cd45dec2e lib/igt_gt: Document and consolidate
Also move forcewake and stop_rings code from igt_debugfs to igt_gt
since it fits better. And move the hang injection fork helpers from
igt_aux to igt_gt, too.

Also push the intel_gen call into igt_hang_ring while at it.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-02-13 09:35:36 +01:00
Daniel Vetter
364efcdf9b tests/gem_reset_stat: Use new ctx helpers
A bit more invasive since getting rid off all the places meant
to flatten some of the control flow with implicit igt_require.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-02-13 09:35:35 +01:00
Thomas Wood
032f30cb38 lib: remove unnecessary checks on the drm_open_any return value
drm_open_any always returns a valid file descriptor, so there is no need
to check the return value.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-01-15 12:23:04 +00:00
Mika Kuoppala
50d539efeb tests/gem_reset_stats: add defer-hangcheck test
to see if one can fool hangcheck by keeping non hanging
ring busy

v2: break from loop instead of return (Daniel Vetter)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
2014-11-11 17:38:46 +02:00
Daniel Vetter
e624fa8a2e tests: sprinkle igt logging
All the cases that simply dump some debug information and couldn't be
converted to some of the fancier macros.

Some information output removed when it's redundant with the subtest
status.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-05-14 00:36:04 +02:00
Mika Kuoppala
99b8f80701 tests/gem_reset_stats: fix length check in inject_hang
To avoid writing past the batch end.

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
2014-04-10 17:53:08 +03:00
Mika Kuoppala
53ad1e4a70 tests/gem_reset_stats: check gpu state before each subtest
Some tests, namely the close pending variety, tries to
carefully drop all handles to gpu when hang is intruduced,
to expose bugs in reset handling without any clients.

Add guards after and before tests to really know if
the gpu is still alive as the particular test might
report success and then gpu dies few seconds after.

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
2014-04-10 17:50:49 +03:00
Mika Kuoppala
d983a47f14 tests: use lib igt_[get|set]_stop_rings()
on gem_reset_stats, kms_flip and pm_rps.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75876
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
2014-04-10 17:50:43 +03:00
Mika Kuoppala
1c7ca57e53 tests/gem_reset_stats: end hanging batch properly
As we use chained batch into itself to hang the gpu, there
was no need to end the batchbuffer with BATCH_BUFFER_END.

With the introduction of command parser, the batch
need to have proper BATCH_BUFFER_END in it or it
will be rejected.

While at it, shift the upper half of batch gtt_offset
accordingly with gen8+

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
2014-04-10 17:24:38 +03:00
Mika Kuoppala
49c611b590 tests/gem_reset_stats: run non hw context tests also on older gens
To gain more coverage on interface, default context and banning.
As there is no proper reset support for gen <= 3, we only
do limited interface testing on those.

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-24 18:13:08 +01:00
Daniel Vetter
f5daeec724 lib: extract igt_aux.[hc]
And shovel all the various helpers in there.

Also move igt_set_vt_graphics_mode to igt_kms.h since the function is
implemented in igt_kms.c. And it fits better. I kinda missed this in
the prep work.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-23 13:47:09 +01:00
Daniel Vetter
c03c6ceb29 lib: rename intel_gpu_tools.h to intel_io.h
With the header cleanup we can now give this header a suitable name,
since it now really only contains register access and other I/O
functions and assorted definitions.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 21:34:29 +01:00
Daniel Vetter
e49ceb8690 lib: unnecessary header removal for drmtest.h, part 1
Brought a few missing headers to light in ioctl_wrappers.h, too.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 21:07:37 +01:00
Daniel Vetter
7dc0001f3d lib: make rendercopy.h an internal header
And move the public interfaces into intel_batchbuffer.[hc].

A bit messy since we are fairly inconsistent with our header #include
handling.

Also exclude rendercopy.h from the documentation.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 15:31:15 +01:00
Daniel Vetter
f04f17bcd4 lib/igt_debugfs: Remove debugfs from igt_debugfs_open
Also update the api docs a bit since the Returns: section was missing.

v2: Readd the accidentally lost line for @filename.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-17 09:47:32 +01:00
Daniel Vetter
803d07b2ff lib: make igt_debugfs_open infallible
(Almost) no one cared anyway.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-12 21:22:48 +01:00
Daniel Vetter
a6bc3d91af tests/gem_reset_stats: Correctly wrap global test code
Tests _must_ be able to run as non-root and on non-intel platforms,
otherwise the enumeration is busted (since QA enumerates testcases on
a gpu-less xeon box).

Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-11 12:06:11 +01:00
Mika Kuoppala
c05c88c2b6 tests/gem_reset_stats: stop only one ring when submitting hang
If we stop all the rings, we can end up blaming the innocent
rings on hangcheck.

Reference: https://bugs.freedesktop.org/show_bug.cgi?id=73652
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-22 09:45:27 +01:00
Daniel Vetter
862de5636f lib: extract igt_drop_root
Useful in other tests.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-19 22:06:48 +01:00
Mika Kuoppala
44c0b2aeff tests/gem_reset_stats: run tests on all rings
Run all relevant tests on all rings.

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-14 19:40:49 +01:00
Mika Kuoppala
3367359a98 tests/gem_reset_stats: split ctx tests
Split context related tests from non-context ones
and cleanup the naming.

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-14 19:40:46 +01:00
Mika Kuoppala
a68937ca3b tests/gem_reset_stats: add reverse order in close-pending-fork
Use own copy of gem_quiescent_gpu() so that test still works
if it gets changed. Further improve the test by posting a batch
to rings in reverse order.

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-12 11:59:47 +01:00
Daniel Vetter
509850bf48 tests/gem_reset_stats: document the new subtest a bit better
I wanted to add this to Mika's original patch but forgot to git add.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-06 08:39:31 +01:00
Mika Kuoppala
6b18ef826f tests/gem_reset_stats: add close-pending-fork
This triggers use after free oops on request->batch_obj when
going through the rings and setting reset status on requests,
after a gpu hang.

v2: Streamlined the test and added comments (Daniel)

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-04 16:45:28 +01:00
Mika Kuoppala
6de398888e tests/gem_reset_stats: check non root access to reset_stats
Getting global reset count needs to be tested with root and
non root access.

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-20 21:31:04 +01:00
Mika Kuoppala
2dd312cbb8 tests/gem_reset_stats: stop rings after injecting hang
To make driver report a simulated hang in dmesg.

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-20 21:29:04 +01:00
Mika Kuoppala
0afe006eac tests/gem_reset_stats: add support for BDW+
For BDW+, there BATCH_BUFFER_START is 3 * 32bits in length and
length needs to be encoded into the opcode.

Suggested-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-20 21:28:25 +01:00
Daniel Vetter
4fd0458be2 tests/gem_reset_stats: More macros!
Instead of freaking out about negating the skip condition and punting
I could have remembered that I've solved this already ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-20 16:07:30 +01:00
Daniel Vetter
ff193614b2 tests/gem_reset_stats: Use macros a bit more
Just demonstration really.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-17 17:31:19 +01:00
Mika Kuoppala
1ff7427578 tests: add gem_reset_stats
v2: check the ioctl pad and flag parameters

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-13 11:55:26 +01:00