Skip to contentSkip to conversation

intel: Add the ability to supply annotations for .aub files.

PATCH In review Paul Berry 2 participants 8 messages May 7, 2012 – May 10, 2012

lore
Share & tools
lore

Paul Berry

author
#0 lore raw

PATCH 1/2 intel: Add the ability to supply annotations for .aub files.

This patch adds a new function, drm_intel_bufmgr_gem_set_aub_annotations(), which can be used to annotate the type and subtype of data stored in various sections of each buffer. This data is used to populate type and subtype fields when generating the .aub file, which improves the ability of later debugging tools to analyze the contents of the .aub file.

If drm_intel_bufmgr_gem_set_aub_annotations() is not called, then we fall back to the old set of annotations (annotate the portion of the batchbuffer that is executed as AUB_TRACE_TYPE_BATCH, and everything else as AUB_TRACE_TYPE_NOTYPE).

---
 intel/intel_bufmgr.h     |   10 +++
 intel/intel_bufmgr_gem.c |  137 +++++++++++++++++++++++++++++++++++++--------
 2 files changed, 122 insertions(+), 25 deletions(-)
intel/intel_bufmgr.h +10 -0
index 45389e1..c804a4c 100644
@@ -92,6 +92,12 @@ enum aub_dump_bmp_format {
 	AUB_DUMP_BMP_FORMAT_ARGB_8888 = 7,
 };
 
+typedef struct _drm_intel_aub_annotation {
+        uint32_t type;
+        uint32_t subtype;
+        uint32_t ending_offset;
+} drm_intel_aub_annotation;
+
 #define BO_ALLOC_FOR_RENDER (1<<0)
 
 drm_intel_bo *drm_intel_bo_alloc(drm_intel_bufmgr *bufmgr, const char *name,
@@ -169,6 +175,10 @@ void drm_intel_gem_bo_aub_dump_bmp(drm_intel_bo *bo,
 				   int x1, int y1, int width, int height,
 				   enum aub_dump_bmp_format format,
 				   int pitch, int offset);
+void
+drm_intel_bufmgr_gem_set_aub_annotations(drm_intel_bo *bo,
+                                         drm_intel_aub_annotation *annotations,
+                                         unsigned count);
 
 int drm_intel_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, int crtc_id);
 
intel/intel_bufmgr_gem.c +112 -25

186 lines not on this page · raw message

Signature · 1 line
1.7.7.6
author
#1 lore raw

PATCH 2/2 configure: Bump version for 2.4.34.

---
 configure.ac |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure.ac +1 -1
index 6a1d98e..538d0d8 100644
@@ -20,7 +20,7 @@
 
 AC_PREREQ([2.63])
 AC_INIT([libdrm],
-        [2.4.33],
+        [2.4.34],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI],
         [libdrm])
 
Signature · 1 line
1.7.7.6
#2 lore raw

Re: [PATCH 2/2] configure: Bump version for 2.4.34.

Quoted 9 lines · Paul Berry
---
 configure.ac |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure.ac +0 -0
index 6a1d98e..538d0d8 100644

configure.ac line 25

Quoted 7 lines
configure.ac +1 -1
@@ -20,7 +20,7 @@
 
 AC_PREREQ([2.63])
 AC_INIT([libdrm],
-        [2.4.33],
+        [2.4.34],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI],
         [libdrm])

Note: so far, we push version bump commits simultaneous with doing the release. Planning on taking doing that?

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#3 lore raw

Re: [PATCH 2/2] configure: Bump version for 2.4.34.

Quoted 12 lines · Eric Anholt
Quoted 10 lines · Paul Berry
---
 configure.ac |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure.ac +0 -0
index 6a1d98e..538d0d8 100644
@@ -20,7 +20,7 @@
 
Quoted 10 lines

configure.ac line 25

Quoted 6 lines
configure.ac +1 -1
 AC_PREREQ([2.63])
 AC_INIT([libdrm],
-        [2.4.33],
+        [2.4.34],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI],
         [libdrm])

