summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
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-20lib/debugfs: Fix probe path for opening i915 debugfs dirChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
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-06-18igt: Add basic exercise of vGEMChris Wilson
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-06-17tests: Push igt_fork/stop_hang_detector into fixturesDaniel Vetter
It access hardware, hence why the simple igt_only_list_subtests() check from igt_fork/stop_signal_helper() isn't enough. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-06-09lib/gt: Omit illegal instruction on hang injection with gen 8+Mika Kuoppala
0xffffffff as an illegal command confuses the command execution on gen9 so that the next BB start will get ignored, causing a runaway head past the bb end. This delays the hang detection substantially as hangcheck then observes only a non progressing seqno. Omit the bad instruction on gen8+ and rely on the chained batch loop to cause a deterministic hang. Make the chained bb start to jump straight into bb start, omitting the MI_NOOP or the bad instruction on subsequent passes. This makes the acthd sampling to hit more reliably to the same value, as the loop is smaller, making the head appear to be 'more stuck'. References: https://bugs.freedesktop.org/show_bug.cgi?id=92715 Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
2016-06-07igt/gem_stolen: Check for available stolen memory sizeAnkitprasad Sharma
Check for available stolen memory size before attempting to run the stolen memory tests. This way we make sure that we do not create objects from stolen memory without knowing the available size. This checks if the kernel supports creation of stolen backed objects before doing any operation on stolen backed objects. Also correcting the CREATE_VERSION ioctl number in getparam ioctl, due to kernel changes added in between. v2: Removed size argument for checking stolen memory availability (Tvrtko) Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2016-06-03Introduced by 0e11befe442. openat(2) is used in igt_sysfs_set() w/ aMarius Vlad
relative path. Fix by passing the correct dirfd. Signed-off-by: Marius Vlad <marius.c.vlad@intel.com> CC: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-By: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-31lib: Override the connector status using the sysfs status attributeChris Wilson
There are two paths to force enable a connector, via debugfs and via sysfs. sysfs has the advantage of being a stable interface and of updating the connector after application (allowing us to not force a reprobe from userspace). v2: Don't assume Intel only Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
2016-05-31lib: Add simple sysfs accessorsChris Wilson
igt_sysfs_set() for setting an attribute via sysfs, igt_sysfs_get() for reading. v2: Lots of little bugs in igt_sysfs_get() v3: Pass device to open, stop assuming Intel rules. v4: Test opening and reading! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-31lib: Actually use provided size when creating BOTomeu Vizoso
When reworking igt_create_fb_with_bo_size to use igt_create_bo_with_dimensions, we mistakenly stopped acknowledging non-zero size parameters. To fix this, we move the core of the code to create_bo_for_fb and teach it to use the GEM APIs when a size is passed. igt_create_bo_with_dimensions ends up calling just create_bo_for_fb with a zero size because now the later is more generic than the former. Also, create_bo_for_fb now returns the handle of the BO that was created, as there's no point anymore in having it be a parameter passed by reference. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
2016-05-27igt_core: Search "." as final fallback for igt_fopen_data()Matt Roper
Some validation teams seem to run tests out of source directories that have been nfs mounted or rsync'd to different locations on the target machine. This causes the igt_srcdir that the tests were built with to be invalid on the machine the tests get run on. Add the current directory as a final fallback for data file searches. Reference: https://bugs.freedesktop.org/show_bug.cgi?id=92248 Cc: Humberto Israel Perez Rodriguez <humberto.i.perez.rodriguez@intel.com> Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-05-23lib/crc: Update doc for igt_pipe_crc_get_crcsDaniel Vetter
Noticed while discussing CRC tests with Ville that this was totally wrong. v2: Ville pointed out that it only does not block when opened using igt_pipe_crc_new_nonblocking. Still different from igt_pipe_crc_collect_crc, which will always block. v3: Fix type (Ville). Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-05-20lib/gt: Replace hanging instructionChris Wilson
First try an illegal instruction before the infinite loop to try and trigger a gpu hang more gracefully as the infinite loop is causing some older machines issues as the GPU hogs the entire systems and makes the machine laggy, unresponsive for long periods. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-17lib/igt_kms: move gtk-doc comments next to the definitionJani Nikula
Now that we have actual functions for kms_test_*_str since commit 2d432fc5773df17f04283f4780dab161dd2e1c85 Author: Jani Nikula <jani.nikula@intel.com> Date: Wed May 11 12:42:06 2016 +0300 lib/igt_aux: define actual functions for kmstest_*_str move also the gtk-doc comments next to the definitions, for consistency. Acked-by: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2016-05-12lib/igt_aux: Polish docs for igt_timeoutDaniel Vetter
Add docs, rename parameter and rename the macro to igt_do_timeout to make it clear it works like a loop. v2: Rename instead to igt_until_timeout (Chris). Acked-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-05-12lib/igt_aux: Polish docs for igt_interruptibleDaniel Vetter
- Give __ prefix to internal funcstion and structs, only igt_interruptible is used by tests. - Move docs to igt_interruptible and adjust. - Explain more clearly how the timeout is getting doubled each iteration until no more interruptions happen. Also rename the argument to give it a more meaningful name in the docs. - Link from other functions to this one for cross-referencing. - Rename to igt_do_interruptible to make it clearer it's a loop, inspired by do {} while () loops. v2: Rename instead to igt_while_interruptible and fix typos (Chris). And add gtk-doc for igt_ioctl, too. Acked-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-05-11lib/igt_aux: define actual functions for kmstest_*_strJani Nikula
Macro generated function definitions considered harmful. You can't find them with code search tools or grep. There may be places where such things might be useful, but this is not it. Define actual functions for kmstest_encoder_type_str(), kmstest_connector_status_str() and kmstest_connector_type_str(). While at it, make the arrays static const. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-05-11lib/igt_aux: update encoder and type namesJani Nikula
Virtual, DSI, DP MST. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-05-04lib/igt_kms: Add fail exit branch in do_display_commit()Feceoru, Gabriel
On Cherryview PIPE_C can only be connected to PORT_D (bspec). The driver properly reports the crtc_mask for the encoder, however the mismatch between pipe and port is not reported back to the test. Add support for detecting this case so the test can be skipped. v2: Apply review comments (Marius) Signed-off-by: Gabriel Feceoru <gabriel.feceoru@intel.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-05-03lib: compute exitcode firstChris Wilson
Before we print the exitcode to the debug/kmsg logs, we should inspect what its final value will be. For example, in the case of running multiple subtests which all happen to be skipped, igt_exitcode is 0, but the final exit code will be 77. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Tested-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2016-05-03lib/intel_chipset: drop unused IS_9XX()Jani Nikula
It's also confusing as the style differs from the kernel (exact platform in the kernel vs. the platform and any later ones in igt). Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2016-05-02lib: Fixup u64 multiply for computing nanosecondsChris Wilson
32bit builds ran into a silly multiplication issue when computing elapsed nanoseconds of more than 2s... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-02lib: Tweak calibration of initial settimer delayChris Wilson
If we assume that the first settimer and clock_gettime() itself have appreciable overhead, try to exclude those from the calibration delay. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-01lib: Enable clflush for 32bit x86 buildsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-01lib: Apply magic clflush serialisationChris Wilson
On Baytrail, Braswell and Atoms beyond we see an issue where the mfence is insufficient to force the cacheline to be coherent (i.e. such that writes from the GPU are visible by the CPU after the call to clflush). A second clflush is ordered with an earlier clflush to the same address and this appears sufficient to give the coherency required for GPU/CPU interop. Testcase: igt/gem_exec_flush Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Akash Goel <akash.goel@intel.com>
2016-04-28igt_kms: Fix use after free in kmstest_get_pipe_from_crtc_idTvrtko Ursulin
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2016-04-25lib/igt_aux: Half the timeout for suspend to RAM and a third for suspend to ↵marius vlad
disk. Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-04-22lib/igt_kms: Move IGT_MAX_PLANES into the igt_plane enumDaniel Vetter
Makes sure we automatically extend that when adding more planes. Inspired by a patch from Robert Foss who extended the max, but forgot all about the enum. While at it, also fix up the whitespace damage. Cc: robert.foss@collabora.com Acked-by: robert.foss@collabora.com Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-04-21lib: Pass format instead of bpp to create_bo_for_fb()Ville Syrjälä
create_bo_for_fb() expects the drm format as a parameter since commit 8a1a38661f56 ("lib: Add igt_create_bo_with_dimensions") but not all callers were updated. Fix that up. Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com> Fixes: 8a1a38661f56 ("lib: Add igt_create_bo_with_dimensions") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93328 Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
2016-04-20igt/gem_close_race: BatifyChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-20lib: Declare loop variable as volatile before setjmpTomeu Vizoso
The variable used as loop counter in the igt_fixture macro had unspecified value from the setjmp(3) man page quoted below. Because of that, in certain circumstances and with -O2 and -Os, the initialization of that variable would be eliminated and the compiler would complain of uninitialized usage. Below can be found a snippet that reproduces the problem with GCC 5.3.1 and 4.9.3 and the errors as printed by 5.3.1. "The compiler may optimize variables into registers, and longjmp() may restore the values of other registers in addition to the stack pointer and program counter. Consequently, the values of automatic variables are unspecified after a call to longjmp() if they meet all the following criteria: · they are local to the function that made the corresponding setjmp(3) call; · their values are changed between the calls to setjmp(3) and longjmp(); and · they are not declared as volatile." static void test(void) { igt_subtest_group { igt_fixture { } igt_subtest("foo") { } igt_fixture { } } } In file included from lib/intel_batchbuffer.h:8:0, from lib/drmtest.h:39, from lib/igt.h:27, from tests/kms_addfb_basic.c:28: tests/kms_addfb_basic.c: In function 'tiling_tests.isra.0': lib/igt_core.h:110:43: warning: '__tmpint245' is used uninitialized in this function [-Wuninitialized] #define igt_fixture for (int igt_tokencat(__tmpint,__LINE__) = 0; \ ^ lib/igt_core.h:110:43: note: '__tmpint245' was declared here #define igt_fixture for (int igt_tokencat(__tmpint,__LINE__) = 0; \ ^ lib/igt_core.h:148:31: note: in definition of macro '__igt_tokencat2' #define __igt_tokencat2(x, y) x ## y ^ lib/igt_core.h:110:30: note: in expansion of macro 'igt_tokencat' #define igt_fixture for (int igt_tokencat(__tmpint,__LINE__) = 0; \ ^ tests/kms_addfb_basic.c:245:3: note: in expansion of macro 'igt_fixture' igt_fixture { Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-04-20lib: update kmstest_get_pipe_from_crtc_idMicah Fedke
This function uses an intel-specific ioctl to fetch a mapping between pipes and crtc ids, but this technique is outdated as the crtc id is now always equivalent to its index in the array of crtcs returned by the kernel. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-04-14lib: Fix doc warnings for real!Daniel Vetter
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-04-14tests: Open any driverTomeu Vizoso
For those tests that now pass on drivers other than i915, call drm_open_driver_master with DRIVER_ANY. Also do so from igt_enable_connectors. 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_create_bo_with_dimensionsTomeu Vizoso
igt_create_bo_with_dimensions() is intended to abstract differences between drivers in buffer object creation. The driver-specific ioctls will be called if the driver that is being tested can satisfy the needs of the calling subtest, or it will be skipped otherwise. 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: Map dumb buffersTomeu Vizoso
If a buffer object is dumb, call DRM_IOCTL_MODE_MAP_DUMB when mapping it. Also, don't call DRM_IOCTL_I915_GEM_SET_DOMAIN on dumb buffers. 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_dirty_fbTomeu Vizoso
Just wraps drmModeDirtyFB and for now invalidates the whole FB. 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 helper kmstest_dumb_map_bufferTomeu Vizoso
Which basically just calls DRM_IOCTL_MODE_MAP_DUMB and is similar to gem_mmap__gtt(). 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 wrapper for DRM_IOCTL_MODE_CREATE_DUMBTomeu Vizoso
In order to test drivers that don't have support for proper buffer objects, add a wrapper for creating dumb buffer objects that will be called from the lib code for those subtests that don't need to care. 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: Call intel_get_drm_devid only from intel codeTomeu Vizoso
It only makes sense when testing the i915 driver, so don't call it otherwise. 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: Assert we are on i915 from intel_get_drm_devidTomeu Vizoso
I915_PARAM_CHIPSET_ID is a i915-only thing, so if a subtest ends up calling it when testing another driver, the subtest (or the library) needs to be fixed. 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: 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: Have gem_set_tiling require intelTomeu Vizoso
Before calling a i915-specific IOCTL, require i915. This allows us to skip subtests that are specific to that driver, though what should eventually happen is that tests don't generally call gem_set_tiling directly but go through an abstraction layer that constructs the buffer object in a driver-specific way. 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-12test/gem_mocs_settings: Testing MOCS register settingsPeter Antoine
The MOCS registers were added in Gen9 and define the caching policy. The registers are split into two sets. The first set controls the EDRAM policy and have a set for each engine, the second set controls the L3 policy. The two sets use the same index. The RCS registers and the L3CC registers are stored in the RCS context. The test checks that the registers are correct by checking the values by directly reading them via MMIO, then again it tests them by reading them from within a batch buffer. RCS engine is tested last as it programs the registers via a batch buffer and this will invalidate the test for workloads that don't use the render ring or don't run a render batch first. v2: Reorganised the structure. Added more tests. (Chris Wilson) v3: Fixed a few bugs. (Chris Wilson) v4: More Tidy-ups. (Chris Wilson) SKL does does not have a snoop bit. (Peter Antoine) Signed-off-by: Peter Antoine <peter.antoine@intel.com>
2016-04-11lib: Tidy presentations of pread/pwrite failuresChris Wilson
Make the assertion failure message readable if gem_read or gem_write fail. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>