summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2016-01-25lib/ioctl_wrappers: Add gem_has_softpinMichał Winiarski
We can move it from softpin test into lib, and since softpin support is highly unlikely to go away in-between getparam ioctl calls, let's just do a single call and store the value. v2: rebase Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-01-25lib/ioctl_wrappers: Add gem_gtt_type exposing raw HAS_ALIASING_PPGTT paramMichał Winiarski
No functional changes. While I'm here, let's also rename gem_uses_aliasing_ppgtt (since it's being used to indicate if we are using ANY kind of ppgtt) and introduce gem_uses_full_ppgtt to drop some unnecessary code from tests that were previously calling getparam directly instead of using ioctl wrapper. v2: drop gem_uses_full_48b_ppgtt since it's no longer used anywhere, s/48b/64b (Chris) v3: rebase Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
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-22lib: Print memory requirements as MiBChris Wilson
Since we need a lot of memory, trim off the less significant digits for easier human consumption. 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-20lib: Always double check igt_require_hang_ring() on useChris Wilson
If we move the igt_require() into the hang injector, this makes simple test cases even more convenient. More complex test cases can always do their own precursory check before settting up the test. However, this does embed the assumption that the first context we are called from is safe (i.e no i915.enable_hangcheck/i915.reset interferrence). v2: A couple of environment variables to skip hang testing or to force hang injection even if the GPU cannot be reset. 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>
2016-01-19gem_concurrent_blit: Don't call igt_require() outside of a subtest/fixtureChris Wilson
gem_concurrent_blit tries to ensure that it doesn't try and run a test that would grind the system to a halt, i.e. unexpectedly cause swap thrashing. It currently calls intel_require_memory(), but outside of the subtest (as the tests use fork, it cannot do requirement testing within the test children) - but intel_require_memory() calls igt_require() and triggers and abort. Wrapping that initial require within an igt_fixture() stops the abort(), but also prevents any further testing. This patch restructures the requirement checking to ordinary conditions, which though allowing the test to run, also prevents listing of subtests on machines which cannot handle them.
2016-01-11core/sighelper: Interrupt everyone in the process groupChris Wilson
Some stress tests create both the signal helper and a lot of competing processes. In these tests, the parent is just waiting upon the children, and the intention is not to keep waking up the waiting parent, but to keep interrupting the children (as we hope to trigger races in our kernel code). kill(-pid) sends the signal to all members of the process group, not just the target pid. We also switch from using SIGUSR1 to SIGCONT to paper over a race condition when forking children that saw the default signal action being run (and thus killing the child). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-01-08Fix a bunch of printf typesVille Syrjälä
igt_kms.c: In function ‘igt_crtc_set_background’: igt_kms.c:1940:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=] LOG(display, "%s.%d: crtc_set_background(%lu)\n", ^ intel_firmware_decode.c: In function ‘csr_open’: intel_firmware_decode.c:169:2: warning: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 3 has type ‘__off_t’ [-Wformat=] printf("Firmware: %s (%zd bytes)\n", filename, st.st_size); ^ intel_gpu_top.c: In function ‘main’: intel_gpu_top.c:683:10: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Wformat=] stats[i] - last_stats[i]); ^ hsw_compute_wrpll.c: In function ‘main’: hsw_compute_wrpll.c:644:3: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘long long int’ [-Wformat=] igt_fail_on_f(ref->r2 != r2 || ref->n2 != n2 || ref->p != p, ^ gem_gtt_hog.c: In function ‘__real_main155’: gem_gtt_hog.c:177:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Wformat=] igt_info("Time to execute %lu children: %7.3fms\n", ^ kms_flip.c: In function ‘run_test_step’: kms_flip.c:985:3: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 10 has type ‘__time_t’ [-Wformat=] igt_assert_f(end - start > 0.9 * frame_time(o) && ^ kms_flip.c:985:3: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 11 has type ‘__suseconds_t’ [-Wformat=] kms_frontbuffer_tracking.c: In function ‘setup_sink_crc’: kms_frontbuffer_tracking.c:1364:3: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘ssize_t’ [-Wformat=] igt_info("Unexpected sink CRC error, rc=:%ld errno:%d %s\n", ^ Signed-off-by: Ville Syrjälä <ville.syrjala@linux.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>
2016-01-08lib: Extract some common fb create+fill methods into helpersVille Syrjälä
Several tests do one or more of the following: * igt_create_fb() + igt_paint_test_pattern() * igt_create_color_fb() + igt_paint_test_pattern() * igt_create_fb() + igt_paint_image() Extract them into new helpers: igt_create_pattern_fb(), igt_create_color_pattern_fb(), igt_create_image_fb(). v2: Fix typos, and improve API docs (Thomas) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2016-01-06igt_core: Fix logging to display extended lineDerek Morton
line[strlen(line)] will always evaluate to NULL so line_continuation was always true. That prevented the program name, pid and log level ever being printed. Changed to [strlen(line) - 1] so the last character before the null terminator is compared with '\n' to determine line_continuation. Signed-off-by: Derek Morton <derek.j.morton@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-12-21lib: Use igt_assert_eq() to check for crc component countVille Syrjälä
It's nice to see just how many components the crc claims to have when the count don't match what we expect. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-12-21lib: Make 'extra_long_opts' constVille Syrjälä
The extra_long_opts passed to igt_*_parse_opts() isn't modified, so let's make it const. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
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-08tests/kms_force_connector_basic: Add prune-stale-modes subtestVille Syrjälä
Add a new subtest that makes sure old stale modes get pruned from the connector's mode list when the EDID changes. v2: s/drmModeGetConnector/drmModeGetConnectorCurrent/ since kmstest_force_edid() already takes care of doing the heavier call for us (Daniel) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-12-08lib/kms: Turn base_edid into a templateVille Syrjälä
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
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-12-04lib/kms+tests: Use cached connector stateDaniel Vetter
Speeds up testcases except for those where we want to exercise the probing itself. The only exceptions left where we do a full probe are - pm_rpm: We use it to make sure the kernel doesn't get things wrong with power domains, so we really want to exercise the full probe paths. And there the only place really is the specific validation done with the data gathered by get_drm_info. - kmstest_force_ functions: Newer kernels should be better at re-probing state when the force sysfs fields change, but better safe than sorry. v2: I also consolidated the start_n_modes and start_connectors while at it - move one of the fixup hunks to this patch that accidentally got misplaced (Thomas). Cc: Thomas Wood <thomas.wood@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-12-03igt/gem_stolen: Verifying extended gem_create ioctlAnkitprasad Sharma
This patch adds the testcases for verifying the new extended gem_create ioctl. By means of this extended ioctl, memory placement of the GEM object can be specified, i.e. either shmem or stolen memory. These testcases include functional tests and interface tests for testing the gem_create ioctl call for stolen memory placement v2: Testing pread/pwrite functionality for stolen backed objects, added local struct for extended gem_create and gem_get_aperture, until headers catch up (Chris) v3: Removed get_aperture related functions, extended gem_pread to compare speeds for user pages with and without page faults, unexposed local_gem_create struct, changed gem_create_stolen usage (Chris) v4: Splitting patch to remove changes from gem_pread/gem_pwrite to another patch (Ankit) v5: Fixed Rebase conflicts (Ankit) Added IGT_TEST_DESCRIPTION (Thomas Wood) v6: Added __gem_create_stolen for user to handle error, updated gem_create_stolen to align with gem_create function, corrected fill_purge test (out of bound access), added testcase to validate allocating of more than 32 bit sized buffers (Tvrtko) v7: Removed unused variables, Corrected comments & formatting (Tvrtko) Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-12-02docs: document intel_pipe_crc_source enum valuesThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-12-02docs: add missing documentation for drm open functionsThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-12-01lib: gem_set_caching() use drmIoctl() rather than ioctl()Chris Wilson
gem_set_caching() tries to be clever and detect when the ioctl isn't supported (thereby skipping the test). However, it forget that we may be acting on active objects and be subject to the usual EAGAIN/EINTR errors. We can use the drmIoctl() to wrap the raw ioctl() in order to get the automatic restart on the interrupted syscall. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-27lib/igt_fb: also pass the stride to igt_create_fb_with_bo_size()Paulo Zanoni
If the caller is going to specify a custom size, it's likely that he will also specify a custom stride. The automatic stride picked by create_bo_for_fb() is too huge for tiled buffers, so if the caller wants smaller buffers, then he'll need a smaller stride too, otherwise the Kernel will reject the addfb IOCTL due to stride * height being bigger than the size. I want to make tests/kms_frontbuffer_tracking use igt_create_fb_with_bo_size() so I can provide smaller buffers that will fit into the CFB. I'm also planning to make all frontbuffers with the same width/height/format have the same stride and size regardless of tiling method so I can exercise specific code paths. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-11-27lib/igt_fb: fix open-coded ALIGN()Paulo Zanoni
Maybe this will help someone's life in the future. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-11-27lib/igt_fb: fix igt_create_fb_with_bo_size() documentationPaulo Zanoni
If we pass zero as the bo_size we won't get the minimum needed size, we'll just get a size that works. The size is decided by create_bo_for_fb(). The selected size is really not minimal for tiled objects. We'll implement support for minimum size later. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-11-27lib/igt_fb: fix fb->size when provided by the userPaulo Zanoni
I want to have a little more control over the size of the buffers in kms_frontbuffer_tracking, so I decided to start calling igt_create_fb_with_bo_size() instead of igt_create_fb(). The problem is that create_bo_for_fb() returns its own calculated size as size_ret instead of the actual used size. So we fix this by returning the actual size, the one used in gem_create instead of the calculated size that's not used anywhere. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-11-24lib/igt_core: Prefer CLOCK_MONOTONIC_RAWJoonas Lahtinen
CLOCK_MONOTONIC_RAW is not affected by NTP, so it should be THE clock used for timing execution of tests. When fetching either the starting or ending time of a test, show the time as -1.000s. v6: - Whitespace corrections (Chris) v5: - Do not use C99 style comments (Chris) v4: - Introduce time_valid macro (Chris) - Reduce amount of boilerplate code for calculating elapsed time v3: - Do not exit directly from handler (Chris) - Show elapsed time as -1 if it is not calculable v2: - Cache the used clock (Chris) - Do not change the clock during execution - Spit out and error if monotonic time can not be read Cc: Thomas Wood <thomas.wood@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-24lib/kbl: Add Kabylake GT4 PCI IDsWayne Boyer
Add the Kabylake GT4 PCI IDs as defined in this kernel patch. commit 8b10c0cf21ec84618d4bf02c73c0543500ece68d Author: Deepak S <deepak.s@intel.com> Date: Wed Oct 28 12:21:12 2015 -0700 drm/i915/kbl: Add Kabylake GT4 PCI ID Signed-off-by: Wayne Boyer <wayne.boyer@intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-24lib/kbl: move KBL check from IS_SKYLAKE() to IS_GEN9()Wayne Boyer
Remove the KBL check from IS_SKYLAKE() following the kernel definition. Then, add the KBL check to IS_GEN9(). The idea is to avoid confusion. On the kernel side, the mix of SKY and KBL was nacked so the platforms are split. Signed-off-by: Wayne Boyer <wayne.boyer@intel.com> 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-11-19lib: Add Skylake Intel Graphics GT4 PCI IDsMika Kuoppala
Add Skylake Intel Graphics GT4 PCI IDs. Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
2015-11-16lib/kms: Pass fb_id=0 to setcrtc in kmstest_unset_all_crtcs()Ville Syrjälä
The setcrtc ioctl ignores the fb_id when there's no mode specified. So passing -1 doens't make much sense. When there is a more, -1 means to preserve the current fb. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2015-11-11lib: add a environment variable to control outputThomas Wood
Disable output of terminal control characters and progress meters when IGT_PLAIN_OUTPUT is set in the environment. Cc: Derek Morton <derek.j.morton@intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-11lib: highlight subtest results on terminalsThomas Wood
Make subtest results easier to identify by making them bold when the output is a terminal. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-11lib: add documentation for igt_display_init/finiThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-11lib: add PIPE_ANY to the pipe enumThomas Wood
This avoids compiler warnings about invalid enum values. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-11Add missing noreturn attribute to various functionsThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-09lib: Add missing #include <stdbool.h>Chris Wilson
A forgotten fixup to allow instdone.h to compile. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-09lib: Make instdone initialisation fail gracefullyChris Wilson
Just report that we don't recognise the chipset rather than explode. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-03lib/tests: Add igt_assert_*() self-testsDaniel Stone
Make sure our igt_assert variants are doing something that looks vaguely like the right thing. Signed-off-by: Daniel Stone <daniels@collabora.com>
2015-10-23lib: Skip suspend/hibernate tests if the system doesn't support themVille Syrjälä
Do a dry run with rtcwake first to determine if the system even supports the intended suspend state. If not, skip the test. Fixes a bunch of stuff on my BYT FFRD8 that doesn't support S3. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2015-10-19Update CONTEXT_PARAM for GTT_SIZE reportingChris Wilson
Add the new PARAM identifier for reporting the context's GTT size. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-19lib: Fix querying context GTT sizeChris Wilson
We need a new ioctl to find the correct GTT size to use when submitting execbuffers (as opposed to wishing to know the global GTT size). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-14lib/kbl: Add Kabylake PCI IDsRodrigo Vivi
Also, following kernel definition Kabylake is Skylake. Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-10-12Replace __gem_mmap__{cpu,gtt,wc}() + igt_assert() with gem_mmap__{cpu,gtt,wc}()Ville Syrjälä
gem_mmap__{cpu,gtt,wc}() already has the assert built in, so replace __gem_mmap__{cpu,gtt,wc}() + igt_assert() with it. Mostly done with coccinelle, with some manual help: @@ identifier I; expression E1, E2, E3, E4, E5, E6; @@ ( - I = __gem_mmap__gtt(E1, E2, E3, E4); + I = gem_mmap__gtt(E1, E2, E3, E4); ... - igt_assert(I); | - I = __gem_mmap__cpu(E1, E2, E3, E4, E5); + I = gem_mmap__cpu(E1, E2, E3, E4, E5); ... - igt_assert(I); | - I = __gem_mmap__wc(E1, E2, E3, E4, E5); + I = gem_mmap__wc(E1, E2, E3, E4, E5); ... - igt_assert(I); ) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09Make gem_mmap__{cpu,gtt,wc}() assert on failureVille Syrjälä
Rename the current gem_mmap__{cpu,gtt,wc}() functions into __gem_mmap__{cpu,gtt,wc}(), and add back wrappers with the original name that assert that the pointer is valid. Most callers will expect a valid pointer and shouldn't have to bother with failures. To avoid changing anything (yet), sed 's/gem_mmap__/__gem_mmap__/g' over the entire codebase. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09lib: Die if framebuffer GTT mapping failsVille Syrjälä
Cairo helpfully allocates a new buffer for us when cairo_image_surface_create_for_data() is called with a NULL ptr. That means if gem_mmap__gtt() fails, we get a totally silent failure and nothing ever drawn into the framebuffer. Very confusing. Put in an igt_assert() to make sure we managed to mmap something. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09lib: Document that gem_mmap__{cpu,gtt,wc} return NULL on failureVille Syrjälä
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>