1101 Commits

Author SHA1 Message Date
Tomeu Vizoso
a2d5b348ee lib: Add igt_dirty_fb
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-14 13:54:24 +01:00
Tomeu Vizoso
fb66a5df93 lib: Add helper kmstest_dumb_map_buffer
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-14 13:54:24 +01:00
Tomeu Vizoso
dc84e7d6ad lib: Add wrapper for DRM_IOCTL_MODE_CREATE_DUMB
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-14 13:54:24 +01:00
Tomeu Vizoso
85a1d45c4a lib: Call intel_get_drm_devid only from intel code
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-14 13:54:24 +01:00
Tomeu Vizoso
644f364da2 lib: Assert we are on i915 from intel_get_drm_devid
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-14 13:54:24 +01:00
Tomeu Vizoso
e0e3a063ae lib: Expose is_i915_device
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-14 13:54:24 +01:00
Tomeu Vizoso
6755757e9f lib: Have gem_set_tiling require intel
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-14 13:54:24 +01:00
Tomeu Vizoso
3fee80efcf lib: add igt_require_intel
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-14 13:54:24 +01:00
Tomeu Vizoso
0eadf638e4 lib: Rename is_intel to has_known_intel_chipset
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-14 13:54:24 +01:00
Peter Antoine
8af67d1980 test/gem_mocs_settings: Testing MOCS register settings
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-12 10:45:49 +01:00
Chris Wilson
4a3fa3532a lib: Tidy presentations of pread/pwrite failures
Make the assertion failure message readable if gem_read or gem_write
fail.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-11 07:40:11 +01:00
Chris Wilson
645c95400c lib: Remove defunct stop_rings
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-09 13:38:12 +01:00
Lionel Landwerlin
cd8da3f65d lib: kms: move framebuffer scanout offset/size to plane
This fixes potential crashes when the framebuffer is unset from a
given plane.

v2: s/with/within/ typo in header

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Marius Vlad <marius.c.vlad@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-04-05 17:09:29 +03:00
Chris Wilson
bd292436ed lib: Avoid assertion if sig_ioctl is unsed from a child accidentally
The timer is tied to the creator thread, i.e. it is not inheritable
across fork() or clone()/pthread_create(). Using it thus causes an
assertion failure in the test after the one that aborts (and so on until
we perform an interruptible test correctly) - one mistake snowballs. We
can stop the snowball by doing an initial check and diverting back to
drmIoctl().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-03 13:40:48 +01:00
Chris Wilson
cb12d05e79 lib: Don't report the last errno inside the async GPU hang detector
Since the last errno doesn't correspond with the signal, reporting it
when we detect the GPU hang is confusing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-03 13:40:48 +01:00
Chris Wilson
c89e8dbfd8 lib: Ignore udev failure to report an event
Fixes gem_exec_suspend complaining that the hang detector spontaneously
combusts.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-29 17:22:41 +01:00
Chris Wilson
2b804c33e7 lib: Tidy error message for a helper process who unexpectedly dies
Transform

gem_exec_suspend: igt_core.c:1429: igt_stop_helper: Assertion `(((signed char) ((((__extension__ (((union { __typeof(status) __in; int __i; }) { .__in = (status) }).__i))) & 0x7f) + 1) >> 1) > 0) && (((__extension__ (((union { __typeof(status) __in; int __i; }) { .__in = (status) }).__i))) & 0x7f) == (proc->use_SIGKILL ? 9 : 15)' failed.

into

(gem_exec_suspend:16589) igt-core-DEBUG: Helper died too early with status=0
gem_exec_suspend: igt_core.c:1437: igt_stop_helper: Assertion `helper_was_alive(proc, status)' failed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-29 17:22:41 +01:00
Chris Wilson
98dcf2f0dc igt/gem_concurrent_blit: Relax maxfiles restrictions
Only fail the dmabuf tests if we cannot prep the system to support
"unlimited" fd.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-25 18:23:56 +00:00
Chris Wilson
756f3e0cb7 lib: Add a GPU error detector
If we listen to the uevents from the kernel, we can detect when the GPU
hangs. This requires us to fork a helper process to do so and send a
signal back to the parent.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-24 11:25:38 +00:00
Lionel Landwerlin
c7e9be2302 lib: add crc comparison function without an assert
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-03-21 11:47:22 -07:00
Lionel Landwerlin
a511310244 lib: fb: add igt_paint_color_gradient_range
This is a helper to draw a gradient between 2 colors.

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-03-21 11:47:04 -07:00
Lionel Landwerlin
1716625e1e lib: kms: add helpers for color management properties on pipes
v2: Rename CTM_MATRIX property to CTM

