Mesa (master): r300g: cleanup texture debug logging

Marek Olšák mareko at kemper.freedesktop.org
Sun Jul 25 09:07:30 UTC 2010


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sat Jul 24 03:17:32 2010 +0200

r300g: cleanup texture debug logging

---

 src/gallium/drivers/r300/r300_debug.c   |    1 +
 src/gallium/drivers/r300/r300_screen.h  |    1 +
 src/gallium/drivers/r300/r300_texture.c |   41 +++++++++++++++++-------------
 3 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c
index 31d4e14..053a64e 100644
--- a/src/gallium/drivers/r300/r300_debug.c
+++ b/src/gallium/drivers/r300/r300_debug.c
@@ -38,6 +38,7 @@ static const struct debug_named_value debug_options[] = {
     { "fall", DBG_FALL, "Fallbacks (for debugging)" },
     { "rs", DBG_RS, "Rasterizer (for debugging)" },
     { "fb", DBG_FB, "Framebuffer (for debugging)" },
+    { "cbzb", DBG_CBZB, "Fast color clear info (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)" },
diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h
index edc494f..18745b8 100644
--- a/src/gallium/drivers/r300/r300_screen.h
+++ b/src/gallium/drivers/r300/r300_screen.h
@@ -90,6 +90,7 @@ r300_winsys_screen(struct pipe_screen *screen) {
 #define DBG_FALL        (1 << 8)
 #define DBG_FB          (1 << 9)
 #define DBG_RS_BLOCK    (1 << 10)
+#define DBG_CBZB        (1 << 11)
 /* Features. */
 #define DBG_ANISOHQ     (1 << 16)
 #define DBG_NO_TILING   (1 << 17)
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index f7c167d..176fa76 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -958,6 +958,21 @@ struct u_resource_vtbl r300_texture_vtbl =
    u_default_transfer_inline_write    /* transfer_inline_write */
 };
 
+static void r300_tex_print_info(struct r300_screen *rscreen, struct r300_texture *tex,
+                                const char *func)
+{
+    fprintf(stderr,
+            "r300: %s: Macro: %s, Micro: %s, Pitch: %i, Dim: %ix%ix%i, "
+            "LastLevel: %i, Size: %i, Format: %s\n",
+            func,
+            tex->macrotile ? "YES" : " NO",
+            tex->microtile ? "YES" : " NO",
+            tex->hwpitch[0],
+            tex->b.b.width0, tex->b.b.height0, tex->b.b.depth0,
+            tex->b.b.last_level, tex->size,
+            util_format_short_name(tex->b.b.format));
+}
+
 /* Create a new texture. */
 struct pipe_resource* r300_texture_create(struct pipe_screen* screen,
                                           const struct pipe_resource* base)
@@ -997,15 +1012,9 @@ struct pipe_resource* r300_texture_create(struct pipe_screen* screen,
     r300_texture_setup_immutable_state(rscreen, tex);
     r300_texture_setup_fb_state(rscreen, tex);
 
-    SCREEN_DBG(rscreen, DBG_TEX,
-               "r300: texture_create: Macro: %s, Micro: %s, Pitch: %i, "
-               "Dim: %ix%ix%i, LastLevel: %i, Size: %i, Format: %s\n",
-               tex->macrotile ? "YES" : " NO",
-               tex->microtile ? "YES" : " NO",
-               tex->hwpitch[0],
-               base->width0, base->height0, base->depth0, base->last_level,
-               tex->size,
-               util_format_short_name(base->format));
+    if (SCREEN_DBG_ON(rscreen, DBG_TEX)) {
+        r300_tex_print_info(rscreen, tex, "texture_create");
+    }
 
     tex->domain = base->flags & R300_RESOURCE_FLAG_TRANSFER ?
                   R300_DOMAIN_GTT :
@@ -1084,7 +1093,7 @@ struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
         else
             surface->cbzb_format = R300_DEPTHFORMAT_16BIT_INT_Z;
 
-        SCREEN_DBG(r300_screen(screen), DBG_TEX,
+        SCREEN_DBG(r300_screen(screen), DBG_CBZB,
                    "CBZB Dim: %ix%i, Misalignment: %i, Macro: %s\n",
                    surface->cbzb_width, surface->cbzb_height,
                    offset & 2047,
@@ -1144,14 +1153,6 @@ r300_texture_from_handle(struct pipe_screen* screen,
 
     rws->buffer_get_tiling(rws, buffer, &tex->microtile, &tex->macrotile);
     r300_setup_flags(tex);
-    SCREEN_DBG(rscreen, DBG_TEX,
-               "r300: texture_from_handle: Macro: %s, Micro: %s, "
-               "Pitch: % 4i, Dim: %ix%i, Format: %s\n",
-               tex->macrotile ? "YES" : " NO",
-               tex->microtile ? "YES" : " NO",
-               stride / util_format_get_blocksize(base->format),
-               base->width0, base->height0,
-               util_format_short_name(base->format));
 
     /* Enforce microtiled zbuffer. */
     override_zb_flags = util_format_is_depth_or_stencil(base->format) &&
@@ -1184,5 +1185,9 @@ r300_texture_from_handle(struct pipe_screen* screen,
                 tex->microtile, tex->macrotile,
                 tex->pitch[0] * util_format_get_blocksize(tex->b.b.format));
     }
+
+    if (SCREEN_DBG_ON(rscreen, DBG_TEX))
+        r300_tex_print_info(rscreen, tex, "texture_from_handle");
+
     return (struct pipe_resource*)tex;
 }




More information about the mesa-commit mailing list