summaryrefslogtreecommitdiff
path: root/lib/drmtest.c
AgeCommit message (Collapse)Author
2018-05-16igt: Drop Intel from the name in docs and pathsArkadiusz Hiler
This is just a simple change to reflect the actual state. No rewording yet, just a simple substitution in most visible places - docs, README and paths. There are probably some leftovers here and there, but we can let them be for now, this is already well overdue. v2: fixed couple of obvious leftovers pointed out by Petri Cc: Petri Latvala <petri.latvala@intel.com> Cc: Daniel Vetter <daniel.vetter@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Harry Wentland <harry.wentland@amd.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2017-12-14lib: Ask the kernel to quiesce the GPUChris Wilson
Since the introduction of debugfs/i915_drop_caches, we have offered the ability to wait upon all outstanding batches. This is more efficient and less error prone (one example is the use of context priorities, we have to idle at the lowest in order not to jump over any low priority tasks we want to wait upon) than trying to do it all in userspace. Though we could if we wanted to, it's just easier to use the existing facility designed for the purpose -- that we were already partially using! Note that debugfs/i915_drop_caches has only existed since v4.2. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2017-12-08lib: Print other clients when DRM_SET_MASTER failsChris Wilson
It looks like there are some rogue processes running in CI that prevent DRM_MASTER from being obtained. Dump the list of clients on failure to make it more obvious what is being left behind. v2: Fix up gtkdocs, meson build References: https://bugs.freedesktop.org/show_bug.cgi?id=104157 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-11-16lib: Attempt to load the module for a missing deviceChris Wilson
If we asked to open a particular chipset and we find no matching device, try again after attempting to load its module. Previously we only did this for vgem, which is not automatically probed during boot, but if we want to leave the module unloaded we have to try harder when we need the device. v2: DRIVER_* are already masks (and not shifts). Use a common driver_open for both /dev/dri/cardX and /dev/dri/renderDX. v3: Beware making local variables accidentally static scoped. v4: Beware multiple threads trying and failing to open a device v5: Fixed spelling of render (Petri) Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2017-11-06lib/drmtest: Fix typoThierry Reding
"other" was misspelled as "otehr". Fix it. Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-10-19lib: Idle the GT when quiescing the GPUChris Wilson
As part of the general procedure for ensuring the GPU is idle, we also want to ask the driver to flush its idle_worker. The idle_worker is responsible for releasing both the driver's internal cache of buffers and cache of state (such as the prolonged GT wakeref). By flushing the idle_worker we ensure that each test (each caller needing an idle gpu) has a clean slate; not carrying over caches from one test to the next. Note this is a silent no-op for kernels that do not know about DROP_IDLE, old bugs will remain. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
2017-09-08build: use HAVE_LIBGEN_H consistentlyDaniel Vetter
Also, we are _GNU_SOURCE, so simplify the conditions accordingly. The next patch will remove _GNU_SOURCE everywhere else. 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>
2017-07-25lib/drmtest: Decode driver flags on failureDaniel Vetter
I spent too much time going wtf why does this test not run until realizing that vgem is missing. This should help a lot for tests that need multiple different drm drivers. v2: Distinguish "any" and "other" (Chris). Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2017-04-22igt: Import basic amdgpu tests from libdrmChris Wilson
Simple copy and replace of the CUnit tests inside libdrm to form a basis for further prime integration testing. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-03-23lib: system() is bad, use libkmod insteadChris Wilson
For an as of yet unknown reason, calling system("modprobe") from inside igt/gem_wait causes kasan to spend 1-5 minutes copying the process pagetables. This evaporates if we replace the fork-happy call to system with a call to load the module using libkmod. So be it. 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-02lib: Mass conversion to to_user_pointer()Chris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-29lib: add igt_dummyloadAbdiel Janulgue
A lot of igt testcases need some GPU workload to make sure a race window is big enough. Unfortunately having a fixed amount of workload leads to spurious test failures or overly long runtimes on some fast/slow platforms. This library contains functionality to submit GPU workloads that should consume exactly a specific amount of time. Since v14: Since we are using multiple signals, walk list of batches to terminate a batch to avoid using a single global batch. Cycle signals between SIGRTMIN and SIGRTMAX properly. Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: tomeu@tomeuvizoso.net Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
2016-10-27lib/drmtest: Test for equivalence with DRIVER_ANYTomeu Vizoso
Cc: Chris Wilson <chris@chris-wilson.co.uk> Fixes: 9921aff583ac ("lib/drmtest: Take DRIVER_ANY into account when opening the DRM device") Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
2016-10-27lib/drmtest: Take DRIVER_ANY into account when opening the DRM deviceTomeu Vizoso
__drm_open_driver was changed to bail out on VGEM devices unless they are explicitly asked for (DRIVER_VGEM). But with that change we lost support for DRIVER_ANY. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Fixes: 7ce63894854d ("lib: Support opening vGEM device") Cc: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-18drmtest: Install exithandler for i915, even in multidriver testsChris Wilson
If we opened the driver multiple times, we would not flush i915 if it was opened second. The persistence of one test state into a second can upset third parties, e.g. prime_vgem upsetting vgem_basic (due to references from i915.ko to vgem.ko preventing module unload). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2016-09-19lib: Add support for DROP_FREED in igt_drop_caches_set()Chris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-19lib: __drm_open_driver() needs to report the errorChris Wilson
The __ prefixed functions are there to report the error and should not automatically skip, which is handled by the normal unprefixed variant. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-12lib/drmtest: add virtio_gpu supportGustavo Padovan
Support the virtio GPU on drmtest. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-07-12lib/drmtest: Fix igt_skip messageGustavo Padovan
Now other gpus are supported too. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-06-30lib: Start weaning off defunct intel_chipset.hChris Wilson
Several years ago we made the plan of only having one canonical source for i915_pciids.h, the kernel and everyone importing their definitions from that. For consistency, we style the intel_device_info after the kernel, most notably using a generation mask and a per-codename bitfield. This first step converts looking up the generation for a devid tree from a massive if(devid)-chain to a (cached) table lookup. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-28lib: Avoid running gem_quiescent_gpu() on non-Intel hardwareRobert Foss
When opening the device, we first ensure the device is idle. However, performing GEM operations on !i915 is bad behaviour, so don't. Signed-off-by: Robert Foss <robert.foss@collabora.com>
2016-06-23Silence compiler warnings for expected and handled error conditionsChris Wilson
Silly compiler emitting warnings that just cause people to break code attempting to silence the compiler. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-21lib: Suppress error messages from failure to load driver modulesChris Wilson
Pass -s switch to modprobe so that we don't litter stderr with the error message for a missing module - the load failure is sufficient. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-18lib: Support opening vGEM deviceChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-14lib: Fix doc warnings for real!Daniel Vetter
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-04-14lib: Expose is_i915_deviceTomeu Vizoso
Lib and test code can use this function to avoid i915-specific behavior when running on other drivers. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-04-14lib: add igt_require_intelTomeu Vizoso
Add function that requires that the driver we are talking to is i915. This allows us to skip subtests that are specific to that driver. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-04-14lib: Rename is_intel to has_known_intel_chipsetTomeu Vizoso
As it reflects more clearly what the function actually does. Suggested-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-04-09lib: Remove defunct stop_ringsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-08lib: Flush all possible ringsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-08lib: Flush BSD2 as well when availableChris Wilson
When flushing work and idling the GPU, we need to flush all engines, including the forgotten BSD2. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-08igt: Add support for DRIVER_VC4 flags on tests.Eric Anholt
Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-12-02docs: add missing documentation for drm open functionsThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-20drmtest: Use standard gem_execbuf() calls in gem_quiescent_gpu()Chris Wilson
Now that we have better ioctl wrappers, let's make us of them. The advantage should be in improved error reporting in case gem_quiescent_gpu() ever fails. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-11lib: adding drm_open_driver() interfaceMicah Fedke
The drm_open_driver*() functions replace the drm_open_any*() functions and provide the same utility, but in a way that is platform agnostic, not intel-specific. This opens the path for adopting intel-gpu-tools to non-intel platforms. This commit renames the calls and adds the chipset parameter which can be used to restrict the opening to a specific hardware family. For example, drm_open_driver(DRIVER_INTEL) will only return a valid fd if an intel GPU is found on the system, along with performing intel-specific initialization stuff like gem_quiescent_gpu(), et al. If OPEN_ANY_GPU is specified, the first available drm device of any type will be opened. Other hardware type flags may be added in the future. The drm_open_any*() calls are retained as aliases of drm_open_driver*(OPEN_ANY_GPU) but will be removed in a subsequent patch. Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-08lib: various documentation fixesThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-18lib: Cache DRM device id to reduce number of ioctlsChris Wilson
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-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-01-19igt/drv_module_reload: Check more carefully for a live driverChris Wilson
As drm_open_any() now quietly fails if there is no driver, this nullifies the effectiviness of using gem_exec_nop as the test for a good reload. Combine with gem_alive (and guarantee that gem_alive can detect a dead driver, putting lie to commit 032f30cb38bb03562ee7fde19cd278b1d8ac31a9 Author: Thomas Wood <thomas.wood@intel.com> Date: Tue Jan 13 13:33:57 2015 +0000 lib: remove unnecessary checks on the drm_open_any return value ) first. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88573 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
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-11-25lib: fix symbol names in documentation commentsThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-09-30tests/pm_rpm: factor out drm_open_any_masterImre Deak
Signed-off-by: Imre Deak <imre.deak@intel.com>
2014-07-25drmtest: First check that driver is i915Chris Wilson
Before issuing any i915 specific ioctls, check the driver is i915 otherwise we make other drivers emit nasty errors at the start of every test. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-23tests: remove unused getopt header includesThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-07-21Quieten valgrindChris Wilson
Clear all the ioctl structs to zero before use as valgrind does not our ioctls and so complains about undefined bytes being passed to syscalls. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-09Fix make distclean by fixing includes of version.hRodrigo Vivi
Actually only the igt_core was breaking the make distcheck, but let's make it consistent and let the code cleaner. Credits-to: Reviewed-by: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
2014-04-10lib/drmtest: don't dup quiescent fdMika Kuoppala
If we dup the fd, we are in mercy of the context banning of the test application. Better to have our own to guarantee that gem_quiescent_gpu won't find itself banned on exit. Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>