]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.9.6/drm-i915-force-full-modeset-if-the-connector-is-in-dpms-off-mode.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 3.9.6 / drm-i915-force-full-modeset-if-the-connector-is-in-dpms-off-mode.patch
1 From e3de42b68478a8c95dd27520e9adead2af9477a5 Mon Sep 17 00:00:00 2001
2 From: Imre Deak <imre.deak@intel.com>
3 Date: Fri, 3 May 2013 19:44:07 +0200
4 Subject: drm/i915: force full modeset if the connector is in DPMS OFF mode
5
6 From: Imre Deak <imre.deak@intel.com>
7
8 commit e3de42b68478a8c95dd27520e9adead2af9477a5 upstream.
9
10 Currently the driver's assumed behavior for a modeset with an attached
11 FB is that the corresponding connector will be switched to DPMS ON mode
12 if it happened to be in DPMS OFF (or another power save mode). This
13 wasn't enforced though if only the FB changed, everything else (format,
14 connector etc.) remaining the same. In this case we only set the new FB
15 base and left the connector in the old power save mode.
16
17 Fix this by forcing a full modeset whenever there is an attached FB and
18 any affected connector is in a power save mode.
19
20 V_2: Run the test for encoders in power save mode outside the the
21 test for fb change: user space may have just disabled the encoders
22 but left everything else in place. Make sure the connector list is
23 not empty before running this test.
24
25 Signed-off-by: Imre Deak <imre.deak@intel.com>
26 Signed-off-by: Egbert Eich <eich@suse.de>
27 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61642
28 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59834
29 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59339
30 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64178
31 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65559
32 Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
33 [danvet: Apply Jani's s/connector_off/is_crtc_connector_off bikeshed.]
34 Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
35 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
36
37 ---
38 drivers/gpu/drm/i915/intel_display.c | 24 ++++++++++++++++++++++--
39 1 file changed, 22 insertions(+), 2 deletions(-)
40
41 --- a/drivers/gpu/drm/i915/intel_display.c
42 +++ b/drivers/gpu/drm/i915/intel_display.c
43 @@ -7960,6 +7960,21 @@ static void intel_set_config_restore_sta
44 }
45 }
46
47 +static bool
48 +is_crtc_connector_off(struct drm_crtc *crtc, struct drm_connector *connectors,
49 + int num_connectors)
50 +{
51 + int i;
52 +
53 + for (i = 0; i < num_connectors; i++)
54 + if (connectors[i].encoder &&
55 + connectors[i].encoder->crtc == crtc &&
56 + connectors[i].dpms != DRM_MODE_DPMS_ON)
57 + return true;
58 +
59 + return false;
60 +}
61 +
62 static void
63 intel_set_config_compute_mode_changes(struct drm_mode_set *set,
64 struct intel_set_config *config)
65 @@ -7967,7 +7982,11 @@ intel_set_config_compute_mode_changes(st
66
67 /* We should be able to check here if the fb has the same properties
68 * and then just flip_or_move it */
69 - if (set->crtc->fb != set->fb) {
70 + if (set->connectors != NULL &&
71 + is_crtc_connector_off(set->crtc, *set->connectors,
72 + set->num_connectors)) {
73 + config->mode_changed = true;
74 + } else if (set->crtc->fb != set->fb) {
75 /* If we have no fb then treat it as a full mode set */
76 if (set->crtc->fb == NULL) {
77 DRM_DEBUG_KMS("crtc has no fb, full mode set\n");
78 @@ -7979,8 +7998,9 @@ intel_set_config_compute_mode_changes(st
79 } else if (set->fb->bits_per_pixel !=
80 set->crtc->fb->bits_per_pixel) {
81 config->mode_changed = true;
82 - } else
83 + } else {
84 config->fb_changed = true;
85 + }
86 }
87
88 if (set->fb && (set->x != set->crtc->x || set->y != set->crtc->y))