diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-08-18 20:17:57 +0200 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2018-03-14 09:04:04 +0100 |
commit | e063691eba37de43a182d459d958693bed83651a (patch) | |
tree | 34eb8594cbc8f9047a0bc5ff447b2a5442c7b987 | |
parent | 2a824b1edb7b0ec34b14c3fcad91cdf0a6c48dc1 (diff) |
DBG gallium/radeon: optionally check definedness of data written into IBs
-rw-r--r-- | src/gallium/Automake.inc | 7 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/radeon_winsys.h | 16 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc index 3e21aa71b5..a90b06402e 100644 --- a/src/gallium/Automake.inc +++ b/src/gallium/Automake.inc @@ -3,7 +3,8 @@ GALLIUM_CFLAGS = \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/gallium/include \ -I$(top_srcdir)/src/gallium/auxiliary \ - $(DEFINES) + $(DEFINES) \ + $(VALGRIND_CFLAGS) # src/gallium/auxiliary must appear before src/gallium/drivers # because there are stupidly two rbug_context.h files in @@ -18,6 +19,7 @@ GALLIUM_DRIVER_CFLAGS = \ -I$(top_srcdir)/src/gallium/drivers \ -I$(top_srcdir)/src/gallium/winsys \ $(DEFINES) \ + $(VALGRIND_CFLAGS) \ $(VISIBILITY_CFLAGS) GALLIUM_DRIVER_CXXFLAGS = \ @@ -29,6 +31,7 @@ GALLIUM_DRIVER_CXXFLAGS = \ -I$(top_srcdir)/src/gallium/drivers \ -I$(top_srcdir)/src/gallium/winsys \ $(DEFINES) \ + $(VALGRIND_CFLAGS) \ $(VISIBILITY_CXXFLAGS) GALLIUM_TARGET_CFLAGS = \ @@ -44,6 +47,7 @@ GALLIUM_TARGET_CFLAGS = \ $(DEFINES) \ $(PTHREAD_CFLAGS) \ $(LIBDRM_CFLAGS) \ + $(VALGRIND_CFLAGS) \ $(VISIBILITY_CFLAGS) GALLIUM_COMMON_LIB_DEPS = \ @@ -65,6 +69,7 @@ GALLIUM_WINSYS_CFLAGS = \ -I$(top_srcdir)/src/gallium/include \ -I$(top_srcdir)/src/gallium/auxiliary \ $(DEFINES) \ + $(VALGRIND_CFLAGS) \ $(VISIBILITY_CFLAGS) diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h index 0a56539246..d45738fa22 100644 --- a/src/gallium/drivers/radeon/radeon_winsys.h +++ b/src/gallium/drivers/radeon/radeon_winsys.h @@ -25,12 +25,22 @@ #define RADEON_WINSYS_H /* The public winsys interface header for the radeon driver. */ +#ifdef HAVE_VALGRIND +#include <valgrind.h> +#include <memcheck.h> +#define VG(x) x +#else +#define VG(x) +#endif #include "pipebuffer/pb_buffer.h" #include "amd/common/ac_gpu_info.h" #include "amd/common/ac_surface.h" +/* Set this to 1 to compile with additional Valgrind checks for IBs. */ +#define RADEON_VALGRIND 1 + /* Tiling flags. */ enum radeon_bo_layout { RADEON_LAYOUT_LINEAR = 0, @@ -660,12 +670,18 @@ static inline bool radeon_emitted(struct radeon_winsys_cs *cs, unsigned num_dw) static inline void radeon_emit(struct radeon_winsys_cs *cs, uint32_t value) { + if (RADEON_VALGRIND) { + VG(VALGRIND_CHECK_VALUE_IS_DEFINED(value)); + } cs->current.buf[cs->current.cdw++] = value; } static inline void radeon_emit_array(struct radeon_winsys_cs *cs, const uint32_t *values, unsigned count) { + if (RADEON_VALGRIND) { + VG(VALGRIND_CHECK_MEM_IS_DEFINED(values, count * 4)); + } memcpy(cs->current.buf + cs->current.cdw, values, count * 4); cs->current.cdw += count; } |