From 9eacbfaf7be7cc5cac03c60fa64d558ea693a03b Mon Sep 17 00:00:00 2001 From: Mark Janes Date: Tue, 5 Jan 2021 21:06:13 -0800 Subject: [PATCH] intel: stop tracking submission state in INTEL_MEASURE With secondary command buffers, it is inconvenient to track whether a batch has been submitted and needs to be gathered. Instead, always check for completed snapshots before destroying a command buffer. Acked-by: Kenneth Graunke Part-of: --- src/gallium/drivers/iris/iris_measure.c | 12 --------- src/intel/common/intel_measure.h | 1 - src/intel/vulkan/anv_measure.c | 33 ++++++------------------- 3 files changed, 8 insertions(+), 38 deletions(-) diff --git a/src/gallium/drivers/iris/iris_measure.c b/src/gallium/drivers/iris/iris_measure.c index 9013af0a863..0564e4abb18 100644 --- a/src/gallium/drivers/iris/iris_measure.c +++ b/src/gallium/drivers/iris/iris_measure.c @@ -347,7 +347,6 @@ iris_measure_gather(struct iris_context *ice) list_first_entry(&measure_device->queued_snapshots, struct iris_measure_batch, link); - assert(measure->base.submitted == true); if (!iris_measure_ready(measure)) { /* command buffer has begun execution on the gpu, but has not * completed. @@ -375,7 +374,6 @@ iris_measure_gather(struct iris_context *ice) iris_bo_unmap(measure->bo); measure->base.index = 0; measure->base.frame = 0; - measure->base.submitted = false; iris_destroy_batch_measure(measure); } @@ -426,7 +424,6 @@ iris_measure_batch_end(struct iris_context *ice, struct iris_batch *batch) /* enqueue snapshot for gathering */ pthread_mutex_lock(&measure_device->mutex); list_addtail(&iris_measure_batch->link, &measure_device->queued_snapshots); - measure_batch->submitted = true; batch->measure = NULL; pthread_mutex_unlock(&measure_device->mutex); /* init new measure_batch */ @@ -448,15 +445,6 @@ iris_measure_frame_end(struct iris_context *ice) if (!config) return; - /* check that the snapshots were submitted */ - for (int i = 0; i < IRIS_BATCH_COUNT; ++i) { - struct intel_measure_batch *measure_batch = - &ice->batches[i].measure->base; - - if (measure_batch != NULL) { - assert(measure_batch->submitted || measure_batch->index == 0); - } - } /* increment frame counter */ intel_measure_frame_transition(p_atomic_inc_return(&measure_device->frame)); diff --git a/src/intel/common/intel_measure.h b/src/intel/common/intel_measure.h index 2e28367748c..b2e0389df1f 100644 --- a/src/intel/common/intel_measure.h +++ b/src/intel/common/intel_measure.h @@ -139,7 +139,6 @@ struct intel_measure_batch { unsigned index; unsigned frame, batch_count, event_count; uintptr_t framebuffer; - bool submitted; struct intel_measure_snapshot snapshots[0]; }; diff --git a/src/intel/vulkan/anv_measure.c b/src/intel/vulkan/anv_measure.c index faec7c18058..76ca02a7ead 100644 --- a/src/intel/vulkan/anv_measure.c +++ b/src/intel/vulkan/anv_measure.c @@ -154,7 +154,6 @@ anv_measure_gather(struct anv_device *device) list_first_entry(&measure_device->queued_snapshots, struct anv_measure_batch, link); - assert(measure->base.submitted == true); if (!anv_measure_ready(device, measure)) { /* command buffer has begun execution on the gpu, but has not * completed. @@ -183,7 +182,6 @@ anv_measure_gather(struct anv_device *device) anv_gem_munmap(device, map, measure->base.index * sizeof(uint64_t)); measure->base.index = 0; measure->base.frame = 0; - measure->base.submitted = false; } intel_measure_print(measure_device, &device->info); @@ -366,16 +364,11 @@ anv_measure_reset(struct anv_cmd_buffer *cmd_buffer) return anv_measure_init(cmd_buffer); } - if (measure->base.submitted) { - /* This snapshot was submitted, but was never gathered after rendering. - * Since the client is resetting the command buffer, rendering is - * certainly complete. - */ - assert (anv_measure_ready(device, measure)); - anv_measure_gather(device); - } + /* it is possible that the command buffer contains snapshots that have not + * yet been processed + */ + anv_measure_gather(device); - assert(!measure->base.submitted); assert(cmd_buffer->device != NULL); measure->base.index = 0; @@ -405,15 +398,10 @@ anv_measure_destroy(struct anv_cmd_buffer *cmd_buffer) if (measure == NULL) return; - if (measure->base.submitted) { - /* This snapshot was submitted, but was never gathered after rendering. - * Since the client is destroying the command buffer, rendering is - * certainly complete. - */ - assert(anv_measure_ready(device, measure)); - anv_measure_gather(device); - assert(!measure->base.submitted); - } + /* it is possible that the command buffer contains snapshots that have not + * yet been processed + */ + anv_measure_gather(device); anv_device_release_bo(device, measure->bo); vk_free(&cmd_buffer->pool->alloc, measure); @@ -455,7 +443,6 @@ _anv_measure_submit(struct anv_cmd_buffer *cmd_buffer) return; if (measure == NULL) return; - assert(measure->base.submitted == false); if (measure->base.index == 0) /* no snapshots were started */ @@ -470,10 +457,6 @@ _anv_measure_submit(struct anv_cmd_buffer *cmd_buffer) measure->base.event_count = 0; } - /* verify that snapshots are submitted once */ - assert(measure->base.submitted == false); - measure->base.submitted = true; - /* add to the list of submitted snapshots */ pthread_mutex_lock(&measure_device->mutex); list_addtail(&measure->link, &measure_device->queued_snapshots);