public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 1/3] lib/debugfs: Fix wraparound handling for crc frame counter check
Date: Tue,  6 Nov 2018 18:19:41 +0200	[thread overview]
Message-ID: <20181106161943.28641-1-ville.syrjala@linux.intel.com> (raw)

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

             reply	other threads:[~2018-11-06 16:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 16:19 Ville Syrjala [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181106161943.28641-1-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox