summaryrefslogtreecommitdiff
path: root/tests/prime_self_import.c
AgeCommit message (Collapse)Author
2019-02-22tests/prime_self_import: Swap gtt mapping for cpuAntonio Argenziano
The test uses gtt mapping to check two BOs have the same content, since it seems there is no contention on the BOs use cpu mapping to make it compatible with platforms that do not have a mappable aperture. v2: - Need to have an explicit set_domain. (Chris) Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-09-08build: remove _GNU_SOURCE from source filesDaniel Vetter
We are, the build system takes care of that. Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Stone <daniels@collabora.com> Acked-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-12-16gem_flink_race/prime_self_import: Improve test reliabilityDerek Morton
gem_flink_race and prime_self_import have subtests which read the number of open gem objects from debugfs to determine if objects have leaked during the test. However the test can fail sporadically if the number of gem objects changes due to other process activity. This patch introduces a change to check the number of gem objects several times to filter out any fluctuations. v2: Moved the common code to a library and made the loop android specific (Daniel Vetter) v3: Renamed get_stable_obj_count -> igt_get_stable_obj_count Signed-off-by: Derek Morton <derek.j.morton@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
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-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-08-14tests/gem_flink, prime_self_import: mark flink and prime tests as basic v2Jesse Barnes
They're testing basic functionality and don't involve stress or race induction. v2: use gem_flink and prime_self_import tests instead (Daniel) add to .gitignore Reviewed-by: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2015-04-13igt/prime_self_import: Ensure driver state is consistent between countsChris Wilson
Similar to gem_flink_race, we need to make sure that when we count objects, the driver is in an identical state. We do this by flushing all work before counting. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90003 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-01-29tests/prime_self_import: further fix object countsThomas Daniel
A previous commit: commit 2f2c491cf3167befe7c79e4b17afb4f6284dfc84 Author: Mika Kuoppala <mika.kuoppala@intel.com> Date: Fri Mar 28 10:52:46 2014 +0200 lib/drmtest: don't dup quiescent fd introduced a regression for drm object leak checking. A following commit: commit 8741c2289f17e9bcb740a01cad4764a71c918eea Author: Mika Kuoppala <mika.kuoppala@intel.com> Date: Wed May 7 16:46:19 2014 +0300 tests/gem_flink_race,prime_self_import: fix object counts fixed the regression for some cases but missed the export-vs-gem_close-race subtest. Note that test behaviour depends on whether the subtest is run as part of the whole prime_self_import test (fail), or as a single subtest (pass). Using execlists on Gen8+ reverses the pass/fail due to lazy context allocation which is presumably why this has now been noticed. This commit applies the same fix to the export-vs-gem_close-race subtest. Cc: Mika Kuoppala <mika.kuoppala@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87627 Signed-off-by: Thomas Daniel <thomas.daniel@intel.com> Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
2015-01-15lib: remove unnecessary checks on the drm_open_any return valueThomas Wood
drm_open_any always returns a valid file descriptor, so there is no need to check the return value. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-12-04tests: add more test descriptionsThomas Wood
Add more test descriptions based on exiting comments. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-11-18tests/prime_self_import: Track leaked objects accuratelyDaniel Vetter
drm_open_any keeps a buffer handle around for the cleanup sync work, so we can only grab the buffer count after the latst drm_open_any call. Otherwise we'll detect a fake leak. This broke in commit 2f2c491cf3167befe7c79e4b17afb4f6284dfc84 Author: Mika Kuoppala <mika.kuoppala@intel.com> Date: Fri Mar 28 10:52:46 2014 +0200 lib/drmtest: don't dup quiescent fd since that additional open drm fd keeps a gem object for the default context around. Hence why this also only blows up on gen6+ - earlier platforms don't have hw context support. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79821 Cc: Mika Kuoppala <mika.kuoppala@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2014-11-06tests: use igt_debugfs where possibleThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-08-29igt: Prettify igt_assert_eq() failure messagesChris Wilson
This just improves the language about the exact failure to reduce confusion. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-13tests/prime_self_import: Use igt_assert_cmpintDaniel Vetter
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-05-07tests/gem_flink_race,prime_self_import: fix object countsMika Kuoppala
We need to add one drm_open_any() before getting the object counts as first call to drm_open_any() allocates file descriptors for exit handlers and thus is not symmetrical. The regression, assymmetric behaviour, was introduced in: commit 2f2c491cf3167befe7c79e4b17afb4f6284dfc84 Author: Mika Kuoppala <mika.kuoppala@intel.com> Date: Fri Mar 28 10:52:46 2014 +0200 lib/drmtest: don't dup quiescent fd Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77867 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77875 Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
2014-03-22lib: unnecessary header removal for drmtest.h, part 1Daniel Vetter
Brought a few missing headers to light in ioctl_wrappers.h, too. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-05prime_self_import: Assure no pending requests before object countingOscar Mateo
We don't want a previously used object to be freed in the middle of a before/after object counting operation (or we would get a "-1 objects leaked" message). We have seen this happening, e.g., when a context from a previous run dies, but its backing object is alive waiting for a retire_work to kick in. v2: Use igt_debugfs facilities for drop cache. v3: Move igt_drop_caches_set() call inside get_object_count() to make it clearer why we want this. Signed-off-by: Oscar Mateo <oscar.mateo@intel.com> Cc: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-01lib: add igt_main macroDaniel Vetter
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-09-03lib/drmtest: include sys/mman.h from drmtest.hDaniel Vetter
We need it for mmapping to get at PROT_READ|WRITE anyway. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-19lib/drmtest: rip out drm_open_any_masterDaniel Vetter
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-15tests/prime: test dma-buf llseek supportDaniel Vetter
This exercises a proposed patch from Christopher James Halse Rogers. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14tests: use igt_exit() consistently with subtestsDaniel Vetter
This is mostly important to get the SKIP reporting right, but I've found a few stragglers that wanted to get converted over to the igt result reporting completely. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-13tests: s/assert/igt_assertDaniel Vetter
Just a wholesale rollout for now, we can refine later on. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12s/drmtest_/igt_/Daniel Vetter
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-12s/drmtest_subtest_block/drmtest_subtest/Daniel Vetter
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-12tests: use drmtest_skip to check for ringsDaniel Vetter
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-12lib/drmtest: Add drmtest_subtest_block macroDaniel Vetter
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-07tests/prime_self_import: fix commentDaniel Vetter
2013-08-07tests/prime_self_import: Fixup previuos testDaniel Vetter
... not a great display of my prowess here. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-07tests/prime_self_import: Add a flink/dma-buf self-import testDaniel Vetter
This checks that we really always fill the dma-buf export cache. Which sometimes we don't. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-06tests/prime_self_import: Add racing handle2fd testcaseDaniel Vetter
Similar to how we test flink races. Note that on unfixed kernels this oopses, and with my current set of patches it still leaks like mad. v2: Only close the prime fd if we've successfully created it. v3: Add a reimport test to check whether we don't race when reaping the obj->dma_buf link. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-04-17tests/prime_self_import: add subtest to export/import a second gem bufferImre Deak
Also add a subtest for the fd=handle_to_fd(), fd2=dup(fd), close(fd) case (idea from Kristian Høgsberg). Signed-off-by: Imre Deak <imre.deak@intel.com> v2: - add a new subtest instead of modifying the original test (Daniel) - add a new subtest for testing dup (Kristian) Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-07-23tests: fixup prime test paranoiaDaniel Vetter
2012-07-23tests/prime: more paranoiaDaniel Vetter
- check the old contents first in check_bo - drop all GEM handles for the re-import test
2012-07-23tests: add basic re-importing prime testDaniel Vetter
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>