summaryrefslogtreecommitdiff
path: root/lib/drmtest.h
AgeCommit message (Collapse)Author
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>
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-05-07lib: drop drmtest dependency on intel_batchbufferLionel Landwerlin
It doesn't look like there should be a dependency there. v2: s/intel_batchbuffer/intel_reg/ v3: One more s/intel_batchbuffer/intel_reg/ in benchmarks Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>
2017-11-29igt: Remove Android supportArkadiusz Hiler
This patch gets rid of the Android support, deleting all the hacks and moving code around to the places it belongs. Android build is not really maintained properly and rots rather fast. With recent push for Meson here and Android going for Soong it will only accelerate. It's a good time to drop the illusion of providing any support. Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Kalyan Kondapally <kalyan.kondapally@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Acked-by: Petri Latvala <petri.latvala@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-01-30lib/drmtest: Add comment explaining DRIVER_ANY excluding DRIVER_VGEMRobert Foss
Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
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-06-18lib: Support opening vGEM deviceChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
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-03-19lib: Replace drmIoctl() with a layer of indirectionChris Wilson
Insted of calling drmIoctl() directly, call igt_ioctl() instead. In the normal scenario this is function pointer that calls drmIoctl() (so no penalty), but allows us to divert ioctls into our own routines for nefarious purposes. One such purpose will be to control interrupt generation into the ioctl, to be able to detect when we successfully interrupt the ioctl and when we no longer need more interrupts. 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-10-07lib/drmtest: Add do_ioctl_err to expect failureDaniel Stone
do_ioctl demands that the ioctl returns success; add a variant named do_ioctl_err, which expects the ioctl to fail, and demands a particular result. Signed-off-by: Daniel Stone <daniels@collabora.com>
2015-09-11lib: remove support for deprecated drm_open_any*() callsMicah Fedke
Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
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-04-22lib/drmtest.h : fix mmap64 againTim Gore
In android mmap64 was redirected to mmap2 because mmap64 was not alway available. But now mmap2 has been removed from 64 bit android builds (and mmap64 is available), so update preprocessor conditional to check for __x86_64__. Signed-off-by: Tim Gore <tim.gore@intel.com> Signed-off-by: Thomas Wood <thomas.wood@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>
2014-09-30tests/pm_rpm: factor out drm_open_any_masterImre Deak
Signed-off-by: Imre Deak <imre.deak@intel.com>
2014-04-25Reset errno to 0 after successChris Wilson
errno is only valid after a syscall wrapper (e.g. ioctl()) reports an error. However, we report the last errno value as a part of the igt_assert() output and so we display spurious values such as: Test requirement not met in function gem_require_ring, file ioctl_wrappers.c:802: Last errno: 11, Resource temporarily unavailable Test requirement: (!((((intel_get_drm_devid(fd)) == 0x0102 || ... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-24tests: Extract ALIGN macro into a common headerTvrtko Ursulin
Makes for a little bit less code duplication, especially since it will be used from more callers in the future. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Brad Volkin <bradley.d.volkin@intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-03-28intel-gpu-tools: fix problem with redefinition of mmap64tgore
In android builds there is no reliable way to determine if mmap64 is defined or not, and this sometimes leads to a compile error due to its re-defnition. So this commit avoids its use altogether in intel-gpu-tools for Android builds, unless the HAVE_MMAP64 macro is defined. Signed-off-by: Tim Gore <tim.gore@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-23lib/drmtest: api documentationDaniel Vetter
Also rename the arguments of do_ioctl a bit for better clarity. I haven't figured out a way to reference other section headers, hence the links to igt_core and intel_batchbuffer are a bit fragile unfortunately. It gets the job done though. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-23lib: extract igt_aux.[hc]Daniel Vetter
And shovel all the various helpers in there. Also move igt_set_vt_graphics_mode to igt_kms.h since the function is implemented in igt_kms.c. And it fits better. I kinda missed this in the prep work. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22lib: s/drmtest_dumb_aub/igt_aub_dump_enabled/Daniel Vetter
This is prep work to extract a new igt aux library with all kinds of random stuff. Also give it a bit a more suitable name to indicate that this is just a flag and doesn't do the aub dumping itself. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22lib: unnecessary header removal for drmtest.h, part 2Daniel Vetter
I've left unistd.h in it - it's not strictly required but most users of drmtest.h want it for the open helpers, and then you kinda need to close that file descriptor again ... Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
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>
2014-03-22tests|lib: remove assert.h includesDaniel Vetter
Only the igt core and non-test tools should have asserts to catch internal errors, tests and helper libraries should all user igt_asert instead. Fix things up where assert instead of igt_assert was used. One tiny step towards header sanity. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22lib: Move non-register things out of intel-gpu-tools.hDaniel Vetter
Right now almost everything in there concerns itself with register access. Move everything else out (into drmtest.h for lack of better place) to prepare for api documentation. Also rename intel_drm.c to intel_os.c since it contains OS, not drm abstractions. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-12lib: move prefault helpers to igt_debugfs.cDaniel Vetter
This way all debugfs library code is in one place, ready for some api documentation care. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-12lib: extract igt_core.cDaniel Vetter
Same game as with ioctl_wrappers.c. To split was rather clean except for the static function oom_adjust_for_doom. But that was a bug, the calls to it in the various open helpers should simply be done at init and fork time. Which was already the case, except for simple testcase. So fix it up. While at it also start with a small section header for the documentation. v2: Don't forget to update the xml template ... Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-12lib/ioctl_wrappers: api docDaniel Vetter
Also some tiny polish to function interface: - @caching in gem_set_tiling should be uint32_t to match the ioctl struct. - s/size/length/ for gem_write/read. - move gem_get_num_rings to the other ring feature helpers. v2: Also demote gem_require_ring from static inline and move it, too. v3: Also move gem_handle_to_libdrm_bo. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-11lib: extract ioctl_wrappers.cDaniel Vetter
I want to group the ioctl wrappers and related functions into their own documentation section. Apparently gtkdoc refuses to obey this wish without a corespdonding header. So appease it. Also gtkdoc seems to struggle with rebuilding a bit ... Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-11drmtest: reformat the API documentationThomas Wood
Make the existing documentation compatible with gtk-doc. Signed-off-by: Thomas Wood <thomas.wood@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-13lib: (somewhat) structured logging supportDaniel Vetter
Apparently there's a bit a need for more verbose output in testcases, mostly for debugging purposes. At least gem_reset_stats and pm_rps have a verbose mode. On top of that we're currently not taking advantage of piglit's "warn" state all that much. But I think it might be useful for testcases which are notorious for some kinds of spurious failures, like e.g. the really nasty timing checks in kms_flip. If we demote some of them to just warnings we could run the overall tests more often. Hence this patchs adds a new igt_log function with the three levels DEBUG, INFO and WARN. Plus a bunch of convenience helpers to keep the test code tidy. The level can be set through an enviroment vairable IGT_LOG_LEVEL with info being the default. Also tests can look at the selected log level in case they want to run costly debug functions only when needed. Comments highly welcome, I plan to roll this out over tests which can use it (not all, imo that's too much churn) once we've settled on the interfaces/semantics. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-12lib: Make igt_skip noreturnDaniel Vetter
This is a remnant from the subtest code before we had proper fixture blocks. With those there's no no reason to have igt_skip calls outside of fixtures or subtests, so we can assert this and hence always jump out. Suggested by Thomas Wood since static analyzers got confused about this. To check for fallout I've run all tests as non-root so that they'll all skip. Only very little fallout resulted. Cc: Thomas Wood <thomas.wood@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-11lib: Add a helper to wait for a keypressDamien Lespiau
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-02-06lib/drmtest: Add igt_wait_helperJeff McGee
igt_wait_helper compliments igt_stop_helper and is used when helper processes are expected to exit naturally. Signed-off-by: Jeff McGee <jeff.mcgee@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-19lib: add __gem_createDaniel Vetter
Useful for when a gem_create ioctl is expected to fail. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-19lib: extract igt_drop_rootDaniel Vetter
Useful in other tests. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-10lib: igt_simple_main/init for subtest-less testsDaniel Vetter
Atm only used to print the version information. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-05lib: add gem_available_aperture_size helperDaniel Vetter
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-27lib: Add gem_bo_busyVille Syrjälä
Move gem_bo_busy() from gem_wait_render_timeout.c to lib. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2013-11-27lib: Add gem_sw_finish()Ville Syrjälä
Wrap DRM_IOCTL_I915_GEM_SW_FINISH into gem_sw_finish() Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2013-11-12build: Fix assorted compilation warningsOscar Mateo
As these files are compiled for every test, the warnings cluttered the Android build completely. v2: As suggested by Daniel Vetter, drop some of the fixes and fix the compilation flags instead. Signed-off-by: Oscar Mateo <oscar.mateo@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-12lib: Move kms stuff from drmtest.c over to igt_kms.cOscar Mateo
This makes cairo dependencies easier to handle. Otherwise, we would have to litter drmtest all over with "#ifndef ANDROID" Signed-off-by: Oscar Mateo <oscar.mateo@intel.com> [danvet: Add missing _GNU_SOURCE to igt_kms.c and missing include to intel_sprite_on.c] 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-11-01lib: make igt_install_exit_handler never failDaniel Vetter
Most callers didn't bother checking, so just move the asserts into the function itself. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>