summaryrefslogtreecommitdiff
path: root/lib/igt_gt.h
AgeCommit message (Collapse)Author
2019-05-13test: perf_pmu: use the gem_engine_topology libraryAndi Shyti
Replace the legacy for_each_engine* defines with the ones implemented in the gem_engine_topology library. Use whenever possible gem_engine_can_store_dword() that checks class instead of flags. Now the __for_each_engine_class_instance and for_each_engine_class_instance are unused, remove them. Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Signed-off-by: Andi Shyti <andi.shyti@intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2019-05-13lib: igt_gt: make gem_engine_can_store_dword() check engine classAndi Shyti
Engines referred by class and instance are getting more popular, gem_engine_can_store_dword() should handle the situation. Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Signed-off-by: Andi Shyti <andi.shyti@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2019-05-13lib: igt_gt: add execution buffer flags to class helperAndi Shyti
we have a "class/instance to eb flags" helper but not the opposite, add it. Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Signed-off-by: Andi Shyti <andi.shyti@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2019-05-13lib/i915: add gem_engine_topology library and for_each loop definitionAndi Shyti
The gem_engine_topology library is a set of functions that interface with the query and getparam/setparam ioctls. The library's access point is the 'intel_init_engine_list()' function that, everytime is called, generates the list of active engines and returns them in a 'struct intel_engine_data'. The structure contains only the engines that are actively present in the GPU. The function can work in both the cases that the query and getparam ioctls are implemented or not by the running kernel. In case they are implemented, a query is made to the driver to fetch the list of active engines. In case they are not implemented, the list is taken from the 'intel_execution_engines2' array and stored only after checking their presence. The gem_engine_topology library provides some iteration helpers: - intel_get_current_engine(): provides the current engine in the iteration. - intel_get_current_physical_engine(): provides the current physical engine, if the current engine is a virtual engine, it moves forward until it finds a physical engine. - intel_next_engine() it just increments the counter so that it points to the next engine. Extend the 'for_each_engine_class_instance' so that it can loop using the new 'intel_init_engine_list()' and rename it to 'for_each_context_engine'. Move '__for_each_engine_class_instance' to gem_engine_topology.h and rename it to '__for_each_static_engine'. Update accordingly tests/perf_pmu.c to use correctly the new for_each loops. Signed-off-by: Andi Shyti <andi.shyti@intel.com>
2019-04-05lib/igt_gt: remove unnecessary argumentAndi Shyti
__for_each_engine_class_instance(fd, e) doesn't need and doesn't use the fd argument. Remove it. Signed-off-by: Andi Shyti <andi.shyti@intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2018-07-13lib/gt: Make use of dummyload library to create recursive batchAntonio Argenziano
An hanging batch is nothing more than a spinning batch that never gets stopped, so re-use the routines implemented in dummyload.c. v2: Let caller decide spin loop size v3: Only use loose loops for hangs (Chris) v4: No requires v5: Free the spinner v6: Chamelium exists. Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> #v3 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
2018-03-29tests/perf_pmu: Fix usage of for_each_engine_class_instanceTvrtko Ursulin
Wrong file descriptor was passed to the iterator. This had currently no effect, since it wasn't used in the macro, but needs to be fixed. At the same time make the macro consistent by checking for engine presence like the other iterators do. Added __for_each_engine_class_instance which does not check for engine presence and so is useful for enumerating all possible engines - like for instance for subtest enumeration. And another 'wrong fd used' fixlet in the render node subtests. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reported-by: Michel Thierry <michel.thierry@intel.com> Cc: Michel Thierry <michel.thierry@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Michel Thierry <michel.thierry@intel.com>
2018-03-20igt: Replace 'all-engines' magic numbers with macroAntonio Argenziano
In interfaces where a parameter allow to select an engine, we usually use '-1' or '~0u' to select all engines. This patch replaces magic numbers with a named constant. Suggested-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-02-23Iterate over physical enginesChris Wilson
We current have a single for_each_engine() iterator which we use to generate both a set of uABI engines and a set of physical engines. Determining what uABI ring-id corresponds to an actual HW engine is tricky, so pull that out to a library function and introduce for_each_physical_engine() for cases where we want to issue requests once on each HW ring (avoiding aliasing issues). v2: Remember can_store_dword for gem_sync v3: Find more open-coded for_each_physical Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2017-12-08include/drm-uapi: bump headersLionel Landwerlin
Taken from drm-next : commit 9c606cd4117a3c45e04a6616b1a0dbeb18eeee62 Merge: c5dd52f653fa 3997eea57caf Author: Dave Airlie <airlied@redhat.com> Date: Thu Dec 7 06:28:22 2017 +1000 Merge branch 'drm-next-4.16' of git://people.freedesktop.org/~agd5f/linux into drm-next Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-11-22tests/perf_pmu: Tests for i915 PMU APITvrtko Ursulin
A bunch of tests for the new i915 PMU feature. Parts of the code were initialy sketched by Dmitry Rogozhkin. v2: (Most suggestions by Chris Wilson) * Add new class/instance based engine list. * Add gem_has_engine/gem_require_engine to work with class/instance. * Use the above two throughout the test. * Shorten tests to 100ms busy batches, seems enough. * Add queued counter sanity checks. * Use igt_nsec_elapsed. * Skip on perf -ENODEV in some tests instead of embedding knowledge locally. * Fix multi ordering for busy accounting. * Use new guranteed_usleep when sleep time is asserted on. * Check for no queued when idle/busy. * Add queued counter init test. * Add queued tests. * Consolidate and increase multiple busy engines tests to most-busy and all-busy tests. * Guarantte interrupts by using fences. * Test RC6 via forcewake. v3: * Tweak assert in interrupts subtest. * Sprinkle of comments. * Fix multi-client test which got broken in v2. v4: * Measured instead of guaranteed sleep. * Missing sync in no_sema. * Log busyness before asserts for debug. * access(2) instead of open(2) to determine if cpu0 is hotpluggable. * Test frequency reporting via min/max setting instead assuming. ^^ All above suggested by Chris Wilson. ^^ * Drop queued subtests to match i915. * Use long batches with fences to ensure interrupts. * Test render node as well. v5: * Add to meson build. (Petri Latvala) * Use 1eN constants. (Chris Wilson) * Add tests for semaphore and event waiting. v6: * Fix interrupts subtest by polling the fence from the "outside". (Chris Wilson) v7: * Assert number of initialized engines matches the expectation. (Chris Wilson) * Warn instead of skipping if we couldn't restore the initial frequency. (Chris Wilson) * Move all asserts to after the test cleanup (just a tidy). * More 1eN notation for timeouts. * Bump the tolerance to 5% since I saw a few noisy runs with sampling counters. * Always start the PMU before submitting batches to lower reliance on i915 doing the delayed engine busy stats disable. v8: * Update for upstream engine class enum. v9: * Add meson build support. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-10-19lib/i915: Move submission related helpers to lib/i915/gem_submissionMichał Winiarski
Since I accidentally broke the build for some, by putting the pretty printer for submission inside ifdef HAVE_PROCPS, it's time to move the whole thing into lib/i915 while fixing this mistake. Let's also rename the pretty printer and add a doc to it as well as the section. Fixes: f6dfe556659f ("lib: Extract helpers for determining submission method") Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-10-17lib: Extract helpers for determining submission methodMichał Winiarski
Couple of tests are using either determining submission method, or pretty printing. Let's move those to helpers in lib. v2: s/igt_show/gem_show Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Katarzyna Dec <katarzyna.dec@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2017-07-06Revert "igt: Remove default from the engine list"Chris Wilson
This reverts commit d7a0b61450797a3d6644c65aebf75c2a90da1a15.
2017-07-06igt: Remove default from the engine listTvrtko Ursulin
Default is not an engine but an ABI alias for RCS. Remove it from the engine list to eliminate redundant subtests and test passes. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Acked-by: Daniel Vetter <daniel.vetter@intel.com>
2017-05-18lib: Refactor testing for ability to use MI_STORE_DATA_IMMChris Wilson
Rather than have the code in multiple locations, put a copy in lib/ Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-03-21Restore "lib: Open debugfs files for the given DRM device"Chris Wilson
This reverts commit 25fbae15262cf570e207e62f50e7c5233e06bc67, restoring commit 301ad44cdf1b868b1ab89096721da91fa8541fdc Author: Tomeu Vizoso <tomeu.vizoso@collabora.com> Date: Thu Mar 2 10:37:11 2017 +0100 lib: Open debugfs files for the given DRM device with fixes. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-03-21Revert "lib: Open debugfs files for the given DRM device"Tomeu Vizoso
This reverts commit 301ad44cdf1b868b1ab89096721da91fa8541fdc. When a render-only device is opened and gem_quiescent_gpu is called, we need to use the debugfs dir for the master device instead. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
2017-03-21lib: Open debugfs files for the given DRM deviceTomeu Vizoso
When opening a DRM debugfs file, locate the right path based on the given DRM device FD. This is needed so, in setups with more than one DRM device, any operations on debugfs files affect the expected DRM device. v2: - rebased and fixed new API additions v3: - updated chamelium test, which was missed previously - use the minor of the device for the debugfs path, not the major - have a proper exit handler for calling igt_hpd_storm_reset with the right device fd. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Robert Foss <robert.foss@collabora.com> Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-01-05tests: Add gem_exec_reuseChris Wilson
Exploratory test into behaviour when reusing bo between batches. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-09-13igt/gem_busy: Prevent banning when running multiple hang testsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-09lib: Remove defunct stop_ringsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-08lib: Magic for_each_engine() macro to iterate over available enginesChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-01lib: move i915_wedged_set to ig_gt.cDaniele Ceraolo Spurio
Upcoming tests will call it to recover from bad states caused by hangcheck bugs.the function was renamed to igt_force_gpu_reset to have a naming closer to other hang-related functions in the same file. The value written to the debugfs has also been changed to -1; this makes no differences with the current implementation but copes with upcoming TDR changes (still under discussion) that should allow the resetting of a mask of rings. Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
2016-02-04tests/drv_hangman: Convert to using central list of enginesChris Wilson
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-01-27Extract array of execution enginesChris Wilson
A few tests wish to execute on every engine, so centralise the array of known engines. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-22lib: Refactor common detection of missed interruptsChris Wilson
As we have the same function in a few places to read the debugfs/i915_ring_missed_irq file, move it to the core. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-20lib: Expand igt_hang_ring() to select target context and various optionsChris Wilson
Some potential callers want to inject a hang into a particular context, some want to trigger an actual ban and others may or may not want to capture the associated error state. Expand the hang injection interface to suit all. v2: Disable the new kernel API, but push to provide a missing piece of infrastucture to unbreak compilation. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-19igt/gem_mmap_wc: Test cpu mmap vs wc mmap coherencyChris Wilson
Similar to the cpu mmap vs gtt mmap coherency test. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-12-04lib: igt_fork_hang_helper must be run in fixturesDaniel Vetter
Because it opens an intel-specific drm fd. Fixes crashes when running igt on no-intel. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-02-25lib: small documentation fixesThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-13lib/igt_gt: Document and consolidateDaniel Vetter
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-13lib/gt: api polish for igt_can_hang_ringDaniel Vetter
Align with common igt library style: - Push the igt_require into the function. - Push the intel_gen into the function. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-01-07igt/gem_concurrent_blit: Inject hangs before verifying contentsChris Wilson
After setting up the copy operations, add a hanging batch. This should mean that we complete the copy and the compare then races against the GEM reset. Hopefully, this will catch driver bugs where the target object is no longer accessible after the hang. Note: hang injection is disabled until the required kernel interface is completed. But there are useful additional tests here... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>