aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3566-drm-amd-display-Skip-2-frames-when-first-reading-CRC.patch
blob: a70b4d3e355f63fec6238e8a115db49b78bd10d9 (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
65
From 323537ff21858e9e39d867c4cabb4d09b5a781eb Mon Sep 17 00:00:00 2001
From: "Leo (Sunpeng) Li" <sunpeng.li@amd.com>
Date: Tue, 6 Feb 2018 10:20:46 -0500
Subject: [PATCH 3566/4131] drm/amd/display: Skip 2 frames when first reading
 CRC

Skipping the first frame will prevent uncoooked values most of the time.
However, in some unlikely cases, the second frame will be uncooked as
well.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h     |  2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
index c40c13a..5b5fa80 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
@@ -198,7 +198,7 @@ struct dm_crtc_state {
 	struct drm_crtc_state base;
 	struct dc_stream_state *stream;
 
-	bool crc_first_skipped;
+	int crc_skip_count;
 	bool crc_enabled;
 };
 
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
index 45439752..ad80991 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
@@ -84,8 +84,8 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name,
 	}
 
 	*values_cnt = 3;
-	/* Reset crc_skipped flag on dm state */
-	crtc_state->crc_first_skipped = false;
+	/* Reset crc_skipped on dm state */
+	crtc_state->crc_skip_count = 0;
 	return 0;
 }
 
@@ -109,11 +109,11 @@ void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc)
 	/*
 	 * Since flipping and crc enablement happen asynchronously, we - more
 	 * often than not - will be returning an 'uncooked' crc on first frame.
-	 * Probably because hw isn't ready yet. Simply skip the first crc
-	 * value.
+	 * Probably because hw isn't ready yet. For added security, skip the
+	 * first two CRC values.
 	 */
-	if (!crtc_state->crc_first_skipped) {
-		crtc_state->crc_first_skipped = true;
+	if (crtc_state->crc_skip_count < 2) {
+		crtc_state->crc_skip_count += 1;
 		return;
 	}
 
-- 
2.7.4