aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.19.8/2046-drm-amd-display-Don-t-set-mode_changed-false-if-the-.patch
blob: e12d8f01947cc534f4af52569040443948c4735e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From 50d40cd6913db43ae740da1d411b86439061a226 Mon Sep 17 00:00:00 2001
From: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Date: Thu, 30 May 2019 15:51:14 -0400
Subject: [PATCH 2046/2940] drm/amd/display: Don't set mode_changed=false if
 the stream was removed

[Why]
When switching from vt to desktop with EDID emulation we can receive
an atomic commit such that we have a crtc where mode_changed = true.

During the dm_update_crtc_state disable pass we remove the stream from
the context and free it on the dm_new_crtc_state.

During the enable pass we compare the new provisional stream to the
dm_old_crtc_state->stream and determine that the stream is unchanged
and no scaling has been changed.

Following this, new_crtc_state->mode_changed is then set to false.
The connectors haven't changed and the CRTC active state hasn't changed
so drm_atomic_crtc_needs_modeset returns false, so we jump to
skip_modeset and we hit:

BUG_ON(dm_new_crtc_state->stream == NULL);

...since the old stream is gone from the context and the new stream is
also still NULL.

[How]
Ensure that we still a stream to reuse before checking if we can reuse
the old stream without a full modeset.

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Chaudhary Amit Kumar <Chaudharyamit.Kumar@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index e089e384b0ba..ad2eb220ff90 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -6295,7 +6295,17 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
                 }
 
 		dm_new_crtc_state->abm_level = dm_new_conn_state->abm_level;
-                if (dc_is_stream_unchanged(new_stream, dm_old_crtc_state->stream) &&
+                /*
+                 * If we already removed the old stream from the context
+                 * (and set the new stream to NULL) then we can't reuse
+                 * the old stream even if the stream and scaling are unchanged.
+                 * We'll hit the BUG_ON and black screen.
+                 *
+                 * TODO: Refactor this function to allow this check to work
+                 * in all conditions.
+                 */
+                if (dm_new_crtc_state->stream &&
+                    dc_is_stream_unchanged(new_stream, dm_old_crtc_state->stream) &&
                     dc_is_stream_scaling_unchanged(new_stream, dm_old_crtc_state->stream)) {
                         new_crtc_state->mode_changed = false;
                         DRM_DEBUG_DRIVER("Mode change not required, setting mode_changed to %d",
-- 
2.17.1