diff mbox

[1/3] tests/gem_reset_stats: add support for BDW+

Message ID 1384959497-25533-1-git-send-email-mika.kuoppala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala Nov. 20, 2013, 2:58 p.m. UTC
For BDW+, there BATCH_BUFFER_START is 3 * 32bits in length and
length needs to be encoded into the opcode.

Suggested-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 tests/gem_reset_stats.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
index 07dfac4..a7497f3 100644
--- a/tests/gem_reset_stats.c
+++ b/tests/gem_reset_stats.c
@@ -202,9 +202,13 @@  static int inject_hang(int fd, int ctx)
 	uint64_t gtt_off;
 	uint32_t *buf;
 	int roff, i;
+	unsigned cmd_len = 2;
 
 	srandom(time(NULL));
 
+	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
+		cmd_len = 3;
+
 	buf = malloc(BUFSIZE);
 	igt_assert(buf != NULL);
 
@@ -240,9 +244,11 @@  static int inject_hang(int fd, int ctx)
 	for (i = 0; i < ITEMS; i++)
 		buf[i] = MI_NOOP;
 
-	roff = random() % (ITEMS - 2);
-	buf[roff] = MI_BATCH_BUFFER_START;
-	buf[roff + 1] = gtt_off + (roff << 2);
+	roff = random() % (ITEMS - cmd_len);
+	buf[roff] = MI_BATCH_BUFFER_START | (cmd_len - 2);
+	buf[roff + 1] = (gtt_off & 0xfffffffc) + (roff << 2);
+	if (cmd_len == 3)
+		buf[roff + 2] = gtt_off & 0xffffffff00000000ull;
 
 #ifdef VERBOSE
 	printf("loop injected at 0x%lx (off 0x%x, bo_start 0x%lx, bo_end 0x%lx)\n",