public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: Add igt_crc_get_previous()
@ 2020-02-21 18:26 Ville Syrjala
  2020-02-21 18:26 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_plane: Pipeline crc capture and flips Ville Syrjala
  2020-02-21 19:02 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/2] lib/igt_debugfs: Add igt_crc_get_previous() Patchwork
  0 siblings, 2 replies; 4+ messages in thread
From: Ville Syrjala @ 2020-02-21 18:26 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add a new helper to return the most recently captured crc
without waiting for the current frame's crc to be captured.
Useful when we pipeline flips and crc captures more deeply
to eliminate dead time between the flips.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_debugfs.c | 29 +++++++++++++++++++++++++++++
 lib/igt_debugfs.h |  1 +
 2 files changed, 30 insertions(+)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 8cac9d1e148e..844763d51c3e 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -970,6 +970,35 @@ igt_pipe_crc_get_current(int drm_fd, igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
 	crc_sanity_checks(pipe_crc, crc);
 }
 
+/**
+ * igt_pipe_crc_get_previous:
+ * @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_current(), but will return the crc
+ * most recently captured (ie. does not wait an extra frame for
+ * the crc computation for the current frame to finish).
+ */
+void
+igt_pipe_crc_get_previous(int drm_fd, igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
+{
+	unsigned vblank = kmstest_get_vblank(drm_fd, pipe_crc->pipe, 0);
+
+	do {
+		read_one_crc(pipe_crc, crc);
+
+		/* Only works with valid frame counter */
+		if (!crc->has_valid_frame) {
+			igt_pipe_crc_drain(pipe_crc);
+			igt_pipe_crc_get_single(pipe_crc, crc);
+			return;
+		}
+	} while (igt_vblank_before(crc->frame, vblank));
+
+	crc_sanity_checks(pipe_crc, crc);
+}
+
 /**
  * igt_pipe_crc_collect_crc:
  * @pipe_crc: pipe CRC object
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index 1e0cc108d6fb..69f65f789bd3 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -104,6 +104,7 @@ int igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
 void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc);
 void igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
 void igt_pipe_crc_get_current(int drm_fd, igt_pipe_crc_t *pipe_crc, igt_crc_t *crc);
+void igt_pipe_crc_get_previous(int drm_fd, igt_pipe_crc_t *pipe_crc, igt_crc_t *crc);
 
 void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
 
-- 
2.24.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-21 19:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-21 18:26 [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: Add igt_crc_get_previous() Ville Syrjala
2020-02-21 18:26 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_plane: Pipeline crc capture and flips Ville Syrjala
2020-02-21 18:42   ` Ville Syrjälä
2020-02-21 19:02 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/2] lib/igt_debugfs: Add igt_crc_get_previous() Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox