diff options
author | Nicolai Hähnle <[email protected]> | 2017-08-18 20:17:29 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-08-23 13:54:07 +0200 |
commit | 8937ac9a1373096be0ac330844cdb0c08e762773 (patch) | |
tree | a134ebf4323a2e33f601ced5d5f9cac99ed3b449 /src/amd/common | |
parent | c2c39124102b0d421f359d5e0df1dd896f327707 (diff) |
ac/debug: invoke valgrind checks while parsing IBs
Help catch garbage data written into IBs.
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/amd/common')
-rw-r--r-- | src/amd/common/ac_debug.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/amd/common/ac_debug.c b/src/amd/common/ac_debug.c index e92dfbd0e4a..2af83a146c8 100644 --- a/src/amd/common/ac_debug.c +++ b/src/amd/common/ac_debug.c @@ -26,6 +26,14 @@ #include "ac_debug.h" +#ifdef HAVE_VALGRIND +#include <valgrind.h> +#include <memcheck.h> +#define VG(x) x +#else +#define VG(x) +#endif + #include "sid.h" #include "gfx9d.h" #include "sid_tables.h" @@ -149,6 +157,18 @@ static uint32_t ac_ib_get(struct ac_ib_parser *ib) if (ib->cur_dw < ib->num_dw) { v = ib->ib[ib->cur_dw]; +#ifdef HAVE_VALGRIND + /* Help figure out where garbage data is written to IBs. + * + * Arguably we should do this already when the IBs are written, + * see RADEON_VALGRIND. The problem is that client-requests to + * Valgrind have an overhead even when Valgrind isn't running, + * and radeon_emit is performance sensitive... + */ + if (VALGRIND_CHECK_VALUE_IS_DEFINED(v)) + fprintf(ib->f, COLOR_RED "Valgrind: The next DWORD is garbage" + COLOR_RESET "\n"); +#endif fprintf(ib->f, "\n\035#%08x ", v); } else { fprintf(ib->f, "\n\035#???????? "); |