linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: Fix broken VT switch with video=1366x768 option
@ 2017-01-09 14:56 Takashi Iwai
  2017-01-10 11:28 ` Ville Syrjälä
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2017-01-09 14:56 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-kernel, Ville Syrjälä

I noticed that the VT switch doesn't work any longer with a Dell
laptop with 1366x768 eDP when the machine is connected with a DP
monitor.  It behaves as if VT were switched, but the graphics remain
frozen.  Actually the keyboard works, so I could switch back to VT7
again.

I tried to track down the problem, and encountered a long story until
we reach to this error:

- The machine is booted with video=1366x768 option (the distro
  installer seems to add it as default).
- Recently, drm_helper_probe_single_connector_modes() deals with
  cmdline modes, and it tries to create a new mode when no
  matching mode is found.
- The drm_mode_create_from_cmdline_mode() creates a mode based on
  either CVT of GFT according to the given cmdline mode; in our case,
  it's 1366x768.
- Since both CVT and GFT can't express the width 1366 due to
  alignment, the resultant mode becomes 1368x768, slightly larger than
  the given size.
- Later on, the atomic commit is performed, and in
  drm_atomic_check_only(), the size of each plane is checked.
- The size check of 1366x768 fails due to the above, and eventually
  the whole VT switch fails.

Back in the history, we've had a manual fix-up of 1368x768 in various
places via c09dedb7a50e ("drm/edid: Add a workaround for 1366x768 HD
panel"), but they have been all in drm_edid.c at probing the modes
from EDID.  For addressing the problem above, we need a similar hack
to the mode newly created from cmdline, manually adjusting the width
when the expected size is 1366 while we get 1368 instead.

Fixes: eaf99c749d43 ("drm: Perform cmdline mode parsing during...")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/gpu/drm/drm_modes.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index ac6a35212501..e6b19bc9021a 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1460,6 +1460,13 @@ drm_mode_create_from_cmdline_mode(struct drm_device *dev,
 		return NULL;
 
 	mode->type |= DRM_MODE_TYPE_USERDEF;
+	/* fix up 1368x768: GFT/CVT can't express 1366 width due to alignment */
+	if (cmd->xres == 1366 && mode->hdisplay == 1368) {
+		mode->hdisplay = 1366;
+		mode->hsync_start--;
+		mode->hsync_end--;
+		drm_mode_set_name(mode);
+	}
 	drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
 	return mode;
 }
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm: Fix broken VT switch with video=1366x768 option
  2017-01-09 14:56 [PATCH] drm: Fix broken VT switch with video=1366x768 option Takashi Iwai
@ 2017-01-10 11:28 ` Ville Syrjälä
  2017-01-10 11:36   ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Ville Syrjälä @ 2017-01-10 11:28 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: dri-devel, linux-kernel

