diff mbox

[v2] lib/igt_kms: Fix override_mode handling

Message ID 20170616140006.27985-1-liviu.dudau@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Liviu Dudau June 16, 2017, 2 p.m. UTC
From: Brian Starkey <brian.starkey@arm.com>

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>
---
 lib/igt_kms.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Comments

Arkadiusz Hiler June 20, 2017, 1:28 p.m. UTC | #1
On Fri, Jun 16, 2017 at 03:00:06PM +0100, Liviu Dudau wrote:
> From: Brian Starkey <brian.starkey@arm.com>
> 
> 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>

... and pushed, thanks!


Also please remember of setting subject prefix to "PATCH i-g-t" as it
makes the changes easily trackable via filters and patchwork :-)

Excerpt from CONTRIBUTING:
-----------------------------------------------------------------------------
Please use --subject-prefix="PATCH i-g-t" so that i-g-t patches are easily
identified in the massive amount mails on intel-gfx. To ensure this is always
done, autogen.sh will run:

  git config format.subjectprefix "PATCH i-g-t"

on its first invocation.
-----------------------------------------------------------------------------

The autogen.sh thing is new addition.
Liviu Dudau June 20, 2017, 3:22 p.m. UTC | #2
On Tue, Jun 20, 2017 at 04:28:14PM +0300, Arkadiusz Hiler wrote:
> On Fri, Jun 16, 2017 at 03:00:06PM +0100, Liviu Dudau wrote:
> > From: Brian Starkey <brian.starkey@arm.com>
> > 
> > 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>
> 
> ... and pushed, thanks!

Many thanks! Now for the more important patches, the writeback support :)
Will send them this week (I'm having quite a busy time all of a sudden)

> 
> 
> Also please remember of setting subject prefix to "PATCH i-g-t" as it
> makes the changes easily trackable via filters and patchwork :-)

Will do and appologies for not reading the document before.

Best regards,
Liviu


> 
> Excerpt from CONTRIBUTING:
> -----------------------------------------------------------------------------
> Please use --subject-prefix="PATCH i-g-t" so that i-g-t patches are easily
> identified in the massive amount mails on intel-gfx. To ensure this is always
> done, autogen.sh will run:
> 
>   git config format.subjectprefix "PATCH i-g-t"
> 
> on its first invocation.
> -----------------------------------------------------------------------------
> 
> The autogen.sh thing is new addition.
> 
> -- 
> Cheers,
> Arek
diff mbox

Patch

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 5e2ef97b..2abb6b4e 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1580,9 +1580,6 @@  static void igt_output_refresh(igt_output_t *output)
 						    BROADCAST_RGB_FULL);
 	}
 
-	if (output->use_override_mode)
-		output->config.default_mode = output->override_mode;
-
 	if (output->config.pipe == PIPE_NONE)
 		return;
 
@@ -2821,7 +2818,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;
 }
 
 /**
@@ -2839,10 +2839,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;