55 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
Jesse Barnes
392e8ee75f tests/pm_rps: add test descriptions
Document a copule of the subtests with their purpose, methods, and
expected results.

Reviewed-by: Ben Widawsky <benjamin.widawsky@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2015-03-23 12:50:48 -07: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
Imre Deak
b32b5327a2 tests/pm_rps: vlv: round middle point to freq supported by HW
When setting the calculated middle frequency value the test assumes that
the HW/kernel rounds this value according to a 50MHz step value. This is
not so at least on VLV/CHV, on my B0 BYT-M for example this step value
is 22MHz, so there the test will fail.

To fix this get the nearest supported value by setting the target
frequency as a min or max frequency and read it back. The kernel will
round the returned value to the nearest supported.

v2:
- remove the 50MHz rounding that was done for non-VLV platforms, the new
  way of rounding should provide the correct value for all platforms
  (Ville)

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Imre Deak <imre.deak@intel.com>
2014-12-08 12:36:59 +02:00
Imre Deak
f70afed4c7 tests/pm_rps: vlv: load gpu for idle min/max tests
When changing the sysfs GT min/max frequencies, the kernel won't
explicitly change the current frequency, unless it becomes out of bound
based on the new min/max values. The test happens to work on non-VLV
platforms because on those the kernel resets the current frequency
unconditionally (to adjust the RPS interrupt mask as a side-effect) and
that will lead to an RPS interrupt setting the minimum frequency.

To fix this load the GPU after decreasing the min frequency and before
checking the current frequency. This should set the current frequency to
the minimum.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Imre Deak <imre.deak@intel.com>
2014-12-08 12:36:54 +02:00
Imre Deak
aabf2d0952 tests/pm_rps: vlv: wait for freq to settle
At least on VLV when forcing a new GT frequency by writing to the
min/max freq sysfs entries the kernel doesn't wait until the new
frequency settles, so the subsequent readback check might fail. To fix
this wait until the current frequency is between the min/max values
using a 10ms timeout.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Imre Deak <imre.deak@intel.com>
2014-12-08 12:36:28 +02:00
Chris Wilson
1244fc6b9b igt/pm_rps: Fix STORE_DWORD for pre-gen8
gen8 actually changed the command layout, not just extended the
relocation value. Oh well.

References: https://bugs.freedesktop.org/show_bug.cgi?id=83915
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-16 08:19:08 +01:00
Chris Wilson
3a1751ef34 igt/pm_rps: Fix the batch count for emitting the flush
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81858#c2
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-12 06:47:20 +01:00
Chris Wilson
10552b5ca6 batch: Specify number of relocations to accommodate
Since relocations are variable size, depending upon generation, it is
easier to handle the resizing of the batch request inside the
BEGIN_BATCH macro. This still leaves us with having to resize commands
in a few places - which still need adaption for gen8+.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-30 11:44:51 +01:00
Chris Wilson
3b94d3f8ce igt: Prettify igt_assert_eq() failure messages
This just improves the language about the exact failure to reduce
confusion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-29 13:20:36 +01:00
Chris Wilson
e48c495572 igt/pm_rps: Fix assertion in load_helper_stop
The load_helper isn't killed by the signal, but it exits gracefully. So
update the assertion to check for the successful exit.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-27 15:39:58 +01:00
Tim Gore
72b1263649 intel-gpu-tools: add sys/wait.h to pm_rps.c
commit 745945546f7366a413a3a51a37f90caa3a227b1d
breaks the build under Android because some of the
macros used in pm_rps.c are defined in sys/wait.h
which is not included.

Signed-off-by: Tim Gore <tim.gore@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-07-25 09:36:10 +02:00
Chris Wilson
745945546f igt_core: Refactor igt_stop_helper() to use igt_wait_helper()
Reduce code duplication as the igt_stop_helper can reuse
igt_wait_helper() to replace its own waiting routine.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-24 11:52:37 +01:00
Thomas Wood
e73008bae3 tests: remove unused getopt header includes
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-07-23 15:23:53 +01: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
Daniel Vetter
961a46c82b tests/pm_rps: Add a new testcase to provoke the "stuck at max" bug
Note that the sleep(5); to fully idle the gpu is _really_ important.
Without it the bug is not exhibited.

The issue at hand is that after gem_quiescent_gpu we are at max
(expected, since the blocking waits peg to max), but then we never go
down to a lower freq again until we're fully idle. The tiny load is
sufficient to keep the gpu at max. I've played around with this a bit
and even ridiculously low loads (like one MI_STORE per 50ms) are
enough to keep the gpu at max freq.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-26 22:15:12 +01:00
Daniel Vetter
669a2fca6c tests/pm_rps: quiescent harder
Apparently some rps chips are prone to stick to max once you're there.
And all the synchronous waits in gem_quiescent_gpu are _really_ good
at forcing the kernel to go full throttle.

And even a positively tiny load (one MI_STORE_IMM per 50 ms) is enough
to eternally keeep it there, which means the first idle measurement of
the freqs before we do the reset it completely busted.

Just add a wait before the tricky test and call it a day.

