anv: track the current frame and write it into the driver identifier BO
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 4 Mar 2020 23:15:57 +0000 (01:15 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 7 Aug 2020 11:27:54 +0000 (11:27 +0000)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2201>

src/intel/dev/gen_debug.c
src/intel/dev/gen_debug.h
src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_private.h
src/intel/vulkan/anv_wsi.c

index d8651390c476a106e449676b26308f95e8da480a..9a0ff4ba45e014989013267e1daa526dbc7f1c60 100644 (file)
@@ -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");
       }
index 687bedb1a42297d48f87c216acee1f69199f024e..616d473bd264810020a8f6cf89c8766247b671be 100644 (file)
@@ -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);
 
index 8804b9865b6ea92cd65475d5a927cc81cb3f24e2..bb2861860b493de7205ad28734cc09790619a3b5 100644 (file)
@@ -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)
index a9d775d6369081b19730120f1d249da3c4139513..488ffdec820b982bd3a0de0e59f1fd852ccff86d 100644 (file)
@@ -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 *
index 3b4877a3abbe15088d654b86a909f78edba327a3..888a91d862033b8b7bcb42aaea27d75cec9bffdb 100644 (file)
@@ -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),