2281 Commits

Author SHA1 Message Date
Chris Wilson
556535400c igt/gem_exec_reloc: Check WC mmaps as well
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-19 10:32:35 +00:00
David Weinehall
15deba4575 lib/igt_pm: Lib for power management
Move power management related code to a separate library.
Initially this is done only for workarounds that apply to external
components.  Modify the users of such workarounds accordingly.
This currently involves HD audio and SATA link power management.
For SATA link PM there's also code to save the previous settings,
to allow for resetting the values after we've finished testing.

Signed-off-by: David Weinehall <david.weinehall@intel.com>
Reviewed-by: Marius Vlad <marius.c.vlad@intel.com>
Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-02-19 12:10:21 +02:00
Chris Wilson
16038908de lib: Restore gem_available_aperture_size()
Missed an error whilst rebasing and trying to modify the previous patch
to keep this function intact... Instead, I now have to add this patch to
restore gem_available_aperture_size() and its one usage.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-18 10:36:45 +00:00
Chris Wilson
391b32c382 igt: Report the global GTT size
For many tests, the relevant aperture is not the ppGTT but the internal
global GTT managed by the kernel. Use this limit appropriately.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-18 10:30:56 +00:00
Chris Wilson
e85c530eab igt: Mark gem_cs_tlb/gem_cs_prefetch as a pair of basic GTT layout tests
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-18 10:28:39 +00:00
Chris Wilson
3990dd87b6 igt/gem_ctx_thrash: Combine context thrashing with a render test
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-18 09:46:02 +00:00
Chris Wilson
3b12d9e6dc igt/gem_ctx_thrash: Double number of threads/proceesses
Slightly increase the stress by doubling the number of contending
threads and the number of times we try and use each ctx/fd.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-18 09:46:02 +00:00
Marius Vlad
0a45d6ba13 tests/prime_mmap: Encapsulate check_for_dma_buf_mmap() in igt_fixture.
This unbreaks distcheck target that in turn runs each test with --list-subtests.

Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-02-14 19:22:25 +02:00
Chris Wilson
ca3d355846 igt/gem_userptr_blits: Flip sign on error check
Following conversion to __gem_execbuf() we need to consider that it
returns -errno when checking the result.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94117
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-12 16:39:29 +00:00
Tiago Vignatti
ed40329c30 tests: Add prime_mmap_coherency for cache coherency tests
Different than kms_mmap_write_crc that captures the coherency issues within the
scanout mapped buffer, this one is meant for test dma-buf mmap on !llc
platforms mostly and provoke coherency bugs so we know where we need the sync
ioctls.

I tested this with !llc and llc platforms, BTY and IVY respectively.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-02-11 18:16:26 +01:00
Tiago Vignatti
7c89c9d734 tests: Add kms_mmap_write_crc for cache coherency tests
This program can be used to detect when CPU writes in the dma-buf mapped object
don't land in scanout due cache incoherency.

Although this seems a problem inherently of non-LCC machines ("Atom"), this
particular test catches a cache dirt on scanout on LLC machines as well. It's
inspired in Ville's kms_pwrite_crc.c and can be used also to test the
correctness of the driver's begin_cpu_access and end_cpu_access (which requires
i915 implementation.

To see the need for flush, one has to run using '-n' option to not call the
sync ioctls which, via a rather simple CPU hog the system will trashes the
caches, while the test will catch the coherency issue. If you now suppress
'-n', then things should just work like expected.

I tested this with !llc and llc platforms, BTY and IVY respectively.

v2: use prime_handle_to_fd_for_mmap instead.
v3: merge end_cpu_access() patch with this and provide options to disable sync.
v4: use library's prime_sync_{start,end} instead.
v7: use CPU hog instead and use testing rounds to catch the sync problems.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-02-11 18:16:20 +01:00
Tiago Vignatti
35debab2d9 lib: Add prime_sync_start and prime_sync_end helpers
This patch adds dma-buf mmap synchronization ioctls that can be used by tests
for cache coherency management e.g. when CPU and GPU domains are being accessed
through dma-buf at the same time.

