summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/vc4/vc4_bufmgr.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2016-08-02 15:01:59 -0700
committerEric Anholt <eric@anholt.net>2016-08-03 10:28:20 -0700
commite97e9e62a1de9689ce8a2a77cb9657b387a1d14b (patch)
treec0843ca5e251e9b284270915ff34119237f2cb3e /src/gallium/drivers/vc4/vc4_bufmgr.c
parentfd32868590c7cbc5c6c2b3d59ff66694de3864b8 (diff)
vc4: Tell valgrind about BO allocations from mmap time to destroy.
This helps in debugging memory pressure. It would be nice if we could tell valgrind about it all the way from allocation time to destroy, but we need a pointer to hand to VALGRIND_MALLOCLIKE_BLOCK.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_bufmgr.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_bufmgr.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_bufmgr.c b/src/gallium/drivers/vc4/vc4_bufmgr.c
index f6bacfd39e0..cf6a5114b87 100644
--- a/src/gallium/drivers/vc4/vc4_bufmgr.c
+++ b/src/gallium/drivers/vc4/vc4_bufmgr.c
@@ -35,6 +35,14 @@
#include "vc4_context.h"
#include "vc4_screen.h"
+#ifdef HAVE_VALGRIND
+#include <valgrind.h>
+#include <memcheck.h>
+#define VG(x) x
+#else
+#define VG(x)
+#endif
+
static bool dump_stats = false;
static void
@@ -209,6 +217,7 @@ vc4_bo_free(struct vc4_bo *bo)
}
#endif
munmap(bo->map, bo->size);
+ VG(VALGRIND_FREELIKE_BLOCK(bo->map, 0));
}
struct drm_gem_close c;
@@ -618,6 +627,7 @@ vc4_bo_map_unsynchronized(struct vc4_bo *bo)
bo->handle, (long long)offset, bo->size);
abort();
}
+ VG(VALGRIND_MALLOCLIKE_BLOCK(bo->map, bo->size, 0, false));
return bo->map;
}