summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-01-08 14:44:14 -0800
committerKenneth Graunke <[email protected]>2019-02-21 10:26:04 -0800
commitaee39df710d2742c15d46f1da65529f8d83cb713 (patch)
treeebd2647d981c43c07f630b5ffbe80a85eabe6a58
parentd3d6ef37f624591aff18e17f591d37cd545b1855 (diff)
iris: packing with valgrind.
borrowed macros from anv!
-rw-r--r--src/gallium/drivers/iris/iris_state.c16
-rw-r--r--src/gallium/drivers/iris/meson.build2
2 files changed, 15 insertions, 3 deletions
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index b156183fa3e..7da0e8956dd 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -22,6 +22,16 @@
*/
#include <stdio.h>
#include <errno.h>
+
+#ifdef HAVE_VALGRIND
+#include <valgrind.h>
+#include <memcheck.h>
+#define VG(x) x
+#define __gen_validate_value(x) VALGRIND_CHECK_MEM_IS_DEFINED(&(x), sizeof(x))
+#else
+#define VG(x)
+#endif
+
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
#include "pipe/p_context.h"
@@ -51,8 +61,10 @@ __gen_combine_address(void *user_data, void *location,
#define iris_pack_command(cmd, dst, name) \
for (struct cmd name = { __genxml_cmd_header(cmd) }, \
*_dst = (void *)(dst); __builtin_expect(_dst != NULL, 1); \
- __genxml_cmd_pack(cmd)(NULL, (void *)dst, &name), \
- _dst = NULL)
+ ({ __genxml_cmd_pack(cmd)(NULL, (void *)_dst, &name); \
+ VG(VALGRIND_CHECK_MEM_IS_DEFINED(_dst, __genxml_cmd_length(cmd) * 4)); \
+ _dst = NULL; \
+ }))
#define iris_pack_state(cmd, dst, name) \
for (struct cmd name = {}, \
diff --git a/src/gallium/drivers/iris/meson.build b/src/gallium/drivers/iris/meson.build
index 4728badd54b..3c19a5bbdd3 100644
--- a/src/gallium/drivers/iris/meson.build
+++ b/src/gallium/drivers/iris/meson.build
@@ -41,7 +41,7 @@ foreach v : ['90', '100']
include_directories : [inc_common, inc_intel],
c_args : [c_vis_args, no_override_init_args,
'-DGEN_VERSIONx10=@0@'.format(v)],
- dependencies : [dep_libdrm],
+ dependencies : [dep_libdrm, dep_valgrind],
)
iris_gen_libs += _lib
endforeach