summaryrefslogtreecommitdiff
path: root/tests/gem_userptr_blits.c
AgeCommit message (Collapse)Author
2016-09-30igt/gem_userptr_blits: Tidy up the debug spamChris Wilson
igt_subtest_group { /* to the request */ } Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97934
2016-02-12igt/gem_userptr_blits: Flip sign on error checkChris Wilson
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-11lib: Add gem_userptr and __gem_userptr helpersTiago Vignatti
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-04igt/gem_userptr_blits: Limit amount of mlocked surfacesChris Wilson
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-01-25Promote eviction memory sizes and buffer counts to uint64_tChris Wilson
References: https://bugs.freedesktop.org/show_bug.cgi?id=93849 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-22igt/gem_userptr_blits: Exercise applying relocations to a userptr boChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-03igt/gem_userptr_blits: Correct the number of objects requiredChris Wilson
Since we allocate 2 times count number of objects, that is the number of objects we should be using when checking for sufficient RAM to use for the test. References: https://bugs.freedesktop.org/show_bug.cgi?id=92799 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-12Replace __gem_mmap__{cpu,gtt,wc}() + igt_assert() with gem_mmap__{cpu,gtt,wc}()Ville Syrjälä
gem_mmap__{cpu,gtt,wc}() already has the assert built in, so replace __gem_mmap__{cpu,gtt,wc}() + igt_assert() with it. Mostly done with coccinelle, with some manual help: @@ identifier I; expression E1, E2, E3, E4, E5, E6; @@ ( - I = __gem_mmap__gtt(E1, E2, E3, E4); + I = gem_mmap__gtt(E1, E2, E3, E4); ... - igt_assert(I); | - I = __gem_mmap__cpu(E1, E2, E3, E4, E5); + I = gem_mmap__cpu(E1, E2, E3, E4, E5); ... - igt_assert(I); | - I = __gem_mmap__wc(E1, E2, E3, E4, E5); + I = gem_mmap__wc(E1, E2, E3, E4, E5); ... - igt_assert(I); ) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09Make gem_mmap__{cpu,gtt,wc}() assert on failureVille Syrjälä
Rename the current gem_mmap__{cpu,gtt,wc}() functions into __gem_mmap__{cpu,gtt,wc}(), and add back wrappers with the original name that assert that the pointer is valid. Most callers will expect a valid pointer and shouldn't have to bother with failures. To avoid changing anything (yet), sed 's/gem_mmap__/__gem_mmap__/g' over the entire codebase. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09Sprinkle igt_assert(ptr) after gem_mmap__{cpu,gtt,wc}Ville Syrjälä
Do the following ptr = gem_mmap__{cpu,gtt,wc}() +igt_assert(ptr); whenever the code doesn't handle the NULL ptr in any kind of specific way. Makes it easier to move the assert into gem_mmap__{cpu,gtt,wc}() itself. Mostly done with coccinelle, with some manual cleanups: @@ identifier I; @@ <... when != igt_assert(I) when != igt_require(I) when != igt_require_f(I, ...) when != I != NULL when != I == NULL ( I = gem_mmap__gtt(...); + igt_assert(I); | I = gem_mmap__cpu(...); + igt_assert(I); | I = gem_mmap__wc(...); + igt_assert(I); ) ...> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09Remove gem_mmap__{cpu,gtt,wc} return value MAP_FAILED assertsVille Syrjälä
gem_mmap__{cpu,gtt,wc} never return MAP_FAILED, it gets converted to NULL internally. So don't go asserting that the returned value is not MAP_FAILED. Done with coccinelle: @@ type T; identifier I; @@ ( I = gem_mmap__gtt(...); | I = gem_mmap__cpu(...); | I = gem_mmap__wc(...); ) ... ( - igt_assert(I != MAP_FAILED); + igt_assert(I); | - igt_assert(I && I != MAP_FAILED); + igt_assert(I); | - igt_assert(I != (T *) MAP_FAILED); + igt_assert(I); | - igt_assert(I != NULL); + igt_assert(I); ) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09s/gem_mmap/gem_mmap__gtt/Ville Syrjälä
Get rid of the gem_mmap() alias of gem_mmap__gtt(). I don't see any point in having it. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-11convert drm_open_any*() calls to drm_open_driver*(DRIVER_INTEL) calls with cocciMicah Fedke
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-08-21lib: add a single include headerThomas Wood
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-05-14tests: match gem_create prototype in igt_eviction_test_ops create functionThomas Wood
This avoids a warning when using gem_create as the create function. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-29igt/gem_evict_everything: Use mlock to reduce available memoryChris Wilson
The idea here is to check what happens when a large process requests memory from us - we create and utilize a bunch of surfaces then have to relinquish some but continue using the whole working set (so as to force reloads). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-03-06igt.cocci: Replace igt_assert() with igt_assert_CMP() where possibleMatt Roper
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-02-04tests/gem_userptr_blits: Race between close and invalidateMichał Winiarski
It was possible for invalidate range start mmu notifier callback to race with releasing userptr object. If the object is released prior to taking a spinlock in the callback, we'll encounter a null pointer dereference. v2: Moved expressions inside igt_assert(), added mem barrier (Chris) Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-01-06Skip MADV_DOFORK & MADV_DONTFORK calls on OS'es that don't support themAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-11-17lib/os: Push simulation test down into intel_require_memoryDaniel Vetter
This has the upside that we'll never forget to add it to thrashing tests. But we'll also never miss to move it when adding basic functionality tests to existing binaries. Chris already started this refining work in e.g. commit d77eda6614a1955717f224be023dedf74eb7735d Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri Nov 14 07:45:40 2014 +0000 igt/gem_linear_blits: Require that we do the full test by moving igt_skip_on_simulation into subtests. Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2014-11-17lib/os: Pust igt_require into memory check functionDaniel Vetter
More in line with the usual igt pattern and simplifies the code - every called just wrapped it in igt_require. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2014-11-04ioctl_wrappers: Pass in offset to CPU mmapsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-24igt/gem_userptr_blits/dmabuf: Map the right pointer for !llcChris Wilson
References: https://bugs.freedesktop.org/show_bug.cgi?id=85354#c2 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-23igt/gem_userptr_blits/dmabuf: Provide partial coverage on !llc platformsChris Wilson
Without LLC, we cannot assume coherency between system RAM and the GTT. If we try to use the GTT with snooped memory, the machine may lock up, so the kernel prevents us from doing so, causing the test to fail. However, we still do want to verify that we can access the userptr through a dmabuf, so just check that we can make a copy from it using the GPU and ignore the GTT cross-checking. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85354 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-17lib: add common min and max macrosThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-10-02tests: Sprinkle missing igt_exit() where needed.Daniel Vetter
Yay for breaking piles of tests. This regression has been introduced with commit 5782eca1e19e85a04ad402fa4094aa1b5f9c53ce Author: Tim Gore <tim.gore@intel.com> Date: Wed Oct 1 13:25:20 2014 +0100 lib/igt_core.c: disable lowmemorykiller during tests Cc: Tim Gore <tim.gore@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2014-09-26igt/gem_userptr_blits: Test interruptible create-destroyChris Wilson
In order to exercise https://bugs.freedesktop.org/show_bug.cgi?id=84207 we need to interrupt the mmu_notifier_register with a signal. This is likely to be quite difficult, but let's just try running the create-destroy test in an interruptible loop for 5s. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-12igt/gem_userptr_blits: GTT mmaping a userptr requires llcChris Wilson
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83790 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-24igt/gem_userptr_blits: Fix multi-threaded mm stress testerTvrtko Ursulin
Two parts to the fix: 1. Do not use pthread_cancel since not available on Android. 2. Do not assert in the thread since that does not get propagated to the process. Rather pass out any failures so we know test did not work as expected. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Tim Gore <tim.gore@intel.com> Reviewed-by: Tim Gore <tim.gore@intel.com>
2014-07-24igt/gem_userptr_blits: Fix forked access testTvrtko Ursulin
copy() blit helper assumes a certain object size much larger than a page size. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-21igt/gem_userptr_blits: New tests, old issuesChris Wilson
Introduce a new test to keep that we clean up on process exit (if the userptr is busy or it has been gtt mmapped). This revealed a few bugs in the existing tests so clean those up. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-15tests/gem_userptr_blits: PolishDaniel Vetter
- Drop return values for test functions - we rely on the implicit control flow from igt_ checks. - Don't use assert directly, this upsets the test flow logic (and results in a CRASH result instead of FAIL). Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-07-15tests/gem_userptr_blits: Race between object creation and multi-threaded mm opsTvrtko Ursulin
Userptr v23 was not thread safe against memory map operations and object creation from separate threads. MMU notifier callback would get triggered on a partially constructed object causing a NULL pointer dereference. This test excercises that path a bit. In my testing it would trigger it every time and easily, but unfortunately a test pass here does not guarantee the absence of the race. v2: Added explicit cancellation point and removed the stop flag. Use only igt_assert(). Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-07-14igt/gem_userptr_blits: Add missing RAM check before coherency testsChris Wilson
-ENOCOFFE. References: https://bugs.freedesktop.org/show_bug.cgi?id=79237 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-14igt/gem_userptr_blits: Add missing RAM check before coherency testsChris Wilson
References: https://bugs.freedesktop.org/show_bug.cgi?id=79237 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-11igt/gem_userptr_blits: Verify that userptr bo work on unshared memoryChris Wilson
If the parent passes a userptr to some private memory, we expect to still be able to use the userptr in the child. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-11igt/gem_userptr_blits: Shared memory allocationsChris Wilson
The forked tests allocate the bo (and thus for userptr, the memory) in the parent and pass them to all children. The difference for userptr is that we allocate system memory which the kernel then copies into each child. As the children need to access the memory for their checks, it does need to be shared - so allocate the userptr from shared memory! Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80208 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-03igt/gem_evict_everything: Move assertionChris Wilson
If we move the assertion from out of the callback, we can get a much more useful error message. References: https://bugs.freedesktop.org/show_bug.cgi?id=79573 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-22igt/gem_userptr_blits: Fix up last minute API changesChris Wilson
When the patch was merged, the ioctl numbers had to be adjusted to leave no holes. Also there was a final piece of munging of the API to downgrade unsynced userptr for export over dma-buf. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-14tests: Use igt macros moreDaniel Vetter
Often just folding together of the common if (cond) printf; abort|igt_skip|igt_fail; pattern. But in a few cases I've ripped out more since the igt macros will already print the condition and errno. A few tests where more work (like ripping out return codes en masse) is needed left as-is. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-05-14tests: sprinkle igt loggingDaniel Vetter
All the cases that simply dump some debug information and couldn't be converted to some of the fancier macros. Some information output removed when it's redundant with the subtest status. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-04-25test: Fixup for the previous patchDaniel Vetter
Oops, failed to git add. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-04-25test/gem_userptr_*: Fix compile failDaniel Vetter
Also shut up warnings. Those revealed incorrect usage of local variables in conjunction with igt_fixture/igt_subtest. Since those use longjmps we need to move the out of the stackframe those magic blocks are declared in. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-04-25tests/gem_userptr_blits: Expanded userptr test casesTvrtko Ursulin
A set of userptr test cases to support the new feature. For the eviction and swapping stress testing I have extracted some common behaviour from gem_evict_everything and made both test cases use it to avoid duplicating the code. Both unsynchronized and synchronized userptr objects are tested but the latter set of tests will be skipped if kernel is compiled without MMU_NOTIFIERS. Also, with 32-bit userspace swapping tests are skipped if the system has a lot more RAM than process address space. Forking swapping tests are not skipped since they can still trigger swapping by cumulative effect. v2: * Fixed dmabuf test. * Added test for rejecting read-only. * Fixed ioctl detection for latest kernel patch. v3: * Use ALIGN macro. * Catchup with big lib/ reorganization. * Fixed up some warnings. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Brad Volkin <bradley.d.volkin@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>