All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Ekstrand <jason@jlekstrand.net>
To: intel-gfx@lists.freedesktop.org
Cc: Jason Ekstrand <jason.ekstrand@intel.com>
Subject: [PATCH i-g-t 2/3] aubdump: Use write_reloc for filling out the ringbuffer
Date: Wed, 23 Aug 2017 10:14:45 -0700	[thread overview]
Message-ID: <1503508486-19432-3-git-send-email-jason.ekstrand@intel.com> (raw)
In-Reply-To: <1503508486-19432-1-git-send-email-jason.ekstrand@intel.com>

---
 tools/aubdump.c | 66 ++++++++++++++++++++++++++++-----------------------------
 1 file changed, 32 insertions(+), 34 deletions(-)

diff --git a/tools/aubdump.c b/tools/aubdump.c
index c14c9fa..567de3d 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -262,9 +262,36 @@ aub_write_trace_block(uint32_t type, void *virtual, uint32_t size, uint64_t gtt_
 }
 
 static void
+write_reloc(void *p, uint64_t v)
+{
+	if (gen >= 8) {
+		/* From the Broadwell PRM Vol. 2a,
+		 * MI_LOAD_REGISTER_MEM::MemoryAddress:
+		 *
+		 *	"This field specifies the address of the memory
+		 *	location where the register value specified in the
+		 *	DWord above will read from.  The address specifies
+		 *	the DWord location of the data. Range =
+		 *	GraphicsVirtualAddress[63:2] for a DWord register
+		 *	GraphicsAddress [63:48] are ignored by the HW and
+		 *	assumed to be in correct canonical form [63:48] ==
+		 *	[47]."
+		 *
+		 * In practice, this will always mean the top bits are zero
+		 * because of the GTT size limitation of the aubdump tool.
+		 */
+		const int shift = 63 - 47;
+		*(uint64_t *)p = (((int64_t)v) << shift) >> shift;
+	} else {
+		*(uint32_t *)p = v;
+	}
+}
+
+static void
 aub_dump_ringbuffer(uint64_t batch_offset, uint64_t offset, int ring_flag)
 {
 	uint32_t ringbuffer[4096];
+	unsigned aub_mi_bbs_len;
 	int ring = AUB_TRACE_TYPE_RING_PRB0; /* The default ring */
 	int ring_count = 0;
 
@@ -275,14 +302,11 @@ aub_dump_ringbuffer(uint64_t batch_offset, uint64_t offset, int ring_flag)
 
 	/* Make a ring buffer to execute our batchbuffer. */
 	memset(ringbuffer, 0, sizeof(ringbuffer));
-	if (gen >= 8) {
-		ringbuffer[ring_count++] = AUB_MI_BATCH_BUFFER_START | (3 - 2);
-		ringbuffer[ring_count++] = batch_offset;
-		ringbuffer[ring_count++] = batch_offset >> 32;
-	} else {
-		ringbuffer[ring_count++] = AUB_MI_BATCH_BUFFER_START;
-		ringbuffer[ring_count++] = batch_offset;
-	}
+
+	aub_mi_bbs_len = gen >= 8 ? 3 : 2;
+	ringbuffer[ring_count] = AUB_MI_BATCH_BUFFER_START | (aub_mi_bbs_len - 2);
+	write_reloc(&ringbuffer[ring_count + 1], batch_offset);
+	ring_count += aub_mi_bbs_len;
 
 	/* Write out the ring.  This appears to trigger execution of
 	 * the ring in the simulator.
@@ -299,32 +323,6 @@ aub_dump_ringbuffer(uint64_t batch_offset, uint64_t offset, int ring_flag)
 	data_out(ringbuffer, ring_count * 4);
 }
 
-static void
-write_reloc(void *p, uint64_t v)
-{
-	if (gen >= 8) {
-		/* From the Broadwell PRM Vol. 2a,
-		 * MI_LOAD_REGISTER_MEM::MemoryAddress:
-		 *
-		 *	"This field specifies the address of the memory
-		 *	location where the register value specified in the
-		 *	DWord above will read from.  The address specifies
-		 *	the DWord location of the data. Range =
-		 *	GraphicsVirtualAddress[63:2] for a DWord register
-		 *	GraphicsAddress [63:48] are ignored by the HW and
-		 *	assumed to be in correct canonical form [63:48] ==
-		 *	[47]."
-		 *
-		 * In practice, this will always mean the top bits are zero
-		 * because of the GTT size limitation of the aubdump tool.
-		 */
-		const int shift = 63 - 47;
-		*(uint64_t *)p = (((int64_t)v) << shift) >> shift;
-	} else {
-		*(uint32_t *)p = v;
-	}
-}
-
 static void *
 relocate_bo(struct bo *bo, const struct drm_i915_gem_execbuffer2 *execbuffer2,
 	    const struct drm_i915_gem_exec_object2 *obj)
-- 
2.5.0.400.gff86faf

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-08-23 17:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23 17:14 [PATCH i-g-t 0/3] aubdump: A few improvements Jason Ekstrand
2017-08-23 17:14 ` [PATCH i-g-t 1/3] aubdump: Reject execbuffer2 calls with bad BOs Jason Ekstrand
2017-08-23 20:28   ` Lionel Landwerlin
2017-08-23 17:14 ` Jason Ekstrand [this message]
2017-08-23 20:31   ` [PATCH i-g-t 2/3] aubdump: Use write_reloc for filling out the ringbuffer Lionel Landwerlin
2017-08-23 17:14 ` [PATCH i-g-t 3/3] aubdump: Log some information about the execbuf calls Jason Ekstrand
2017-08-23 18:00   ` Scott D Phillips
2017-08-23 17:33 ` ✗ Fi.CI.BAT: failure for aubdump: A few improvements Patchwork
2017-08-24 13:00 ` ✓ Fi.CI.BAT: success " Patchwork
2017-08-24 14:03 ` ✓ Fi.CI.IGT: " Patchwork

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=1503508486-19432-3-git-send-email-jason.ekstrand@intel.com \
    --to=jason@jlekstrand.net \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jason.ekstrand@intel.com \
    /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.