106 Commits

Author SHA1 Message Date
Chris Wilson
c7551bf7cc igt/kms_flip/nonblocking_read: Demonstrate that O_NONBLOCK is a myth
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-08 10:44:57 +01:00
Thomas Wood
6a8d33c2bb lib: add a function to indicate activity
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-09-30 17:54:12 +01:00
Imre Deak
c256af5d44 test/kms, pm: use drm_open_any_master
These tests require DRM master right, so make sure they have it from the
beginning. This gives an early indication if another DRM master is running
and makes the given test skip (with a proper explanation of the reason)
instead of exiting with error.

Signed-off-by: Imre Deak <imre.deak@intel.com>
2014-09-30 16:46:28 +03:00
Chris Wilson
10552b5ca6 batch: Specify number of relocations to accommodate
Since relocations are variable size, depending upon generation, it is
easier to handle the resizing of the batch request inside the
BEGIN_BATCH macro. This still leaves us with having to resize commands
in a few places - which still need adaption for gen8+.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-30 11:44:51 +01:00
Chris Wilson
982f7eb238 Prepare for 64bit relocation addresses
This reveal that quite a few locations were writing relocation offsets
but only allowing for 32 bit addresses. To reveal such places in active
tests, we also now double check that we do not use more batch space than
declared.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-29 20:02:10 +01:00
Damien Lespiau
d71031cd74 kms_flip: Adjust to the new igt_create_fb*() API
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-08-21 14:54:01 +01:00
Daniel Vetter
1cad834261 lib/igt_kms: Simplify return value of kmstest_get_connector_config
A plain bool is enough.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-08-12 19:36:53 +02:00
Daniel Vetter
33f0884f3c lib/igt_kms: set_vt_graphics_mode is a low-level helper
So give it a kmstest_ prefix and shuffle it around a bit.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-08-12 19:36:53 +02:00
Chris Wilson
4d4f4b213c igt/kms_flip: Skip if headless
If there are no connectors, we cannot perform any pageflips and so we
have nothing to test.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73640&list_id=446828
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-19 11:59:42 +01:00
Thomas Wood
eef768f283 tests: enable extra connectors in kms_flip and kms_pipe_crc_basic
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-07-11 11:47:46 +01:00
Ville Syrjälä
11e62a3927 tests/kms_flip: Move EBUSY to a new busy-flip subtest
The EBUSY checking is very fragile currently in case there's any kind
extra delay in the test loop. At least the flip-vs-rmfb fails reliably
on my IVB.

So to make the test less fragile remove the EBUSY check from all the
current flip tests, and instead add a specific busy-flip test. To
better guarantee that we get the EBUSY add a blocking vblank wait just
before we issue the first flip. This maximizes the time we have to
submit two flips during one frame.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-06-04 20:16:01 +03:00
Ville Syrjälä
e4ba3b75e6 tests/kms_flip: Make flip-vs-panning-vs-hang change DSPSURF
Make sure DSPSURF will change during the panning operation
in flip-vs-panning-vs-hang.

This will now test agains bugs between the kernel's mmio vs.
CS flip race handling and GPU resets. If the kernel is buggy
if will fail to notice that the panning operation changed the
base address before the GPU reset had a chance to deal with the
pending page flips, and so the flip would never complete due to
DSPSURFLIVE not matching the expected value.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-05-27 21:03:59 +02:00
Daniel Vetter
c75dcbdac5 tests/kms_flip: various improvements
- Some debug logging for the ts continuity checks.
- Add a plain vblank-vs-suspend test where kms_flip doesn't switch off
  the displays first.
- Ensure that we do at least 2 rounds, the suspend tests bailed out
  after 1 round and so didn't test anything.
