summaryrefslogtreecommitdiff
path: root/lib/igt_kms.c
AgeCommit message (Collapse)Author
2017-02-21lib/igt_kms: Remove redundant cursor codeBrian Starkey
The dynamic plane support means that there should never be gaps in the pipe->planes array. This means we should never need to move the cursor plane from the last slot to another. Remove the unnecessary code, and add an assert that makes sure nothing strange happened that broke the assignment logic. Signed-off-by: Brian Starkey <brian.starkey@arm.com> Reviewed-by: Robert Foss <robert.foss@collabora.com>
2017-02-21lib/igt_kms: Fix memory corruption when there's no cursor planeBrian Starkey
The dynamic plane support means that if there's no cursor plane, then there is no space in the pipe->planes array for it, and thus assigning a "drm_plane-less" plane is out-of-bounds and leads to heap corruption and later crashes. The "drm_plane-less" cursor plane isn't included in n_planes anyway, which means there's no way to ever access it/know that it's there - so just remove it entirely. Fixes: 36656239ef96 lib/igt_kms: Implement dynamic plane count support Signed-off-by: Brian Starkey <brian.starkey@arm.com> Reviewed-by: Robert Foss <robert.foss@collabora.com>
2017-02-21lib/igt_kms: Fix possible out-of-bounds accessBrian Starkey
If there's no primary plane, pipe->plane_primary == -1, and the assert meant to check that it's valid will access pipe->planes[-1]. Fix that to check that pipe->plane_primary has been set instead. Fixes: 36656239ef96 lib/igt_kms: Implement dynamic plane count support Signed-off-by: Brian Starkey <brian.starkey@arm.com> Reviewed-by: Robert Foss <robert.foss@collabora.com>
2017-02-21lib/igt_kms: Neaten up pipe->planes[] assignmentBrian Starkey
Remove a bunch of branches, functionally equivalent. Changes since v1: - Added back display->has_cursor_plane assignment Signed-off-by: Brian Starkey <brian.starkey@arm.com> Reviewed-by: Robert Foss <robert.foss@collabora.com>
2017-02-21lib/igt_kms: Fix drm_plane leakBrian Starkey
In the loop looking for planes on a pipe, we always want to free up the drm_plane afterwards. Fixes: 36656239ef96 lib/igt_kms: Implement dynamic plane count support Signed-off-by: Brian Starkey <brian.starkey@arm.com> Reviewed-by: Robert Foss <robert.foss@collabora.com>
2017-02-17lib/igt_kms: Fix regression on kms_plane_lowres testMika Kahola
kms_plane_lowres subtest pipe-C-tiling-none crashes when reading out number of crtc. This patch fixes the bug on crtc readout. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99653 Fixes: 9de635976c426b4c835083792c7d4d6e32aec615 ("lib/igt_kms: Avoid depencency on static plane count") Reviewed-by: Robert Foss <robert.foss@collabora.com> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
2017-02-08igt_kms: Handle failure in drmModeGetConnector gracefully.Maarten Lankhorst
This can happen when a DP-MST disappears, handle the error by printing a warning instead of crashing. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2017-02-02tests/kms_atomic_transition: add in_fences testsGustavo Padovan
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Brian Starkey <brian.starkey@arm.com>
2017-02-02tests/kms_atomic_transition: add out_fences testsRobert Foss
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Brian Starkey <brian.starkey@arm.com>
2017-02-02lib/igt_kms: Add support for the OUT_FENCE_PTR propertyGustavo Padovan
Add support for the OUT_FENCE_PTR property to enable setting out fences for atomic commits. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Brian Starkey <brian.starkey@arm.com>
2017-02-02lib/igt_kms: Add support for the IN_FENCE_FD propertyRobert Foss
Add support for the IN_FENCE_FD property to enable setting in fences for atomic commits. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Brian Starkey <brian.starkey@arm.com>
2017-02-02lib/igt_kms: export properties namesGustavo Padovan
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Brian Starkey <brian.starkey@arm.com>
2017-02-02lib/igt_kms: move igt_kms_get_alt_edid() to the right placeGustavo Padovan
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Brian Starkey <brian.starkey@arm.com>
2017-01-31lib/igt_kms: Remove code obsoleted by dyn n_planes implementationRobert Foss
Due to the dyn n_planes implementation some attributes and functions were made obsolete and cand be removed. However to keep all of the tests building the obsolete code is removed after all of the tests have been made compatible with the dyn n_planes changes. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
2017-01-31lib/igt_kms: Implement dynamic plane count supportRobert Foss
In upcoming drm-misc-next changes, the number of planes per pipe has been increased as more than one primary plane can be associated with a pipe. The simple fix for this would be to simply bump hardcoded value for number of frames per pipe. But a better solution would be to add support for dynamic number of planes per pipe to i-g-t. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
2017-01-31lib/igt_kms: Rename kmstest properties nplanes and planeRobert Foss
Rename these properties to have them use the same naming convention as the igt_*_t structs. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
2017-01-31lib/igt_kms: Avoid depencency on static plane countRobert Foss
Rework kmstest_crtc and kmstest_plane structs and their usage to not depend on a static plane count. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
2017-01-31lib/igt_kms: Add index property to kmstest_plane structRobert Foss
Add an index property which helps accessing the corresponding igt_plane_t structure through the igt_*_get_plane() functions. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
2017-01-26igt_kms: Add kmstest_set_connector_broadcast_rgb()Lyude
A simple helper that checks whether or not the given connector has the "Broadcast RGB" prop, and if so sets it to the given mode. Required for working with the Chamelium since the Chamelium EDIDs enable limited color ranges by default on i915 and break frame dump comparisons/CRCs. Cc: Tomeu Vizoso <tomeu@tomeuvizoso.net> Signed-off-by: Lyude <lyude@redhat.com>
2017-01-26igt_kms: Add igt_output_from_connector()Lyude
A simple helper for getting the igt_output_t struct corresponding to the given DRM connector id. Cc: Tomeu Vizoso <tomeu@tomeuvizoso.net> Signed-off-by: Lyude <lyude@redhat.com>
2017-01-26igt_kms: Add helpers for watching for sysfs hotplug eventsLyude
This adds some basic helpers for connecting to udev and watching for sysfs hotplug events. Cc: Tomeu Vizoso <tomeu@tomeuvizoso.net> Signed-off-by: Lyude <lyude@redhat.com> Changes since v1: - Remove unused arg from documentation Changes since v2: - Make udev_monitor explicit so that we can use this for detecting FSMs from the Chamelium in rpc calls
2017-01-26lib/igt_kms.c: Always set pipe_changed.Maarten Lankhorst
The pipe may be reset when doing a modeset in a fork, changing it back after the fork exited caused the output not to be updated. This resulted in a -EINVAL when doing atomic commit. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2017-01-20lib/igt_kms: Fixed typoRobert Foss
Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2017-01-20lib/igt_kms: Set free'd pointer to NULLRobert Foss
Avoid double free's by setting the free'd pointer to NULL after free. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2017-01-20lib/igt_kms: Check memory allocations for failuresRobert Foss
Add missing descriptive igt_assert_t calls to calloc'd memory. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2017-01-13tests/kms_plane_lowres: Plane visibility after atomic modesetsMika Kahola
Testcase for plane visibility after atomic modesets. The idea of the test is the following: - draw a blue screen with high resolution - enable a yellow plane, visible, in lower-left corner - set a new lower resolution mode (1024x768) that makes plane invisible - check from debugfs 'i915_display_info' that the plane is invisible - switch back to higher resolution mode - check from debugfs 'i915_display_info' that the plane is visible again - repeat number of iterations, default 64 v2: allow test to be run on non-Intel drivers (Daniel) moved test for plane visibility to as helper function (Daniel) moved get_vblank() function to be part of helper functions (Daniel) rename 'tiling' parameter as 'modifier' (Daniel) select a mode from a list so that the plane should be invisible. use default 1024x768 mode only as a fallback if decent mode has not been found (Daniel) add tiling MODE_NONE (Daniel) v3: draw as many overlay planes as the platform supports + cursor plane on top of each other on lower-left corner skip the test if i915_display_info file is not available test plane visibility with igt_assert_plane_visibility() function drop option for multiple test iterations (Daniel Vetter) v4: switch 'for_each_connected_output()' to 'for_each_valid_output_on_pipe()' skip Y and Yf tiling for generations older than 9 (Maarten) Cc: Daniel Stone <daniel@fooishbar.org> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
2017-01-10lib/igt_kms: Remove output->valid againMaarten Lankhorst
This time add an explicit variable force_reprobe, which is set to true on initial probe and might be set again (in a future patch) after a hpd event. Acked-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2017-01-07Revert "lib/igt_kms: Remove output->valid"Chris Wilson
This reverts commit 20258f2353a266f8fe19e7392eb282e58dd87f6a. This completely breaks igt running on bare hardware where it is required that igt probes the connectors before use. Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2017-01-05lib/igt_kms: Remove output->validMaarten Lankhorst
None of the tests depend on it any longer, so it's time to kill. :) Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2016-12-13igt_kms: Dynamically allocate igt_display->pipesLyude
Many GPUs have more then 3 pipes available, so hard limiting this to I915_MAX_PIPES prevents us from using anything that relies on igt_display_init() on non-intel systems (since we end up writing out of bounds and seg faulting). Fix this by dynamically allocating igt_display->pipes using the number of pipes we've detected on the GPU. Signed-off-by: Lyude <lyude@redhat.com> Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
2016-12-08igt_kms: Remove support for drivers with <1 drm_planeLyude
We've had support for universal planes since kernel version 3.15, so there's not really a good reason to try supporting drivers that lack plane support now. As well, the current has_universal_planes logic is broken anyway as it makes the assumption that having display planes always means we have both a primary plane and a cursor plane (this isn't true on radeon/amdgpu and nouveau). So, remove this, and just check for whether or not we have a cursor plane. Signed-off-by: Lyude <lyude@redhat.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-12-07lib: Use igt_assert_eq in CHECK_RETURNTomeu Vizoso
So that debug logs contain the unexpected value. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
2016-12-07igt_kms: Don't require intel hardware for kmstest_force_connectorLyude
Due to the unconditional call to intel_get_drm_devid() in kmstest_force_connector(), trying to use this function on anything that isn't intel hardware results in the current fixture being skipped. So, don't try to get the devid in kmstest_force_connector() unless we're on an Intel chipset. Signed-off-by: Lyude <lyude@redhat.com> Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
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>