anv: add support for mesh shading in INTEL_MEASURE

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19344>
This commit is contained in:
Marcin Ślusarz
2022-10-24 09:54:11 +02:00
committed by Marge Bot
parent b1b2dee30e
commit 2bc82581ad
5 changed files with 43 additions and 11 deletions
+1 -1
View File
@@ -241,7 +241,7 @@ state_changed(const struct iris_context *ice,
/* else blorp, all programs NULL */
return intel_measure_state_changed(&batch->measure->base,
vs, tcs, tes, gs, fs, cs);
vs, tcs, tes, gs, fs, cs, 0, 0);
}
static void
+9 -6
View File
@@ -209,7 +209,7 @@ intel_measure_init(struct intel_measure_device *device)
fputs("draw_start,draw_end,frame,batch,"
"event_index,event_count,type,count,vs,tcs,tes,"
"gs,fs,cs,framebuffer,idle_us,time_us\n",
"gs,fs,cs,ms,ts,framebuffer,idle_us,time_us\n",
config.file);
}
@@ -268,7 +268,8 @@ intel_measure_snapshot_string(enum intel_measure_snapshot_type type)
bool
intel_measure_state_changed(const struct intel_measure_batch *batch,
uintptr_t vs, uintptr_t tcs, uintptr_t tes,
uintptr_t gs, uintptr_t fs, uintptr_t cs)
uintptr_t gs, uintptr_t fs, uintptr_t cs,
uintptr_t ms, uintptr_t ts)
{
if (batch->index == 0) {
/* always record the first event */
@@ -302,7 +303,7 @@ intel_measure_state_changed(const struct intel_measure_batch *batch,
*/
assert(config.flags & INTEL_MEASURE_SHADER);
if (!vs && !tcs && !tes && !gs && !fs && !cs) {
if (!vs && !tcs && !tes && !gs && !fs && !cs && !ms && !ts) {
/* blorp always changes program */
return true;
}
@@ -312,7 +313,9 @@ intel_measure_state_changed(const struct intel_measure_batch *batch,
last_snap->tes != (uintptr_t) tes ||
last_snap->gs != (uintptr_t) gs ||
last_snap->fs != (uintptr_t) fs ||
last_snap->cs != (uintptr_t) cs);
last_snap->cs != (uintptr_t) cs ||
last_snap->ms != (uintptr_t) ms ||
last_snap->ts != (uintptr_t) ts);
}
/**
@@ -603,13 +606,13 @@ print_combined_results(struct intel_measure_device *measure_device,
const struct intel_measure_snapshot *begin = &start_result->snapshot;
fprintf(config.file, "%"PRIu64",%"PRIu64",%u,%u,%u,%u,%s,%u,"
"0x%"PRIxPTR",0x%"PRIxPTR",0x%"PRIxPTR",0x%"PRIxPTR",0x%"PRIxPTR","
"0x%"PRIxPTR",0x%"PRIxPTR",%.3lf,%.3lf\n",
"0x%"PRIxPTR",0x%"PRIxPTR",0x%"PRIxPTR",0x%"PRIxPTR",%.3lf,%.3lf\n",
start_result->start_ts, current_result->end_ts,
start_result->frame, start_result->batch_count,
start_result->event_index, event_count,
begin->event_name, begin->count,
begin->vs, begin->tcs, begin->tes, begin->gs, begin->fs, begin->cs,
begin->framebuffer,
begin->ms, begin->ts, begin->framebuffer,
(double)duration_idle_ns / 1000.0,
(double)duration_time_ns / 1000.0);
}
+3 -2
View File
@@ -108,7 +108,7 @@ struct intel_measure_snapshot {
enum intel_measure_snapshot_type type;
unsigned count, event_count;
const char* event_name;
uintptr_t framebuffer, vs, tcs, tes, gs, fs, cs;
uintptr_t framebuffer, vs, tcs, tes, gs, fs, cs, ms, ts;
/* for vulkan secondary command buffers */
struct intel_measure_batch *secondary;
};
@@ -157,7 +157,8 @@ void intel_measure_init(struct intel_measure_device *device);
const char * intel_measure_snapshot_string(enum intel_measure_snapshot_type type);
bool intel_measure_state_changed(const struct intel_measure_batch *batch,
uintptr_t vs, uintptr_t tcs, uintptr_t tes,
uintptr_t gs, uintptr_t fs, uintptr_t cs);
uintptr_t gs, uintptr_t fs, uintptr_t cs,
uintptr_t ms, uintptr_t ts);
void intel_measure_frame_transition(unsigned frame);
bool intel_measure_ready(struct intel_measure_batch *batch);
+6 -2
View File
@@ -176,6 +176,8 @@ anv_measure_start_snapshot(struct anv_cmd_buffer *cmd_buffer,
snapshot->tes = (uintptr_t) pipeline->shaders[MESA_SHADER_TESS_EVAL];
snapshot->gs = (uintptr_t) pipeline->shaders[MESA_SHADER_GEOMETRY];
snapshot->fs = (uintptr_t) pipeline->shaders[MESA_SHADER_FRAGMENT];
snapshot->ms = (uintptr_t) pipeline->shaders[MESA_SHADER_MESH];
snapshot->ts = (uintptr_t) pipeline->shaders[MESA_SHADER_TASK];
}
}
@@ -206,7 +208,7 @@ static bool
state_changed(struct anv_cmd_buffer *cmd_buffer,
enum intel_measure_snapshot_type type)
{
uintptr_t vs=0, tcs=0, tes=0, gs=0, fs=0, cs=0;
uintptr_t vs=0, tcs=0, tes=0, gs=0, fs=0, cs=0, ms=0, ts=0;
if (cmd_buffer->usage_flags & VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT)
/* can't record timestamps in this mode */
@@ -225,11 +227,13 @@ state_changed(struct anv_cmd_buffer *cmd_buffer,
tes = (uintptr_t) gfx->shaders[MESA_SHADER_TESS_EVAL];
gs = (uintptr_t) gfx->shaders[MESA_SHADER_GEOMETRY];
fs = (uintptr_t) gfx->shaders[MESA_SHADER_FRAGMENT];
ms = (uintptr_t) gfx->shaders[MESA_SHADER_MESH];
ts = (uintptr_t) gfx->shaders[MESA_SHADER_TASK];
}
/* else blorp, all programs NULL */
return intel_measure_state_changed(&cmd_buffer->measure->base,
vs, tcs, tes, gs, fs, cs);
vs, tcs, tes, gs, fs, cs, ms, ts);
}
void
+24
View File
@@ -4718,6 +4718,10 @@ genX(CmdDrawMeshTasksNV)(
if (anv_batch_has_error(&cmd_buffer->batch))
return;
anv_measure_snapshot(cmd_buffer,
INTEL_SNAPSHOT_DRAW,
"draw mesh", taskCount);
/* TODO(mesh): Check if this is not emitting more packets than we need. */
genX(cmd_buffer_flush_gfx_state)(cmd_buffer);
@@ -4748,6 +4752,10 @@ genX(CmdDrawMeshTasksEXT)(
if (anv_batch_has_error(&cmd_buffer->batch))
return;
anv_measure_snapshot(cmd_buffer,
INTEL_SNAPSHOT_DRAW,
"draw mesh", x * y * z);
/* TODO(mesh): Check if this is not emitting more packets than we need. */
genX(cmd_buffer_flush_gfx_state)(cmd_buffer);
@@ -4856,6 +4864,10 @@ genX(CmdDrawMeshTasksIndirectNV)(
if (anv_batch_has_error(&cmd_buffer->batch))
return;
anv_measure_snapshot(cmd_buffer,
INTEL_SNAPSHOT_DRAW,
"draw mesh indirect", drawCount);
genX(cmd_buffer_flush_gfx_state)(cmd_buffer);
if (cmd_state->conditional_render_enabled)
@@ -4896,6 +4908,10 @@ genX(CmdDrawMeshTasksIndirectEXT)(
if (anv_batch_has_error(&cmd_buffer->batch))
return;
anv_measure_snapshot(cmd_buffer,
INTEL_SNAPSHOT_DRAW,
"draw mesh indirect", drawCount);
genX(cmd_buffer_flush_gfx_state)(cmd_buffer);
if (cmd_state->conditional_render_enabled)
@@ -4938,6 +4954,10 @@ genX(CmdDrawMeshTasksIndirectCountNV)(
if (anv_batch_has_error(&cmd_buffer->batch))
return;
anv_measure_snapshot(cmd_buffer,
INTEL_SNAPSHOT_DRAW,
"draw mesh indirect count", 0);
genX(cmd_buffer_flush_gfx_state)(cmd_buffer);
bool uses_drawid = (task_prog_data && task_prog_data->uses_drawid) ||
@@ -4983,6 +5003,10 @@ genX(CmdDrawMeshTasksIndirectCountEXT)(
if (anv_batch_has_error(&cmd_buffer->batch))
return;
anv_measure_snapshot(cmd_buffer,
INTEL_SNAPSHOT_DRAW,
"draw mesh indirect count", 0);
genX(cmd_buffer_flush_gfx_state)(cmd_buffer);
bool uses_drawid = (task_prog_data && task_prog_data->uses_drawid) ||