summaryrefslogtreecommitdiff
path: root/lib/drmtest.c
AgeCommit message (Collapse)Author
2019-05-09drmtest: Properly handle virtio-gpu's namingPetri Latvala
Instead of listing virtio-gpu with both spellings in the modules array, properly use its driver name for opening and module name for loading. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-04-18lib/igt_dummyload: Get rid of 'batch' on spinner accessorsMika Kuoppala
There is no guarantee that spinners are and will be implemented using batches. As we have igt_spin_t, manipulate it through igt_spin_* functions consistently and hide the batch nature. Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-03-27lib/drmtest: Add helpers to check and require amdgpuNicholas Kazlauskas
These helpers will be used to address amdgpu specific quirks and features. They're implemented like the i915 and VC4 helpers. In order for the string comparison to pick up "amdgpu" the buffer size had to be expanded for __is_device. I've gone ahead and made it 12 bytes to cover everything that's there right now. v2: rebase Cc: Leo Li <sunpeng.li@amd.com> Cc: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
2019-03-20lib: Kill drm_get_card()Michał Winiarski
It's not operating on FD, and we've provided a nice reimplementation that does. Let's use it instead. Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-02-26lib: drmtest: Add helpers to check and require the VC4 driverPaul Kocialkowski
In order to add support for features specific to the VC4 driver, add helpers for checking and requiring the driver like it's done for the i915 driver. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>
2019-02-19lib: Restore the i915.reset modparam before cleaning upChris Wilson
We force a reset on test exit so that we can rapidly cleanup after a naughty test, it is not unknown for us to leave a queue of hanging batches around. However, if we have also fiddled with the i915.reset parameter in the meantime, this can leave the kernel unable to fulfil our request (and those naughty batches continue to disrupt testing). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Mika Kuoppala <mika.kuoppala@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Acked-by: Antonio Argenziano <antonio.argenziano@intel.com>
2019-01-21lib/drmtest: Don't read from NULL in set_forced_driverPetri Latvala
The only caller so far never passes NULL so no effects today. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
2019-01-14Make force work with multiple drivers availableRodrigo Siqueira
The force option allows users to specify which driver they want that IGT uses. Nonetheless, if the user has two or more loaded drivers in his system, the force option will not work as expected because IGT will take the first driver found at /dev/dri. This problem can be reproduced in a QEMU VM that using Bochs and VKMS. This patch handles this scenario by ensuring that IGT uses the forced module specified via IGT_FORCE_DRIVER. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2018-12-20Add support for forcing a specific driverPetri Latvala
This commit adds a new option for forcing the use of a specific driver indicated via an environment variable. v2 (Petri): - Use an environment variable instead of command line - Refactor the loop in __open_device - Don't try to load kernel modules v3 (Petri): - Rebase and adjust to the driver loading changes Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Cc: gustavo@padovan.org Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
2018-11-26v3d: Add a helper libraryEric Anholt
Just a few little ioctl wrappers that v3d tests will use. v2: Move the struct above the prototypes. Signed-off-by: Eric Anholt <eric@anholt.net> Acked-by: Petri Latvala <petri.latvala@intel.com> (v1)
2018-09-07lib: Cancel all outstanding requests at the end of a testChris Wilson
Quite often on catastrophic failure the test leaves a long queue of unterminated batches pending execution. Each runs until hangcheck fires and skips onto the next, leaving us waiting for a very long time at test exit. On older kernels, this gracefully degrades into the existing mechanism. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
2018-09-03lib: Check for a specific match if requested.Chris Wilson
We only want to allow driver_open to match an unknown driver if asked for DRIVER_ANY, so we need to double check. Fixes: 9e5fa9112546 ("lib/drmtest: Move open device to separate function") Reported-by: Petri Latvala <petri.latvala@intel.com> 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>
2018-09-03lib: Fix strcmp() direction for bsearch.Chris Wilson
I fluked out as vgem was the initial mid value, hiding the worst of the errors as i915 matched with DRIVER_ANY. Fixes: 20087bf22698 ("lib: Use a bsearch to find the module name") Reported-by: Petri Latvala <petri.latvala@intel.com> 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>
2018-09-03lib: Use a bsearch to find the module nameChris Wilson
Even with a small number of known drivers (6), a bsearch will take at most 3 steps, whereas the linear search will take 3 steps on average. In the future with more known drivers, the logN bsearch will be even more advantageous. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Katarzyna Dec <katarzyna.dec@intel.com> Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>
2018-09-01lib/drmtest: Move open device to separate functionKatarzyna Dec
While working on IGT code and during reviewes I've noticed that it could be nice to have function that is opening particular device. Let's move out conditions for opening device and rename __open_device to __search_and_open() function. v2: Refactored open_device even more by getting device name once and returning fd for it. (Chris) v3: Added name_size to __get_drm_device_name, removed unused is_X_device. v4: Fixed cases with failing virtio_gpu v5: Rebase, indent fixes Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-08-31lib: Stop caching __drm_device_idChris Wilson
In a multi-device system there is no guarantee that the fd being probed in intel_get_drm_devid() is the same as was opened earlier. Any cache may outlive the fd, so is frought with lifetime issues. The primary reason for caching the devid was to avoid extra ioctls in the dmesg/strace, but hopefully all users now grab the id in their fixture and not inside every function. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Katarzyna Dec <katarzyna.dec@intel.com> Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>
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>