Option b) would have been to now have this tiny load, but I think a
good reminder how quirky rps is is always welcome. Just in case we
start sleeping too easy at night.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74956
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-26 21:33:38 +01:00
Daniel Vetter
7a8109458e tests/pm_rps: fixup the blt copy load helper changes
All suggested by Jeff McGee.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-23 17:15:37 +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
254f19ba8d lib: unnecessary header removal for drmtest.h, part 2
I've left unistd.h in it - it's not strictly required but most users
of drmtest.h want it for the open helpers, and then you kinda need to
close that file descriptor again ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 21:29:01 +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
0e22f14ed6 tests|lib: remove assert.h includes
Only the igt core and non-test tools should have asserts to catch
internal errors, tests and helper libraries should all user igt_asert
instead.

Fix things up where assert instead of igt_assert was used.

One tiny step towards header sanity.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 19:39:46 +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
553d594b6e tests/pm_rps: wait longer for idling
Big cores seem to take forever to idle, at least my ivb here. Fairly
ridiculous, so maybe there's more room for our debooster to kick in.

Anyway, this gets the min-max-config-idle and reset subtests going
somewhat reliably on my ivb. They still occasionally fail with the
current frequency pegged to max (or close to it) for no apparent
reason at all. Rebooting tends to fix it.

Don't ask, don't tell.

Cc: Jeff McGee <jeff.mcgee@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-14 11:24:27 +01:00
Daniel Vetter
a7dd98497a tests/pm_rps: use igt_assert_cmpint
Much better debug output almost for free.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-14 11:24:27 +01:00
Daniel Vetter
5632bc81d9 tests/pm_rps: load harder
Big core platforms need some seriuos omph to break a sweat.

This fixes min-max-config-loaded here on my ivb.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75146
Cc: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-14 10:27:30 +01:00
Daniel Vetter
d4f89d0ff2 tests/pm_rps: simplify load helper setup
There's no need to be fancy here.

Cc: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-14 10:27:30 +01:00
Daniel Vetter
5188bbe23e tests/pm_rps: ducttape for igt fork helper cleanup issues
We don't call cleanup handlers when exiting a subtest currently, only
when exiting the entire binary. Which means pm_rps falls over when it
fails more than one subtest.

Cc: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-14 10:27:29 +01:00
Daniel Vetter
46ec3ef1f8 test/pm_rps: use igt logging
Cc: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-13 14:41:40 +01:00
Daniel Vetter
971c7db2c8 tests/pm_rps: remove setfreq
It's unused.

Cc: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-07 10:03:24 +01:00
Daniel Vetter
ffc481b8ac tests/pm_rps: Round requested freq correctly
The kernel will round it, so if we don't we'll have a spurious
mismatch. Happens on my machine here with 650-1300MHz range, where the
midpoint is 975.

Cc: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-07 10:03:20 +01:00
Daniel Vetter
32b624c71d tests/pm_rps: Fix compilation on Linux
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-06 07:49:33 +01:00
Jeff McGee
2b8d953aa2 pm_rps: New subtest for gpu reset
Test that RPS functions as expected after a gpu reset.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-06 07:47:51 +01:00
Jeff McGee
663d758d91 pm_rps: Add variable load support to load helper
The load helper can be set to HIGH or LOW. HIGH is the original mode
of sending continuous dword store commands. LOW adds a pause between
each command to reduce throughput.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-06 07:47:40 +01:00
Jeff McGee
22dfb0988a pm_rps: Load helper should stall for last write
This ensures that gpu is quiescent when load helper exits.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-06 07:47:23 +01:00
Jeff McGee
2d16e0aad7 pm_rps: Add stop rings injection utility
Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-06 07:47:10 +01:00
Jeff McGee
2cbb0fbf5f pm_rps: New subtest min-max-config-loaded
Like subtest basic-api, but additionally requires that current
frequency is increasing to the configured maximum within reasonable
time since we are loaded.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-06 07:46:42 +01:00
Jeff McGee
ceb14b1905 pm_rps: Add load helper for loading gpu
The load helper submits repeated dword store commands to keep the
gpu loaded while subtests running in the parent process check for
expected rps response.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-06 07:46:06 +01:00
Jeff McGee
3bada1626c pm_rps: New subtest min-max-config-idle
Like subtest basic-api, but additionally requires that current
frequency is settling to the configured minimum within reasonable
time since we are idle.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-06 07:45:10 +01:00
Daniel Vetter
d1b5823ee7 tests/pm_rps: rename basic test to "basic-api"
Jeff plans to add more tests ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-27 23:38:02 +01:00
Jeff McGee
5d26a7e2a2 pm_rps: Make frequency logging more compact
Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-27 23:37:50 +01:00
Jeff McGee
88864d2ba5 pm_rps: Remove repeat sysfs reads
Storing values avoids some unnecessary overhead but more importantly
allows all of our processing to be atomic.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-27 23:37:50 +01:00
Jeff McGee
4e3b661b48 pm_rps: Expand on min and max config testing
Add a function that methodically varies min and max to exercise
several valid and invalid combinations. Allow the caller to
define what is to be checked between each step.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-27 23:37:50 +01:00
Daniel Vetter
71f1f9eafd tests/pm_rps: Add missing static
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-19 22:12:25 +01:00
Jeff McGee
7f1c5057cf pm_rps: Fix verbose option and streamline its use
Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-18 15:20:56 +01:00
Jeff McGee
d14cd7430b pm_rps: Convert to subtest structure
Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-18 15:18:58 +01:00
Jeff McGee
0102b6bde6 pm_rps: Add read back checking on sysfs writes
Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-18 15:17:16 +01:00
Jeff McGee
2a7dbe5f01 pm_rps: Use igt exit handler for restore
Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 22:31:51 +01:00