mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-19 21:28:32 +02:00
anv: Emit CS stall on INTEL_MEASURE timestamp
For INTEL_MEASURE, ensure all prior instructions completed before
timestamp taken. Continue to support no CS flush case for Perfetto.
CS stall was dropped from pipecontrol when adding u_trace support.
Fixes: cc5843a573 ("anv: implement u_trace support")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20502>
This commit is contained in:
parent
0a11cea652
commit
7f6beb8537
5 changed files with 37 additions and 11 deletions
|
|
@ -153,7 +153,7 @@ void genX(blorp_exec)(struct blorp_batch *batch,
|
|||
void genX(cmd_emit_timestamp)(struct anv_batch *batch,
|
||||
struct anv_device *device,
|
||||
struct anv_address addr,
|
||||
bool end_of_pipe);
|
||||
enum anv_timestamp_capture_type);
|
||||
|
||||
void genX(batch_emit_dummy_post_sync_op)(struct anv_batch *batch,
|
||||
struct anv_device *device,
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ anv_measure_start_snapshot(struct anv_cmd_buffer *cmd_buffer,
|
|||
(struct anv_address) {
|
||||
.bo = measure->bo,
|
||||
.offset = index * sizeof(uint64_t) },
|
||||
true /* end_of_pipe */);
|
||||
ANV_TIMESTAMP_CAPTURE_AT_CS_STALL);
|
||||
|
||||
if (event_name == NULL)
|
||||
event_name = intel_measure_snapshot_string(type);
|
||||
|
|
@ -196,7 +196,7 @@ anv_measure_end_snapshot(struct anv_cmd_buffer *cmd_buffer,
|
|||
(struct anv_address) {
|
||||
.bo = measure->bo,
|
||||
.offset = index * sizeof(uint64_t) },
|
||||
true /* end_of_pipe */);
|
||||
ANV_TIMESTAMP_CAPTURE_AT_CS_STALL);
|
||||
|
||||
struct intel_measure_snapshot *snapshot = &(measure->base.snapshots[index]);
|
||||
memset(snapshot, 0, sizeof(*snapshot));
|
||||
|
|
|
|||
|
|
@ -954,6 +954,12 @@ struct anv_memregion {
|
|||
uint64_t available;
|
||||
};
|
||||
|
||||
enum anv_timestamp_capture_type {
|
||||
ANV_TIMESTAMP_CAPTURE_TOP_OF_PIPE,
|
||||
ANV_TIMESTAMP_CAPTURE_END_OF_PIPE,
|
||||
ANV_TIMESTAMP_CAPTURE_AT_CS_STALL,
|
||||
};
|
||||
|
||||
struct anv_physical_device {
|
||||
struct vk_physical_device vk;
|
||||
|
||||
|
|
@ -1061,7 +1067,7 @@ struct anv_physical_device {
|
|||
int64_t master_minor;
|
||||
struct intel_query_engine_info * engine_info;
|
||||
|
||||
void (*cmd_emit_timestamp)(struct anv_batch *, struct anv_device *, struct anv_address, bool);
|
||||
void (*cmd_emit_timestamp)(struct anv_batch *, struct anv_device *, struct anv_address, enum anv_timestamp_capture_type);
|
||||
struct intel_measure_device measure_device;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -227,11 +227,14 @@ anv_utrace_record_ts(struct u_trace *ut, void *cs,
|
|||
struct anv_device *device = cmd_buffer->device;
|
||||
struct anv_bo *bo = timestamps;
|
||||
|
||||
enum anv_timestamp_capture_type capture_type =
|
||||
(end_of_pipe) ? ANV_TIMESTAMP_CAPTURE_END_OF_PIPE
|
||||
: ANV_TIMESTAMP_CAPTURE_TOP_OF_PIPE;
|
||||
device->physical->cmd_emit_timestamp(&cmd_buffer->batch, device,
|
||||
(struct anv_address) {
|
||||
.bo = bo,
|
||||
.offset = idx * sizeof(uint64_t) },
|
||||
end_of_pipe);
|
||||
capture_type);
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
|
|
|
|||
|
|
@ -7808,17 +7808,34 @@ VkResult genX(CmdSetPerformanceStreamMarkerINTEL)(
|
|||
void genX(cmd_emit_timestamp)(struct anv_batch *batch,
|
||||
struct anv_device *device,
|
||||
struct anv_address addr,
|
||||
bool end_of_pipe) {
|
||||
if (end_of_pipe) {
|
||||
enum anv_timestamp_capture_type type) {
|
||||
switch (type) {
|
||||
case ANV_TIMESTAMP_CAPTURE_TOP_OF_PIPE: {
|
||||
struct mi_builder b;
|
||||
mi_builder_init(&b, device->info, batch);
|
||||
mi_store(&b, mi_mem64(addr), mi_reg64(TIMESTAMP));
|
||||
break;
|
||||
}
|
||||
|
||||
case ANV_TIMESTAMP_CAPTURE_END_OF_PIPE:
|
||||
anv_batch_emit(batch, GENX(PIPE_CONTROL), pc) {
|
||||
pc.PostSyncOperation = WriteTimestamp;
|
||||
pc.Address = addr;
|
||||
anv_debug_dump_pc(pc);
|
||||
}
|
||||
} else {
|
||||
struct mi_builder b;
|
||||
mi_builder_init(&b, device->info, batch);
|
||||
mi_store(&b, mi_mem64(addr), mi_reg64(TIMESTAMP));
|
||||
break;
|
||||
|
||||
case ANV_TIMESTAMP_CAPTURE_AT_CS_STALL:
|
||||
anv_batch_emit(batch, GENX(PIPE_CONTROL), pc) {
|
||||
pc.CommandStreamerStallEnable = true;
|
||||
pc.PostSyncOperation = WriteTimestamp;
|
||||
pc.Address = addr;
|
||||
anv_debug_dump_pc(pc);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
unreachable("invalid");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue