summaryrefslogtreecommitdiff
path: root/lib/igt_kms.c
AgeCommit message (Collapse)Author
2016-10-05igt_kms: Refresh output when setting pipe.Maarten Lankhorst
We still allow duplicates at this point, but when commit is called only one output per display is allowed. This fixes tests like kms_psr_sink_crc, which expect a valid pipe. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2016-09-15lib/kms: Probe connectors from igt_enable_connectors()Chris Wilson
This fixes a failure when running kms_flip after booting on a bare system as nothing will have probed the connectors before hand. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-25igt_kms: Populate more members of connectors.Maarten Lankhorst
It's possible to make use of disconnected connectors, for example when overriding the mode or testing connector properties that don't need it to be connected. Support this by zeroing the mode in that case. We still return false, but this is ignored by commit. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2016-08-23lib/kms: Force connector probing on first useChris Wilson
In order for igt to run completely standalone, it must coldplug connectors on first use by forcing the probe. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-05lib: Fix typo s/huma-readable/human-readable/Ville Syrjälä
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2016-08-04igt_kms: Use proper panning coordinates for legacy primary plane updatesMatt Roper
A copy/paste error resulted in us using src_x for both the x and y panning coordinates; make sure we use src_y instead for the appropriate parameter. Fixes: 0e29ce3265b ("igt_kms: Remove pan members from igt_plane, v2.") Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
2016-07-27lib/igt_kms: Add some more documentation to some common kms functions.Maarten Lankhorst
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2016-07-27lib/igt_kms: Move doc header to start of the fileMaarten Lankhorst
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2016-07-26igt_kms: Allow disabling previous override modeMaarten Lankhorst
By passing a null argument. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2016-07-26igt_kms: Add more apis for panel fitting test.Maarten Lankhorst
igt_output_set_scaling_mode is a simple way to update scaling mode, igt_display_(try_)commit_atomic will allow you to call drmAtomicCommit with custom flags, like TEST_ONLY, EVENT, NONBLOCKING or without ALLOW_MODESET. This is useful when you only want to do any of those things, for events it can be useful to set the user_data pointer too, so export that to users. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2016-07-26igt_kms: Add modeset support to atomic commits.Maarten Lankhorst
Add the correct properties, add pipe_changed and mode_changed and go! Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
2016-07-26igt_kms: Clear all _changed members centrally, v2.Maarten Lankhorst
This will make it easier to support TEST_ONLY commits. Changes since v1: - Fix color_mgmt_changed and background_changed being cleared for legacy too. (anderco) Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2016-07-26igt_kms: Remove pan members from igt_plane, v2.Maarten Lankhorst
They're duplicates with src_x/y, so just use those. Changes since v1: - Fix order of parameters in calls to igt_fb_set_position. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
2016-07-26igt_kms: Handle atomic pipe properties better.Maarten Lankhorst
Move properties to the pipe, they don't belong in the output and make atomic commit use the pipes for crtc properties. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
2016-07-26igt_kms: Change PIPE_ANY behavior to mean unassigned, v2.Maarten Lankhorst
None of the tests requires that a output bound to PIPE_ANY is assigned, so don't do it. Fix the display commit to iterate over crtc's instead oof outputs to properly disable pipes without outputs. This also means that output->valid is only set after connecting a output to a pipe, so no longer depend on it in for_each_connected_output and similar macros. New code should use PIPE_NONE to avoid confusion, PIPE_ANY is a deprecated alias, and will be removed. Changes since v1: - Split out the property changes. - Split out the commit changes. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
2016-07-26igt_kms: Use pipes for committing, not outputsMaarten Lankhorst
This can be split off from the PIPE_ANY -> PIPE_NONE commit by making small changes to how igt_pipe_get_output works, next commit restores the behavior. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
2016-07-26igt_kms: Assign pipe properties in pipe initMaarten Lankhorst
This is a small change required for changing PIPE_ANY to PIPE_NONE, but it's a standalone change, so make it a separate commit. Suggested-and-reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2016-07-26igt_kms: Find optimal encoder only after selecting pipeMaarten Lankhorst
This will allow us to find a matching encoder based on a pipe only. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
2016-07-26igt_kms: Remove kmstest_connector_config.crtc_idxMaarten Lankhorst
This is the same as using config.pipe because the order of crtcs will never change. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
2016-07-14lib/igt_kms: Fix different order of properties and their name stringsRobert Foss
igt_crtc_prop_names and igt_atomic_crtc_properties have different orders of properties, which is fixed in this patch. Signed-off-by: Robert Foss <robert.foss@collabora.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-07-04igt_kms: Change igt_wait_for_vblank to use helper function.Robert Foss
Change igt_wait_for_vblank() to use kmstest_get_vbl_flag() helper function. Signed-off-by: Robert Foss <robert.foss@collabora.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-07-04Added function kmstest_get_vbl_flag() to igt_kms.Marius Vlad
This function formats a pipe_id into the format expected by DRM while processing DRM_IOCTL_WAIT_VBLANK. Signed-off-by: Robert Foss <robert.foss@collabora.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-07-04lib/igt_kms: Switch to verbose assert.Robert Foss
Switch igt_assert to igt_assert_lte to provide more diagnostic information. Signed-off-by: Robert Foss <robert.foss@collabora.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-07-04lib/igt_kms: Fix plane counting in igt_display_init.Robert Foss
Fix issue where the plane counting fails due to the number and configuration of planes being unlike the intel configuration. Signed-off-by: Robert Foss <robert.foss@collabora.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-07-04lib/igt_kms: Add support for up to 10 planes.Robert Foss
Increase the number of planes supported to 10. kmstest_plane_name only previously supported 4 planes, this patch adds support for up to 10 planes. Signed-off-by: Robert Foss <robert.foss@collabora.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-06-29Revert "igt_kms: Add modeset support for atomic style commits."Maarten Lankhorst
This reverts commit 4a1859781f154513f19cd6392e04f50dbe6c030a. This commit wasn't ready yet, should never have been committed.
2016-06-29igt_kms: Add modeset support for atomic style commits.Maarten Lankhorst
All pipes are now updated in the loop first, before connectors are read out. The mode_id and active crtc properties are added, and crtc_id for connectors. These are required to do a modeset, and the behavior during atomic commits is changed slightly too. A lot of code will do the following: - Init. - igt_output_set_pipe(output, pipe); - commit. Since legacy setcrtc and atomic commit differ, there are some differences in how we commit pipes and connectors too. For atomic we set output->crtc during igt_output_set_pipe, and use it in atomic commit. This may be set to NULL, in which case the output is disconnected from the crtc. Unlike legacy we won't attempt to bind all connectors to all pipes, only the ones that were explicitly set. As a test, convert kms_rmfb.c Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2016-06-29lib/igt_kms: Add for_each_pipe_with_valid_output and ↵Maarten Lankhorst
for_each_valid_output_on_pipe. There are a lot of places where we do either for_each_pipe { igt_subtest_f(... "-pipe-C", pipe_name()) for_each_connected_output() /* Run subtest */ } or: igt_subtest_f(...) { for_each_pipe() for_each_connected_output() /* Run subtest */ } The former should be replaced with for_each_valid_output_on_pipe, the latter with for_each_pipe_with_valid_output. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.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-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-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-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-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 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-05lib: kms: move framebuffer scanout offset/size to planeLionel Landwerlin
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-03-21lib: kms: add helpers for color management properties on pipesLionel Landwerlin
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-21lib: kms: add crtc_id to igt_pipe_tLionel Landwerlin
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-19lib: Fix some doc warningsDaniel Vetter
Cc: Marius Vlad <marius.c.vlad@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-03-15lib/igt_kms: Add COMMIT_ATOMIC to igt_display_commit2()Mayuresh Gharpure
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-08lib/igt_kms: Don't disable exit handlers around set_vt_modeDaniel Vetter
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-03tests: fix CRTC assignment for a few testsPaulo Zanoni
All the tests I wrote always assumed that every connector supported CRTC 0. This is not the case for BSW and possibly others, so fix the tests before the CI reports more failures. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-03-03lib/igt_kms: add kmstest_get_crtc_idxPaulo Zanoni
Move it from pm_rpm.c to lib/igt_kms and remove the hardcoded version from kms_frontbuffer_tracking. I'm also planning to add other callers. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-03-03lib/igt_kms: Fix igt_fb_set_size() debug messageVille Syrjälä
The debug message in igt_fb_set_size() was copy pasted from igt_fb_set_position() and not adjusted to say the right thing. Fix it up. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2016-01-26lib/igt_kms, tests/testdisplay: allow probing of new connector modesJesse Barnes
Fixup some fallout from the connector probing changes so testdisplay -m will pick up newly hotplugged displays correctly. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org.
2016-01-08Fix a bunch of printf typesVille Syrjälä
igt_kms.c: In function ‘igt_crtc_set_background’: igt_kms.c:1940:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=] LOG(display, "%s.%d: crtc_set_background(%lu)\n", ^ intel_firmware_decode.c: In function ‘csr_open’: intel_firmware_decode.c:169:2: warning: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 3 has type ‘__off_t’ [-Wformat=] printf("Firmware: %s (%zd bytes)\n", filename, st.st_size); ^ intel_gpu_top.c: In function ‘main’: intel_gpu_top.c:683:10: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Wformat=] stats[i] - last_stats[i]); ^ hsw_compute_wrpll.c: In function ‘main’: hsw_compute_wrpll.c:644:3: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘long long int’ [-Wformat=] igt_fail_on_f(ref->r2 != r2 || ref->n2 != n2 || ref->p != p, ^ gem_gtt_hog.c: In function ‘__real_main155’: gem_gtt_hog.c:177:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Wformat=] igt_info("Time to execute %lu children: %7.3fms\n", ^ kms_flip.c: In function ‘run_test_step’: kms_flip.c:985:3: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 10 has type ‘__time_t’ [-Wformat=] igt_assert_f(end - start > 0.9 * frame_time(o) && ^ kms_flip.c:985:3: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 11 has type ‘__suseconds_t’ [-Wformat=] kms_frontbuffer_tracking.c: In function ‘setup_sink_crc’: kms_frontbuffer_tracking.c:1364:3: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘ssize_t’ [-Wformat=] igt_info("Unexpected sink CRC error, rc=:%ld errno:%d %s\n", ^ Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2015-12-08tests/kms_force_connector_basic: Add prune-stale-modes subtestVille Syrjälä
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-08lib/kms: Turn base_edid into a templateVille Syrjälä
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2015-12-04lib/kms+tests: Use cached connector stateDaniel Vetter
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>