@@ -461,6 +461,7 @@ struct dm_crtc_state {
int update_type;
int active_planes;
+ u64 vblank_at_crc_init;
int crc_skip_count;
enum amdgpu_dm_pipe_crc_source crc_src;
@@ -305,6 +305,17 @@ void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc)
* first two CRC values.
*/
if (crtc_state->crc_skip_count < 2) {
+ /*
+ * Save the vblank count at the time when the CRC calculation starts and comes here
+ * for the first time (crc_skip_count=0).
+ * drm_crtc_add_crc_entry() reports the number of the frame these CRCs are about,
+ * which should be the vblank_count of the frame rather than when the CRCs are
+ * ready.
+ */
+ if (crtc_state->crc_skip_count == 0) {
+ crtc_state->vblank_at_crc_init =
+ drm_crtc_accurate_vblank_count(crtc);
+ }
crtc_state->crc_skip_count += 1;
return;
}
@@ -315,6 +326,6 @@ void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc)
return;
drm_crtc_add_crc_entry(crtc, true,
- drm_crtc_accurate_vblank_count(crtc), crcs);
+ crtc_state->vblank_at_crc_init, crcs);
}
}
From: Mark Yacoub <markyacoub@google.com> On reporting back the frame number of the CRCs through drm_crtc_add_crc_entry(), send back the vblank count at the time the frame CRC starts calculating rather than when the CRCs are ready to be reported. Tested by running IGT module: kms_plane::capture_crc() Cc: Harry Wentland <harry.wentland@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 1 + .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)