- Frob the testnames a bit.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-05-20 15:45:31 +02:00
Daniel Vetter
89152791e2 tests/kms_flip: Add vblank vs. gpu hang testcase
Currently broken :(

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-05-20 14:42:12 +02:00
Oscar Mateo
542c2b5ed5 tests/kms_flip: test a fb backed by a bo too big/small for its own good
This is a "review by igt test" for a bug located in
i915_gem_object_pin_to_display_plane and fixed by:

commit 392013bdd4b6128795e33c84bd6d6d3fd66ff0a3
Author: Oscar Mateo <oscar.mateo@intel.com>
Date:   Fri May 16 11:23:12 2014 +0100

    drm/i915: Gracefully handle obj not bound to GGTT in is_pin_display

    Otherwise, we do a NULL pointer dereference.

    I've seen this happen while handling an error in
    i915_gem_object_pin_to_display_plane():

    If i915_gem_object_set_cache_level() fails, we call is_pin_display()
    to handle the error. At this point, the object is still not pinned
    to GGTT and maybe not even bound, so we have to check before we
    dereference its GGTT vma.

    v2: Chris Wilson says restoring the old value is easier, but that
    is_pin_display is useful as a theory of operation. Take the solomonic
    decision: at least this way is_pin_display is a little more robust
    (until Chris can kill it off).

v2: Avoid code duplication by using igt_create_fb_with_bo_size() as
requested by Ville Syrjälä (original author of the "too big" test idea).

Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-05-16 17:45:14 +03:00
Daniel Vetter
6727de0c1a tests/kms_flip: nasty power management tests
These check whether everything is still ok wrt vblank handling after
runtime pm and system suspend-resume.

In addition to the usual checks they also ensure that the vblank frame
counter isn't totally ridiculous, something Keith complained about
aeons ago. With Ville's drm_vblank_on/off rework this should now be
fixed and solid.

v2:
- Ignore seq_step, vblanks completely immediately when the crtc goes off
- Only run system suspend/resume tests once.

Cc: Keith Packard <keithp@keithp.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-05-15 14:25:47 +02:00
Daniel Vetter
62cd793c37 tests/kms_flip: Fix vblank ts check
Oops, fumbled that in the conversion.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-05-14 18:00:07 +02:00
Daniel Vetter
5597a1f418 tests/kms_flip: Use asserts
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-05-14 11:52:35 +02:00
Daniel Vetter
29ee36f259 lib: extract kmstest_set_connector_dpms
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-04-30 18:07:58 +02:00
Daniel Vetter
cc730c418f lib/kmstest: Fix up tiled buffer creation
When extracting a raw __gem_set_tiling helper I've fumbled this in

commit 590f6101402b51bca54f69c002380bda967484ea
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Wed Oct 9 20:50:50 2013 +0200

    lib/drmtest: extract rawer __gem_set_tiling

Fix things up so that we properly propaget the error again.

Now to make this all properly work we also need to make kms_flip a
notch more robust against such failures ...

This only blows up on gen2/3 with the pan tests which want a too wide
framebuffer for tiling.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-04-13 19:08:17 +02:00
Mika Kuoppala
d983a47f14 tests: use lib igt_[get|set]_stop_rings()
on gem_reset_stats, kms_flip and pm_rps.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75876
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
2014-04-10 17:50:43 +03:00
Daniel Vetter
9aea7ae541 lib/igt_fb: switch to igt_ prefix from kmstest_
Shorter and more in line with our general igt_ prefix for everything
which isn't somehow intel or i915-gem or otherwise hw specific - these
helpers here are all fully generic framebuffer handling functions
based on kms + cairo.

Well, the actual buffer alloc is done with i915 gem, but meh ;-)

Two special cases:
- bpp_depth_to_drm_format and drm_format_to_bpp completely lacked
  prefixes, so just add igt_.
- write_fb was a bit misleading given that we have gem_write for
  uploading to buffers. Rename that to write_fb_to_png to make it
  crystal clear what this thing does even without looking at docs.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-26 18:50:27 +01:00
Daniel Vetter
2fc2fa5471 lib/igt_kms: s/kmstest_create_fb2/kmstest_create_fb/
Simplify the name since the old _fb function is now gone.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-26 18:50:27 +01:00
Daniel Vetter
70182167d6 lib: remove kmstest_create_fb
Use the new-style function using drm fourcc codes instead everywhere.

To easily use thew fourcc based interface also expose
bpp_depth_to_drm_format from the library. Finally include drm_fourcc.h
from the igt_kms.h header since pretty much everyone needs this now.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-26 18:50:27 +01:00
Daniel Vetter
f5daeec724 lib: extract igt_aux.[hc]
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-23 13:47:09 +01:00
Daniel Vetter
e49ceb8690 lib: unnecessary header removal for drmtest.h, part 1
Brought a few missing headers to light in ioctl_wrappers.h, too.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 21:07:37 +01:00
Daniel Vetter
53a4d9e982 lib/intel_batchbuffer: igt_ prefix for rendercopy/mediafill funcs
Now everything is prepared to pour some neat api docs over this all.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 15:49:02 +01:00
Daniel Vetter
83a4c7d3eb lib/intel_batchbuffer: igt_ namespace for the buffer structure
Step one to properly namespace the rendercpy/mediafill functions. Als
give the buf_height/width helpers a proper igt_ prefix.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 15:44:48 +01:00
Daniel Vetter
7dc0001f3d lib: make rendercopy.h an internal header
And move the public interfaces into intel_batchbuffer.[hc].

A bit messy since we are fairly inconsistent with our header #include
handling.

