diff options
author | Jason Ekstrand <[email protected]> | 2015-06-09 21:36:12 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-06-09 21:51:37 -0700 |
commit | 9cae3d18ac44677fb1c1a4d9c01a1630e62fcb7a (patch) | |
tree | d9621d5909f7a044247f57202693ae4e99dd809f | |
parent | d5ad24e39b704525f1f39dd75b2092801c1c6124 (diff) |
vk: Add valgrind checks in various emit functions
The check in batch_bo_finish should catch any undefined values in the batch
but isn't that great for debugging. The checks in the various emit
functions will help get better granularity.
-rw-r--r-- | src/vulkan/device.c | 5 | ||||
-rw-r--r-- | src/vulkan/private.h | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/vulkan/device.c b/src/vulkan/device.c index 4dc527e9f0f..39d818d2656 100644 --- a/src/vulkan/device.c +++ b/src/vulkan/device.c @@ -659,6 +659,7 @@ anv_batch_bo_finish(struct anv_batch_bo *bbo, struct anv_batch *batch) { assert(batch->start == bbo->bo.map); bbo->length = batch->next - batch->start; + VG(VALGRIND_CHECK_MEM_IS_DEFINED(batch->start, bbo->length)); bbo->num_relocs = batch->relocs.num_relocs - bbo->first_reloc; } @@ -3070,6 +3071,8 @@ anv_cmd_buffer_emit_dynamic(struct anv_cmd_buffer *cmd_buffer, dwords * 4, alignment); memcpy(state.map, a, dwords * 4); + VG(VALGRIND_CHECK_MEM_IS_DEFINED(state.map, dwords * 4)); + return state; } @@ -3087,6 +3090,8 @@ anv_cmd_buffer_merge_dynamic(struct anv_cmd_buffer *cmd_buffer, for (uint32_t i = 0; i < dwords; i++) p[i] = a[i] | b[i]; + VG(VALGRIND_CHECK_MEM_IS_DEFINED(p, dwords * 4)); + return state; } diff --git a/src/vulkan/private.h b/src/vulkan/private.h index 84c0524ad3c..7ffba4f63b6 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -488,6 +488,7 @@ __gen_combine_address(struct anv_batch *batch, void *location, }; \ void *__dst = anv_batch_emit_dwords(batch, cmd ## _length); \ cmd ## _pack(batch, __dst, &__template); \ + VG(VALGRIND_CHECK_MEM_IS_DEFINED(__dst, (cmd ## _length) * 4)); \ } while (0) #define anv_batch_emitn(batch, n, cmd, ...) ({ \ @@ -509,6 +510,7 @@ __gen_combine_address(struct anv_batch *batch, void *location, dw = anv_batch_emit_dwords((batch), ARRAY_SIZE(dwords0)); \ for (uint32_t i = 0; i < ARRAY_SIZE(dwords0); i++) \ dw[i] = (dwords0)[i] | (dwords1)[i]; \ + VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, ARRAY_SIZE(dwords0) * 4));\ } while (0) #define GEN8_MOCS { \ |