From patchwork Tue Oct 16 14:34:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 1601021 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 84D7740ABA for ; Tue, 16 Oct 2012 14:46:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A36D6A0891 for ; Tue, 16 Oct 2012 07:46:20 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [143.182.124.37]) by gabe.freedesktop.org (Postfix) with ESMTP id C889E9F576 for ; Tue, 16 Oct 2012 07:35:23 -0700 (PDT) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 16 Oct 2012 07:35:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,593,1344236400"; d="scan'208";a="205092281" Received: from ideak-desk.fi.intel.com (HELO localhost) ([10.237.72.98]) by azsmga001.ch.intel.com with ESMTP; 16 Oct 2012 07:35:22 -0700 From: Imre Deak To: intel-gfx@lists.freedesktop.org Date: Tue, 16 Oct 2012 17:34:45 +0300 Message-Id: <1350398096-3649-12-git-send-email-imre.deak@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1350398096-3649-1-git-send-email-imre.deak@intel.com> References: <1350398096-3649-1-git-send-email-imre.deak@intel.com> Subject: [Intel-gfx] [PATCH 11/22] flip_test: store current flip/received timestamps in the context obj X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org 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 --- 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)