113 Commits

Author SHA1 Message Date
Daniel Vetter
15c19229f4 lib/drmtest: add igt_subtest_name and use it in kms_flip
Useful when the testname is constructed with igt_subtest_f.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14 18:03:09 +02:00
Daniel Vetter
2dbd998429 tests: Introduce igt_fixture
Just a tiny wrapper to protect global test setup/teardown code when
just listing subtests. Rolling this out over all tests with subtests
should allow us to generate the testlist with piglit as an
unpriviledged user on a non-intel system.

The aim here is to make our QA team happy who currently suffers from
this. Even more so for the prime tests since you need a system with
intel _and_ nouveau gpus to just be able to list tests.

Exemplary conversion with gem_concurrent_blt.c

Fixture is the same name other test suites like googletest use for
setup/teardown code used by multiple tests.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14 17:04:56 +02:00
Daniel Vetter
f8c0dfe399 lib/drmtest: sprinkle documentation over igt_skip|fail|success|exit
And make the behaviour of igt_exit() a bit saner.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14 16:52:08 +02:00
Daniel Vetter
6234658063 tests: add igt_subtest_f for snprintf'ing testnames
Useful when stitching together combinatorial testnames.

v2:
- ## rules are just fun. We need 2 indirections to actually get
  __LINE__ to properly expand.
- Kill stray ; which botched the logic.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14 13:47:47 +02:00
Daniel Vetter
8f5387eb99 tests: introduce igt_require
Since igt_skip has funny control flow we can abuse it and make it work
like a special kind of assert which automatically skips tests if a
requirement fails.

Note that in places where we have a less strict test which should
always succeed (e.g. ioctl works or isn't available) the igt_assert
should be place before the igt_require with the more strict
requirements. Otherwise we'll skip a test instead of properly failing
it.

Convert a few users of igt_skip over to igt_require to showcase its
use.

v2: s/gem_check_/gem_require_/ so that we consistently use "require"
to indicate magic check that can call igt_skip. Imo hiding the
igt_require for feature checks is ok, but for more traditional assert
like use cases an explicit igt_require might be better.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-13 15:15:18 +02:00
Daniel Vetter
646a6fefbc lib/drmtest: add igt_assert as a replacement for assert
The aim is that we keep on running subtests even when a not-too-lethal
assert failed in a subtest. To make that useful also print per-subtest
test results from igt_skip|fail|success functions.

If required we can always go googletest-nuts with different types of
asserts later on, but I think for now we're good with what we have
here.

v2: Also print out proper SKIP message when skipping all subsequent
tests since a global (i.e. outside of a subtest) init step failed and
resulted in an igt_skip call.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-13 15:07:01 +02:00
Daniel Vetter
6877877558 tests: s/return igt_retval();/igt_exit();/
Requested-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 12:26:35 +02:00
Daniel Vetter
1caaf0a6b6 s/drmtest_/igt_/
Requested-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 12:20:22 +02:00
Daniel Vetter
814b135541 s/drmtest_subtest_block/drmtest_subtest/
The _block postfix meant to convey that a C statement/block must
follow can be misread as the verb to block. So drop it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 12:15:16 +02:00
Daniel Vetter
16024841a1 lib/drmtest: __ prefix for drmtest_run_subtest
Now that callers must setup the longjmp target (we can't do that in
run_subtest itself since that callframe won't survive) tests shouldn't
call this function directly any more.

Make this clear by adding a __ prefix.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 11:57:32 +02:00
Daniel Vetter
7847ea2965 tests: use drmtest_skip to check for rings
To simplify things add a set of gem_check_<ring> functions which take
care of this. Since I've opted for static inlines drmtest.h grew a few
more header includes which was a neat opportunity to dump a few redundant
#defines.

This kills all the skipped_all hand-rolled logic we have.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 11:17:58 +02:00
Daniel Vetter
7553ad6e10 tests: use drmtest_skip() in caching ioctl helpers
This way we can rip out all the skip handling from the test control flow,
and additionally (by using drmtest_retval()) even get correct exit codes.

The only tricky part is that when we only want ot skip parts of a test
(like for gem_pread and gem_pwrite) we need to split out those parts as
subtests. But no addition of control-flow is required, the set/longjmp
magic in the helpers all makes it happen.

Also we make extensive use of the behaviour of drmtest_skip to skip
all subsequent subtests if it is called outside of a subtest. This allows
us to re-flatten the control flow a lot.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 11:17:58 +02:00
Daniel Vetter
ba0d2acf0e lib/drmtest: skip/fail handling
Exitcode handling in igt testcases has too ugly facets in combination
with subtests:

- When individual subtest needed to be skipped for different reasons
  we need to painstakingly thread this information through the test to
  make sure that we still succeed if just one testcase worked (for
  running it with the simple automake test runner in igt). But it also
  needs to correctly report the skip exit value if only this one
  skipped testcase has been run (e.g. when run with piglit or in QA's
  test infrastructure).

- We'd prefer to easily skip (and also fail) subtests without
  hampering other subtests. Again threading the return value of each
  subtest through the code is cumbersome.

To simplify test case writing use longjmps to be able to get out of
subcases easily. But since longjmps are funny things thug it all away
into the newly added drmtest_subtest_block macro.

Note that if drmtest_skip is called outside of a subtest, but in a
testcase with subtests all subsequent subtests will be automatically
skipped.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 11:10:26 +02:00
Daniel Vetter
9f6365e4ea lib/drmtest: Add drmtest_subtest_block macro
Doesn't do more than an if (drmtest_run_test(name)) right now, but
as soon as we get a bit of infrastructure to handle test failures and
skipping, this will get more interesting.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 11:10:26 +02:00
Daniel Vetter
40ea6f4ea8 tests: s/cacheing/caching
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 11:10:26 +02:00
Chris Wilson
467796acc8 Expand gem_set_cacheing testing to handle the proposed DISPLAY domain 2013-08-10 15:49:33 +01:00
Imre Deak
24de8bac80 lib: export drm_format_to_bpp
Needed by the next patch.

Signed-off-by: Imre Deak <imre.deak@intel.com>
2013-07-29 18:40:00 +03:00
Daniel Vetter
8e46c382e3 lib/drmtest: add gem_flink and gem_open
Requires us to rename a few things in the gem_flink test to avoid
variable shadowing.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-23 23:15:12 +02:00
Daniel Vetter
10834f8610 tests/gem_suspend: exercise fence restore code
This exercise the bug fixed in

commit 94a335dba34ff47cad3d6d0c29b452d43a1be3c8
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Wed Jul 17 14:51:28 2013 +0200

    drm/i915: correctly restore fences with objects attached

For fun I've also added a subtest for the inverse transition.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-23 20:46:57 +02:00
Daniel Vetter
5bc0324e86 lib/drmtest: document interface groups with one-liners
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-22 09:25:41 +02:00
Xiong Zhang
7ea2983b11 lib/drmtest: add drmtest_disable/enable_prefault() function
V2: add exit handler to enable prefault (Daniel)

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
2013-07-19 18:12:36 +02:00
Damien Lespiau
4b34765594 lib: Introduce drmtest_skip_on_simulation()
This will allow us to explicitely blacklist tests we don't want to run
on simulation.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-07-18 15:48:46 +01:00
Damien Lespiau
c25e892ec3 lib: Rename IGT_QUICK to INTEL_SIMULATION
It's more accurate this way as the quick mode is really useful for in
the simulation environment.

v2: Use the INTEL_ prefix to have a chance to share the same environment
    variable as piglit OpenGL tests

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-07-18 15:48:42 +01:00
Imre Deak
528b1f381c tests: add kms_render
Add a test going through all connectors/crtcs/modes/formats painting to
a front FB with CPU or painting to a back FB with CPU and blitting it
to the front FB.

Only formats understood by cairo are supported for now.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
2013-06-06 01:43:51 +03:00
Imre Deak
f68d964c57 lib: refactor kmstest_create_fb
Factor out parts that will be used by an upcoming patch adding
kmstest_create_fb2.

Also call the fb paint functions directly, there is not much
point in passing a function pointer for that.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
2013-06-06 01:43:51 +03:00
Imre Deak
bfb0cdd668 lib: add kmstest_get_connector_config
This is used by multiple test cases, so make it shared.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
2013-06-06 01:43:51 +03:00
Imre Deak
542a40c485 lib: add kmstest_cairo_printf_line
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
[v3: fix mode printing in paint_output_info() botched by debugging leftover :/ ]
2013-06-06 01:43:51 +03:00
Imre Deak
3a2aed1f30 lib: move connector_type_str and co to drmtest
These are used by multiple test cases, so make them shared.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
2013-06-06 01:43:50 +03:00
Imre Deak
bce7d8a061 lib: export the exit handler interface
Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-05-22 18:18:28 +02:00
Imre Deak
cf26435be8 lib: add helper to set VT graphics mode
Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-05-08 21:00:42 +02:00
Zhong Li
8ddf84d129 i-g-t: check kernel enable rings or not
1. add functions check kernel enable a ring or not.
2. add function gem_get_num_rings() to check how many rings kernel has
enable.
3. gem_ring_sync_loop.c will call gem_get_num_rings() directly instead
of original static fucntion get_number_rings().

Signed-off-by: Zhong Li <zhong.li@intel.com>
[Ben: Wrapped commit message + whitespace fixes]
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
2013-05-03 17:39:14 -07:00
Chris Wilson
2facc1368d Check for vebox support before testing
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63941
2013-04-26 08:30:52 +01:00
Damien Lespiau
bb33d08845 lib: Add a way to specify values for "quick" runs
In some environments, we don't really want to loop 100000 times or
allocate 152352621 buffers because it makes the tests too long to run.

This adds a way to specify "quick" values to reduce the time taken by
certain tests.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-02-13 18:09:11 +01:00
Daniel Vetter
0af2b184ad lib: extract kmstest_get_pipe_from_crtc_id 2012-12-17 15:30:54 +01:00
Daniel Vetter
9fc7e1386a lib/drmtest: subtest infrastructure
To make these helpers as least invasive as possible simply initialize
the options with a getopt parser and let the control flow be steered
with a simple helper which gets the subtest name as an argument.

The only tricky part for using it is that the subtest check helper
doubles up as the conduit to enumerate tests (and in that mode
prevents any test from being run). It is therefore important that
nothing gets printed to stdout outside of these checks.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-11-28 11:57:58 +01:00
Imre Deak
21393431f1 drmtest: add function to remove an DRM FB
Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-10-16 16:51:56 +02:00
Daniel Vetter
df7edaab90 lib: helper to convert gem_hanlde to drm_intel_bo 2012-10-02 10:32:10 +02:00
Chris Wilson
51baabb562 Add bare-metal interface to adjust cacheing (i.e. snoop status) of a bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-27 09:39:45 +01:00
Daniel Vetter
6bc22e3dfd tests: add basic re-importing prime test
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-07-23 09:52:10 +02:00
Chris Wilson
77586dcdf7 test/gem_gtt_speed: Add a baseline test for the performance of a CPU mmap
When looking at the pwrite/pread/wc performance, it is useful to judge
that against the performance of an ordinary CPU mmap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-06-04 17:50:51 +01:00
Daniel Vetter
17787f30c6 lib: extract kmstest_dump_mode 2012-05-22 16:15:15 +02:00
Daniel Vetter
662d732199 lib: extract kmstest_create_fb
We should get more kms tests soon, and not needing to copy-paste a
nice test pattern should be useful.

That establishes a firm depency of i-g-t on cairo over everything, but
I don't care so much about that.

Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-05-22 15:56:29 +02:00
Daniel Vetter
cf72da57dc tests: add gem_unfence_active_buffers
Unfortunately this requires slab poisoning to catch anything :(

Also add a new helper to drmtest to get the available fence count.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-04-22 12:35:23 +02:00
Ben Widawsky
f841f4028c tests: rc6 residency test
This is meant to test the sysfs entry for showing rc6 residency in
milliseconds. Remember, sysfs is a permanent interface.

v2: use new get_card interface to try "all" devices
check rc6p and rc6pp in addition to rc6

v3: rename rc6_residency.c to sysfs_rc6_residency.c
print better error messages
skip test if rc6 isn't enabled

v4: update to new sysfs names

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
2012-04-10 21:11:13 -07:00
Chris Wilson
b7bd1837cc Make the assertions guarding syscalls (drmIoctl in particular) verbose
Currently all we see is gem_read: ret == 0 failed, where it would help
to see the errno and/or the ret.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-03-29 12:50:07 +01:00
Daniel Vetter
afbdc7af8d tests: adapt storedw tests to ppgtt
MI_MEM_VIRTUAL actually means use global gtt now, not setting the bit
means use ppgtt. On previous gens, not setting the bits ment 'use
physical memory'. So what, the usual confusion.

Note that for some odd reasong this is broken on gen6, but only on the
bsd ring. Unexpected.

Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-03-22 14:00:22 +01:00
Daniel Vetter
16c4f52782 tests: add gem_mmap_offset_exhaustion
This also adds a gem_madvise helper to lib/drmtest.c

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-03-20 14:27:05 +01:00
Daniel Vetter
93a65895bb drmtest: add progress indicator
Some test that trash the aperture necessarily need to take forever, so
add a little progress indicator to keep worried minds at peace.

Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-01-24 23:18:21 +01:00
Daniel Vetter
98129fa2ff tests: add gem_tiled_swapping
Also add a drmtest_exchange_int helper, might come handy at other
places.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-01-22 22:28:46 +01:00
Daniel Vetter
fbfe374b28 lib: extract drmtest_permute_array
Lots of tests need to create havoc to LRUs in the kernel or otherwise
need to shuffle things around a bit. So make a small array permutation
function available.

Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-01-22 20:09:54 +01:00