aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorLeo (Sunpeng) Li <sunpeng.li@amd.com>2018-02-06 10:20:46 -0500
committerAlex Deucher <alexander.deucher@amd.com>2018-02-19 14:20:11 -0500
commita0a31ec4ce6a8c8bc4f4b8619b537e4a9a0ddaf1 (patch)
treea52fcd4bc73306e820d9a60b5ab32bea48e2dced /drivers/gpu/drm
parentea41fb640dd8789db325b90ffa4142d808247de1 (diff)
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>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h2
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c12
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 ed939600cdbe..aa7df5775545 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 {
198 struct drm_crtc_state base; 198 struct drm_crtc_state base;
199 struct dc_stream_state *stream; 199 struct dc_stream_state *stream;
200 200
201 bool crc_first_skipped; 201 int crc_skip_count;
202 bool crc_enabled; 202 bool crc_enabled;
203}; 203};
204 204
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 55aa379cfcbe..52f2c01349e3 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,
84 } 84 }
85 85
86 *values_cnt = 3; 86 *values_cnt = 3;
87 /* Reset crc_skipped flag on dm state */ 87 /* Reset crc_skipped on dm state */
88 crtc_state->crc_first_skipped = false; 88 crtc_state->crc_skip_count = 0;
89 return 0; 89 return 0;
90} 90}
91 91
@@ -109,11 +109,11 @@ void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc)
109 /* 109 /*
110 * Since flipping and crc enablement happen asynchronously, we - more 110 * Since flipping and crc enablement happen asynchronously, we - more
111 * often than not - will be returning an 'uncooked' crc on first frame. 111 * often than not - will be returning an 'uncooked' crc on first frame.
112 * Probably because hw isn't ready yet. Simply skip the first crc 112 * Probably because hw isn't ready yet. For added security, skip the
113 * value. 113 * first two CRC values.
114 */ 114 */
115 if (!crtc_state->crc_first_skipped) { 115 if (crtc_state->crc_skip_count < 2) {
116 crtc_state->crc_first_skipped = true; 116 crtc_state->crc_skip_count += 1;
117 return; 117 return;
118 } 118 }
119 119