112 Commits

Author SHA1 Message Date
Daniel Vetter
556c49f20b lib/ioctl_wrappers: api doc
Also some tiny polish to function interface:
- @caching in gem_set_tiling should be uint32_t to match the ioctl
  struct.
- s/size/length/ for gem_write/read.
- move gem_get_num_rings to the other ring feature helpers.

v2: Also demote gem_require_ring from static inline and move it, too.

v3: Also move gem_handle_to_libdrm_bo.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-12 16:39:39 +01:00
Daniel Vetter
766c5bc6ae lib: extract ioctl_wrappers.c
I want to group the ioctl wrappers and related functions into their
own documentation section.

Apparently gtkdoc refuses to obey this wish without a corespdonding
header. So appease it. Also gtkdoc seems to struggle with rebuilding a
bit ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-11 22:58:07 +01:00
Thomas Wood
2d4438605e drmtest: reformat the API documentation
Make the existing documentation compatible with gtk-doc.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-11 17:19:47 +01:00
Daniel Vetter
eebdf7f920 lib: (somewhat) structured logging support
Apparently there's a bit a need for more verbose output in testcases,
mostly for debugging purposes. At least gem_reset_stats and pm_rps
have a verbose mode.

On top of that we're currently not taking advantage of piglit's "warn"
state all that much. But I think it might be useful for testcases which
are notorious for some kinds of spurious failures, like e.g. the really
nasty timing checks in kms_flip. If we demote some of them to just
warnings we could run the overall tests more often.

Hence this patchs adds a new igt_log function with the three levels DEBUG,
INFO and WARN. Plus a bunch of convenience helpers to keep the test
code tidy.

The level can be set through an enviroment vairable IGT_LOG_LEVEL with
info being the default. Also tests can look at the selected log level in
case they want to run costly debug functions only when needed.

Comments highly welcome, I plan to roll this out over tests which can
use it (not all, imo that's too much churn) once we've settled on the
interfaces/semantics.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-13 14:41:40 +01:00
Daniel Vetter
a036959f3e lib: Make igt_skip noreturn
This is a remnant from the subtest code before we had proper
fixture blocks. With those there's no no reason to have igt_skip
calls outside of fixtures or subtests, so we can assert this and
hence always jump out.

Suggested by Thomas Wood since static analyzers got confused about
this.

To check for fallout I've run all tests as non-root so that they'll
all skip. Only very little fallout resulted.

Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-12 00:07:19 +01:00
Damien Lespiau
377f48afe6 lib: Add a helper to wait for a keypress
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-11 13:50:16 +00:00
Jeff McGee
fd3fcbd3b3 lib/drmtest: Add igt_wait_helper
igt_wait_helper compliments igt_stop_helper and is used when helper
processes are expected to exit naturally.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-06 07:45:53 +01:00
Daniel Vetter
7d2ba073ad lib: add __gem_create
Useful for when a gem_create ioctl is expected to fail.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-19 22:13:36 +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
Daniel Vetter
ef9745b7fa lib: igt_simple_main/init for subtest-less tests
Atm only used to print the version information.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-10 09:41:48 +01:00
Daniel Vetter
1a95c710f9 lib: add gem_available_aperture_size helper
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-05 15:50:43 +01:00
Ville Syrjälä
49f4860d5c lib: Add gem_bo_busy
Move gem_bo_busy() from gem_wait_render_timeout.c to lib.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2013-11-27 16:21:28 +02:00
Ville Syrjälä
525788a736 lib: Add gem_sw_finish()
Wrap DRM_IOCTL_I915_GEM_SW_FINISH into gem_sw_finish()

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2013-11-27 16:21:28 +02:00
Oscar Mateo
5032e7bbdd build: Fix assorted compilation warnings
As these files are compiled for every test, the warnings cluttered
the Android build completely.

v2: As suggested by Daniel Vetter, drop some of the fixes and fix
the compilation flags instead.

Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-12 12:05:55 +01:00
Oscar Mateo
37f26d17b1 lib: Move kms stuff from drmtest.c over to igt_kms.c
This makes cairo dependencies easier to handle. Otherwise, we
would have to litter drmtest all over with "#ifndef ANDROID"

Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
[danvet: Add missing _GNU_SOURCE to igt_kms.c and missing include to
intel_sprite_on.c]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-12 12:04:12 +01:00
Daniel Vetter
071e9ca1ca lib: add igt_main macro
In the past new testcases with subtest often forgot to add the call to
igt_exit at the end of their main() function. That is now caught with
a bit more obnoxious asserts, but it's still a nuissance.

This little igt_main macro takes care of that (and also of calling the
subtest machinery initialization code correctly).

If no one objects I'll roll this out for all the simple cases (i.e.
those tests that don't have additional argv parsing on top of the
subtest machinery).