Note: so far, we push version bump commits simultaneous with doing the release. Planning on taking doing that?

I've never done a release of drm. What's the procedure?

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [PATCH 2/2] configure: Bump version for 2.4.34.

Quoted 25 lines · Paul Berry
Quoted 12 lines · Eric Anholt
Quoted 10 lines · Paul Berry
---
 configure.ac |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure.ac +0 -0
index 6a1d98e..538d0d8 100644
@@ -20,7 +20,7 @@
 
Quoted 10 lines

configure.ac line 25

Quoted 6 lines
configure.ac +1 -1
 AC_PREREQ([2.63])
 AC_INIT([libdrm],
-        [2.4.33],
+        [2.4.34],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI],
         [libdrm])

Note: so far, we push version bump commits simultaneous with doing the release. Planning on taking doing that?

Quoted 1 line

I've never done a release of drm. What's the procedure?

There's a RELEASING file at the top level.

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
In reply to Paul Berry
Quoted 11 lines · Paul Berry

This patch adds a new function, drm_intel_bufmgr_gem_set_aub_annotations(), which can be used to annotate the type and subtype of data stored in various sections of each buffer. This data is used to populate type and subtype fields when generating the .aub file, which improves the ability of later debugging tools to analyze the contents of the .aub file.

If drm_intel_bufmgr_gem_set_aub_annotations() is not called, then we fall back to the old set of annotations (annotate the portion of the batchbuffer that is executed as AUB_TRACE_TYPE_BATCH, and everything else as AUB_TRACE_TYPE_NOTYPE).

This looks better than the interface I was thinking of. Only real nitpick note is that the style in this file is tab indents, rather than 8 spaces, same as linux kernel and 2d driver style. (I have since been convinced that 8 spaces is superior, but a mix is worse).

Quoted 14 lines