v7: add sync invalid flags test.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-02-11 18:16:12 +01:00
Tiago Vignatti
4edfa09ae4 prime_mmap: Add basic tests to write in a bo using CPU
This patch adds test_correct_cpu_write, which maps the texture buffer through a
prime fd and then writes directly to it using the CPU. It stresses the driver
to guarantee cache synchronization among the different domains.

This test also adds test_forked_cpu_write, which creates the GEM bo in one
process and pass the prime handle of the it to another process, which in turn
uses the handle only to map and write. Roughly speaking this test simulates
Chrome OS  architecture, where the Web content ("unpriviledged process") maps
and CPU-draws a buffer, which was previously allocated in the GPU process
("priviledged process").

This requires kernel modifications (Daniel Thompson's "drm: prime: Honour
O_RDWR during prime-handle-to-fd") and therefore prime_handle_to_fd_for_mmap is
added to fail in case these lack. Also, upcoming tests (e.g. next patch) are
going to use it as well, so make it public and available in the lib.

v2: adds prime_handle_to_fd_with_mmap for skipping test in older kernels and
test for invalid flags.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-02-11 18:15:59 +01:00
Rob Bradford
e0efeb97a9 prime_mmap: Add new test for calling mmap() on dma-buf fds
This test has the following subtests:
 - test_correct for correctness of the data
 - test_map_unmap checks for mapping idempotency
 - test_reprime checks for dma-buf creation idempotency
 - test_forked checks for multiprocess access
 - test_refcounting checks for buffer reference counting
 - test_dup checks that dup()ing the fd works
 - test_userptr make sure it fails when mmaping due the lack of obj->base.filp
   in a userptr.
 - test_errors checks the error return values for failures
 - test_aperture_limit tests multiple buffer creation at the gtt aperture
   limit

v2 (Tiago): Removed pattern_check(), which was walking through a useless
iterator. Removed superfluous PROT_WRITE from gem_mmap, in test_correct().
Added binary file to .gitignore
v3 (Tiago): squash patch "prime_mmap: Test for userptr mmap" into this one.
v4 (Tiago): use synchronized userptr for testing. Add test for buffer
overlapping.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-02-11 18:15:52 +01:00
Tiago Vignatti
e1f663b543 lib: Add gem_userptr and __gem_userptr helpers
This patch moves userptr definitions and helpers implementation that were
locally in gem_userptr_benchmark and gem_userptr_blits to the library, so other
tests can make use of them as well. There's no functional changes.

v2: added __ function to differentiate when errors want to be handled back in
the caller; bring gem_userptr_sync back to gem_userptr_blits; added gtkdoc.
v8: remove local_i915_gem_userptr from gem_concurrent_all.c to use the global
helpers instead.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-02-11 18:15:44 +01:00
Maarten Lankhorst
7670e286f5 kms_force_connector_basic: Add force-load-detect test
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-02-11 12:46:24 +01:00
Daniele Ceraolo Spurio
0e388f409a tests/gem_exec_params: test all valid execution flags
The control subtest has been extended to check the execution flags for
all the rings that are present in the HW.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-02-10 09:16:33 +01:00
Daniel Vetter
9e5478dc43 lib: Only compile igt_vc4 is we have it
Unbreaks compilation fail.

Also appease gcc in gem_exec_basic because.

Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-02-09 09:46:03 +01:00
Eric Anholt
467a9fac9b igt/vc4_wait_bo: Add tests with rendering performed.
These caught an unexpected bug with clear colors (we'd get the last
executed clear's color in our new BO), while failing to catch the bug
I'd been hoping to find all along.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-02-08 16:34:13 -08:00
Eric Anholt
e7e094f444 igt/vc4_create_bo: Test various paths in BO creation.
create-bo-0 fails on the current kernel, and it's something I want to
fix.

v2: Use do_ioctl_err().

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-02-08 16:34:13 -08:00
Eric Anholt
59f98997ab igt: Add a helper function for creating VC4 BOs.
v2: Use do_ioctl().

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-02-08 16:34:13 -08:00
Eric Anholt
7f421acb60 igt/vc4_wait_bo: Add a test for VC4's wait-for-BO ioctl.
The pad subtest fails currently.

v2: Use do_ioctl() and do_ioctl_err().

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-02-08 16:34:13 -08:00
Eric Anholt
d333a0ed69 igt/vc4_wait_seqno: Add a test for VC4's wait-for-seqno ioctl.
v2: Use do_ioctl_err().

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-02-08 16:34:13 -08:00
Chris Wilson
6b3c832cfb igt/gem_workarounds: Convert to real GPU hang injection
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-05 17:38:02 +00:00
Chris Wilson
6f7372f664 igt/gem_exec_alignment: Fix off-by-one in buffer objects
When reducing the buffer count to fit into the aperture whilst aligned,
remember to adjust the pointer so that the batch is the last object!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-05 16:13:23 +00:00
Chris Wilson
b081257d74 igt/gem_exec_alignment: Mark batch buffer as also requiring 48B
If we completely fill the lower 4G of address space with our alignment
objects, then we also need to mark the batch as requiring high-address.
Though the kernel should be reordering in this case...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-05 15:35:58 +00:00
Chris Wilson
e7faf33ec7 igt/gem_ctx_thrash: Rewrite to avoid extraneous allocations
The goal of the test is to exercise what happens when we fill the Global
GTT with the contexts. To that end, we only need to allocate 2/4GiB of
context objects, and can forgo filling each context with buffers.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94005
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-05 09:12:31 +00:00
Chris Wilson
0e96238bf3 igt/gem_userptr_blits: Limit amount of mlocked surfaces
When testing surface eviction we don't need that many surfaces as we
mlock surplus memory. Reducing the number of surfaces speeds up the test
and prevents a couple of integer overflow bugs.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94004
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-04 17:48:16 +00:00
Chris Wilson
7b5a818581 igt/gem_reset_stats: Convert from stop-rings to real hang injection
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-04 15:25:40 +00:00
Chris Wilson
9cc2b1336b igt/gem_ctx_exec: Convert from stop-rings to a real GPU hang/reset
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-04 11:22:00 +00:00
Chris Wilson
38fe49d9a8 tests/drv_hangman: Convert to using central list of engines
Rather than encoding our own list of engines, use the common one for
greater coverage.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-04 11:22:00 +00:00
Chris Wilson
01e467a631 igt/drv_hangman: Make the batchbuffer check more robust
All the external viewer expects of the GPU error capture is to extract
the exact batch that triggered the hang. Everything else is internal
detail to aide in post-mortem debugging of the kernel driver (i.e.
subject to change) and not of the userspace portion (under control of
the test).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-04 11:08:07 +00:00
Chris Wilson
0753057446 igt/drv_hangman: Inject a true hang
Wean drv_hangman off the atrocious stop_rings and use a real GPU hang
instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-04 09:49:36 +00:00
Chris Wilson
8f6957a05a igt/gem_ringfill: Add exercising the default-ring to basic testing
ringfill generates a few very common errors when submitting requests,
and historically these have been where we have had many implementation
bugs, repeated over and over again.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-04 09:49:35 +00:00
Chris Wilson
348742ec0d igt/gem_streaming_writes: Set bb start alignment to 64b for Ironlake
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-04 09:49:35 +00:00
Chris Wilson
3992babd98 igt/gem_busy: Refactor to use gem_require_ring()
Now that gem_require_ring() does the right thing with BSD1/BSD2 we can
use it to our advantage here.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-04 09:49:29 +00:00
Paulo Zanoni
ec5deb218d tests/pm_rpm: find an appropriate CRTC instead of hardcoding CRTC 0
BSW does not allow CRTC 0 to be used on every connector, so we need to
write code to actually find a suitable CRTC.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93124
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-29 16:31:18 -02:00
Paulo Zanoni
84157ad1b4 tests/pm_rpm: remove POWER_DIR definition
Unused ever since we moved some code from pm_rpm.c to lib/. This is
currently defined inside igt_aux.c.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-29 16:30:55 -02:00
Paulo Zanoni
7ca55f433c tests/igt_fb: rename igt_get_all_formats to igt_get_all_cairo_formats
I recently had this discussion with Daniel where I didn't want to use
igt_drm_format_to_bpp() because it uses the format_desc array, and
igt_fb currently assumes that all the format_desc formats have a
matching valid Cairo format, so I wouldn't be able to easily add
formats such as ARGB2101010.

The function that has the assumption mentioned above is
igt_get_all_formats: its current users call igt_get_all_formats, and
then call cairo-dependent functions, such as igt_get_cairo_ctx on the
returned formats.

In order to document the current behavior and prevent any problems in
case we start adding new formats without matching Cairo versions to
format_desc, rename igt_get_all_formats to igt_get_all_cairo_formats
and make it explicitly check for CAIRO_FORMAT_INVALID.

Requested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-29 16:30:15 -02:00
Paulo Zanoni
0432201e6d kms_frontbuffer_tracking: standardize the used FB sizes
We want to make sure that both tiled and untiled buffers have the same
size for the same width/height/format. This will allow better control
over the failure paths exercised by our tests: when we try to flip
from tiled to untiled, we'll be sure that we won't execute the error
path that checks for buffer sizes.

v2: Use the new igt_calc_fb_size() instead of implementing our own
size calculation (Daniel).
v3: We can now use igt_drm_format_to_bpp() (Daniel).

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-29 16:29:08 -02:00
Paulo Zanoni
096e020743 kms_frontbuffer_tracking: use igt_drm_format_to_bpp()
The only format from fb_get_bpp() not supported by
igt_drm_format_to_bpp() is ARGB2101010, but we don't really use it in
kms_frontbuffer_tracking, so we can do the switch.

Adding ARGB2101010 to igt_fb won't be that simple since there's no
equivalent Cairo format, and igt_fb users assume that all formats
known by igt_fb have equivalent Cairo formats.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-29 16:28:47 -02:00
Chris Wilson
d63e72f0ad igt/gem_cs_tlb: Increase BB start alignment to 64bytes
Ironlake requires 64byte alignment for its MI_BATCH_BUFFER_START.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-28 17:03:21 +00:00
Chris Wilson
89f81e0396 igt: More MI_STORE_DWORD fixes for gen5
A few other tests I have updated recently to use MI_STORE_DWORD also need
the magic bit for gen4/5.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-28 16:22:43 +00:00
Chris Wilson
3ec8b1d28e igt/gem_ringfill: Set MI_MEM_VIRTUAL flag for gen<6
bit22 of MI_STORE_DWORD is confusing as the meaning changed between
physical/virtual addressing in early gen and GTT/ppGTT in later gen. It
looks like gen4 and gen5 still need the flag.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-28 14:04:07 +00:00
Chris Wilson
506d683da1 tests: Add gem_exec_reloc
The first steps towards basic relocation handling. In today's edition,
we ask how well does the kernel fare if we pass it relocations via
mmappings of our buffer objects.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-28 12:18:22 +00:00
Chris Wilson
d18d1eca81 igt/gem_reset_stats: Convert residual calllers of gem_exec() to gem_execbuf()
Missed from e3b68bb66683ad4cb4c80df904a3a21c98a2b6c2 due to rebasing
fun.

gem_reset_stats.c: In function 'inject_hang_ring':
gem_reset_stats.c:227:19: error: implicit declaration of function 'gem_exec' [-Werror=implicit-function-declaration]
gem_reset_stats.c:227:2: warning: nested extern declaration of 'gem_exec' [-Wnested-externs]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 20:23:45 +00:00
Chris Wilson
a1b47ef6ae igt/gem_concurrent_blit: Disable libdrm buffer cache for child inheritance
It just ends up with buffer leaks all over. On the flip side, it does
allow us to inherit the bufmgr directly without worry of stomping over
the aliased entries (and causing double closes).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 19:59:16 +00:00
Chris Wilson
37f4da0d98 igt/gem_concurrent_all: Pass buffer data down
In order reduce the number of parameters being passed everywhere, whilst
simultaneously making more information available to the lower levels,
pass the struct buffers around.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 19:59:16 +00:00
Chris Wilson
5dea5deffc igt/gem_cs_prefetch: Check each ring
Since each engine has its own ring, each is subject to CS prefetching
and has its own layout that needs probing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 18:34:05 +00:00
Chris Wilson
de70769cc0 Add I915_EXEC_DEFAULT to list of known engines
I dropped this from the list of rings for some tests when refactoring to
a common array. Almost all of the tests should be run over the default
exec engine to ensure ABI backwards compatiblity.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27 16:42:10 +00:00