80 Commits

Author SHA1 Message Date
Alan Coopersmith
cf93bc8df9 Solaris needs to #include <sys/kd.h> instead of <linux/kd.h>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-01-06 09:29:45 +01:00
Thomas Wood
8161a21762 lib: introduce log domains
Log domains can be used to identify the source of log messages, such as
the test being run or the helper library.

v2: Add separate domains for different parts of the helper library and
    use an empty default domain for applications.
    Expand the log output to include the process name and the log level
    of the message in addition to the domain and pid.
    Print the expanded message only for warning and debug messages.

v3: check for glibc before using program_invocation_short_name

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-12-11 17:55:15 +00:00
Thomas Wood
c76f35386c lib: always reset connectors after the state is forced
Install the exit handler to reset connector states whenever
kmstest_force_connector is called, so that the connector states are
always reset even if a test fails.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-12-04 16:07:55 +00:00
Thomas Wood
8d82e5b5ef lib: remove igt_edid.h
This has been replaced by igt_kms_get_base_edid().

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-12-04 16:07:55 +00:00
Thomas Wood
273a06dc9b igt_kms: add a base edid
Add a basic edid block that includes several different display modes.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-12-04 16:07:55 +00:00
Gagandeep S Arora
b8f193bbbf demos/intel_sprite_on: Added support to compile intel_sprite_on on Android.
Added Android.mk for intel_sprite_on.

v2: Addressed review comments by Daniel Vetter.
    - Moved the cairo independent functions from igt_kms.c to igt_aux.c.

Signed-off-by: Gagandeep S Arora <gagandeep.s.arora@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-11-25 11:49:24 +00:00
Thomas Wood
dad4694b00 lib: fix igt_reset_connectors
Use igt_debugfs_open to open the connector file, since the
forced_connectors array now only stores the connector path relative to
the debugfs path. Also add some extra error checking to ensure a test
failure if the reset fails.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85829
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-11-25 09:35:18 +01:00
Thomas Wood
c049c39f35 tests: use igt_debugfs where possible
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-11-06 13:25:03 +00:00
Ville Syrjälä
7b76754e0e lib: Add igt_plane_set_size()
Allow tests to specify the plane size instead of assuming that the
entire FB will be scanned out.

To keep the current tests working without having to sprinkle
igt_plane_set_size() calls all over the place, make
igt_plane_set_fb() reset the plane size to the FB size.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-09-18 12:56:56 +03:00
Thomas Wood
f675f6771b lib: keep a list of modified connectors to reset
Avoid calling functions in igt_reset_connectors that are not safe to use
in signal handlers by keeping a list of connectors that have been
modified, instead of enumerating all connectors.

v2: add space for a sentinel NULL value on forced_connectors and print a
    warning when the connector limit is reached (Chris Wilson)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83498
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-09-05 16:52:51 +01:00
Thomas Wood
d3c83b2033 lib: don't force HDMI or DP connectors on HSW and BDW
Forcing HDMI or DP connectors on these platforms doesn't currently work,
so fail early to allow the test to skip if required.

v2: restrict to HSW and BDW (Daniel Vetter)

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-09-05 16:52:51 +01:00
Thomas Wood
a124b1a430 lib: add kmstest_edid_add_3d
kmstest_edid_add_3d adds an EDID extension block with 3D support to a
copy of the specified EDID.

v2: Avoid using an invalid CEC SPA (Clint Taylor)

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-09-05 16:52:51 +01:00
Daniel Vetter
c49542af07 lib/igt_aux: Improve wait_for_keypress helper a bit
- Use keys in just one env variable to enable/disable it.
- Add an informational message so that the users knows when to press
  the key (more useful over ssh than when run on the terminal ofc).
- Improve the documentation so that it's clearer how to use this
  when running tests.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-09-05 09:30:53 +02:00
Daniel Vetter
1649ef0d1f lib/igt_* Use igt macros in igt libaries
Except in igt_core since that would lead to some hilarious recursions.

v2: Don't fflush any more, spotted by Chris.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-08-26 21:29:14 +02:00
Thomas Wood
fcb324c2cc lib: add igt_restore_vt_mode
Add a function to restore the previous VT mode after
igt_set_vt_graphics_mode is called.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-08-14 15:02:17 +01:00
Daniel Vetter
5c7bcb11be lib/igt_kms: doc for the remaining kmstest_ functions
Plus a bit an overview section explaining the split in the library - a
few people (everyone except me it seems) didn't really understand it.

