summaryrefslogtreecommitdiff
path: root/lib/igt_debugfs.h
AgeCommit message (Collapse)Author
2019-03-11lib/debugfs: Nuke enum intel_pipe_crc_sourceVille Syrjälä
No one is using anything but the "auto" crc source, so the enum listing other options is quite pointless. Let's switch to just using the string instead of the enum. That way any hypothetical test that wants to use a more specific crc source can just pass in the proper string. v2: Assert the string isn't NULL (Chris) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-02-20lib/crc: Reset fifo underrun reporting for every crc captureDaniel Vetter
We have tons of issues with crc mismatches, but often by that time there was already a fifo underrun, which disables further fifo underrun reporting. Reset fifo underrun reporting before we capture a crc so that it's easier to figure out why the crc mismatch happened. Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2018-10-25lib/debugfs: function to open connector debugfs dirRamalingam C
Function to open a debugfs directory of a connector associated to a device. v2: instead of string manipulation openat used [Chris] Signed-off-by: Ramalingam C <ramalingam.c@intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2018-09-27lib/debugfs: Use a blocking read in igt_pipe_crc_get_single()Ville Syrjälä
All users of igt_pipe_crc_get_single() want a blocking read even if the fd was opened in nonblocking mode. Make it so. v2: Fix the docs for igt_pipe_crc_get_single() Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
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-05lib/debugfs: Function to read debugfs with the directory already openDhinakaran Pandiyan
tests/kms_frontbuffer_tracking and tests/kms_psr read debugfs nodes several times after opening the directory once. There is already an implementation of this in the kms_frontbuffer_tracking, moving that functionality to the library will allow us to share the code with kms_psr and kms_fbcon_fbt Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
2018-08-14lib/igt_debugfs: Add igt_pipe_crc_get_current() to get a crc.Maarten Lankhorst
A pair of igt_pipe_crc_drain() and igt_pipe_crc_get_single() has a bug in which you're not sure whether the new CRC is captured because the vblank irq may race against the CRC irq and delivered to userspace too soon. When receiving a vblank event, igt_pipe_crc_drain() will then drain all crc's, but not the new (stale) crc, which is then delivered and immediately returned by igt_pipe_crc_get_single(). Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2018-02-12lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v4.Maarten Lankhorst
Collecting CRC may result in a modeset and extra vblank waits. On some tests this will increase the runtime a lot, so it makes sense to keep it enabled, and only collect the most recent CRC when needed. Changes since v1: - Fix read_crc semantics. (Ville) Changes since v2: - Remove EAGAIN assert, can be reached from drain_crc. Changes since v3: - Do not infinitely loop in igt_pipe_crc_drain(). Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com> #v2 Tested-by: Vidya Srinivas <vidya.srinivas@intel.com>
2017-10-19lib: Add DROP_IDLEChris Wilson
A new flag for an old API; now we can request that the driver flush its idle_worker to release internal caches. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
2017-09-06igt/pm_rpm: Use libc 'ftw' rather than opencoding our own filetree walkChris Wilson
By using ftw, we avoid the issue of having to handle directory recursion ourselves and can focus on the test of checking the reading a sysfs/debugfs does not break runtime suspend. In the process, disregard errors when opening the individual files as they may fail for other reasons. v2: Bracket the file open/close with the wait_for_suspended() tests. Whilst the fd is open, it may be keeping the device awake, e.g. i915_forcewake_user. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Tested-by: Jari Tahvanainen <jari.tahvanainen@intel.com>
2017-07-19lib/igt_debugfs: Add extended helper to format crc to stringPaul Kocialkowski
This introduces a igt_crc_to_string_extended helper that allows formatting a crc to a string with a given delimiter and size to print per crc word. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com> Reviewed-by: Lyude <lyude@redhat.com>
2017-07-19lib/igt_debugfs: Introduce CRC check function, with logic made commonPaul Kocialkowski
This introduces an igt_check_crc_equal function in addition to igt_assert_crc_equal and makes the CRC comparison logic from the latter common. In particular, an igt_find_crc_mismatch function indicates whether there is a mistmatch and at what index, so that the calling functions can print the diverging values. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com> Reviewed-by: Lyude <lyude@redhat.com>
2017-03-24lib/debugfs: Phase out igt_debugfs_fopen()Chris Wilson
Wrapping fdopen() proved dangerous, the underlying fd is not refcounted, and we must close it in the library or else we easily leak and exhaust all fd. Since we can't provide igt_debugfs_fopen(), move the burden onto the caller for those that require a stream FILE*. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-03-24Improve utilisation of igt_debugfs_dir()Chris Wilson
As we can export igt_debugfs_dir() to cache the path to our debugfs directory, encourage a few more users to take advantage. 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-03-10igt: Exercise the shrinkerChris Wilson
Introduce a new fork helper that spawns a process that just repeatedly calls i915_gem_shrink_all() and watch what happens as we try to use objects that have been shrunk. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-02-28lib/igt_debugfs: Add functions/tests for controlling/testing HPD storm logicLyude
Recently we added i915_hpd_storm_ctl into i915's debugfs directory, which allows us to control the thresholds i915 uses for detecting hotplug interrupt storms from userspace, along with the ability to entirely disable them. This adds some helper functions into IGT to enable making use of this feature, along with adding some chamelium tests for it. Signed-off-by: Lyude <lyude@redhat.com>
2016-12-17igt_kms: Use const parameters for igt_assert_crc_equalLyude
Since we're not modifying these anywhere, let's make them const so as to not break code doing comparisons against compile-time CRCs. Signed-off-by: Lyude <lyude@redhat.com> Tested-by: Robert Foss <robert.foss@collabora.com>
2016-12-14lib/debugfs: Support new generic ABI for CRC captureTomeu Vizoso
The kernel has now a new debugfs ABI that can also allow capturing frame CRCs for drivers other than i915. Add alternative codepaths so the new ABI is used if the kernel is recent enough, and fall back to the legacy ABI if not. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Robert Foss <robert.foss@collabora.com>
2016-11-07igt: Add a test for reordering execbufsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
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-09-16lib: Export igt_debugfs_mount()Chris Wilson
Not everything we want from debugfs is under debugfs/dri. But we do want to share the code to find the debugfs mount point (and mount it if is not found). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-27lib/debugs: nuke igt_crc_equal againDaniel Vetter
This was intentionally left out of the abi since CRC have fairly low entropy and can't be reliably compared for inequality in testcases. Spotted while fixing up warnigns in docs, but given that igt_assert_crc_equal has a big comment explaining why only the positive assert exists I'm not sure all those docs are all that useful :( Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Cc: Matt Roper <matthew.d.roper@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-07-27lib: update docs for igt_debugfsDaniel Vetter
- gtk-doc requires that the names in comments match the ones in the header declaration. - igt_debugfs_dir works together with igt_sysfs_get(). Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-06-20igt/vgem_basic: Exercise opening sysfs/debugfsChris Wilson
For fun, debugfs/.../names currently explodes, so lets capture that and make sure that basic access to debugfs does no harm. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-21lib: add crc comparison function without an assertLionel Landwerlin
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
2016-01-08lib: Add igt_pipe_crc_new_nonblock()Ville Syrjälä
Add support for reading the CRC in non-blocking mode. Useful for tests that want to start the CRC capture, then do a bunch of operations, then collect however many CRCs that got generated. The current igt_pipe_crc_new() + igt_pipe_crc_get_crcs() method would block until it gets the requested number of CRCs, whreas in non-blocking mode we can just read as many as got generated thus far. v2: __attribute__((warn_unused_result)), document the new igt_pipe_crc_get_crcs() return value (Daniel) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
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-12-02docs: document intel_pipe_crc_source enum valuesThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-24lib: add igt_debugfs_searchThomas Wood
Add igt_debugfs_search to search each line in a debugfs file for a specified substring. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-08-05lib: add igt_debugfs_read()Paulo Zanoni
A helpful function for when you want to read a whole debugfs file to a string and don't want to worry about opening and closing file descriptors and asserting buffer sizes. We've been using this already for kms_frontbuffer_tracking and kms_fbcon_fbt, so the only test with new code here is kms_fbc_crc. Also notice that for kms_fbc_crc we had to increase the buffer size since the file can sometimes be bigger than 64 bytes - depending on the reason why FBC is disabled. Of course, there are probably many other programs we can patch, but I'm not doing this now. v2: Add the macro to wrap sizeof() (Daniel). v3: Add documentation for the macro too (Daniel). Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-03-23tests: Remove usage of igt_crc_equal and _non_nullDaniel Vetter
Tests should positively check for crc matches, not for mismatches. Enforce this by only exposing and igt_assert function for comparing crcs. For the few tests which didn't just do this as consistency checks but to do functional tests add FIXME comments that some reference crc values are missing. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-03-23lib/debugfs: Add igt_assert_crc_equalDaniel Vetter
Because of hash collisions tests should only ever compare crc checksums for equality. Checking for inequality can result in random failures. To ensure this only expose and igt_assert function and use that. Follow-up patches will rework the code for tests which don't follow this requirement and try to compare for CRC inequality. v2: Rebase on top of Matt's kms_plane changes. Signed-off-by: Daniel Vetter <daniel.vetter@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>
2014-10-17lib: various documentation fixesThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-09-30doc: various spelling and typo fixesThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-05-05gem_alive: A utility to see if the driver or GPU has hungChris Wilson
2014-04-10lib: add igt_get_stop_rings and igt_set_stop_ringsMika Kuoppala
Multiple tests are introducing hangs by fidding with i915_ring_stop debugfs entry. Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
2014-03-22lib: remove uncessary #includes from headersDaniel Vetter
Only include what the header itself needs. The big fish here is intel-gpu-tools.h. More will follow. One ugly thing removed here is the duplicated GEN6_TD_CTL #define, one of which was broken. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-17lib/igt_debugfs: s/igt_pipe_crc_check/igt_require_pipe_crc/Daniel Vetter
Functions which provide feature checks through igt_skip should be of the form <prefix>_require_<feature>. Otoh feature checks which return in a boolean whether the feature is available should be of the form <prefix>_has_<feature>, e.g. gem_has_blt. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-17lib/igt_debugfs: Remove igt_debugfs_initDaniel Vetter
And also move the igt_debugfs_t type out of the headers. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-17lib/igt_debugfs: Remove debugfs from pipe crc functionsDaniel Vetter
All tests have now lost explicit references to igt_debugfs_t! Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-17lib/igt_debugfs: Remove debugfs from igt_debugfs_fopenDaniel Vetter
Also add a missing igt_assert to kms_fbc_crc and again add the missing Returns: section to the api doc. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-17lib/igt_debugfs: Remove debugfs from igt_debugfs_openDaniel Vetter
Also update the api docs a bit since the Returns: section was missing. v2: Readd the accidentally lost line for @filename. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-14lib: extract igt_open_forcewake_handleDaniel Vetter
... and I immediately regret that I've killed the return value for igt_debugfs_init, since we have callers which need to work without the forcewake stuff, e.g. the reg dumper needs to work without i915 loaded. Put this new helper to good use in the mmio code and the pm_pc8 testcase. Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-12lib/igt_debugfs: api docsDaniel Vetter
Again issues with an enum, this time intel_pipe_crc_source. The typedefs seem to work better here though. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-12lib/igt_debugfs: drop drm_fd argument from igt_pipe_crc_newDaniel Vetter
It's nowhere used and removing it gives us a cleaner, more orthogonal interface. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-12lib: make igt_debugfs_open infallibleDaniel Vetter
(Almost) no one cared anyway. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>