public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/3] lib/debugfs: Fix wraparound handling for crc frame counter check
@ 2018-11-06 16:19 Ville Syrjala
  2018-11-06 16:19 ` [igt-dev] [PATCH i-g-t 2/3] tests/kms_setmode: Request the initial vbl count with RELATIVE instead of ABSOLUTE Ville Syrjala
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Ville Syrjala @ 2018-11-06 16:19 UTC (permalink / raw)
  To: igt-dev

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

Deal with frame counter wraparound correcrtly.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_debugfs.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index a3aca8466658..70874416d128 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -975,6 +975,16 @@ void igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
 	crc_sanity_checks(crc);
 }
 
+static bool vbl_after_eq(uint32_t a, uint32_t b)
+{
+	return (int32_t)(a - b) >= 0;
+}
+
+static bool vbl_before_eq(uint32_t a, uint32_t b)
+{
+	return vbl_after_eq(b, a);
+}
+
 /**
  * igt_pipe_crc_get_current:
  * @drm_fd: Pointer to drm fd for vblank counter
@@ -999,7 +1009,7 @@ 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 (crc->frame <= vblank);
+	} while (vbl_before_eq(crc->frame, vblank));
 
 	crc_sanity_checks(crc);
 }
-- 
2.18.1

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

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

end of thread, other threads:[~2018-11-08  7:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-06 16:19 [igt-dev] [PATCH i-g-t 1/3] lib/debugfs: Fix wraparound handling for crc frame counter check Ville Syrjala
2018-11-06 16:19 ` [igt-dev] [PATCH i-g-t 2/3] tests/kms_setmode: Request the initial vbl count with RELATIVE instead of ABSOLUTE Ville Syrjala
2018-11-06 16:38   ` Chris Wilson
2018-11-06 16:57     ` Daniel Vetter
2018-11-06 17:02       ` Ville Syrjälä
2018-11-06 18:40     ` Ville Syrjälä
2018-11-06 19:27       ` Chris Wilson
2018-11-06 16:19 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_flip: " Ville Syrjala
2018-11-06 16:58 ` [igt-dev] [PATCH i-g-t 1/3] lib/debugfs: Fix wraparound handling for crc frame counter check Daniel Vetter
2018-11-06 17:11 ` Chris Wilson
2018-11-07 19:19 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] " Patchwork
2018-11-08  7:20 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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