All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 11/22] flip_test: store current flip/received timestamps in the context obj
Date: Tue, 16 Oct 2012 17:34:45 +0300	[thread overview]
Message-ID: <1350398096-3649-12-git-send-email-imre.deak@intel.com> (raw)
In-Reply-To: <1350398096-3649-1-git-send-email-imre.deak@intel.com>

This is needed by the next patch that splits the flip handler function
into logical parts. Make the timestamps accesible to these parts.

No functional change.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 tests/flip_test.c |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/tests/flip_test.c b/tests/flip_test.c
index 9b7ac2b..f554818 100644
--- a/tests/flip_test.c
+++ b/tests/flip_test.c
@@ -77,6 +77,8 @@ struct test_output {
 	unsigned int fb_height;
 	unsigned int fb_ids[2];
 	struct kmstest_fb fb_info[2];
+	struct timeval current_flip_received;
+	struct timeval current_flip_ts;
 	struct timeval last_flip_received;
 	struct timeval last_flip_ts;
 };
@@ -179,17 +181,17 @@ static void page_flip_handler(int fd, unsigned int frame, unsigned int sec,
 {
 	struct test_output *o = data;
 	unsigned int new_fb_id;
-	struct timeval now, diff, pageflip_ts;
+	struct timeval diff;
 	double usec_interflip;
 	/* for funny reasons page_flip returns -EBUSY on disabled crtcs ... */
 	int expected_einval = o->flags & TEST_MODESET ? -EBUSY : -EINVAL;
 
-	pageflip_ts.tv_sec = sec;
-	pageflip_ts.tv_usec = usec;
+	o->current_flip_ts.tv_sec = sec;
+	o->current_flip_ts.tv_usec = usec;
 
-	gettimeofday(&now, NULL);
+	gettimeofday(&o->current_flip_received, NULL);
 
-	timersub(&pageflip_ts, &now, &diff);
+	timersub(&o->current_flip_ts, &o->current_flip_received, &diff);
 
 	if (diff.tv_sec > 0 || (diff.tv_sec == 0 && diff.tv_usec > 2000)) {
 		fprintf(stderr, "pageflip timestamp delayed for too long: %is, %iusec\n",
@@ -197,16 +199,16 @@ static void page_flip_handler(int fd, unsigned int frame, unsigned int sec,
 		exit(5);
 	}
 
-	if (!timercmp(&o->last_flip_received, &pageflip_ts, <)) {
+	if (!timercmp(&o->last_flip_received, &o->current_flip_ts, <)) {
 		fprintf(stderr, "pageflip ts before the pageflip was issued!\n");
-		timersub(&pageflip_ts, &o->last_flip_received, &diff);
+		timersub(&o->current_flip_ts, &o->last_flip_received, &diff);
 		fprintf(stderr, "timerdiff %is, %ius\n",
 			(int) diff.tv_sec, (int) diff.tv_usec);
 		exit(6);
 	}
 
 	if (o->count > 1 && o->flags & TEST_CHECK_TS && !analog_tv_connector(o)) {
-		timersub(&pageflip_ts, &o->last_flip_ts, &diff);
+		timersub(&o->current_flip_ts, &o->last_flip_ts, &diff);
 		usec_interflip = 1.0 / ((double) o->mode.vrefresh) * 1000.0 * 1000.0;
 
 		if (fabs((((double) diff.tv_usec) - usec_interflip) / usec_interflip) > 0.005) {
@@ -281,8 +283,8 @@ static void page_flip_handler(int fd, unsigned int frame, unsigned int sec,
 	if (o->flags & TEST_EINVAL)
 		assert(do_page_flip(o, new_fb_id) == expected_einval);
 
-	o->last_flip_received = now;
-	o->last_flip_ts = pageflip_ts;
+	o->last_flip_received = o->current_flip_received;
+	o->last_flip_ts = o->current_flip_ts;
 }
 
 static void connector_find_preferred_mode(struct test_output *o, int crtc_id)
-- 
1.7.9.5

  parent reply	other threads:[~2012-10-16 14:35 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-16 14:34 [PATCH 00/22] i-g-t: flip_test: add vblank test cases Imre Deak
2012-10-16 14:34 ` [PATCH 01/22] drmtest: add function to remove an DRM FB Imre Deak
2012-10-16 14:34 ` [PATCH 02/22] flip_test: free FBs after each test run Imre Deak
2012-10-16 14:34 ` [PATCH 03/22] flip_test: reset the state for " Imre Deak
2012-10-16 14:34 ` [PATCH 04/22] flip_test: check drmHandleEvents()' return value Imre Deak
2012-10-16 14:34 ` [PATCH 05/22] test_flip: fix checking for delayed event reception Imre Deak
2012-10-16 14:34 ` [PATCH 06/22] flip_test: store fb width, height in test context object Imre Deak
2012-10-16 14:34 ` [PATCH 07/22] flip_test: factor out drmModePageFlip Imre Deak
2012-10-16 14:34 ` [PATCH 08/22] flip_test: move output panning inside the flip_handler Imre Deak
2012-10-16 14:59   ` Daniel Vetter
2012-10-16 14:34 ` [PATCH 09/22] flip_test: factor out the event loop/wait for event logic Imre Deak
2012-10-16 14:34 ` [PATCH 10/22] flip_test: factor out the final state check Imre Deak
2012-10-16 14:34 ` Imre Deak [this message]
2012-10-16 14:34 ` [PATCH 12/22] flip_test: split the flip handler into logical parts Imre Deak
2012-10-16 14:34 ` [PATCH 13/22] flip_test: swap the order of check state/run test step Imre Deak
2012-10-16 14:34 ` [PATCH 14/22] flip_test: factor out the event state Imre Deak
2012-10-16 14:34 ` [PATCH 15/22] flip_test: don't skip checks for sequence #1 Imre Deak
2012-10-16 14:34 ` [PATCH 16/22] flip_test: store crtc_idx in the test context obj Imre Deak
2012-10-16 14:34 ` [PATCH 17/22] flip_test: unify the name of the current test in status messages Imre Deak
2012-10-16 14:34 ` [PATCH 18/22] flip_test: make page flip tests conditional Imre Deak
2012-10-16 14:34 ` [PATCH 19/22] flip_test: add logic to track pending events Imre Deak
2012-10-16 14:34 ` [PATCH 20/22] flip_test: add event sequence number tracking Imre Deak
2012-10-16 14:34 ` [PATCH 21/22] flip_test: add check to see if any event has occured Imre Deak
2012-10-16 14:34 ` [PATCH 22/22] flip_test: add wait-for-vblank tests Imre Deak

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=1350398096-3649-12-git-send-email-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.