[igt-dev] [PATCH i-g-t 4/7] lib/kms: Commit reasonable defaults on display init

Arkadiusz Hiler
2020-04-07T13:17:05Z

We often end up with a leftover state from fbcon with a mode enabled on
some of the connecters. Let's clean that up.

v2: commit only if we have pipes and outputs

Issue: https://gitlab.freedesktop.org/drm/intel/issues/323
Cc: Imre Deak <imre.deak@intel.com>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
lib/igt_kms.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 7f9fafb3..4ffc3ed2 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -2066,6 +2066,12 @@ void igt_display_require(igt_display_t *display, int drm_fd)
/* Set reasonable default values for every object in the display. */
igt_display_reset(display);

+ /* Commit those resonable defaults to clean up fbcon/etc leftover state */
+ if (display->n_pipes && display->n_outputs) {
+ igt_display_commit2(display,
+ display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
+ }
+
out:
LOG_UNINDENT(display);