All of lore.kernel.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 10/14] tools/intel_display_poller: Add frame timestamp tests
Date: Thu, 17 Dec 2020 18:26:59 +0200	[thread overview]
Message-ID: <20201217162703.20779-11-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20201217162703.20779-1-ville.syrjala@linux.intel.com>

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

Add a couple of new test modes to verify how frame timestamps
work.
* frametimestamp determines on which scanline the frame
  timestamp is sampled
* timestamp returns the difference between the current timestamp
  on a specific scanline from the last sampled frame timestamp.
  This can be used to determine if the timestamp ticks at the
  expected rate.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tools/intel_display_poller.c | 103 ++++++++++++++++++++++++++++++++++-
 1 file changed, 102 insertions(+), 1 deletion(-)

diff --git a/tools/intel_display_poller.c b/tools/intel_display_poller.c
index 260818db1baa..ae3f993fa650 100644
--- a/tools/intel_display_poller.c
+++ b/tools/intel_display_poller.c
@@ -49,6 +49,8 @@ enum test {
 	TEST_FRAMECOUNT,
 	TEST_FRAMECOUNT_GEN3,
 	TEST_FRAMECOUNT_G4X,
+	TEST_FRAMETIMESTAMP,
+	TEST_TIMESTAMP,
 	TEST_FLIPCOUNT,
 	TEST_PAN,
 	TEST_FLIP,
@@ -732,6 +734,80 @@ static void poll_dsl_framecount_gen3(int pipe, uint32_t *min, uint32_t *max, con
 	}
 }
 
