1 From 707f01a9c6e68ee77855a702614d205ffc530791 Mon Sep 17 00:00:00 2001
2 From: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
3 Date: Wed, 23 Jan 2019 14:55:58 -0500
4 Subject: drm/amd/display: Don't re-program planes for DPMS changes
6 [ Upstream commit 5062b797db4103218fa00ee254417b8ecaab7401 ]
9 There are opt1c lock warnings and CRTC read timeouts when running the
10 "igt@kms_plane@plane-position-hole-dpms-pipe-*" tests. These are
11 caused by trying to reprogram planes that are not in the current
14 DPMS off removes the stream from the context. In this case:
16 new_crtc_state->active_changed = true
17 new_crtc_state->mode_changed = false
19 The planes are reprogrammed before the stream is removed from the
20 context because stream_state->mode_changed = false.
22 For DPMS adds the stream and planes back to the context:
24 new_crtc_state->active_changed = true
25 new_crtc_state->mode_changed = false
27 The planes are also reprogrammed here before the stream is added to the
28 context because stream_state->mode_changed = true. They were not
29 previously in the current context so warnings occur here.
32 Set stream_state->mode_changed = true when
33 new_crtc_state->active_changed = true too.
35 This prevents reprogramming before the context is applied in DC. The
36 programming will be done after the context is applied.
38 Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
39 Reviewed-by: Sun peng Li <Sunpeng.Li@amd.com>
40 Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
41 Acked-by: Tony Cheng <Tony.Cheng@amd.com>
42 Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
43 Signed-off-by: Sasha Levin <sashal@kernel.org>
45 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
46 1 file changed, 2 insertions(+), 1 deletion(-)
48 diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
49 index c5ba9128b736..c57e85f08e23 100644
50 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
51 +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
52 @@ -4368,7 +4368,8 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
53 static void amdgpu_dm_crtc_copy_transient_flags(struct drm_crtc_state *crtc_state,
54 struct dc_stream_state *stream_state)
56 - stream_state->mode_changed = crtc_state->mode_changed;
57 + stream_state->mode_changed =
58 + crtc_state->mode_changed || crtc_state->active_changed;
61 static int amdgpu_dm_atomic_commit(struct drm_device *dev,