diff mbox

[i-g-t,2/7] lib/igt_kms: Fix override_mode handling

Message ID 1493138713-2319-3-git-send-email-brian.starkey@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Brian Starkey April 25, 2017, 4:45 p.m. UTC
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>
---
 lib/igt_kms.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 5837a9f112a6..474aa005b9fa 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1575,9 +1575,6 @@  static void igt_output_refresh(igt_output_t *output)
 		igt_atomic_fill_connector_props(display, output,
 			IGT_NUM_CONNECTOR_PROPS, igt_connector_prop_names);
 
-	if (output->use_override_mode)
-		output->config.default_mode = output->override_mode;
-
 	if (output->config.pipe == PIPE_NONE)
 		return;
 
@@ -2816,7 +2813,10 @@  const char *igt_output_name(igt_output_t *output)
 
 drmModeModeInfo *igt_output_get_mode(igt_output_t *output)
 {
-	return &output->config.default_mode;
+	if (output->use_override_mode)
+		return &output->override_mode;
+	else
+		return &output->config.default_mode;
 }
 
 /**
@@ -2834,10 +2834,6 @@  void igt_output_override_mode(igt_output_t *output, drmModeModeInfo *mode)
 
 	if (mode)
 		output->override_mode = *mode;
-	else /* restore default_mode, may have been overwritten in igt_output_refresh */
-		kmstest_get_connector_default_mode(output->display->drm_fd,
-						   output->config.connector,
-						   &output->config.default_mode);
 
 	output->use_override_mode = !!mode;