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.
This commit is contained in:
Jason Ekstrand
2015-06-09 21:36:12 -07:00
parent d5ad24e39b
commit 9cae3d18ac
2 changed files with 7 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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 { \