v2: Fix typo'ed s/kmstest_set_vt_graphics_mode/kmstest_get_pipe_from_crtc_id/
in a doc comment spotted by Imre.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-08-12 19:36:53 +02: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
81dfcaba88 lib/igt_kms: Simplify return value of kmstest_get_connector_default_mode
A plain bool is good enough, no need for fancy negative error values.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-08-12 19:36:53 +02:00
Daniel Vetter
3b39bfff60 lib/igt_kms: Shuffle kmtests_ functions
Group them a bit both in the header and .c file, and make sure they
appear in the same order in both.

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
Daniel Vetter
27a19de059 lib/igt_kms: Clean up the other _name functions/macros
And remove sprite_name, redundant and won't work due to lack of
dev_priv.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-08-12 19:36:53 +02:00
Daniel Vetter
dd8fba44cd lib/igt_kms: Unify pipe name helpers
And add api doc while at it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-08-12 19:36:53 +02:00
Paulo Zanoni
d52365677e igt_kms: add kmstest_unset_all_crtcs()
Both pm_rpm.c and pm_lpsp.c call it "disable_all_screens", but let's
give it a name that better describes what the implementation does.

v2: Rename to kmstest_unset_all_crtcs (Daniel).

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2014-08-07 15:44:06 -03:00
Paulo Zanoni
4924b78368 igt_kms: document and export kmstest_get_property()
So we can use it on pm_rpm.c.

v2: Rename to kmstest_get_property (Daniel)

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2014-08-07 15:42:22 -03:00
Paulo Zanoni
053c104322 igt_kms: optionally return the property from get_property
So we can use this function on places that also need the property
pointer, without having to call drmModeGetProperty() again with the
returned id.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2014-08-07 15:41:55 -03:00
Paulo Zanoni
18d8ea7fe4 igt_kms: pass drm_fd instead of igt_display_t on some functions
Since these functions only really use the drm_fd. The goal is to be
able to reuse these functions on programs that don't use the
igt_display_t structure.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2014-08-07 15:41:28 -03:00
Paulo Zanoni
61920c68d8 igt_kms: don't get drmModeRes just to free it later
Stress testing malloc is not our goal :)

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2014-08-07 15:41:02 -03:00
Thomas Wood
bb48429a6c lib: don't abort if forcing the connector state fails
Ensure tests using igt_enable_connectors can still run even if the
relevant debugfs files are not available.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-07-30 11:13:13 +01:00
Damien Lespiau
068efd8d9f igt_kms: Add support for setting plane rotation
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:21 +01:00
Damien Lespiau
b2eb48576f igt_kms: Add a way to query of the plane supports rotation
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:21 +01:00
Damien Lespiau
143c3a7575 igt_kms: Provide a get_plane_property() shorthand
So one doesn't have to write the plane type all the time.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:21 +01:00
Damien Lespiau
33842d5940 igt_kms: Factor out a generic get_property() out of get_drm_plane_type()
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-11 15:12:21 +01:00
Thomas Wood
b81020526f lib: allow the edid to be reset
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-07-11 11:47:46 +01:00
Thomas Wood
b6ed9fb0d9 lib: add igt_enable_connectors and igt_reset_connectors
igt_enable_connectors forces connectors to be enabled where doing so is
known to work well. igt_reset_connectors resets the force state on all
connectors.
2014-07-11 11:47:46 +01:00
Thomas Wood
13cd79c128 lib: add the ability to set an EDID data block on a connector
Add a function to set an EDID data block on a connector and include a
set of generic EDID blocks for testing.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-07-11 11:47:46 +01:00
Thomas Wood
37ffb22d3c lib: add function to change connector states
Add an API function and a test program to force a particular state on a
connector.

v2: mask the correct part of the minor number to get the card number (Chris
    Wilson)

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-07-11 11:47:46 +01:00
Yi Sun
b5333b416f kms_plane: Add panning test for primary plane
Get CRCs of a full red and a full blue surface as reference.

Create a big framebuffer that is twice width and twice height as the
current display mode.

Fill the top left quarter with red, bottom right quarter with blue
Check the scanned out image with the CRTC at position (0, 0) of the
framebuffer and it should be the same CRC as the full red fb
Check the scanned out image with the CRTC at position (hdisplay,
vdisplay) and it should be the same CRC as the full blue fb

v2: Fix a few things here and there (Damien)

