diff mbox

[v3,08/20] drm/i915: fill in more mode members

Message ID 1436797833-11493-9-git-send-email-maarten.lankhorst@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Maarten Lankhorst July 13, 2015, 2:30 p.m. UTC
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Daniel Vetter July 14, 2015, 9:50 a.m. UTC | #1
On Mon, Jul 13, 2015 at 04:30:21PM +0200, Maarten Lankhorst wrote:
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Needs a summary (or just pasting relevant parts of our mail threads) about
double-modesets, ways to avoid them and why exactly we ended up opting for
this solution here. Especially please highlight the TYPE_DRIVER trick.

Thanks, Daniel

> ---
>  drivers/gpu/drm/i915/intel_display.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 118187dc76be..d37f6a93b094 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -7754,9 +7754,14 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode,
>  	mode->vsync_end = pipe_config->base.adjusted_mode.crtc_vsync_end;
>  
>  	mode->flags = pipe_config->base.adjusted_mode.flags;
> +	mode->type = DRM_MODE_TYPE_DRIVER;
>  
>  	mode->clock = pipe_config->base.adjusted_mode.crtc_clock;
>  	mode->flags |= pipe_config->base.adjusted_mode.flags;
> +
> +	mode->hsync = drm_mode_hsync(mode);
> +	mode->vrefresh = drm_mode_vrefresh(mode);
> +	drm_mode_set_name(mode);
>  }
>  
>  static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc)
> -- 
> 2.1.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst July 14, 2015, 10:31 a.m. UTC | #2
Hey,

Op 14-07-15 om 11:50 schreef Daniel Vetter:
> On Mon, Jul 13, 2015 at 04:30:21PM +0200, Maarten Lankhorst wrote:
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Needs a summary (or just pasting relevant parts of our mail threads) about
> double-modesets, ways to avoid them and why exactly we ended up opting for
> this solution here. Especially please highlight the TYPE_DRIVER trick.
Not in this patch I think, that would be for 11/20.

~Maarten
Daniel Stone July 14, 2015, 11:21 a.m. UTC | #3
Hi,

On 14 July 2015 at 10:50, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Mon, Jul 13, 2015 at 04:30:21PM +0200, Maarten Lankhorst wrote:
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>
> Needs a summary (or just pasting relevant parts of our mail threads) about
> double-modesets, ways to avoid them and why exactly we ended up opting for
> this solution here. Especially please highlight the TYPE_DRIVER trick.

Actually, the original motivation for this patch when it was in my
branch was very different: I was seeing failures on commit because
hsync == vsync == 0, and also the lack of name made debugging a bit
more difficult. TYPE_DRIVER is new though, and separately motivated.
:)

Cheers,
Daniel
Maarten Lankhorst July 14, 2015, 11:40 a.m. UTC | #4
Op 14-07-15 om 13:21 schreef Daniel Stone:
> Hi,
>
> On 14 July 2015 at 10:50, Daniel Vetter <daniel@ffwll.ch> wrote:
>> On Mon, Jul 13, 2015 at 04:30:21PM +0200, Maarten Lankhorst wrote:
>>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Needs a summary (or just pasting relevant parts of our mail threads) about
>> double-modesets, ways to avoid them and why exactly we ended up opting for
>> this solution here. Especially please highlight the TYPE_DRIVER trick.
> Actually, the original motivation for this patch when it was in my
> branch was very different: I was seeing failures on commit because
> hsync == vsync == 0, and also the lack of name made debugging a bit
> more difficult. TYPE_DRIVER is new though, and separately motivated.
>
Oh, in my branch it was because it made me avoid modesets and to make fastboot work. But fastboot was made to work in a better way.

What about:
"Fill in driver type, hsync, vrefresh and name.
Those members are not read out but can be calculated from the mode."
Daniel Vetter July 14, 2015, 12:42 p.m. UTC | #5
On Tue, Jul 14, 2015 at 01:40:45PM +0200, Maarten Lankhorst wrote:
> Op 14-07-15 om 13:21 schreef Daniel Stone:
> > Hi,
> >
> > On 14 July 2015 at 10:50, Daniel Vetter <daniel@ffwll.ch> wrote:
> >> On Mon, Jul 13, 2015 at 04:30:21PM +0200, Maarten Lankhorst wrote:
> >>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> >> Needs a summary (or just pasting relevant parts of our mail threads) about
> >> double-modesets, ways to avoid them and why exactly we ended up opting for
> >> this solution here. Especially please highlight the TYPE_DRIVER trick.
> > Actually, the original motivation for this patch when it was in my
> > branch was very different: I was seeing failures on commit because
> > hsync == vsync == 0, and also the lack of name made debugging a bit
> > more difficult. TYPE_DRIVER is new though, and separately motivated.
> >
> Oh, in my branch it was because it made me avoid modesets and to make fastboot work. But fastboot was made to work in a better way.
> 
> What about:
> "Fill in driver type, hsync, vrefresh and name.
> Those members are not read out but can be calculated from the mode."

Maybe add "Note that we mark the mode as TYPE_DRIVER to force a mismatch
with whatever mode userspace provides. This ensures we force a modeset on
the first real modeset, while avoiding spurious modesets on no-op property
changes before that (where the mode is just duplicated exactly)."
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 118187dc76be..d37f6a93b094 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7754,9 +7754,14 @@  void intel_mode_from_pipe_config(struct drm_display_mode *mode,
 	mode->vsync_end = pipe_config->base.adjusted_mode.crtc_vsync_end;
 
 	mode->flags = pipe_config->base.adjusted_mode.flags;
+	mode->type = DRM_MODE_TYPE_DRIVER;
 
 	mode->clock = pipe_config->base.adjusted_mode.crtc_clock;
 	mode->flags |= pipe_config->base.adjusted_mode.flags;
+
+	mode->hsync = drm_mode_hsync(mode);
+	mode->vrefresh = drm_mode_vrefresh(mode);
+	drm_mode_set_name(mode);
 }
 
 static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc)