978 Commits

Author SHA1 Message Date
Thomas Wood
04b1526f9d lib: add debug flags
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-30 17:09:22 +01:00
Thomas Wood
47f6b1305c igt.cocci: check the return values of various functions
Add rules to fix unused-result warnings when compiling with
_FORTIFY_SOURCE defined and apply them to the library and tests.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-26 15:50:59 +00:00
Thomas Wood
277ca2b992 lib: print a stack trace when a test assertion fails
Add an optional dependency on libunwind to print stack traces when a
test assertion fails.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-26 15:50:05 +00:00
Chris Wilson
7763349a9a igt/gem_concurrent_blit: Separate out the combinatorial explosion
Apparently nobody else likes testing and debugging GEM coherency issues.
However, this also means that QA is skipping these vital tests. Split
out a set of canaries into igt/gem_concurrent_blit and keep the rest in
igt/gem_concurrent_all.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89497
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-03-26 08:15:19 +00:00
Chris Wilson
2fa35c7316 lib/core: Silence internally used signals
We use SIGTERM to kill off child processes. We use it a lot. Reporting
everytime we use it is just spam. Treat the similar user signals
(SIGINT, SIGQUIT and the should-never-have-been SIGPIPE) similarly to
reduce noise.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Thomas Wood <thomas.wood@intel.com>
2015-03-26 08:15:18 +00:00
Jeff McGee
aef4605f7c lib: Add media spin
The media spin utility is derived from media fill. The purpose
is to create a simple means to keep the render engine (media
pipeline) busy for a controlled amount of time. It does so by
emitting a batch with a single execution thread that spins in
a tight loop the requested number of times. Each spin increments
a counter whose final 32-bit value is written to the destination
buffer on completion for checking. The implementation supports
Gen8, Gen8lp, and Gen9.

v2: Apply the recommendations of igt.cocci.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Tested-by: Lei Liu <lei.a.liu@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-25 17:52:11 +00:00
Ville Syrjälä
e5e7a53071 lib: Add i854 PCI ID
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2015-03-24 15:30:20 +02:00
Ville Syrjälä
ac28ecefe0 lib: Allow 32bit addresses for IOSF-SB registers
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2015-03-24 15:30:20 +02:00
Ville Syrjälä
0a3ef582da lib: Change IOSF SB devfn to 0.0
The devfn field in the IOSF SB messages is only relevant when there's a
real PCI bus or some other multifunction device behind a single port.
Otherwise the port number itself is enough to uniquely identify the
target. In fact some IOSF SB targets reject the access when devfn is not
0.0 (eg. GPIO_NC on BYT).

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2015-03-24 15:30:20 +02:00
Daniel Vetter
d297e58529 lib: Only warn about suspicious CRCs
It is theoretically possible to hit these in the wild, so only warn
about them. Dropping the test is probably too much since these caught
some real bugs in the past.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-03-23 11:02:28 +01:00
Daniel Vetter
562bbe12f6 tests: Remove usage of igt_crc_equal and _non_null
Tests should positively check for crc matches, not for mismatches.
Enforce this by only exposing and igt_assert function for comparing
crcs.

For the few tests which didn't just do this as consistency checks but
to do functional tests add FIXME comments that some reference crc
values are missing.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-03-23 11:02:28 +01:00
Daniel Vetter
e588f6dfa6 lib/debugfs: Add igt_assert_crc_equal
Because of hash collisions tests should only ever compare crc
checksums for equality. Checking for inequality can result in random
failures.

To ensure this only expose and igt_assert function and use that.
Follow-up patches will rework the code for tests which don't follow
this requirement and try to compare for CRC inequality.

v2: Rebase on top of Matt's kms_plane changes.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-03-23 11:02:28 +01:00
Daniel Vetter
4fec18e5e0 lib/core: add interactive debug point to igt_fail
Useful for inspecting the screen state in kms tests when they fail.

Also move the screen clearing in kms_cursor_crc to the bottom.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-03-23 11:02:28 +01:00
Chris Wilson
d3e9316b44 lib/batch: Fix range checks for blits
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-03-18 08:37:33 +00:00
Chris Wilson
233808a58d lib/batch: Trivial compile fix for 32-bit builds
intel_batchbuffer.c: In function 'fill_object':
intel_batchbuffer.c:589:20: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  obj->relocs_ptr = (uint64_t)relocs;
                    ^
intel_batchbuffer.c: In function 'exec_blit':
intel_batchbuffer.c:598:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  exec.buffers_ptr = (uint64_t)objs;

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-03-18 08:37:33 +00:00
Thomas Wood
3b8e121552 lib: small documentation fixes
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-12 17:05:18 +00:00
Thomas Wood
a6c40c7665 lib: move igt_interactive_debug into igt_core.c
igt_interactive_debug should be defined in igt_core.c, rather than the
header, to avoid it being defined more than once.

