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 <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7354>
This commit is contained in:
Mark Janes 2021-01-05 21:06:13 -08:00
parent f7d4ebbf86
commit 9eacbfaf7b
3 changed files with 8 additions and 38 deletions

View File

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

View File

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

View File

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