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:
cc5843a573b ("anv: implement u_trace support")
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20502>
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(rasterization_mode)(VkPolygonMode raster_mode,
(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);
(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));
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;
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;
};
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
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");
}
}