summaryrefslogtreecommitdiff
path: root/lib/igt_kms.c
AgeCommit message (Collapse)Author
2017-06-20lib/igt_kms: Fix override_mode handlingBrian Starkey
Changelog: - v2: removed the forced overwrite of output->config.default_mode - v1: original submission by Brian igt_display_commit isn't refreshing all outputs anymore, which means that an override mode may never get picked up. Instead of forcing a reprobe to handle copying the override_mode into default_mode, just change igt_output_get_mode() to return the override_mode if it's been set, and remove the old code which would directly overwrite default_mode. This should be more robust, as igt_output_get_mode() will always return the correct mode, without needing the output to be reprobed. This change means that output->config.default_mode always contains the "non-overridden" default mode. Signed-off-by: Brian Starkey <brian.starkey@arm.com> Signed-off-by: Liviu Dudau <liviu.dudau@arm.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2017-06-16tests: Rename I915_MAX_PIPES to IGT_MAX_PIPESLeo (Sunpeng) Li
Name should not be driver-specific. Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2017-06-16tests: Increase value of I915_MAX_PIPES to 6Leo (Sunpeng) Li
Increasing max pipe count to 6 to support AMD GPU's. Since some tests' behavior depends on this value, small changes are made to remove this dependency: * kms_ccs: Early abort if wanted_pipe is out-of-bounds. * kms_concurrent: Check if pipe is within bounds first. * kms_pipe_color: Prevent skipping of subsequent tests by placing generated tests in a 'igt_subtest_group'. * kms_plane: Move pipe and plane index checking to subtest group level. v2: Change invalid pipe check on kmstest_pipe_name() to use I915_MAX_PIPE v3: Change tabs to spaces in 'enum pipe' Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Tested-by: Tomi Sarvela <tomi.p.sarvela@intel.com>
2017-06-14lib/igt_kms: Fix indent when try_commit fails.Maarten Lankhorst
First unindent before calling check_return, else when an expected failure happens, the unindent never happens. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2017-06-14lib/igt_kms: Add igt_display_require_output(/on_pipe)Maarten Lankhorst
Most KMS users open code this. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2017-06-09lib/igt_kms: Fix erroneous assertBrian Starkey
In trying to fix igt_display_init() for devices without cursors, I actually made matters worse. Fix the assert. Fixes: 545aa3398223 lib/igt_kms: Remove redundant cursor code Signed-off-by: Brian Starkey <brian.starkey@arm.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2017-05-10Revert "Revert "lib/igt_kms: Force outputs to use full range RGB""Petri Latvala
Somehow an incorrect commit was reverted. This reverts commit cda2b91da9c5209d9b3eaac2d2c6f4778a58d4a0. Signed-off-by: Petri Latvala <petri.latvala@intel.com>
2017-05-10Revert "lib/igt_kms: Force outputs to use full range RGB"Chris Wilson
This reverts commit 15ffbf378c3d9b3a75ac6b6ec6d96f917e9a7637. Some how you need to put headers in the sources, but I've forgotten how to do in the mess of automake/Android.
2017-05-10lib/igt_kms: Force outputs to use full range RGBAnder Conselvan de Oliveira
In at least SKL and GLK (possibly other devices too), using a cursor plane to scan out an fb might result in a different pipe crc than when using a regular plane at the same position with the same fb while using the CSC logic to limit the color range. The differences could be caused by the cursor plane being limited to 8 bpc while the regular planes support higher bit depths, leading to slightly different values to be used internally. This is evidenced by the failures happening with specific color values, 0.5 for example, but that's mostly speculation. To avoid misterious failures caused by limited range rgb, force all tests to use full range. It is still possible for tests to override this if necessary. v2: Add more details to the commit message. v3: Force all tests to use full range. Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
2017-04-20lib/igt_kms: Add support for 4K and audio HDMI EDID injection.Abdiel Janulgue
Based on the initial work by Marius Vlad. v3: Bring back audio injection v4: Make a helper for 3d/4k/audio HDMI injection (Petri) Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
2017-03-24lib/debugfs: Phase out igt_debugfs_fopen()Chris Wilson
Wrapping fdopen() proved dangerous, the underlying fd is not refcounted, and we must close it in the library or else we easily leak and exhaust all fd. Since we can't provide igt_debugfs_fopen(), move the burden onto the caller for those that require a stream FILE*. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-03-21Restore "lib: Open debugfs files for the given DRM device"Chris Wilson
This reverts commit 25fbae15262cf570e207e62f50e7c5233e06bc67, restoring commit 301ad44cdf1b868b1ab89096721da91fa8541fdc Author: Tomeu Vizoso <tomeu.vizoso@collabora.com> Date: Thu Mar 2 10:37:11 2017 +0100 lib: Open debugfs files for the given DRM device with fixes. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-03-21Revert "lib: Open debugfs files for the given DRM device"Tomeu Vizoso
This reverts commit 301ad44cdf1b868b1ab89096721da91fa8541fdc. When a render-only device is opened and gem_quiescent_gpu is called, we need to use the debugfs dir for the master device instead. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
2017-03-21lib: Open debugfs files for the given DRM deviceTomeu Vizoso
When opening a DRM debugfs file, locate the right path based on the given DRM device FD. This is needed so, in setups with more than one DRM device, any operations on debugfs files affect the expected DRM device. v2: - rebased and fixed new API additions v3: - updated chamelium test, which was missed previously - use the minor of the device for the debugfs path, not the major - have a proper exit handler for calling igt_hpd_storm_reset with the right device fd. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Robert Foss <robert.foss@collabora.com> Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-03-20lib/igt_kms: Do not refresh all outputs in igt_display_commitMaarten Lankhorst
Now that igt_output_set_pipe handles refreshing igt_output, we only have to be sure that there are no conflicting outputs in igt_display_commit. Reported-and-tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2017-03-13igt/kms_pipe_crc_basic: Tighten timings for CRC readbackChris Wilson
The number of vblanks that pass whilst we read back the CRCs is depended upon CPU scheduling -- we may take longer than expected and end up reading more CRCs. Align the start of the loop to a vblank. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100132 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
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>