]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.46/drm-fix-broken-vt-switch-with-video-1366x768-option.patch
fix up queue-5.15/mm-fix-race-between-__split_huge_pmd_locked-and-gup-.patch
[thirdparty/kernel/stable-queue.git] / releases / 4.4.46 / drm-fix-broken-vt-switch-with-video-1366x768-option.patch
CommitLineData
377e81b2
GKH
1From fdf35a6b22247746a7053fc764d04218a9306f82 Mon Sep 17 00:00:00 2001
2From: Takashi Iwai <tiwai@suse.de>
3Date: Mon, 9 Jan 2017 15:56:14 +0100
4Subject: drm: Fix broken VT switch with video=1366x768 option
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9From: Takashi Iwai <tiwai@suse.de>
10
11commit fdf35a6b22247746a7053fc764d04218a9306f82 upstream.
12
13I noticed that the VT switch doesn't work any longer with a Dell
14laptop with 1366x768 eDP when the machine is connected with a DP
15monitor. It behaves as if VT were switched, but the graphics remain
16frozen. Actually the keyboard works, so I could switch back to VT7
17again.
18
19I tried to track down the problem, and encountered a long story until
20we reach to this error:
21
22- The machine is booted with video=1366x768 option (the distro
23 installer seems to add it as default).
24- Recently, drm_helper_probe_single_connector_modes() deals with
25 cmdline modes, and it tries to create a new mode when no
26 matching mode is found.
27- The drm_mode_create_from_cmdline_mode() creates a mode based on
28 either CVT of GFT according to the given cmdline mode; in our case,
29 it's 1366x768.
30- Since both CVT and GFT can't express the width 1366 due to
31 alignment, the resultant mode becomes 1368x768, slightly larger than
32 the given size.
33- Later on, the atomic commit is performed, and in
34 drm_atomic_check_only(), the size of each plane is checked.
35- The size check of 1366x768 fails due to the above, and eventually
36 the whole VT switch fails.
37
38Back in the history, we've had a manual fix-up of 1368x768 in various
39places via c09dedb7a50e ("drm/edid: Add a workaround for 1366x768 HD
40panel"), but they have been all in drm_edid.c at probing the modes
41from EDID. For addressing the problem above, we need a similar hack
42to the mode newly created from cmdline, manually adjusting the width
43when the expected size is 1366 while we get 1368 instead.
44
45Fixes: eaf99c749d43 ("drm: Perform cmdline mode parsing during...")
46Signed-off-by: Takashi Iwai <tiwai@suse.de>
47Link: http://patchwork.freedesktop.org/patch/msgid/20170109145614.29454-1-tiwai@suse.de
48Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
49Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
50Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
51
52---
53 drivers/gpu/drm/drm_modes.c | 7 +++++++
54 1 file changed, 7 insertions(+)
55
56--- a/drivers/gpu/drm/drm_modes.c
57+++ b/drivers/gpu/drm/drm_modes.c
58@@ -1401,6 +1401,13 @@ drm_mode_create_from_cmdline_mode(struct
59 return NULL;
60
61 mode->type |= DRM_MODE_TYPE_USERDEF;
62+ /* fix up 1368x768: GFT/CVT can't express 1366 width due to alignment */
63+ if (cmd->xres == 1366 && mode->hdisplay == 1368) {
64+ mode->hdisplay = 1366;
65+ mode->hsync_start--;
66+ mode->hsync_end--;
67+ drm_mode_set_name(mode);
68+ }
69 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
70 return mode;
71 }