diff options
author | Lionel Landwerlin <[email protected]> | 2019-02-23 23:27:17 +0000 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2019-02-23 23:29:04 +0000 |
commit | e4d88396d259c4ec6032d2834d1c9073d55e9b45 (patch) | |
tree | f7917365e3401781f7b0046263013cbd3e29573e /src/intel/vulkan/anv_batch_chain.c | |
parent | c56e73449698c31fe72b99a95b7e4ecdb2985b73 (diff) |
anv: add support for INTEL_DEBUG=bat
As requested by Ken ;)
Signed-off-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_batch_chain.c')
-rw-r--r-- | src/intel/vulkan/anv_batch_chain.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index ff713d529af..486b0ac97d6 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -29,6 +29,8 @@ #include "anv_private.h" +#include "common/gen_decoder.h" + #include "genxml/gen8_pack.h" #include "util/debug.h" @@ -1589,6 +1591,50 @@ setup_empty_execbuf(struct anv_execbuf *execbuf, struct anv_device *device) return VK_SUCCESS; } +/* Finding a buffer for batch decoding */ +static struct gen_batch_decode_bo +decode_get_bo(void *v_batch, uint64_t address) +{ + struct anv_cmd_buffer *cmd_buffer = v_batch; + struct anv_batch_bo *bo; + + u_vector_foreach(bo, &cmd_buffer->seen_bbos) { + /* The decoder zeroes out the top 16 bits, so we need to as well */ + uint64_t bo_address = bo->bo.offset & (~0ull >> 16); + + if (address >= bo_address && address < bo_address + bo->bo.size) { + return (struct gen_batch_decode_bo) { + .addr = address, + .size = bo->bo.size, + .map = bo->bo.map, + }; + } + } + + return (struct gen_batch_decode_bo) { }; +} + +static void +decode_batch(struct anv_cmd_buffer *cmd_buffer) +{ + struct gen_batch_decode_ctx ctx; + struct anv_batch_bo *bo = u_vector_head(&cmd_buffer->seen_bbos); + const unsigned decode_flags = + GEN_BATCH_DECODE_FULL | + ((INTEL_DEBUG & DEBUG_COLOR) ? GEN_BATCH_DECODE_IN_COLOR : 0) | + GEN_BATCH_DECODE_OFFSETS | + GEN_BATCH_DECODE_FLOATS; + + gen_batch_decode_ctx_init(&ctx, + &cmd_buffer->device->instance->physicalDevice.info, + stderr, decode_flags, NULL, + decode_get_bo, NULL, cmd_buffer); + + gen_print_batch(&ctx, bo->bo.map, bo->bo.size, bo->bo.offset); + + gen_batch_decode_ctx_finish(&ctx); +} + VkResult anv_cmd_buffer_execbuf(struct anv_device *device, struct anv_cmd_buffer *cmd_buffer, @@ -1752,6 +1798,9 @@ anv_cmd_buffer_execbuf(struct anv_device *device, if (need_out_fence) execbuf.execbuf.flags |= I915_EXEC_FENCE_OUT; + if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) + decode_batch(cmd_buffer); + result = anv_device_execbuf(device, &execbuf.execbuf, execbuf.bos); /* Execbuf does not consume the in_fence. It's our job to close it. */ |