public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Arun Siluvery <arun.siluvery@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 2/2] igt/gem_workarounds: rework igt to test workaround registers
Date: Mon,  1 Sep 2014 14:29:47 +0100	[thread overview]
Message-ID: <1409578187-2909-3-git-send-email-arun.siluvery@linux.intel.com> (raw)
In-Reply-To: <1409578187-2909-1-git-send-email-arun.siluvery@linux.intel.com>

kernel patch that exports w/a data to debugfs is reworked so
update igt accordingly.

Address review comments from Damien.
- if kernel is not exposing w/a data instead of failing just skip instead.
- if the platform is not exposing w/a table then no of workarounds
applied are 0; we can use this data to skip platform checks.

Signed-off-by: Arun Siluvery <arun.siluvery@linux.intel.com>
---
 tests/gem_workarounds.c | 44 +++++++++++++++++++++++---------------------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/tests/gem_workarounds.c b/tests/gem_workarounds.c
index 32156d2..fae4382 100644
--- a/tests/gem_workarounds.c
+++ b/tests/gem_workarounds.c
@@ -62,7 +62,7 @@ int drm_fd;
 uint32_t devid;
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
-int num_wa_regs;
+int num_wa_regs = 0;
 struct intel_wa_reg *wa_regs;
 
 
@@ -153,7 +153,7 @@ static void check_workarounds(enum operation op, int num)
 	igt_info("Address\tbefore\t\tafter\t\tw/a mask\tresult\n");
 	for (i = 0; i < num; ++i) {
 		status = (current_wa[i].value & current_wa[i].mask) !=
-			(wa_regs[i].value & wa_regs[i].mask);
+			wa_regs[i].mask;
 		if (status)
 			++fail_count;
 
@@ -171,21 +171,15 @@ out:
 igt_main
 {
 	igt_fixture {
-		int i;
 		int fd;
 		int ret;
 		FILE *file;
 		char *line = NULL;
 		size_t line_size;
 
-		drm_fd = drm_open_any();
-
-		bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
-		devid = intel_get_drm_devid(drm_fd);
-		batch = intel_batchbuffer_alloc(bufmgr, devid);
-
 		fd = igt_debugfs_open("i915_wa_registers", O_RDONLY);
-		igt_assert(fd >= 0);
+		if (fd < 0)
+			igt_skip_on("No Workaround table available !!\n");
 
 		file = fdopen(fd, "r");
 		igt_assert(file > 0);
@@ -193,32 +187,40 @@ igt_main
 		ret = getline(&line, &line_size, file);
 		igt_assert(ret > 0);
 		sscanf(line, "Workarounds applied: %d", &num_wa_regs);
-		igt_assert(num_wa_regs > 0);
 
-		wa_regs = malloc(num_wa_regs * sizeof(*wa_regs));
+		if (num_wa_regs) {
+			int i = 0;
 
-		i = 0;
-		while(getline(&line, &line_size, file) > 0) {
-			sscanf(line, "0x%X: 0x%08X, mask: 0x%08X",
-			       &wa_regs[i].addr, &wa_regs[i].value,
-			       &wa_regs[i].mask);
-			++i;
-		}
+			wa_regs = malloc(num_wa_regs * sizeof(*wa_regs));
+			while (getline(&line, &line_size, file) > 0) {
+				sscanf(line, "0x%X: 0x%08X, mask: 0x%08X",
+				       &wa_regs[i].addr, &wa_regs[i].value,
+				       &wa_regs[i].mask);
+				++i;
+			}
+		} else
+			igt_info("No workarounds exported\n");
 
 		free(line);
 		fclose(file);
 		close(fd);
+
+		drm_fd = drm_open_any();
+
+		bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
+		devid = intel_get_drm_devid(drm_fd);
+		batch = intel_batchbuffer_alloc(bufmgr, devid);
 	}
 
 	igt_subtest("check-workaround-data-after-reset") {
-		if (IS_BROADWELL(devid))
+		if (num_wa_regs)
 			check_workarounds(GPU_RESET, num_wa_regs);
 		else
 			igt_skip_on("No Workaround table available!!\n");
 	}
 
 	igt_subtest("check-workaround-data-after-suspend-resume") {
-		if (IS_BROADWELL(devid))
+		if (num_wa_regs)
 			check_workarounds(SUSPEND_RESUME, num_wa_regs);
 		else
 			igt_skip_on("No Workaround table available!!\n");
-- 
2.0.4

  parent reply	other threads:[~2014-09-01 13:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-01 13:29 [PATCH 0/2] Rework workaround igt Arun Siluvery
2014-09-01 13:29 ` [PATCH 1/2] gem_workarounds: intel_wa_registers is now prefixed with i915 Arun Siluvery
2014-09-01 13:29 ` Arun Siluvery [this message]
2014-09-01 14:12   ` [PATCH 2/2] igt/gem_workarounds: rework igt to test workaround registers Damien Lespiau
2014-09-02  9:18   ` [PATCH v2] " Arun Siluvery
2014-09-02  9:59     ` Damien Lespiau
2014-09-02 11:04       ` Daniel Vetter
2014-09-02 11:12         ` Chris Wilson
2014-09-02 13:22           ` Daniel Vetter

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=1409578187-2909-3-git-send-email-arun.siluvery@linux.intel.com \
    --to=arun.siluvery@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox