freedreno/a6xx: limit scratch/debug markers to debug builds
authorRob Clark <robdclark@chromium.org>
Thu, 16 Jan 2020 18:42:39 +0000 (10:42 -0800)
committerRob Clark <robdclark@chromium.org>
Fri, 17 Jan 2020 23:43:51 +0000 (15:43 -0800)
The overhead does seem to matter when you have a high enough # of draw
calls that effect few bins/pixels, because these writes would happen
unconditionally (ie. not part of a state-group).

Possibly we could keep these if we moved them into a state-group so the
register writes would be no-ops on bins with no geometry.  OTOH I
usually end up adding in a WFI when using them scratch reg values to
track down a crash.  (So add a WFI to mitigate the annoyance of needing
to use a debug build to get scratch regs to locate the position of a
crash/hang in the cmdstream.)

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3435>

src/gallium/drivers/freedreno/a6xx/fd6_context.h

index 0d810d350e9569099b44fa97512e1fbe5ccd6750..a7f786fac618264e377d0218fc3c32ef1461fa4b 100644 (file)
@@ -143,8 +143,16 @@ emit_marker6(struct fd_ringbuffer *ring, int scratch_idx)
 {
        extern unsigned marker_cnt;
        unsigned reg = REG_A6XX_CP_SCRATCH_REG(scratch_idx);
-       OUT_PKT4(ring, reg, 1);
-       OUT_RING(ring, ++marker_cnt);
+#ifdef DEBUG
+#  define __EMIT_MARKER 1
+#else
+#  define __EMIT_MARKER 0
+#endif
+       if (__EMIT_MARKER) {
+               OUT_WFI5(ring);
+               OUT_PKT4(ring, reg, 1);
+               OUT_RING(ring, ++marker_cnt);
+       }
 }
 
 #endif /* FD6_CONTEXT_H_ */