Cc: Lei Liu <lei.a.liu@intel.com>
Cc: Yi Sun <yi.sun@intel.com>
Signed-off-by: Lei Liu <lei.a.liu@intel.com>
Signed-off-by: Yi Sun <yi.sun@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-07 18:27:10 +01:00
Damien Lespiau
4f83c4efa8 lib: Reset 'position_changed' after a drmModeSetCrtc()
So the next commit won't trigger a drmModeSetCrtc() if the primary plane
doesn't have any update needing it.

This shouldn't be a problem at the moment as we don't allow the primary
plane to be of a different size than the CRTC viewport, but it will most
likely change in the future and we don't want to have that bug there.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-07 17:58:26 +01:00
Matt Roper
c8b8f8abf6 lib/kms: Provide universal plane #define's
There hasn't been a libdrm release containing the universal plane
definitions yet, so add them to igt_kms to allow compilation to succeed
in the meantime.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-07-07 18:27:07 +02:00
Matt Roper
04067c3d50 lib/kms: Drop primary plane windowing test from igt_plane_set_position()
None of our hardware can support this today, but we'd like to be able to
write tests that check that the kernel returns the proper error code
when userspace tries it anyway.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-04 12:04:17 +01:00
Matt Roper
794a9fd6bc lib/kms: Add universal plane support (v2)
Add support for universal planes.  This involves revamping the existing
plane handling a bit to allow primary & cursor planes to come from the
DRM plane list, rather than always being manually added.

v2: Don't drop fixed ordering of internal plane list.  Primary will
    always be index 0, cursor will always be last in internal plane
    list.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-04 12:04:14 +01:00
Matt Roper
82bc03f392 lib/kms: Add igt_display_try_commit2()
Add a new public API that will attempt a display commit, but will return
an error code upon failure rather than failing the IGT test.  This is
intended to allow igt tests to verify that the expected error codes are
returned to userspace when invalid requests are issued.

Note that with non-atomic programming, a single commit operation has
several potential failure points internally; the first non-zero error
code encountered will be returned immediately and no further programming
will be performed by the commit.  It is the caller's responsibility to
return to a sane state.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-04 12:04:12 +01:00
Matt Roper
1c25547d48 lib/kms: Add igt_display_commit2()
Add a new commit interface, igt_display_commit2(), that allows tests to
specify which programming API should be used to perform hardware
updates.  COMMIT_LEGACY is the only option for now, but universal
and atomic interfaces will be added as additional options in the future.

igt_display_commit() remains unchanged for existing tests that wish to
place the hardware in a specific state, but that don't care which API is
used to achieve that state.  The legacy API will be used by default for
now, but in the future we may decide to make the default API
configurable via an environment variable.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-04 12:04:01 +01:00
Matt Roper
2a3e212acc lib/kms: Track need for vblank wait locally
The need to wait for a vblank after programming is due to the way we
actually program the hardware.  Move need_wait_for_vblank out of the
pipe and into a local variable in preparation for future programming
styles (e.g., atomic pageflip) that will need different logic.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-04 12:03:45 +01:00
Matt Roper
3cc60bab46 lib/kms: Drop igt_pipe->need_set_{crtc, cursor}
The "need" flags on igt_pipe simply mirror the fb_changed field of the
primary/cursor planes.  Drop them and just use fb_changed instead.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-04 12:03:26 +01:00
Thomas Wood
5874daddc4 lib: ensure igt_display_init clears the memory for the display struct
Add the call to memset that was accidentally removed in:

commit 1e9e1baba389fe498be12390ceeeacb1d141a5cf
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Thu Mar 13 17:20:05 2014 +0100

    lib/igt_kms: rip out custom verbose loggin support

    Instead just piggy-pack on top of igt_log.

    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-06-16 20:11:51 +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
Daniel Vetter
c6c2b2bb70 lib/igt_kms/bf: doc skeleton
igt_kms docs are just skeleton and also added igt_fb to make sure the
linking works correctly.

Next up: Actually documenting igt_fb.

Also fix that depency spelling fumble I've copied around to a few too
many places.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-26 18:50:28 +01:00
Daniel Vetter
64401f57e9 lib: fold igt_display into igt_kms
For 1 function and 2 types we kinda don't need separate files.
Especially now that igt_kms is much more focused on the actual modeset
stuff with all the framebuffer helpers extracted to igt_fb.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-26 18:50:28 +01:00