v2: Roll it out across the board.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-01 21:10:59 +01:00
Daniel Vetter
223a61e12e lib: make igt_install_exit_handler never fail
Most callers didn't bother checking, so just move the asserts into
the function itself.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-01 21:10:59 +01:00
Daniel Vetter
1f0cf2df85 lib: make igt_set_vt_graphics_mode never fail
All tests agree that this is a letal failure, so no point
to pass it back to callers.

Also add some igt_require calls for the drm_fd where I've
noticed that it's missing.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-01 21:10:59 +01:00
Damien Lespiau
69c200b0bb lib: Add a drm_open_any_render() that will try to use render nodes
I was fedup with having to run my tests as root and not being able to
use my usual setup for tests that only exercise the GT part of the GPU.

Render nodes to the rescue!

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-10-28 11:00:07 +00:00
Ville Syrjälä
471ec64de8 lib/drmtest: Add kmstest_paint_color_alpha()
kmstest_paint_color_alpha() just like kmstest_paint_color() except you
also get to specify the alpha channel.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2013-10-21 20:00:32 +03:00
Damien Lespiau
09e9f0b216 rendercopy: Add a way to dump an .aub file with the rendercopy bos
v2 (by Ben): Remove libdrm dependency since intel-gpu-tools now requires
a higher version anyway. Remove associated #ifdef ENABLE_AUB_DUMP

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
2013-10-18 09:49:41 -07:00
Damien Lespiau
252dca1c7b lib: Add kmstest_paint_color()
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-10-15 19:32:09 +01:00
Damien Lespiau
5a97ea91e1 lib: Add a igt_assert_cmpint()
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-10-15 19:02:08 +01:00
Daniel Vetter
ffdece38e2 tests/gem_suspend: test debugfs/sysfs reads while s/r
Just a very quick hack cobbled together with /bin/sh and exec. We
can't use system since that does stupid things with singals ... Still
we need to whack the child process pretty hard to get rid of it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-10-10 14:20:43 +02:00
Daniel Vetter
590f610140 lib/drmtest: extract rawer __gem_set_tiling
For tests that expect failures. Also apply the existing gem_set_tiling
helper a bit wider.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-10-09 20:50:50 +02:00
Damien Lespiau
a7d1937cd7 testdisplay: Use DRM_MODE_FLAG_3D_MASK
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-09-30 18:04:22 +01:00
Damien Lespiau
79f4cfedbf lib: Add a helper to write a png from a struct kmstest_fb
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-09-30 18:04:21 +01:00
Damien Lespiau
bde7060e3c lib: Add a helper to paint a PNG using cairo
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-09-30 18:04:21 +01:00
Damien Lespiau
30e0710ca3 lib: Dump information about the supported 3D stereo formats
When dumping the details of a mode, let's add the 3D formats the mode
supports.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-09-30 18:04:21 +01:00
Daniel Vetter
e5cdd62624 lib/drmtest: igt_assert|require with format strings
v2: Add a comment about the pitfalls around va_list handling.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-19 19:40:32 +02:00
Daniel Vetter
e73c1a07f3 lib/drmtest: consolidate the helper process killing in one exit handler
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-10 18:22:17 +02:00
Daniel Vetter
edd723457c lib/drmtest: create helpers for forking helper threads
The upshot is that we can share the logic to make sure the helpers
are all properly stoved again in a 2nd step.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-10 17:40:06 +02:00
Daniel Vetter
5113df7891 lib/drmtest: add igt_skip_on macro
I've fumbled the logic inversion when converting to igt_require way
too often, so lets add something for dummies like me ;-)

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-04 13:19:42 +02:00
Daniel Vetter
f4b93781be lib/drmtest: use igt_require/assert in the prefault helpers 2013-09-03 15:19:30 +02:00
Daniel Vetter
225a91bc54 lib/drmtest: include sys/mman.h from drmtest.h
We need it for mmapping to get at PROT_READ|WRITE anyway.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-03 10:38:29 +02:00
Daniel Vetter
9cc16e8afd lib/drmtest: extract gem_execbuf helper
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-03 10:37:14 +02:00
Daniel Vetter
cd1f220847 lib/drmtest: extract igt_fork from gem_concurrent_blt
Making sure that we correctly collect the exit codes from all children
is a bit a hassle. So add another magic igt codeblock for easy forking
and joining.