/*

intel/intel_bufmgr_gem.c +1 -4
@@ -1989,23 +2027,31 @@ aub_exec(drm_intel_bo *bo, int ring_flag, int used)
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
 	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
 	int i;
+        bool batch_buffer_needs_annotations;
 
 	if (!bufmgr_gem->aub_file)
 		return;
 
-	/* Write out all but the batchbuffer to AUB memory */
-	for (i = 0; i < bufmgr_gem->exec_count - 1; i++) {
-		if (bufmgr_gem->exec_bos[i] != bo)
-			aub_write_bo(bufmgr_gem->exec_bos[i]);

intel/intel_bufmgr_gem.c aub_exec(drm_intel_bo *bo, int ring_flag, int used) · line 2044

Quoted 10 lines
intel/intel_bufmgr_gem.c +10 -0
+        /* If batch buffer is not annotated, annotate it the best we
+         * can.
+         */
+        batch_buffer_needs_annotations = bo_gem->aub_annotation_count == 0;
+        if (batch_buffer_needs_annotations) {
+                drm_intel_aub_annotation annotations[2] = {
+                        { AUB_TRACE_TYPE_BATCH, 0, used },
+                        { AUB_TRACE_TYPE_NOTYPE, 0, bo->size }
+                };
+                drm_intel_bufmgr_gem_set_aub_annotations(bo, annotations, 2);

Looks like you don't actually need to be explicit about the range from used to bo->size given the "Write out any remaining unannotated data" code above, but either way.

Assuming tab replacement: Reviewed-by: Eric Anholt <[email protected]>

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#6 lore raw
Quoted 14 lines · Eric Anholt
Quoted 11 lines · Paul Berry

This patch adds a new function, drm_intel_bufmgr_gem_set_aub_annotations(), which can be used to annotate the type and subtype of data stored in various sections of each buffer. This data is used to populate type and subtype fields when generating the .aub file, which improves the ability of later debugging tools to analyze the contents of the .aub file.

If drm_intel_bufmgr_gem_set_aub_annotations() is not called, then we fall back to the old set of annotations (annotate the portion of the batchbuffer that is executed as AUB_TRACE_TYPE_BATCH, and everything else as AUB_TRACE_TYPE_NOTYPE).

Quoted 5 lines

This looks better than the interface I was thinking of. Only real nitpick note is that the style in this file is tab indents, rather than 8 spaces, same as linux kernel and 2d driver style. (I have since been convinced that 8 spaces is superior, but a mix is worse).

Ok. Are there any plans to switch drm over to spaces or are we stuck with tabs forever?

Quoted 28 lines

Review aub_exec(drm_intel_bo *bo, int ring_flag, int

Quoted 3 lines

/*

(quoted diff) +0 -0
@@ -1989,23 +2027,31 @@ aub_exec(drm_intel_bo *bo, int ring_flag, int

used)

Review aub_exec(drm_intel_bo *bo, int ring_flag, int · line 2027

Quoted 1 line
(quoted diff) +0 -0
      drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)

bo->bufmgr;

Quoted 5 lines
intel/intel_bufmgr_gem.c +1 -0
      drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
      int i;
+        bool batch_buffer_needs_annotations;
 
      if (!bufmgr_gem->aub_file)

intel/intel_bufmgr_gem.c aub_exec(drm_intel_bo *bo, int ring_flag, int used)

Quoted 10 lines
intel/intel_bufmgr_gem.c +4 -4
              return;
 
-     /* Write out all but the batchbuffer to AUB memory */
-     for (i = 0; i < bufmgr_gem->exec_count - 1; i++) {
-             if (bufmgr_gem->exec_bos[i] != bo)
-                     aub_write_bo(bufmgr_gem->exec_bos[i]);
+        /* If batch buffer is not annotated, annotate it the best we
+         * can.
+         */
+        batch_buffer_needs_annotations = bo_gem->aub_annotation_count

== 0;

intel/intel_bufmgr_gem.c aub_exec(drm_intel_bo *bo, int ring_flag, int used)

Quoted 6 lines
intel/intel_bufmgr_gem.c +6 -0
+        if (batch_buffer_needs_annotations) {
+                drm_intel_aub_annotation annotations[2] = {
+                        { AUB_TRACE_TYPE_BATCH, 0, used },
+                        { AUB_TRACE_TYPE_NOTYPE, 0, bo->size }
+                };
+                drm_intel_bufmgr_gem_set_aub_annotations(bo,
Quoted 6 lines

annotations, 2);

Looks like you don't actually need to be explicit about the range from used to bo->size given the "Write out any remaining unannotated data" code above, but either way.

Fair point. I think I will leave the code as is just to avoid having to do another round of testing :)

Quoted 3 lines

Assuming tab replacement: Reviewed-by: Eric Anholt <[email protected]>

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw
Quoted 16 lines · Paul Berry
Quoted 14 lines · Eric Anholt
Quoted 11 lines · Paul Berry

This patch adds a new function, drm_intel_bufmgr_gem_set_aub_annotations(), which can be used to annotate the type and subtype of data stored in various sections of each buffer. This data is used to populate type and subtype fields when generating the .aub file, which improves the ability of later debugging tools to analyze the contents of the .aub file.

If drm_intel_bufmgr_gem_set_aub_annotations() is not called, then we fall back to the old set of annotations (annotate the portion of the batchbuffer that is executed as AUB_TRACE_TYPE_BATCH, and everything else as AUB_TRACE_TYPE_NOTYPE).

Quoted 8 lines
Quoted 5 lines

This looks better than the interface I was thinking of. Only real nitpick note is that the style in this file is tab indents, rather than 8 spaces, same as linux kernel and 2d driver style. (I have since been convinced that 8 spaces is superior, but a mix is worse).

Ok. Are there any plans to switch drm over to spaces or are we stuck with tabs forever?

Our project as a whole includes work on the linux kernel, and most people working on libdrm are also working on the kernel. As far as I'm concerned, having a different style between them would be worse than the minor benefit of having diffs look nicer.

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx