vc4: Hook up VC4_DEBUG=perf to some useful printfs.
authorEric Anholt <eric@anholt.net>
Tue, 14 Apr 2015 18:24:00 +0000 (11:24 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 15 Apr 2015 23:50:22 +0000 (16:50 -0700)
src/gallium/drivers/vc4/vc4_context.h
src/gallium/drivers/vc4/vc4_draw.c
src/gallium/drivers/vc4/vc4_resource.c

index 68eacb84fd1cdf2b61b956c0779e307bef55e525..d89f1974e121cd98f2c914e8fd96eee64f8e5ab0 100644 (file)
@@ -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)
 {
index 3a6d6254a1b55d048ceaf7dc31ed832c3a54384b..717eb8aea2b58700ed40aa0ff7b022a41f1a8fc4 100644 (file)
@@ -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] =
index f6ca0759012d7abc85b9a1a557ae1ba51a359fb5..94bab9934e79c2fc93d409fbbb8154891c01fe40 100644 (file)
@@ -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,