v3: Add support for atomic commits

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-03-21 11:46:18 -07:00
Lionel Landwerlin
59b5487625 lib: kms: add crtc_id to igt_pipe_t
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-03-21 11:45:45 -07:00
Chris Wilson
8520037e54 lib: Measure the cost of calling timer_settimer() for sigiter
We wish to delay the first signal from the igt_sigiter_ioctl
sufficiently to skip over the timer_settime() and into the drmIoctl
kernel context before firing. If we fire too early, we will think that
the ioctl doesn't respond to signals and ignore it in future. If we fire
too late, we won't probe the ioctl for signal handling at all. Let's try
measuring the timer_settime() call time as a first approximation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-21 16:26:04 +00:00
Chris Wilson
82e9113bfb lib/igt_aux: Refine decision to stop signal injection
The goal of injecting signals into the ioctl() is to trigger an EINTR.
If we did not succeed on the last pass, we are not going to on the next
or subsequent passes either.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-19 16:00:02 +00:00
Chris Wilson
e85613b47c igt/gem_concurrent_blit: dmabuf requires twice the number of files
In order to keep the dmabuf mmap around whilst we keep the object alive,
we need a file descriptor for each. Check that the VFS supports that
many fd.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-19 15:21:28 +00:00
Chris Wilson
d545610861 lib/igt_aux: Divert ioctls for signal injection
To simplify and speed up running interruptible tests, use a custom
ioctl() function that control the signaling and detect when we need no
more iterations to trigger an interruption.

We use a realtime timer to inject the signal after a certain delay,
increasing the delay on every loop to try and exercise different code
paths within the function. The first delay is very short such that we
hopefully enter the kernel with a pending signal.

Clients should use

struct igt_sigiter iter = {};
while (igt_sigiter_repeat(&iter, enable_interrupts=true))
	do_test()

to automatically repeat the test until we can inject no more signals
into the ioctls. This is condensed into a macro

igt_interruptible(enable_interrupts=true)
	do_test();

for convenience.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-19 15:20:43 +00:00
Chris Wilson
c1fed522ae lib: Replace drmIoctl() with a layer of indirection
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-03-19 13:15:08 +00:00
Daniel Vetter
4e4f5b4fdc lib/tests: More igt_subtest_group checks
... for some cases discussed with Chris on irc. We seem to get them all
right.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-03-19 12:15:47 +01:00
Daniel Vetter
483d1c0a23 lib: Fix some doc warnings
Cc: Marius Vlad <marius.c.vlad@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-03-19 12:12:47 +01:00
Daniel Vetter
72d04b8453 lib: Add igt_subtest_group
Useful for creating common setup code in igt_fixture which is only
needed by a subset of tests. And since I'm a good citizen it comes
with a library testcase/example included.

v2: Make testcase nastier to ensure a subtest group SKIPS when it's
parent is skipping already. I accidentally got this right, but let's
make sure.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-03-19 10:37:40 +01:00
Rodrigo Vivi
dbc74dd990 intel: Adding missing Broxton PCI IDs.
These IDs were already part of the kernel since:

kernel commit 985dd4360fdf2533fe48a33a4a2094f2e4718dc0
Author: Imre Deak <imre.deak@intel.com>
Date:   Thu Jan 28 16:04:12 2016 +0200

     drm/i915/bxt: update list of PCIIDs

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Arun Siluvery <arun.siluvery@linux.intel.com>
2016-03-18 09:30:08 -07:00
Chris Wilson
95090bb50b lib/ioctl_wrappers: Explain a couple of igt_require(ret == 0)
Use more verbose igt_require(), here assocaited with SET_CACHING, such
that the requirements are explained in the debug/failure log.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-18 14:46:23 +00:00
Chris Wilson
a8a685f877 lib/intel_os: Squelch dmesg spam when purging VM caches
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-18 11:44:06 +00:00
Chris Wilson
4eba8e22fa igt/gem_concurrent_all: struct buffers for all
Now that we started packaging all parameters in one handy struct, pass
them everywhere. This allows us to pass along requirements so that we
can perform the checks inside each indvidual subtest and so not anger
the igt gods.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-18 10:47:34 +00:00
Chris Wilson
dcb39b5270 igt/gem_softpin: Repeat tests with signal interruptions
For the long running tests probing error conditions, throwing in the
signal interruptions is a good idea.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-18 09:20:06 +00:00
Chris Wilson
34098b71fa lib/igt_gt: Handle SIGINT whilst writing to i915_error_state
Becareful in case we try and eat the error state whilst interrupts are
being sent and repeat the write() until we finish uninterrupted.

References: https://bugs.freedesktop.org/show_bug.cgi?id=94573
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-17 09:55:00 +00:00
Mayuresh Gharpure
0e2e880e04 lib/igt_kms: Add COMMIT_ATOMIC to igt_display_commit2()
Co-Author : Marius Vlad <marius.c.vlad@intel.com>
Co-Author : Pratik Vishwakarma <pratik.vishwakarma@intel.com>

