Mesa (master): vc4: Hook up VC4_DEBUG=perf to some useful printfs.

Eric Anholt anholt at kemper.freedesktop.org
Thu Apr 16 00:22:46 UTC 2015


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

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Apr 14 11:24:00 2015 -0700

vc4: Hook up VC4_DEBUG=perf to some useful printfs.

---

 src/gallium/drivers/vc4/vc4_context.h  |    5 +++++
 src/gallium/drivers/vc4/vc4_draw.c     |    7 ++++++-
 src/gallium/drivers/vc4/vc4_resource.c |    5 +++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/vc4/vc4_context.h b/src/gallium/drivers/vc4/vc4_context.h
index 68eacb8..d89f197 100644
--- a/src/gallium/drivers/vc4/vc4_context.h
+++ b/src/gallium/drivers/vc4/vc4_context.h
@@ -303,6 +303,11 @@ struct vc4_depth_stencil_alpha_state {
         uint32_t stencil_uniforms[3];
 };
 
+#define perf_debug(...) do {                            \
+        if (unlikely(vc4_debug & VC4_DEBUG_PERF))       \
+                fprintf(stderr, __VA_ARGS__);           \
+} while (0)
+
 static inline struct vc4_context *
 vc4_context(struct pipe_context *pcontext)
 {
diff --git a/src/gallium/drivers/vc4/vc4_draw.c b/src/gallium/drivers/vc4/vc4_draw.c
index 3a6d625..717eb8a 100644
--- a/src/gallium/drivers/vc4/vc4_draw.c
+++ b/src/gallium/drivers/vc4/vc4_draw.c
@@ -22,6 +22,7 @@
  * IN THE SOFTWARE.
  */
 
+#include "util/u_prim.h"
 #include "util/u_format.h"
 #include "util/u_pack_color.h"
 #include "indices/u_primconvert.h"
@@ -139,6 +140,8 @@ vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
                 util_primconvert_save_index_buffer(vc4->primconvert, &vc4->indexbuf);
                 util_primconvert_save_rasterizer_state(vc4->primconvert, &vc4->rasterizer->base);
                 util_primconvert_draw_vbo(vc4->primconvert, info);
+                perf_debug("Fallback conversion for %d %s vertices\n",
+                           info->count, u_prim_name(info->mode));
                 return;
         }
 
@@ -303,8 +306,10 @@ vc4_clear(struct pipe_context *pctx, unsigned buffers,
         /* We can't flag new buffers for clearing once we've queued draws.  We
          * could avoid this by using the 3d engine to clear.
          */
-        if (vc4->draw_call_queued)
+        if (vc4->draw_call_queued) {
+                perf_debug("Flushing rendering to process new clear.");
                 vc4_flush(pctx);
+        }
 
         if (buffers & PIPE_CLEAR_COLOR0) {
                 vc4->clear_color[0] = vc4->clear_color[1] =
diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c
index f6ca075..94bab99 100644
--- a/src/gallium/drivers/vc4/vc4_resource.c
+++ b/src/gallium/drivers/vc4/vc4_resource.c
@@ -586,6 +586,9 @@ vc4_update_shadow_baselevel_texture(struct pipe_context *pctx,
         if (shadow->writes == orig->writes)
                 return;
 
+        perf_debug("Updating shadow texture due to %s\n",
+                   view->u.tex.first_level ? "base level" : "raster layout");
+
         for (int i = 0; i <= shadow->base.b.last_level; i++) {
                 unsigned width = u_minify(shadow->base.b.width0, i);
                 unsigned height = u_minify(shadow->base.b.height0, i);
@@ -646,6 +649,8 @@ vc4_update_shadow_index_buffer(struct pipe_context *pctx,
         if (shadow->writes == orig->writes)
                 return;
 
+        perf_debug("Fallback conversion for %d uint indices\n", count);
+
         struct pipe_transfer *src_transfer;
         uint32_t *src = pipe_buffer_map_range(pctx, &orig->base.b,
                                               ib->offset,




More information about the mesa-commit mailing list