public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/3] lib/igt_debugfs: Add igt_crc_get_for_frame()
@ 2020-02-21 20:50 Ville Syrjala
  2020-02-21 20:50 ` [igt-dev] [PATCH i-g-t 2/3] tests/kms_plane: Pipeline crc capture and flips Ville Syrjala
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Ville Syrjala @ 2020-02-21 20:50 UTC (permalink / raw)
  To: igt-dev

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

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.

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

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 8cac9d1e148e..bf6be552057a 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,11 +964,29 @@ 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
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index 1e0cc108d6fb..7d1a6175ed64 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -104,6 +104,8 @@ 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_for_frame(int drm_fd, igt_pipe_crc_t *pipe_crc,
+				unsigned int vblank, 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] 10+ messages in thread

end of thread, other threads:[~2020-02-27 14:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-21 20:50 [igt-dev] [PATCH i-g-t 1/3] lib/igt_debugfs: Add igt_crc_get_for_frame() Ville Syrjala
2020-02-21 20:50 ` [igt-dev] [PATCH i-g-t 2/3] tests/kms_plane: Pipeline crc capture and flips Ville Syrjala
2020-02-26 20:51   ` [igt-dev] [PATCH i-g-t v2 " Ville Syrjala
2020-02-21 20:50 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_plane: Use non-blocking commits for pixel format tests Ville Syrjala
2020-02-26 20:52   ` [igt-dev] [PATCH i-g-t v2 " Ville Syrjala
2020-02-21 21:21 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib/igt_debugfs: Add igt_crc_get_for_frame() Patchwork
2020-02-24 12:49 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2020-02-26 21:50 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib/igt_debugfs: Add igt_crc_get_for_frame() (rev3) Patchwork
2020-02-27 12:01 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2020-02-27 13:59 ` [igt-dev] [PATCH i-g-t 1/3] lib/igt_debugfs: Add igt_crc_get_for_frame() Juha-Pekka Heikkila

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