freedreno: emit_marker() cleanup

1) Propagate the change to only emit markers in debug builds (and add
   the WFI that ensures they are synchronized with GPU.  We could
   consider dropping them entirely, since the GPU devcoredump support
   in newer kernels is more useful.  But it is still an occasionally
   useful fallback.

2) Use p_atomic_inc_return() to placate helgrind

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7717>
This commit is contained in:
Rob Clark 2020-11-16 11:18:32 -08:00 committed by Marge Bot
parent b039e03f55
commit 8651cfbbf0
4 changed files with 21 additions and 14 deletions

View file

@ -38,10 +38,13 @@ void fd5_screen_init(struct pipe_screen *pscreen);
static inline void
emit_marker5(struct fd_ringbuffer *ring, int scratch_idx)
{
extern unsigned marker_cnt;
extern int32_t marker_cnt;
unsigned reg = REG_A5XX_CP_SCRATCH_REG(scratch_idx);
OUT_PKT4(ring, reg, 1);
OUT_RING(ring, ++marker_cnt);
if (__EMIT_MARKER) {
OUT_WFI5(ring);
OUT_PKT4(ring, reg, 1);
OUT_RING(ring, p_atomic_inc_return(&marker_cnt));
}
}
#endif /* FD5_SCREEN_H_ */

View file

@ -145,17 +145,12 @@ struct fd6_control {
static inline void
emit_marker6(struct fd_ringbuffer *ring, int scratch_idx)
{
extern unsigned marker_cnt;
extern int32_t marker_cnt;
unsigned reg = REG_A6XX_CP_SCRATCH_REG(scratch_idx);
#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);
OUT_RING(ring, p_atomic_inc_return(&marker_cnt));
}
}

View file

@ -29,7 +29,7 @@
#include "freedreno_util.h"
unsigned marker_cnt;
int32_t marker_cnt;
enum adreno_rb_depth_format
fd_pipe2depth(enum pipe_format format)

View file

@ -272,16 +272,25 @@ __OUT_IB5(struct fd_ringbuffer *ring, struct fd_ringbuffer *target)
// rework..
#define HW_QUERY_BASE_REG REG_AXXX_CP_SCRATCH_REG4
#ifdef DEBUG
# define __EMIT_MARKER 1
#else
# define __EMIT_MARKER 0
#endif
static inline void
emit_marker(struct fd_ringbuffer *ring, int scratch_idx)
{
extern unsigned marker_cnt;
extern int32_t marker_cnt;
unsigned reg = REG_AXXX_CP_SCRATCH_REG0 + scratch_idx;
assert(reg != HW_QUERY_BASE_REG);
if (reg == HW_QUERY_BASE_REG)
return;
OUT_PKT0(ring, reg, 1);
OUT_RING(ring, ++marker_cnt);
if (__EMIT_MARKER) {
OUT_WFI5(ring);
OUT_PKT0(ring, reg, 1);
OUT_RING(ring, p_atomic_inc_return(&marker_cnt));
}
}
static inline uint32_t