Mesa (master): r300g: extend and clean up debug logging

Marek Olšák mareko at kemper.freedesktop.org
Mon Jul 12 23:35:50 UTC 2010


Module: Mesa
Branch: master
Commit: 50db6dba65560c1fb598d495d7d4103019bbbea5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=50db6dba65560c1fb598d495d7d4103019bbbea5

Author: Marek Olšák <maraeo at gmail.com>
Date:   Tue Jul 13 00:47:39 2010 +0200

r300g: extend and clean up debug logging

---

 src/gallium/drivers/r300/r300_debug.c         |    9 ++++++---
 src/gallium/drivers/r300/r300_emit.c          |    6 +++---
 src/gallium/drivers/r300/r300_render.c        |    6 ++++--
 src/gallium/drivers/r300/r300_screen.h        |    6 ++++--
 src/gallium/drivers/r300/r300_state_derived.c |   13 ++++++-------
 5 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c
index a6cd86e..31d4e14 100644
--- a/src/gallium/drivers/r300/r300_debug.c
+++ b/src/gallium/drivers/r300/r300_debug.c
@@ -29,17 +29,20 @@
 static const struct debug_named_value debug_options[] = {
     { "fp", DBG_FP, "Fragment program handling (for debugging)" },
     { "vp", DBG_VP, "Vertex program handling (for debugging)" },
-    { "draw", DBG_DRAW, "Draw and emit (for debugging)" },
+    { "draw", DBG_DRAW, "Draw calls (for debugging)" },
+    { "swtcl", DBG_SWTCL, "SWTCL-specific info (for debugging)" },
+    { "rsblock", DBG_RS_BLOCK, "Rasterizer registers (for debugging)" },
+    { "psc", DBG_PSC, "Vertex stream registers (for debugging)" },
     { "tex", DBG_TEX, "Textures (for debugging)" },
     { "texalloc", DBG_TEXALLOC, "Texture allocation (for debugging)" },
     { "fall", DBG_FALL, "Fallbacks (for debugging)" },
     { "rs", DBG_RS, "Rasterizer (for debugging)" },
     { "fb", DBG_FB, "Framebuffer (for debugging)" },
+    { "fakeocc", DBG_FAKE_OCC, "Use fake occlusion queries (for debugging)" },
     { "anisohq", DBG_ANISOHQ, "High quality anisotropic filtering (for benchmarking)" },
     { "notiling", DBG_NO_TILING, "Disable tiling (for benchmarking)" },
     { "noimmd", DBG_NO_IMMD, "Disable immediate mode (for benchmarking)" },
-    { "fakeocc", DBG_FAKE_OCC, "Use fake occlusion queries (for lulz)" },
-    { "stats", DBG_STATS, "Gather statistics (for lulz)" },
+    { "stats", DBG_STATS, "Gather statistics" },
 
     /* must be last */
     DEBUG_NAMED_VALUE_END
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 59a3cea..daae6dd 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -638,7 +638,7 @@ void r300_emit_rs_block_state(struct r300_context* r300,
     unsigned count = (rs->inst_count & R300_RS_INST_COUNT_MASK) + 1;
     CS_LOCALS(r300);
 
-    if (SCREEN_DBG_ON(r300->screen, DBG_DRAW)) {
+    if (DBG_ON(r300, DBG_RS_BLOCK)) {
         r500_dump_rs_block(rs);
 
         fprintf(stderr, "r300: RS emit:\n");
@@ -783,7 +783,7 @@ void r300_emit_aos_swtcl(struct r300_context *r300, boolean indexed)
 {
     CS_LOCALS(r300);
 
-    DBG(r300, DBG_DRAW, "r300: Preparing vertex buffer %p for render, "
+    DBG(r300, DBG_SWTCL, "r300: Preparing vertex buffer %p for render, "
             "vertex size %d\n", r300->vbo,
             r300->vertex_info.size);
     /* Set the pointer to our vertex buffer. The emitted values are this:
@@ -811,7 +811,7 @@ void r300_emit_vertex_stream_state(struct r300_context* r300,
     unsigned i;
     CS_LOCALS(r300);
 
-    if (DBG_ON(r300, DBG_DRAW)) {
+    if (DBG_ON(r300, DBG_PSC)) {
         fprintf(stderr, "r300: PSC emit:\n");
 
         for (i = 0; i < streams->count; i++) {
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index cf80692..970cb68 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -870,13 +870,12 @@ static void r300_render_draw_arrays(struct vbuf_render* render,
     unsigned dwords = 6;
 
     CS_LOCALS(r300);
-
     (void) i; (void) ptr;
 
     r300_prepare_for_rendering(r300, PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
                                NULL, dwords, 0, 0, NULL);
 
-    DBG(r300, DBG_DRAW, "r300: Doing vbuf render, count %d\n", count);
+    DBG(r300, DBG_DRAW, "r300: render_draw_arrays (count: %d)\n", count);
 
     /* Uncomment to dump all VBOs rendered through this interface.
      * Slow and noisy!
@@ -919,6 +918,7 @@ static void r300_render_draw_elements(struct vbuf_render* render,
     unsigned free_dwords;
 
     CS_LOCALS(r300);
+    DBG(r300, DBG_DRAW, "r300: render_draw_elements (count: %d)\n", count);
 
     /* Reserve at least 256 dwords.
      *
@@ -1052,6 +1052,8 @@ static void r300_blitter_draw_rectangle(struct blitter_context *blitter,
 
     r300_prepare_for_rendering(r300, PREP_FIRST_DRAW, NULL, dwords, 0, 0, NULL);
 
+    DBG(r300, DBG_DRAW, "r300: draw_rectangle\n");
+
     BEGIN_CS_AS_CB(r300, dwords);
     /* Set up GA. */
     OUT_CB_REG(R300_GA_POINT_SIZE, (height * 6) | ((width * 6) << 16));
diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h
index 29cd5db..c6b4b57 100644
--- a/src/gallium/drivers/r300/r300_screen.h
+++ b/src/gallium/drivers/r300/r300_screen.h
@@ -61,17 +61,19 @@ static INLINE struct r300_screen* r300_screen(struct pipe_screen* screen) {
  * those changes.
  */
 /*@{*/
-#define DBG_HELP        (1 << 0)
+
 /* Logging. */
+#define DBG_PSC         (1 << 0)
 #define DBG_FP          (1 << 1)
 #define DBG_VP          (1 << 2)
-/* The bit (1 << 3) is unused. */
+#define DBG_SWTCL       (1 << 3)
 #define DBG_DRAW        (1 << 4)
 #define DBG_TEX         (1 << 5)
 #define DBG_TEXALLOC    (1 << 6)
 #define DBG_RS          (1 << 7)
 #define DBG_FALL        (1 << 8)
 #define DBG_FB          (1 << 9)
+#define DBG_RS_BLOCK    (1 << 10)
 /* Features. */
 #define DBG_ANISOHQ     (1 << 16)
 #define DBG_NO_TILING   (1 << 17)
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 3760ff2..2ef9766 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -119,7 +119,7 @@ static void r300_draw_emit_all_attribs(struct r300_context* r300)
 
     /* WPOS. */
     if (r300_fs(r300)->shader->inputs.wpos != ATTR_UNUSED && gen_count < 8) {
-        DBG(r300, DBG_DRAW, "draw_emit_attrib: WPOS, index: %i\n",
+        DBG(r300, DBG_SWTCL, "draw_emit_attrib: WPOS, index: %i\n",
             vs_outputs->wpos);
         r300_draw_emit_attrib(r300, EMIT_4F, INTERP_PERSPECTIVE,
                               vs_outputs->wpos);
@@ -141,13 +141,8 @@ static void r300_swtcl_vertex_psc(struct r300_context *r300)
     /* For each Draw attribute, route it to the fragment shader according
      * to the vs_output_tab. */
     attrib_count = vinfo->num_attribs;
-    DBG(r300, DBG_DRAW, "r300: attrib count: %d\n", attrib_count);
+    DBG(r300, DBG_SWTCL, "r300: attrib count: %d\n", attrib_count);
     for (i = 0; i < attrib_count; i++) {
-        DBG(r300, DBG_DRAW, "r300: attrib: index %d, interp %d, emit %d,"
-               " vs_output_tab %d\n", vinfo->attrib[i].src_index,
-               vinfo->attrib[i].interp_mode, vinfo->attrib[i].emit,
-               vs_output_tab[i]);
-
         if (vs_output_tab[i] == -1) {
             assert(0);
             abort();
@@ -155,6 +150,10 @@ static void r300_swtcl_vertex_psc(struct r300_context *r300)
 
         format = draw_translate_vinfo_format(vinfo->attrib[i].emit);
 
+        DBG(r300, DBG_SWTCL,
+            "r300: swtcl_vertex_psc [%i] <- %s\n",
+            vs_output_tab[i], util_format_short_name(format));
+
         /* Obtain the type of data in this attribute. */
         type = r300_translate_vertex_data_type(format);
         if (type == R300_INVALID_FORMAT) {




More information about the mesa-commit mailing list