* [PATCH] drm/amdgpu: Report the Frame number at beginning of CRC calculation
@ 2021-04-08 19:55 Mark Yacoub
0 siblings, 0 replies; only message in thread
From: Mark Yacoub @ 2021-04-08 19:55 UTC (permalink / raw)
To: amd-gfx, dri-devel
Cc: alexander.deucher, harry.wentland, seanpaul, Mark Yacoub
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(-)
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 8bfe901cf2374..b1e7af435b440 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
@@ -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;
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 66cb8730586b1..abf9dcefadbe6 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
@@ -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);
}
}
--
2.31.0.208.g409f899ff0-goog
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-08 19:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 19:55 [PATCH] drm/amdgpu: Report the Frame number at beginning of CRC calculation Mark Yacoub
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).