So far we have had only two commit styles, COMMIT_LEGACY
and COMMIT_UNIVERSAL. This patch adds another commit style
COMMIT_ATOMIC which makes use of drmModeAtomicCommit()

v2: (Marius)
	i)Set CRTC_ID to zero while disabling plane
	ii)Modified the log message in igt_atomic_prepare_plane_commit
	https://patchwork.freedesktop.org/patch/71945/

v3: (Marius)Set FB_ID to zero while disabling plane
	https://patchwork.freedesktop.org/patch/72179/

v4: (Maarten) Corrected the typo in commit message
	https://patchwork.freedesktop.org/patch/72598/

v5: Added check for DRM_CLIENT_CAP_ATOMIC in igt_display_init
    (Marius)
	i)Removed unused props from igt_display_init
	ii)Removed unused ret. Changed function to void
	iii)Declare the variable before checking if we have
	DRM_CLIENT_CAP_ATOMIC.
	https://patchwork.freedesktop.org/patch/73505/

v6: (Jani) Corrected typo in commit message

v7: Added is_atomic check for DRM_CLIENT_CAP_ATOMIC in
	igt_display_init and igt_atomic_commit

v8: (Matthew Auld) Replaced for loops by for_each_connected_output and
	for_each_plane_on_pipe
    (Lionel) Populate properties only if the value has changed
    	Remove the resetting of values in disable case
	Note : I've used Maarten's diff patch

v9: (Lionel) Added resetting of rotation property

v10: (Marius) Modified the macro declaration to avoid shadow declaration
	warning, also removed one unused variable

Signed-off-by: Mayuresh Gharpure <mayuresh.s.gharpure@intel.com>
Signed-off-by: Pratik Vishwakarma <pratik.vishwakarma@intel.com>
Signed-off-by: Mayuresh Gharpure <mayuresh.s.gharpure@intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2016-03-15 12:32:05 +01:00
Chris Wilson
5459374120 lib: Remove dead gem_get_num_rings()
No users so time to die.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-14 14:17:12 +00:00
Chris Wilson
3d9bcd0804 lib: Remove unused gem_has_enable_ring()
No one uses this nor should they as it just gem_get_param() in disguise
and they are better feature queries for whether individual execution
engines are functional.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-14 14:17:12 +00:00
Chris Wilson
6cd15fb930 benchmarks: Add gem_syslatency
Instead of measuring the wakeup latency of a GEM client, we turn the
tables here and ask what is the wakeup latency of a normal process
competing with GEM. In particular, a realtime process that expects
deterministic latency.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-09 23:40:21 +00:00
Daniel Vetter
598deeda52 lib: remove saved_sig_mask
Oversight from the exit handler cleanup, spotted by Chris Wilson.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-03-09 15:09:56 +01:00
Daniel Vetter
93824f0cd0 lib: Unit test for exit handler
Checks that
- exit handlers are run only once, even when registered multiple
  times.
- run in reverse order
- actually run for all ways a test could exit.

This is prep work to extend exit handlers to also work in a subtest
aware way.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-03-08 17:12:04 +01:00
Daniel Vetter
78f2ea3bc8 lib/igt_core: remove igt_disable/enable_exit_handlers
No longer needed, and also not really a safe idea.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-03-08 17:12:04 +01:00
Daniel Vetter
771dbb06b5 lib/igt_kms: Don't disable exit handlers around set_vt_mode
This was originally added to work around a race, but then that's
broken now. And set_vt_mode generally never results in a test binary
crash, so overkill.

I want to get rid of this interface since I spotted some abuse.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-03-08 17:12:04 +01:00
Chris Wilson
74761382b3 benchmarks/gem_latency: Replace igt_stats with igt_mean
Use a simpler statically allocated struct for computing the mean as
otherwise we many run out of memeory!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-08 14:58:59 +00:00
Chris Wilson
697c3f5550 lib: Magic for_each_engine() macro to iterate over available engines
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-08 09:57:33 +00:00
Chris Wilson
60eafc5489 igt/gem_exec_suspend: Do pre/post suspend double checks
Check that the system operates normally before and after the suspend (as
well as across the suspend). The goal is to isolate the breakage to the
subtest.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-08 09:57:33 +00:00
Chris Wilson
9ba9af2ea4 lib: Skip execution in gem_has_ring()
By looking for a particular error we can avoid actually executing
anything when testing whether the kernel supports an individual ring.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-08 09:57:33 +00:00
Chris Wilson
0501dcfd0f lib: Flush all possible rings
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-08 09:57:33 +00:00