Reported-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-12 15:11:11 +00:00
Damien Lespiau
dde047fe2c lib/fb: Use PRIx64 for uint64_t in format string
Fix the following warning:

  igt_fb.c: In function 'igt_create_fb_with_bo_size':
  igt_fb.c:414:2: warning: format '%llx' expects argument of type
    'long long unsigned int', but argument 9 has type 'uint64_t' [-Wformat=]

  igt_debug("%s(width=%d, height=%d, format=0x%x [bpp=%d], tiling=%llx, size=%d\n",

introduced by commit:

  commit e36091d1c7010e825897dc4487f9985ab353973b
  Author: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
  Date:   Tue Mar 3 14:11:01 2015 +0000

      tiling: Convert framebuffer helpers to use fb modifiers

Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-03-12 14:33:36 +00:00
Damien Lespiau
ff451a6d43 lib: Allow the creation of Ys/Yf tiled FBs
There's no fencing for those tiling layouts, so we create a linear bo
for cairo to play with, and when cairo is finished with it, we do a fast
copy blit to the fb BO with its final tiling.

v2: Move to correct domain after CPU is done with the object (-EINVAL). (Tvrtko Ursulin)
    Correct arguments passed in to framebuffer creation (segfault). (Tvrtko Ursulin)
    Pass zero stride to kernel as it expects for Yf&Ys. (Tvrtko Ursulin)

v3: Rebase for gem_mmap__cpu changes. (Tvrtko Ursulin)

v4: Rebase for addfb2.5. (Tvrtko Ursulin)

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2015-03-12 14:24:18 +00:00
Tvrtko Ursulin
eb93c1b33e lib/igt_fb: Use new ADDFB2 extension for new tiling modes
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2015-03-12 14:24:11 +00:00
Tvrtko Ursulin
c7bac3c62a lib: Add support for new extension to the ADDFB2 ioctl.
New functionality accessesed via the __kms_addfb wrapper.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2015-03-12 14:24:05 +00:00
Tvrtko Ursulin
e36091d1c7 tiling: Convert framebuffer helpers to use fb modifiers
This converts the IGT API only, underneath legacy set_tiling is still used.

v2: One got away in kms_flip.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-03-12 14:23:48 +00:00
Damien Lespiau
672e88acb7 lib: Provide a raw version of the gen9 fast copy blits
So we can use it with bare kernel types, without going through libdrm
bos.

v2: Don't forget the object handle. (Tvrtko)
    Correct surface pitch calculation. (Tvrtko)

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2015-03-12 14:20:10 +00:00
Damien Lespiau
6533d113a9 lib: Split two helpers to build fast copy's dword0 and dword1
Again, these helpers will be useful for a raw version of the gen9 fast
copy.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-03-12 14:20:08 +00:00
Damien Lespiau
130221b3b5 lib: Don't give a struct igt_buf * to fast_copy_pitch()
So we can use this function in a "raw" (ie without igt_buf) version.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-03-12 14:19:57 +00:00
Damien Lespiau
cbd927cd35 lib/skl: Add gen9 specific igt_blitter_fast_copy()
v2: Adjust for BB handling changes. (Tvrtko Ursulin)
    Correct XY_FAST_COPY_DST_TILING_Yf. (Tvrtko Ursulin)

v3: New tiling modes are not defined in the kernel any more. (Tvrtko Ursulin)

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2015-03-12 14:19:41 +00:00
Tvrtko Ursulin
0c15e068a5 tests/kms_addfb: Y tiled testcases
v2: Moved all init into fixtures.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2015-03-12 14:15:26 +00:00
Tvrtko Ursulin
0a087733d2 tests/kms_addfb: Add support for fb modifiers
Just a few basic tests to make sure fb modifiers can be used and
behave sanely when mixed with the old set_tiling API.

v2:
   * Review feedback from Daniel Vetter:
      1. Move cap detection into the subtest so skipping works.
      2. Added some gtkdoc comments.
      3. Two more test cases.
      4. Removed unused parts for now.

v3:
   * Removed two tests which do not make sense any more after the
     fb modifier rewrite.

v4:
   * Moved gtkdoc comments into .c file.
   * Moved all initialization into fixtures.
   * Rebased for fb modifier changes.

v5:
   * Added bad modifier subtest.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2015-03-12 14:14:27 +00: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
Chris Wilson
b8db5d60e0 lib/core: Make the start of the debug output more clear
I missed the quiet "Log start" between the test failure and the debug
output (and so was very confused by the repetition). You have to shout
at me!

v2: Thomas suggested I make the end of the logging clear as well. Since
I completely missed that there was a end marker, he must be right!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Thomas Wood <thomas.wood@intel.com>
2015-03-06 15:43:03 +00:00
Daniel Vetter
f45698df8b lib/igt_core: don't add newlines in logging functions
igt_kms extensively uses line continuation when dumping state updates
at the debug level. They got badly mangled with the recent changes to
for the log handling functions. Two separate fixes:
- Don't prepend domain and other metainformation when it's just a
  continuation line.
- Dont add newlines when dumping the log recorder.

If someone interleaves different log level messages this will go awry,
but really just don't do that.

Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-02-27 19:34:38 +01:00
Daniel Vetter
305fb1db5c lib: add igt_assert_lt
Found one user in gem_wait.c

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-02-27 16:24:25 +01:00
Thomas Wood
26f40811d7 lib: small documentation fixes
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-25 16:59:22 +00:00
Thomas Wood
d9224c3479 lib/tests: update .gitignore 2015-02-25 16:59:22 +00:00
Thomas Wood
4ff4ea601a lib: print the signal name to stderr when handling a signal
Print the received signal name to stderr when handling a signal. This
uses an array of handled signal names since strsignal() only provides
descriptions.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-25 16:50:13 +00:00
Thomas Wood
8fb19782f8 lib: remove handled option arguments from argv
Remove options from argv that have been handled by getopt to allow
additional non-option parameters to be processed in the test application.

This fixes issues when using options such as --debug with tests that accept
additional non-option parameters.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-25 16:48:25 +00:00
Thomas Wood
55cc132b32 lib: use defines for igt_simple_init and igt_subtest_init
Using defines removes an extra function call and prepares for changes
to the command line argument handling.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-25 16:48:25 +00:00
Marc Herbert
c6d18ee56b lib/igt_kms.c: remove tests dependency on VT /dev/tty0
Required to run on any recent, freon-based and X11-free ChromeOS release.

v2:
- igt_debug() instead of igt_warn()
- return KD_GRAPHICS instead of -1UL
- print previous mode in debug statements. Among others this help a tiny
  bit with the now confusing debug output ("cannot change" immediately
  followed by a misleading "mode changed").

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-02-24 23:39:15 +01:00
David Weinehall
7890b09348 tests/drv_suspend: hibernation test
intel-gpu-tools currently has a bunch of tests for suspend,
but currently none (that I could find) for hibernate.

Attached is a rudimentary patch to add said test.  It does so
by repurposing the drv_suspend driver to handle both suspend
and hibernate, since the difference is miniscule.

I decided to split the suspend/autoresume functions in
igt_aux.c though, to be able to leave the igt_system_uspend_autoresume()
function unchanged (the other option would be to
introduce a boolean function argument and have that
decide what parameters to pass to rtcwake).

The timeout passed to rtcwake probably needs tuning (it might
even need to be dynamically adjusted, since the time hibernation takes
varies wildly depending on the amount of non-cache memory in use).

Signed-off-by: David Weinehall <david.weinehall@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
2015-02-24 16:46:22 +02:00
Chris Wilson
5b93daf5cb lib: Use strtol not strtod for overiding the PCI ID
Simply to avoid the roundtrip through floating points and any extra
headaches from worrying about the implications

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-18 16:09:28 +00:00
Chris Wilson
eaa7e6183c lib: Cache DRM device id to reduce number of ioctls
The DRM device id for the igfx is fixed, since there can only be one in
the system. So once we query it for the first time we can safely report
that value on every subsequent request, cutting out a lot of noisy
ioctls from inside tests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-18 16:04:12 +00:00
Thomas Wood
a22548fec0 lib: small documentation fixes
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-17 11:24:04 +00:00
Thomas Wood
f8fd4c977a lib: print recent log messages to stderr when a test or subtest fails
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-17 11:24:04 +00:00
Thomas Wood
a5f21726cd lib: add a ring buffer for log entries
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-17 11:24:04 +00: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
2eca38eab9 lib/igt_aux: s/swap/igt_swap/
It collides with the subtest naming convention glossary entry for swap.
Which makes the docbook xml stuff unhappy.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-02-13 09:35:36 +01:00
Daniel Vetter
75c075cb26 lib/ioctl: Document ctx param functions
And move them so that they're grouped with the other context wrappers.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-02-13 09:35:35 +01:00
Daniel Vetter
09b8211d41 lib/ioctl: Add gem_context_destroy helpers
We also need a raw version for some tests.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-02-13 09:35:35 +01:00
Daniel Vetter
8d21b39251 lib/ioctls: make gem_context_set/get_param infallible
We have separate require checks already, so these failing is a bug in
the test logic.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-02-13 09:35:35 +01:00
Daniel Vetter
15801b4dad igt/ioctls: doc for gem_mmap
Just spotted while driving around. gtkdoc needs the full parameter
list otherwise it doesn't recognize it as a function. So add them.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-02-13 09:35:35 +01:00