summaryrefslogtreecommitdiff
path: root/lib/igt_debugfs.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2020-02-21 18:53:15 +0200
committerVille Syrjälä <ville.syrjala@linux.intel.com>2020-02-28 16:27:08 +0200
commitab405a405f053474a6c7308fe0a95df972f4dc2e (patch)
tree9a63095eaf2bf3de511df747f6f0f7e9672ec807 /lib/igt_debugfs.c
parent6628336d5699e3fda2c3b64b1c9fc5426b6de29a (diff)
lib/igt_debugfs: Add igt_crc_get_for_frame()
Add a new helper to return the crc for a specific frame. Useful when we pipeline flips and crc captures more deeply to eliminate dead time between the flips. Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'lib/igt_debugfs.c')
-rw-r--r--lib/igt_debugfs.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 8cac9d1e..bf6be552 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -945,17 +945,16 @@ void igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
* igt_pipe_crc_get_current:
* @drm_fd: Pointer to drm fd for vblank counter
* @pipe_crc: pipe CRC object
+ * @vblank: frame counter value we're looking for
* @crc: buffer pointer for the captured CRC value
*
- * Same as igt_pipe_crc_get_single(), but will wait until a new CRC can be captured.
- * This is useful for retrieving the current CRC in a more race free way than
- * igt_pipe_crc_drain() + igt_pipe_crc_get_single().
+ * Same as igt_pipe_crc_get_single(), but will wait until a CRC has been captured
+ * for frame @vblank.
*/
void
-igt_pipe_crc_get_current(int drm_fd, igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
+igt_pipe_crc_get_for_frame(int drm_fd, igt_pipe_crc_t *pipe_crc,
+ unsigned int vblank, igt_crc_t *crc)
{
- unsigned vblank = kmstest_get_vblank(drm_fd, pipe_crc->pipe, 0);
-
do {
read_one_crc(pipe_crc, crc);
@@ -965,12 +964,30 @@ igt_pipe_crc_get_current(int drm_fd, igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
igt_pipe_crc_get_single(pipe_crc, crc);
return;
}
- } while (igt_vblank_before_eq(crc->frame, vblank));
+ } while (igt_vblank_before(crc->frame, vblank));
crc_sanity_checks(pipe_crc, crc);
}
/**
+ * igt_pipe_crc_get_current:
+ * @drm_fd: Pointer to drm fd for vblank counter
+ * @pipe_crc: pipe CRC object
+ * @crc: buffer pointer for the captured CRC value
+ *
+ * Same as igt_pipe_crc_get_single(), but will wait until a new CRC can be captured.
+ * This is useful for retrieving the current CRC in a more race free way than
+ * igt_pipe_crc_drain() + igt_pipe_crc_get_single().
+ */
+void
+igt_pipe_crc_get_current(int drm_fd, igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
+{
+ unsigned vblank = kmstest_get_vblank(drm_fd, pipe_crc->pipe, 0) + 1;
+
+ return igt_pipe_crc_get_for_frame(drm_fd, pipe_crc, vblank, crc);
+}
+
+/**
* igt_pipe_crc_collect_crc:
* @pipe_crc: pipe CRC object
* @out_crc: buffer for the captured CRC values