100 Commits

Author SHA1 Message Date
Ville Syrjälä
870548b653 tests/kms_force_connector_basic: Add prune-stale-modes subtest
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-08 15:23:10 +02:00
Ville Syrjälä
b0f4df31ba lib/kms: Turn base_edid into a template
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2015-12-08 15:21:59 +02:00
Daniel Vetter
db4f83ca5d lib/kms+tests: Use cached connector state
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-04 10:49:11 +01:00
Ville Syrjälä
4d8983bcdf lib/kms: Pass fb_id=0 to setcrtc in kmstest_unset_all_crtcs()
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-16 15:35:28 +02:00
Thomas Wood
2e5a43d296 lib: add documentation for igt_display_init/fini
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-11 14:21:12 +00:00
Micah Fedke
c81d293aed convert drm_open_any*() calls to drm_open_driver*(DRIVER_INTEL) calls with cocci
Apply the new API to all call sites within the test suite using the following
semantic patch:

// Semantic patch for replacing drm_open_any* with arch-specific drm_open_driver* calls
@@
identifier i =~ "\bdrm_open_any\b";
@@
- i()
+ drm_open_driver(DRIVER_INTEL)

@@
identifier i =~ "\bdrm_open_any_master\b";
@@
- i()
+ drm_open_driver_master(DRIVER_INTEL)

@@
identifier i =~ "\bdrm_open_any_render\b";
@@
- i()
+ drm_open_driver_render(DRIVER_INTEL)

@@
identifier i =~ "\b__drm_open_any\b";
@@
- i()
+ __drm_open_driver(DRIVER_INTEL)

Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-11 14:39:43 +01:00
Thomas Wood
f0381d1abe lib: various documentation fixes
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-09-08 16:15:16 +01:00
Paulo Zanoni
4deb562659 configure: require libdrm >= 2.4.55
And drop the now unnecessary universal plane definitions. The 2.4.55
version is already quite old, so we should be fine.

Thanks to Thomas Wood for quickly spotting this.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@>
2015-07-14 12:52:09 -03:00
Thomas Wood
d01ebbd97d docs: various documentation fixes
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-07-02 08:17:17 +01:00
Damien Lespiau
6ebd8c2dc3 doc: Remove i-g-t/intel prefixes and capitalize section titles
Looks better!

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27 16:04:07 +01:00
Thomas Wood
6141aa2dad docs: various documentation fixes
Fix various typos, add missing parameter documentation, include the
igt_draw section and update the list of ignored headers.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-05-14 17:00:40 +01:00
Tvrtko Ursulin
980ccf124a igt_kms: Do not reset plane position on assigning a fb
commit a26f9f9ad0e679c7ce413a25d34f6914e1174151
    Author: chandra konduru <chandra.konduru@intel.com>
    Date:   Mon Mar 30 13:52:04 2015 -0700

        i-g-t: Adding plane scaling test case

Started doing this and broke kms_rotation_crc.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: chandra konduru <chandra.konduru@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-05-12 13:45:36 +02:00
Tvrtko Ursulin
c3bd608fc5 igt_kms: Merge condition in igt_plane_set_fb
There were two paths for fb and !fb.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: chandra konduru <chandra.konduru@intel.com>
Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-05-12 13:45:36 +02:00
Tvrtko Ursulin
759bb7ac98 igt_kms: Avoid NULL ptr deref when commiting disabled planes
I think;

   commit a26f9f9ad0e679c7ce413a25d34f6914e1174151
   Author: chandra konduru <chandra.konduru@intel.com>
   Date:   Mon Mar 30 13:52:04 2015 -0700

       i-g-t: Adding plane scaling test case

introduced a condition where it attempts to update a disabled plane because
of the newly introduced size_changed flag which is set for disabled frame
buffers. Result is a NULL ptr deref in igt_drm_plane_commit (plane->fb->src_x).

Start recognising this case as disabled plane and act accordingly.

v2: Split out igt_plane_set_fb cleanup. (Thomas Wood)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: chandra konduru <chandra.konduru@intel.com>
Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-05-12 13:45:36 +02:00
Sonika Jindal
7ef80c0a98 lib/igt_kms: Let set_property return the result
Return the return value of the set_property ioctl and add check for
the failure.

Signed-off-by: Sonika Jindal <sonika.jindal@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-22 18:00:42 +01:00
chandra konduru
a26f9f9ad0 i-g-t: Adding plane scaling test case
This patch is adding i-g-t plane scaling test case to test couple basic
display plane scaling usages. Additional test scenarios can be added later.

v2:
-Added iterative scaling to visually observe scaling (me)

v3:
-Added a flag to control primary plane scaling (me)

v4:
-Use new tiled types when calling igt_create_fb (me)

Signed-off-by: chandra konduru <chandra.konduru@intel.com>
[Thomas: convert test to use igt_simple_main]
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-14 17:44:34 +01:00
chandra konduru
ace4208702 i-g-t: Adding test case to test background color.
Adding i-g-t test case to test display crtc background color.

v2:
- Added IGT_TEST_DESCRIPTION() (Thomas Wood)
- Added to .gitignore (Thomas Wood)
- Added additional details to function header (Thomas Wood)
- Simplified igt_main (Thomas Wood)

v3:
- rebased to latest master (me)
- took sleep calls out (Daniel)
- use new tiled types when calling igt_create_fb (me)

Signed-off-by: chandra konduru <chandra.konduru@intel.com>
[Thomas: convert test to use igt_simple_main]
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-14 17:44:34 +01:00
Ander Conselvan de Oliveira
9aeff2b5c5 lib/kms: Add a way to override an output's mode
So that it is possible to use a custom mode with the simplified mode set API.

v2: Add documentation for igt_output_override_mode(). (Thomas)

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-31 10:21:54 +01:00
Thomas Wood
47f6b1305c igt.cocci: check the return values of various functions
Add rules to fix unused-result warnings when compiling with
_FORTIFY_SOURCE defined and apply them to the library and tests.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-26 15:50:59 +00:00
Marc Herbert
c6d18ee56b lib/igt_kms.c: remove tests dependency on VT /dev/tty0
Required to run on any recent, freon-based and X11-free ChromeOS release.

v2:
- igt_debug() instead of igt_warn()
- return KD_GRAPHICS instead of -1UL
- print previous mode in debug statements. Among others this help a tiny
  bit with the now confusing debug output ("cannot change" immediately
  followed by a misleading "mode changed").

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-02-24 23:39:15 +01:00
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