+
+static void poll_dsl_frametimestamp(uint32_t devid, int pipe,
+				    uint32_t *min, uint32_t *max, const int count)
+{
+	uint32_t dsl, dsl1, dsl2, frm, frm1, frm2;
+	bool field1, field2;
+	int i[2] = {};
+
+	frm = PIPE_REG(pipe, PIPEAFRMTMSMTP);
+	dsl = PIPE_REG(pipe, PIPEA_DSL);
+
+	while (!quit) {
+		while (!quit) {
+			dsl1 = read_reg(dsl);
+			frm1 = read_reg(frm);
+			frm2 = read_reg(frm);
+			dsl2 = read_reg(dsl);
+
+			field1 = dsl1 & 0x80000000;
+			field2 = dsl2 & 0x80000000;
+			dsl1 &= ~0x80000000;
+			dsl2 &= ~0x80000000;
+
+			if (frm1 != frm2)
+				break;
+		}
+
+		if (field1 != field2)
+			printf("fields are different (%u:%u -> %u:%u)\n",
+			       field1, dsl1, field2, dsl2);
+
+		min[field1*count+i[field1]] = dsl1;
+		max[field1*count+i[field1]] = dsl2;
+		if (++i[field1] >= count)
+			break;
+	}
+}
+
+static uint32_t timestamp_reg(uint32_t devid)
+{
+	if (intel_gen(devid) >= 7)
+		return IVB_TIMESTAMP_CTR;
+	else if (intel_gen(devid) >= 5)
+		return ILK_TIMESTAMP_HI;
+	else
+		return TIMESTAMP_QW + 4;
+}
+
+static void poll_dsl_timestamp(uint32_t devid, int pipe, int target_scanline,
+			       uint32_t *min, uint32_t *max, const int count)
+{
+	uint32_t dsl1, frm, frm1, ts, ts1;
+	bool field1;
+	int i[2] = {};
+
+	ts = timestamp_reg(devid);
+	frm = PIPE_REG(pipe, PIPEAFRMTMSMTP);
+
+	while (!quit) {
+		dsl1 = wait_scanline(pipe, target_scanline, &field1);
+
+		frm1 = read_reg(frm);
+		ts1 = read_reg(ts);
+
+		field1 = dsl1 & 0x80000000;
+		dsl1 &= ~0x80000000;
+
+		min[field1*count+i[field1]] = dsl1;
+		max[field1*count+i[field1]] = ts1 - frm1;
+		if (++i[field1] >= count)
+			break;
+	}
+}
+
 static void poll_dsl_pan(uint32_t devid, int pipe, int target_scanline, int target_fuzz,
 			 uint32_t *min, uint32_t *max, const int count)
 {
@@ -1087,6 +1163,12 @@ static const char *test_name(enum test test, int pipe, int bit, bool test_pixel_
 	case TEST_FRAMECOUNT_G4X:
 		snprintf(str, sizeof str, "%s / pipe %c / Frame count (g4x+)", type, pipe_name(pipe));
 		return str;
+	case TEST_FRAMETIMESTAMP:
+		snprintf(str, sizeof str, "%s / pipe %c / Frame timestamp", type, pipe_name(pipe));
+		return str;
+	case TEST_TIMESTAMP:
+		snprintf(str, sizeof str, "%s / pipe %c / Timestamp", type, pipe_name(pipe));
+		return str;
 	case TEST_FLIPCOUNT:
 		snprintf(str, sizeof str, "%s / pipe %c / Flip count (g4x+)", type, pipe_name(pipe));
 		return str;
@@ -1119,7 +1201,7 @@ static const char *test_name(enum test test, int pipe, int bit, bool test_pixel_
 static void __attribute__((noreturn)) usage(const char *name)
 {
 	fprintf(stderr, "Usage: %s [options]\n"
-		" -t,--test <pipestat|iir|framecount|flipcount|pan|flip|flipdone|surflive|wrap|field>\n"
+		" -t,--test <pipestat|iir|framecount|flipcount|frametimestamp|timestamp|pan|flip|flipdone|surflive|wrap|field>\n"
 		" -p,--pipe <pipe>\n"
 		" -b,--bit <bit>\n"
 		" -l,--line <target scanline/pixel>\n"
@@ -1170,6 +1252,10 @@ int main(int argc, char *argv[])
 				test = TEST_FRAMECOUNT;
 			else if (!strcmp(optarg, "flipcount"))
 				test = TEST_FLIPCOUNT;
+			else if (!strcmp(optarg, "frametimestamp"))
+				test = TEST_FRAMETIMESTAMP;
+			else if (!strcmp(optarg, "timestamp"))
+				test = TEST_TIMESTAMP;
 			else if (!strcmp(optarg, "pan"))
 				test = TEST_PAN;
 			else if (!strcmp(optarg, "flip"))
@@ -1318,6 +1404,11 @@ int main(int argc, char *argv[])
 		case TEST_WRAP:
 		case TEST_FIELD:
 			break;
+		case TEST_FRAMETIMESTAMP:
+		case TEST_TIMESTAMP:
+			if (!IS_G4X(devid))
+				usage(argv[0]);
+			break;
 		default:
 			usage(argv[0]);
 		}
@@ -1348,6 +1439,8 @@ int main(int argc, char *argv[])
 		case TEST_SURFLIVE:
 		case TEST_WRAP:
 		case TEST_FIELD:
+		case TEST_TIMESTAMP:
+		case TEST_FRAMETIMESTAMP:
 			break;
 		default:
 			usage(argv[0]);
@@ -1403,6 +1496,14 @@ int main(int argc, char *argv[])
 		assert(!test_pixelcount);
 		poll_dsl_framecount_g4x(pipe, min, max, count);
 		break;
+	case TEST_FRAMETIMESTAMP:
+		assert(!test_pixelcount);
+		poll_dsl_frametimestamp(devid, pipe, min, max, count);
+		break;
+	case TEST_TIMESTAMP:
+		assert(!test_pixelcount);
+		poll_dsl_timestamp(devid, pipe, target_scanline, min, max, count);
+		break;
 	case TEST_FLIPCOUNT:
 		assert(!test_pixelcount);
 		poll_dsl_flipcount_g4x(devid, pipe, min, max, count);
-- 
2.26.2

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

  parent reply	other threads:[~2020-12-17 16:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17 16:26 [igt-dev] [PATCH i-g-t 00/14] tools/intel_display_poller: async flip and vrr Ville Syrjala
2020-12-17 16:26 ` [igt-dev] [PATCH i-g-t 01/14] tools/intel_display_poller: Fix TILEOFF vs. LINOFF for skl+ Ville Syrjala
2020-12-17 16:26 ` [igt-dev] [PATCH i-g-t 02/14] tools/intel_display_poller: Unify ilk+ and bdw+ codepaths Ville Syrjala
2020-12-17 16:26 ` [igt-dev] [PATCH i-g-t 03/14] tools/intel_display_poller: Use intel_gen() Ville Syrjala
2020-12-17 16:26 ` [igt-dev] [PATCH i-g-t 04/14] tools/intel_display_poller: Add pipe D support Ville Syrjala
2020-12-17 16:26 ` [igt-dev] [PATCH i-g-t 05/14] tools/intel_display_poller: Add flipdone tests Ville Syrjala
2020-12-17 16:26 ` [igt-dev] [PATCH i-g-t 06/14] tools/intel_display_poller: Add async flip test mode Ville Syrjala
2020-12-17 16:26 ` [igt-dev] [PATCH i-g-t 07/14] lib: Add transcoder VRR registers Ville Syrjala
2020-12-17 16:26 ` [igt-dev] [PATCH i-g-t 08/14] lib: Add timestmap registers Ville Syrjala
2020-12-17 16:26 ` [igt-dev] [PATCH i-g-t 09/14] tools/intel_display_poller: Extract wait_scanline() Ville Syrjala
2020-12-17 16:26 ` Ville Syrjala [this message]
2020-12-17 16:27 ` [igt-dev] [PATCH i-g-t 11/14] tools/intel_display_poller: Rework some loops Ville Syrjala
2020-12-17 16:27 ` [igt-dev] [PATCH i-g-t 12/14] tools/intel_display_poller: Add VRR push support Ville Syrjala
2020-12-17 16:27 ` [igt-dev] [PATCH i-g-t 13/14] tools/intel_display_poller: Add vrr-wrap test Ville Syrjala
2020-12-17 16:27 ` [igt-dev] [PATCH i-g-t 14/14] tools/intel_display_poller: Add vrr-push test Ville Syrjala
2020-12-17 18:10 ` [igt-dev] ✗ Fi.CI.BAT: failure for tools/intel_display_poller: async flip and vrr Patchwork
2021-03-01 20:37 [igt-dev] [PATCH i-g-t 00/14] " Manasi Navare
2021-03-01 20:37 ` [igt-dev] [PATCH i-g-t 10/14] tools/intel_display_poller: Add frame timestamp tests Manasi Navare
2021-04-08 18:30   ` Navare, Manasi

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=20201217162703.20779-11-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 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.