Also exclude rendercopy.h from the documentation.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 15:31:15 +01:00
Ville Syrjälä
42aa254c65 kms_flip: Add dpms-vs-vblank-race and modeset-vs-vblank-race subtests
dpms-vs-vblank-race and modeset-vs-vblank-race try to race wait for
vblank ioctls from one thread against modeset/dpms ioctls from another.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-02-21 21:33:20 +02:00
Chris Wilson
a0c936cfc1 kms_flip: Skip tests that try to inject GPU hangs if already terminally wedged
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-21 15:28:43 +00:00
Chris Wilson
0cc6a219f1 kms_flip: Assert that hang_gpu() should only fail is the GPU is already hung
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-21 15:19:01 +00:00
Ville Syrjälä
5f190f2d67 kms_flip: Fail the subtest if page flip hang recovery wasn't actually tested
Context banning can prevent the page flip hang tests from actaully
testing anything, so make the relevant subtests fail in that case.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-02-21 16:19:12 +02:00
Ville Syrjälä
48ba2cdf96 kms_flip: Restore rings to running state in unhang_gpu()
If things go bad, make sure the rings aren't left in the stopped state.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-02-21 16:19:11 +02:00
Chris Wilson
3db29744f7 kms_flip: Try to make hang_gpu() robust against hanging the GPU
On a bad day, hanging the GPU may be terminal. Yet even if the GPU is
terminally wedged we expect modesetting (and pageflips) to continue.
That deserves to be a dedicated test, but in the meantime we should
strive to avoid falling over just because the code is not resilient.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-21 11:39:45 +00:00
Daniel Vetter
959783684e test/kms_flip: fix up igt logging conversion
Silly me ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-13 19:22:53 +01:00
Daniel Vetter
d1e318d23d tests/kms_flip: use igt logging
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-02-13 14:41:40 +01:00
Chris Wilson
03d144d16f kms_flip: Try to consume all fences after a flip
As a flip is outstanding, there is an issue that the kernel may not be
able to release one of the fences that userspace requires and erroneous
report EDEADLK (on gen2, gen3).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73696
2014-01-20 20:27:42 +00:00
Paulo Zanoni
98c10d379b tests/kms_flip: free the test_output struct when counting modes
Looks like we have to do a lot of work just to count the number of
modes...

Caught by Valgrind.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2014-01-07 09:57:04 -02:00
Paulo Zanoni
69856b5e7b tests/kms_flip: don't leak the connector_config struct
... in case we can't find a compatible mode. We already have
config[0], we can't return without freeing it first.

Caught by Valgrind.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2014-01-07 09:57:04 -02:00
Paulo Zanoni
056500bdc5 tests/kms_flip: don't leak the CRTC
The kms_flip program calls kmstest_get_connector_config, which returns
a struct containing some allocated variables, including a pointer to
the CRTC. The problem is that we copy the values returned by this
structure to the test_output struct, but we ignore the CRTC pointer.
So free the CRTC pointer instead of leaking it.

Caught by Valgrind.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2014-01-07 09:57:04 -02:00
Paulo Zanoni
02ad7e04dd tests/kms_flip: don't leak the connector when setting DPMS
Caught by Valgrind.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2014-01-07 09:57:04 -02:00
Chris Wilson
164d9d26ac kmstest: Fix up lifetimes of cairo objects
cairo_t is the short lived drawing context, whereas cairo_surface_t is
the heavyweight object that persists and is also tied to underlying GEM
objects. So make the kmstest API reflect the different weights and fix
the lifetime and underlying object reference leaks.

Based on the fix by Paulo Zanoni.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-12-31 12:30:30 +00:00
Imre Deak
13ef9e8d54 kms_flip: consolidate run_test_on_{crtc,crtc_pair}
No functional change.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-10 15:46:00 +02:00
Imre Deak
1ac94b50af kms_flip: keep drm_fd open for the dpms restore exit handler
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69161

Signed-off-by: Imre Deak <imre.deak@intel.com>
2013-12-10 14:07:37 +02:00
Imre Deak
2c6c4cf2a1 kms_flip: fix seq_step for 2xcrtc subtests
This also raises the absolute wait-for-vblank sequence step from 5 to
10, just to make it consistent with the corresponding 1x subtests.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69161
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-12-10 14:07:37 +02:00
Ville Syrjälä
725da6ee74 rendercopy: Pass context to rendercopy functions
rendercopy does the batch buffer flush internally, so if we want
to use it with multiple contexts, we need to pass the context
in from caller.

v2: Modify rendercopy_gen8 as well

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2013-11-27 16:21:28 +02:00
Oscar Mateo
37f26d17b1 lib: Move kms stuff from drmtest.c over to igt_kms.c
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-12 12:04:12 +01:00
Ben Widawsky
f4dfa37e85 bdw: Update obvious missing blit support
This provides a macro that allows us to update all the arbitrary blit
commands we have stuck throughout the code. It assumes we don't actually
use 64b relocs (which is currently true). This also allows us to easily find
all the areas we need to update later when we really use the upper dword.

This block was done mostly with a sed job, and represents the easier
in test blit implementations.

v2 by Oscar: s/OUT_BATCH/BEGIN_BATCH in BLIT_COPY_BATCH_START

CC: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
2013-11-06 09:34:35 -08:00
Daniel Vetter
223a61e12e lib: make igt_install_exit_handler never fail
Most callers didn't bother checking, so just move the asserts into
the function itself.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-01 21:10:59 +01:00