From: Lionel Landwerlin Date: Wed, 4 Mar 2020 23:15:57 +0000 (+0200) Subject: anv: track the current frame and write it into the driver identifier BO X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9f0db069d3a507fbb4a64393d50df18fa9376b62;p=mesa.git anv: track the current frame and write it into the driver identifier BO Signed-off-by: Lionel Landwerlin Reviewed-by: Kenneth Graunke Part-of: --- diff --git a/src/intel/dev/gen_debug.c b/src/intel/dev/gen_debug.c index d8651390c47..9a0ff4ba45e 100644 --- a/src/intel/dev/gen_debug.c +++ b/src/intel/dev/gen_debug.c @@ -176,6 +176,18 @@ intel_debug_write_identifiers(void *_output, break; } + case GEN_DEBUG_BLOCK_TYPE_FRAME: { + struct gen_debug_block_frame frame_desc = { + .base = { + .type = GEN_DEBUG_BLOCK_TYPE_FRAME, + .length = sizeof(frame_desc), + }, + }; + memcpy(output, &frame_desc, sizeof(frame_desc)); + output += sizeof(frame_desc); + break; + } + default: unreachable("Missing identifier write"); } diff --git a/src/intel/dev/gen_debug.h b/src/intel/dev/gen_debug.h index 687bedb1a42..616d473bd26 100644 --- a/src/intel/dev/gen_debug.h +++ b/src/intel/dev/gen_debug.h @@ -134,6 +134,9 @@ enum gen_debug_block_type { /* Driver identifier (struct gen_debug_block_driver) */ GEN_DEBUG_BLOCK_TYPE_DRIVER, + /* Frame identifier (struct gen_debug_block_frame) */ + GEN_DEBUG_BLOCK_TYPE_FRAME, + /* Internal, never to be written out */ GEN_DEBUG_BLOCK_TYPE_MAX, }; @@ -148,6 +151,11 @@ struct gen_debug_block_driver { uint8_t description[]; }; +struct gen_debug_block_frame { + struct gen_debug_block_base base; + uint64_t frame_id; +}; + extern void *intel_debug_identifier(void); extern uint32_t intel_debug_identifier_size(void); diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 8804b9865b6..bb2861860b4 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -2970,10 +2970,10 @@ VkResult anv_CreateDevice( "Anv") + 8, 8), }; - if (!device->info.has_llc) { - gen_clflush_range(device->workaround_bo->map, - device->workaround_address.offset); - } + device->debug_frame_desc = + intel_debug_get_identifier_block(device->workaround_bo->map, + device->workaround_bo->size, + GEN_DEBUG_BLOCK_TYPE_FRAME); result = anv_device_init_trivial_batch(device); if (result != VK_SUCCESS) diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index a9d775d6369..488ffdec820 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1391,6 +1391,8 @@ struct anv_device { uint64_t perf_metric; /* 0 if unset */ struct gen_aux_map_context *aux_map_ctx; + + struct gen_debug_block_frame *debug_frame_desc; }; static inline struct anv_instance * diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c index 3b4877a3abb..888a91d8620 100644 --- a/src/intel/vulkan/anv_wsi.c +++ b/src/intel/vulkan/anv_wsi.c @@ -288,6 +288,15 @@ VkResult anv_QueuePresentKHR( const VkPresentInfoKHR* pPresentInfo) { ANV_FROM_HANDLE(anv_queue, queue, _queue); + struct anv_device *device = queue->device; + + if (device->debug_frame_desc) { + device->debug_frame_desc->frame_id++; + if (!device->info.has_llc) { + gen_clflush_range(device->debug_frame_desc, + sizeof(*device->debug_frame_desc)); + } + } return wsi_common_queue_present(&queue->device->physical->wsi_device, anv_device_to_handle(queue->device),