On Mon, Jan 09, 2017 at 03:56:14PM +0100, Takashi Iwai wrote:
> I noticed that the VT switch doesn't work any longer with a Dell
> laptop with 1366x768 eDP when the machine is connected with a DP
> monitor.  It behaves as if VT were switched, but the graphics remain
> frozen.  Actually the keyboard works, so I could switch back to VT7
> again.
> 
> I tried to track down the problem, and encountered a long story until
> we reach to this error:
> 
> - The machine is booted with video=1366x768 option (the distro
>   installer seems to add it as default).
> - Recently, drm_helper_probe_single_connector_modes() deals with
>   cmdline modes, and it tries to create a new mode when no
>   matching mode is found.
> - The drm_mode_create_from_cmdline_mode() creates a mode based on
>   either CVT of GFT according to the given cmdline mode; in our case,
>   it's 1366x768.
> - Since both CVT and GFT can't express the width 1366 due to
>   alignment, the resultant mode becomes 1368x768, slightly larger than
>   the given size.
> - Later on, the atomic commit is performed, and in
>   drm_atomic_check_only(), the size of each plane is checked.
> - The size check of 1366x768 fails due to the above, and eventually
>   the whole VT switch fails.
> 
> Back in the history, we've had a manual fix-up of 1368x768 in various
> places via c09dedb7a50e ("drm/edid: Add a workaround for 1366x768 HD
> panel"), but they have been all in drm_edid.c at probing the modes
> from EDID.  For addressing the problem above, we need a similar hack
> to the mode newly created from cmdline, manually adjusting the width
> when the expected size is 1366 while we get 1368 instead.
> 
> Fixes: eaf99c749d43 ("drm: Perform cmdline mode parsing during...")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>  drivers/gpu/drm/drm_modes.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index ac6a35212501..e6b19bc9021a 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -1460,6 +1460,13 @@ drm_mode_create_from_cmdline_mode(struct drm_device *dev,
>  		return NULL;
>  
>  	mode->type |= DRM_MODE_TYPE_USERDEF;
> +	/* fix up 1368x768: GFT/CVT can't express 1366 width due to alignment */
> +	if (cmd->xres == 1366 && mode->hdisplay == 1368) {
> +		mode->hdisplay = 1366;
> +		mode->hsync_start--;
> +		mode->hsync_end--;
> +		drm_mode_set_name(mode);
> +	}

Maybe give fixup_mode_1366x768() a drm_ prefix and make in non-static to
avoid duplicating the code? And I guess move it to drm_modes.c?

Otherwise lgtm:
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>  	drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
>  	return mode;
>  }
> -- 
> 2.11.0

-- 
Ville Syrjälä
Intel OTC

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm: Fix broken VT switch with video=1366x768 option
  2017-01-10 11:28 ` Ville Syrjälä
@ 2017-01-10 11:36   ` Takashi Iwai
  2017-01-10 12:41     ` Daniel Vetter
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2017-01-10 11:36 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: dri-devel, linux-kernel

On Tue, 10 Jan 2017 12:28:36 +0100,
Ville Syrjälä wrote:
> 
> On Mon, Jan 09, 2017 at 03:56:14PM +0100, Takashi Iwai wrote:
> > I noticed that the VT switch doesn't work any longer with a Dell
> > laptop with 1366x768 eDP when the machine is connected with a DP
> > monitor.  It behaves as if VT were switched, but the graphics remain
> > frozen.  Actually the keyboard works, so I could switch back to VT7
> > again.
> > 
> > I tried to track down the problem, and encountered a long story until
> > we reach to this error:
> > 
> > - The machine is booted with video=1366x768 option (the distro
> >   installer seems to add it as default).
> > - Recently, drm_helper_probe_single_connector_modes() deals with
> >   cmdline modes, and it tries to create a new mode when no
> >   matching mode is found.
> > - The drm_mode_create_from_cmdline_mode() creates a mode based on
> >   either CVT of GFT according to the given cmdline mode; in our case,
> >   it's 1366x768.
> > - Since both CVT and GFT can't express the width 1366 due to
> >   alignment, the resultant mode becomes 1368x768, slightly larger than
> >   the given size.
> > - Later on, the atomic commit is performed, and in
> >   drm_atomic_check_only(), the size of each plane is checked.
> > - The size check of 1366x768 fails due to the above, and eventually
> >   the whole VT switch fails.
> > 
> > Back in the history, we've had a manual fix-up of 1368x768 in various
> > places via c09dedb7a50e ("drm/edid: Add a workaround for 1366x768 HD
> > panel"), but they have been all in drm_edid.c at probing the modes
> > from EDID.  For addressing the problem above, we need a similar hack
> > to the mode newly created from cmdline, manually adjusting the width
> > when the expected size is 1366 while we get 1368 instead.
> > 
> > Fixes: eaf99c749d43 ("drm: Perform cmdline mode parsing during...")
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > ---
> >  drivers/gpu/drm/drm_modes.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> > index ac6a35212501..e6b19bc9021a 100644
> > --- a/drivers/gpu/drm/drm_modes.c
> > +++ b/drivers/gpu/drm/drm_modes.c
> > @@ -1460,6 +1460,13 @@ drm_mode_create_from_cmdline_mode(struct drm_device *dev,
> >  		return NULL;
> >  
> >  	mode->type |= DRM_MODE_TYPE_USERDEF;
> > +	/* fix up 1368x768: GFT/CVT can't express 1366 width due to alignment */
> > +	if (cmd->xres == 1366 && mode->hdisplay == 1368) {
> > +		mode->hdisplay = 1366;
> > +		mode->hsync_start--;
> > +		mode->hsync_end--;
> > +		drm_mode_set_name(mode);
> > +	}
> 
> Maybe give fixup_mode_1366x768() a drm_ prefix and make in non-static to
> avoid duplicating the code? And I guess move it to drm_modes.c?

Yes, that'll be a good cleanup.  I was afraid of symbol export, but
both are in the same module, so far.  I can post a follow-up once when
this one gets accepted.

> 
> Otherwise lgtm:
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Thanks!


Takashi

> >  	drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
> >  	return mode;
> >  }
> > -- 
> > 2.11.0
> 
> -- 
> Ville Syrjälä
> Intel OTC
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm: Fix broken VT switch with video=1366x768 option
  2017-01-10 11:36   ` Takashi Iwai
@ 2017-01-10 12:41     ` Daniel Vetter
  2017-01-10 12:45       ` Takashi Iwai
  2017-01-11 17:05       ` Ville Syrjälä
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Vetter @ 2017-01-10 12:41 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Ville Syrjälä, linux-kernel, dri-devel

On Tue, Jan 10, 2017 at 12:36:50PM +0100, Takashi Iwai wrote:
> On Tue, 10 Jan 2017 12:28:36 +0100,
> Ville Syrjälä wrote:
> > 
> > On Mon, Jan 09, 2017 at 03:56:14PM +0100, Takashi Iwai wrote:
> > > I noticed that the VT switch doesn't work any longer with a Dell
> > > laptop with 1366x768 eDP when the machine is connected with a DP
> > > monitor.  It behaves as if VT were switched, but the graphics remain
> > > frozen.  Actually the keyboard works, so I could switch back to VT7
> > > again.
> > > 
> > > I tried to track down the problem, and encountered a long story until
> > > we reach to this error:
> > > 
> > > - The machine is booted with video=1366x768 option (the distro
> > >   installer seems to add it as default).
> > > - Recently, drm_helper_probe_single_connector_modes() deals with
> > >   cmdline modes, and it tries to create a new mode when no
> > >   matching mode is found.
> > > - The drm_mode_create_from_cmdline_mode() creates a mode based on
> > >   either CVT of GFT according to the given cmdline mode; in our case,
> > >   it's 1366x768.
> > > - Since both CVT and GFT can't express the width 1366 due to
> > >   alignment, the resultant mode becomes 1368x768, slightly larger than
> > >   the given size.
> > > - Later on, the atomic commit is performed, and in
> > >   drm_atomic_check_only(), the size of each plane is checked.
> > > - The size check of 1366x768 fails due to the above, and eventually
> > >   the whole VT switch fails.
> > > 
> > > Back in the history, we've had a manual fix-up of 1368x768 in various
> > > places via c09dedb7a50e ("drm/edid: Add a workaround for 1366x768 HD
> > > panel"), but they have been all in drm_edid.c at probing the modes
> > > from EDID.  For addressing the problem above, we need a similar hack
> > > to the mode newly created from cmdline, manually adjusting the width
> > > when the expected size is 1366 while we get 1368 instead.
> > > 
> > > Fixes: eaf99c749d43 ("drm: Perform cmdline mode parsing during...")
> > > Cc: <stable@vger.kernel.org>
> > > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > > ---
> > >  drivers/gpu/drm/drm_modes.c | 7 +++++++
> > >  1 file changed, 7 insertions(+)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> > > index ac6a35212501..e6b19bc9021a 100644
> > > --- a/drivers/gpu/drm/drm_modes.c
> > > +++ b/drivers/gpu/drm/drm_modes.c
> > > @@ -1460,6 +1460,13 @@ drm_mode_create_from_cmdline_mode(struct drm_device *dev,
> > >  		return NULL;
> > >  
> > >  	mode->type |= DRM_MODE_TYPE_USERDEF;
> > > +	/* fix up 1368x768: GFT/CVT can't express 1366 width due to alignment */
> > > +	if (cmd->xres == 1366 && mode->hdisplay == 1368) {
> > > +		mode->hdisplay = 1366;
> > > +		mode->hsync_start--;
> > > +		mode->hsync_end--;
> > > +		drm_mode_set_name(mode);
> > > +	}
> > 
> > Maybe give fixup_mode_1366x768() a drm_ prefix and make in non-static to
> > avoid duplicating the code? And I guess move it to drm_modes.c?
> 
> Yes, that'll be a good cleanup.  I was afraid of symbol export, but
> both are in the same module, so far.  I can post a follow-up once when
> this one gets accepted.

For the follow up, pls put the decl into drm_crtc_internal.h, so that
drivers aren't tempted to use it. That header is for module-internal
shared code only.

> > Otherwise lgtm:
> > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Thanks!

Ville, can you pls also apply this one to drm-misc-fixes?
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm: Fix broken VT switch with video=1366x768 option
  2017-01-10 12:41     ` Daniel Vetter
@ 2017-01-10 12:45       ` Takashi Iwai
  2017-01-11 17:05       ` Ville Syrjälä
  1 sibling, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2017-01-10 12:45 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Ville Syrjälä, linux-kernel, dri-devel

On Tue, 10 Jan 2017 13:41:42 +0100,
Daniel Vetter wrote:
> 
> On Tue, Jan 10, 2017 at 12:36:50PM +0100, Takashi Iwai wrote:
> > On Tue, 10 Jan 2017 12:28:36 +0100,
> > Ville Syrjälä wrote:
> > > 
> > > On Mon, Jan 09, 2017 at 03:56:14PM +0100, Takashi Iwai wrote:
> > > > I noticed that the VT switch doesn't work any longer with a Dell
> > > > laptop with 1366x768 eDP when the machine is connected with a DP
> > > > monitor.  It behaves as if VT were switched, but the graphics remain
> > > > frozen.  Actually the keyboard works, so I could switch back to VT7
> > > > again.
> > > > 
> > > > I tried to track down the problem, and encountered a long story until
> > > > we reach to this error:
> > > > 
> > > > - The machine is booted with video=1366x768 option (the distro
> > > >   installer seems to add it as default).
> > > > - Recently, drm_helper_probe_single_connector_modes() deals with
> > > >   cmdline modes, and it tries to create a new mode when no
> > > >   matching mode is found.
> > > > - The drm_mode_create_from_cmdline_mode() creates a mode based on
> > > >   either CVT of GFT according to the given cmdline mode; in our case,
> > > >   it's 1366x768.
> > > > - Since both CVT and GFT can't express the width 1366 due to
> > > >   alignment, the resultant mode becomes 1368x768, slightly larger than
> > > >   the given size.
> > > > - Later on, the atomic commit is performed, and in
> > > >   drm_atomic_check_only(), the size of each plane is checked.
> > > > - The size check of 1366x768 fails due to the above, and eventually
> > > >   the whole VT switch fails.
> > > > 
> > > > Back in the history, we've had a manual fix-up of 1368x768 in various
> > > > places via c09dedb7a50e ("drm/edid: Add a workaround for 1366x768 HD
> > > > panel"), but they have been all in drm_edid.c at probing the modes
> > > > from EDID.  For addressing the problem above, we need a similar hack
> > > > to the mode newly created from cmdline, manually adjusting the width
> > > > when the expected size is 1366 while we get 1368 instead.
> > > > 
> > > > Fixes: eaf99c749d43 ("drm: Perform cmdline mode parsing during...")
> > > > Cc: <stable@vger.kernel.org>
> > > > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > > > ---
> > > >  drivers/gpu/drm/drm_modes.c | 7 +++++++
> > > >  1 file changed, 7 insertions(+)
> > > > 
> > > > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> > > > index ac6a35212501..e6b19bc9021a 100644
> > > > --- a/drivers/gpu/drm/drm_modes.c
> > > > +++ b/drivers/gpu/drm/drm_modes.c
> > > > @@ -1460,6 +1460,13 @@ drm_mode_create_from_cmdline_mode(struct drm_device *dev,
> > > >  		return NULL;
> > > >  
> > > >  	mode->type |= DRM_MODE_TYPE_USERDEF;
> > > > +	/* fix up 1368x768: GFT/CVT can't express 1366 width due to alignment */
> > > > +	if (cmd->xres == 1366 && mode->hdisplay == 1368) {
> > > > +		mode->hdisplay = 1366;
> > > > +		mode->hsync_start--;
> > > > +		mode->hsync_end--;
> > > > +		drm_mode_set_name(mode);
> > > > +	}
> > > 
> > > Maybe give fixup_mode_1366x768() a drm_ prefix and make in non-static to
> > > avoid duplicating the code? And I guess move it to drm_modes.c?
> > 
> > Yes, that'll be a good cleanup.  I was afraid of symbol export, but
> > both are in the same module, so far.  I can post a follow-up once when
> > this one gets accepted.
> 
> For the follow up, pls put the decl into drm_crtc_internal.h, so that
> drivers aren't tempted to use it. That header is for module-internal
> shared code only.

Alright, thanks for information.


Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm: Fix broken VT switch with video=1366x768 option
  2017-01-10 12:41     ` Daniel Vetter
  2017-01-10 12:45       ` Takashi Iwai
@ 2017-01-11 17:05       ` Ville Syrjälä
  2017-01-11 18:46         ` Takashi Iwai
  1 sibling, 1 reply; 7+ messages in thread
From: Ville Syrjälä @ 2017-01-11 17:05 UTC (permalink / raw)
  To: Takashi Iwai, linux-kernel, dri-devel

On Tue, Jan 10, 2017 at 01:41:42PM +0100, Daniel Vetter wrote:
> On Tue, Jan 10, 2017 at 12:36:50PM +0100, Takashi Iwai wrote:
> > On Tue, 10 Jan 2017 12:28:36 +0100,
> > Ville Syrjälä wrote:
> > > 
> > > On Mon, Jan 09, 2017 at 03:56:14PM +0100, Takashi Iwai wrote:
> > > > I noticed that the VT switch doesn't work any longer with a Dell
> > > > laptop with 1366x768 eDP when the machine is connected with a DP
> > > > monitor.  It behaves as if VT were switched, but the graphics remain
> > > > frozen.  Actually the keyboard works, so I could switch back to VT7
> > > > again.
> > > > 
> > > > I tried to track down the problem, and encountered a long story until
> > > > we reach to this error:
> > > > 
> > > > - The machine is booted with video=1366x768 option (the distro
> > > >   installer seems to add it as default).
> > > > - Recently, drm_helper_probe_single_connector_modes() deals with
> > > >   cmdline modes, and it tries to create a new mode when no
> > > >   matching mode is found.
> > > > - The drm_mode_create_from_cmdline_mode() creates a mode based on
> > > >   either CVT of GFT according to the given cmdline mode; in our case,
> > > >   it's 1366x768.
> > > > - Since both CVT and GFT can't express the width 1366 due to
> > > >   alignment, the resultant mode becomes 1368x768, slightly larger than
> > > >   the given size.
> > > > - Later on, the atomic commit is performed, and in
> > > >   drm_atomic_check_only(), the size of each plane is checked.
> > > > - The size check of 1366x768 fails due to the above, and eventually
> > > >   the whole VT switch fails.
> > > > 
> > > > Back in the history, we've had a manual fix-up of 1368x768 in various
> > > > places via c09dedb7a50e ("drm/edid: Add a workaround for 1366x768 HD
> > > > panel"), but they have been all in drm_edid.c at probing the modes
> > > > from EDID.  For addressing the problem above, we need a similar hack
> > > > to the mode newly created from cmdline, manually adjusting the width
> > > > when the expected size is 1366 while we get 1368 instead.
> > > > 
> > > > Fixes: eaf99c749d43 ("drm: Perform cmdline mode parsing during...")
> > > > Cc: <stable@vger.kernel.org>
> > > > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > > > ---
> > > >  drivers/gpu/drm/drm_modes.c | 7 +++++++
> > > >  1 file changed, 7 insertions(+)
> > > > 
> > > > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> > > > index ac6a35212501..e6b19bc9021a 100644
> > > > --- a/drivers/gpu/drm/drm_modes.c
> > > > +++ b/drivers/gpu/drm/drm_modes.c
> > > > @@ -1460,6 +1460,13 @@ drm_mode_create_from_cmdline_mode(struct drm_device *dev,
> > > >  		return NULL;
> > > >  
> > > >  	mode->type |= DRM_MODE_TYPE_USERDEF;
> > > > +	/* fix up 1368x768: GFT/CVT can't express 1366 width due to alignment */
> > > > +	if (cmd->xres == 1366 && mode->hdisplay == 1368) {
> > > > +		mode->hdisplay = 1366;
> > > > +		mode->hsync_start--;
> > > > +		mode->hsync_end--;
> > > > +		drm_mode_set_name(mode);
> > > > +	}
> > > 
> > > Maybe give fixup_mode_1366x768() a drm_ prefix and make in non-static to
> > > avoid duplicating the code? And I guess move it to drm_modes.c?
> > 
> > Yes, that'll be a good cleanup.  I was afraid of symbol export, but
> > both are in the same module, so far.  I can post a follow-up once when
> > this one gets accepted.
> 
> For the follow up, pls put the decl into drm_crtc_internal.h, so that
> drivers aren't tempted to use it. That header is for module-internal
> shared code only.
> 
> > > Otherwise lgtm:
> > > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Thanks!
> 
> Ville, can you pls also apply this one to drm-misc-fixes?

Pushed. Thanks for the patch.

-- 
Ville Syrjälä
Intel OTC

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm: Fix broken VT switch with video=1366x768 option
  2017-01-11 17:05       ` Ville Syrjälä
@ 2017-01-11 18:46         ` Takashi Iwai
  0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2017-01-11 18:46 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: linux-kernel, dri-devel

On Wed, 11 Jan 2017 18:05:12 +0100,
Ville Syrjälä wrote:
> 
> On Tue, Jan 10, 2017 at 01:41:42PM +0100, Daniel Vetter wrote:
> > On Tue, Jan 10, 2017 at 12:36:50PM +0100, Takashi Iwai wrote:
> > > On Tue, 10 Jan 2017 12:28:36 +0100,
> > > Ville Syrjälä wrote:
> > > > 
> > > > On Mon, Jan 09, 2017 at 03:56:14PM +0100, Takashi Iwai wrote:
> > > > > I noticed that the VT switch doesn't work any longer with a Dell
> > > > > laptop with 1366x768 eDP when the machine is connected with a DP
> > > > > monitor.  It behaves as if VT were switched, but the graphics remain
> > > > > frozen.  Actually the keyboard works, so I could switch back to VT7
> > > > > again.
> > > > > 
> > > > > I tried to track down the problem, and encountered a long story until
> > > > > we reach to this error:
> > > > > 
> > > > > - The machine is booted with video=1366x768 option (the distro
> > > > >   installer seems to add it as default).
> > > > > - Recently, drm_helper_probe_single_connector_modes() deals with
> > > > >   cmdline modes, and it tries to create a new mode when no
> > > > >   matching mode is found.
> > > > > - The drm_mode_create_from_cmdline_mode() creates a mode based on
> > > > >   either CVT of GFT according to the given cmdline mode; in our case,
> > > > >   it's 1366x768.
> > > > > - Since both CVT and GFT can't express the width 1366 due to
> > > > >   alignment, the resultant mode becomes 1368x768, slightly larger than
> > > > >   the given size.
> > > > > - Later on, the atomic commit is performed, and in
> > > > >   drm_atomic_check_only(), the size of each plane is checked.
> > > > > - The size check of 1366x768 fails due to the above, and eventually
> > > > >   the whole VT switch fails.
> > > > > 
> > > > > Back in the history, we've had a manual fix-up of 1368x768 in various
> > > > > places via c09dedb7a50e ("drm/edid: Add a workaround for 1366x768 HD
> > > > > panel"), but they have been all in drm_edid.c at probing the modes
> > > > > from EDID.  For addressing the problem above, we need a similar hack
> > > > > to the mode newly created from cmdline, manually adjusting the width
> > > > > when the expected size is 1366 while we get 1368 instead.
> > > > > 
> > > > > Fixes: eaf99c749d43 ("drm: Perform cmdline mode parsing during...")
> > > > > Cc: <stable@vger.kernel.org>
> > > > > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > > > > ---
> > > > >  drivers/gpu/drm/drm_modes.c | 7 +++++++
> > > > >  1 file changed, 7 insertions(+)
> > > > > 
> > > > > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> > > > > index ac6a35212501..e6b19bc9021a 100644
> > > > > --- a/drivers/gpu/drm/drm_modes.c
> > > > > +++ b/drivers/gpu/drm/drm_modes.c
> > > > > @@ -1460,6 +1460,13 @@ drm_mode_create_from_cmdline_mode(struct drm_device *dev,
> > > > >  		return NULL;
> > > > >  
> > > > >  	mode->type |= DRM_MODE_TYPE_USERDEF;
> > > > > +	/* fix up 1368x768: GFT/CVT can't express 1366 width due to alignment */
> > > > > +	if (cmd->xres == 1366 && mode->hdisplay == 1368) {
> > > > > +		mode->hdisplay = 1366;
> > > > > +		mode->hsync_start--;
> > > > > +		mode->hsync_end--;
> > > > > +		drm_mode_set_name(mode);
> > > > > +	}
> > > > 
> > > > Maybe give fixup_mode_1366x768() a drm_ prefix and make in non-static to
> > > > avoid duplicating the code? And I guess move it to drm_modes.c?
> > > 
> > > Yes, that'll be a good cleanup.  I was afraid of symbol export, but
> > > both are in the same module, so far.  I can post a follow-up once when
> > > this one gets accepted.
> > 
> > For the follow up, pls put the decl into drm_crtc_internal.h, so that
> > drivers aren't tempted to use it. That header is for module-internal
> > shared code only.
> > 
> > > > Otherwise lgtm:
> > > > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > 
> > > Thanks!
> > 
> > Ville, can you pls also apply this one to drm-misc-fixes?
> 
> Pushed. Thanks for the patch.

Thanks!


Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-01-11 18:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-09 14:56 [PATCH] drm: Fix broken VT switch with video=1366x768 option Takashi Iwai
2017-01-10 11:28 ` Ville Syrjälä
2017-01-10 11:36   ` Takashi Iwai
2017-01-10 12:41     ` Daniel Vetter
2017-01-10 12:45       ` Takashi Iwai
2017-01-11 17:05       ` Ville Syrjälä
2017-01-11 18:46         ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).