Note that children are (currently at least) not allowed to call igt_skip.
Add an assert to enforce this.

v2:
- Properly propagate the exit code.
- Fix the segfault.
- Add a child int and num_children paramter to the magic codeblock as
  suggested by Chris Wilson.
- Don't dump noise into stdout when a child thread fails, the parent
  will do that for us already.

v3: Now with some docs.

v4: Fixup igt_waitchildren to properly reset state so it can be used
again.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-29 18:18:33 +02:00
Chris Wilson
d0ed912107 kms_flip: Exercise flip-vs-render
For machine with split BCS/RCS rings, we also need to test whether we
correctly wait upon outstanding render work before flipping and changing
modes. This should also serve to exercise the ring selection code for
flips.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-29 16:19:41 +01:00
Daniel Vetter
8869e1e628 lib/drmtest: don't complete fixtures with a longjmp
Longjmp creates havoc with stack variables of the current stackframe.
And since fixtures should be used to set up such variables creating
havoc isn't a great idea. With this I can revert a bunch of
bogus patches I've done to paper over this by moving stack variables
to be global.

The same issue is actually a feature for subtest blocks since subtests
should be independant anyway.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-26 20:55:54 +02:00
Chris Wilson
55b8c33ca5 overlay: Auatomatically mount debugfs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-19 18:16:11 +01:00
Imre Deak
5cabaae4dd lib: add subtest extra command line option handling
At the moment any command line option handling done by tests will
interfere with the option handling of the subtest interface. To fix this
add a new version of the subtest_init function accepting optional short
and long command line options. Merge these together with the subtest
interface's own long options and handle both together in the same
getopt_long call.

Signed-off-by: Imre Deak <imre.deak@intel.com>
2013-08-19 16:38:22 +03:00
Imre Deak
9a9f13167a lib: export kmstest_get_connector_default_mode
Signed-off-by: Imre Deak <imre.deak@intel.com>
2013-08-19 16:38:21 +03:00
Daniel Vetter
8dbd1fb9d4 lib/drmtest: igt_skip when drm_get_card fails
Also add printf support to igt_skip to make sure there's always a
reason why we fail a testcase.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-19 11:09:25 +02:00
Daniel Vetter
9ad062d0b3 lib/drmtest: extract gem_create_context
libdrm requirements are now up to it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-19 10:55:28 +02:00
Daniel Vetter
5951ffb6a0 lib/drmtest: rip out drm_open_any_master
It's unused. Also most of our tests failed to ask for the right type
of drm fd anyway. So it's imo better to just let them fall over when
they don't get master but want it, like they already do today.

This also allows us to garbage-collect the master parameter to
drm_get_card and associated code.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-19 10:34:34 +02:00
Daniel Vetter
78865847f9 lib/drmtest: skip fixtures after an igt_skip
This way we can just enclose all igt_skip/igt_require calls into
fixtures even when we have subtests, and still output correct SKIP
message for all of them. Wohoo, magic!

The only thing which doesn't work yet is enumerating failed subtests,
but I think that should work out on top of this.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-19 08:09:25 +02:00
Daniel Vetter
e58891d0ae tests/prime: test dma-buf llseek support
This exercises a proposed patch from Christopher James Halse Rogers.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-15 14:01:10 +02:00
Daniel Vetter
79abed393f lib/drmtest: Use igt_assert in the do_ioctl/do_or_die helpers
abort results in "crash" test results in the piglit runner, igt gives
us neater output.

The downside is that we can now only use these in igt tests, but
that's already the case (and given their placement in drmtest.h their
intended use-case, too).

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-15 14:01:10 +02:00
Daniel Vetter
696c8f6434 lib/drmtest: documentation for igt_fixture
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14 18:30:03 +02:00
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