From aee39df710d2742c15d46f1da65529f8d83cb713 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 8 Jan 2018 14:44:14 -0800 Subject: [PATCH] iris: packing with valgrind. borrowed macros from anv! --- src/gallium/drivers/iris/iris_state.c | 16 ++++++++++++++-- src/gallium/drivers/iris/meson.build | 2 +- 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 #include + +#ifdef HAVE_VALGRIND +#include +#include +#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 -- 2.30.2