mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-17 13:58:05 +02:00
i965/fs: Add CS shader time support
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
6b1b484b60
commit
b750e14fbb
4 changed files with 33 additions and 2 deletions
|
|
@ -834,6 +834,9 @@ enum shader_time_shader_type {
|
|||
ST_FS16,
|
||||
ST_FS16_WRITTEN,
|
||||
ST_FS16_RESET,
|
||||
ST_CS,
|
||||
ST_CS_WRITTEN,
|
||||
ST_CS_RESET,
|
||||
};
|
||||
|
||||
struct brw_vertex_buffer {
|
||||
|
|
|
|||
|
|
@ -297,6 +297,14 @@ brw_upload_cs_state(struct brw_context *brw)
|
|||
struct brw_cs_prog_data *cs_prog_data = brw->cs.prog_data;
|
||||
struct brw_stage_prog_data *prog_data = &cs_prog_data->base;
|
||||
|
||||
if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
|
||||
brw->vtbl.emit_buffer_surface_state(
|
||||
brw, &stage_state->surf_offset[
|
||||
prog_data->binding_table.shader_time_start],
|
||||
brw->shader_time.bo, 0, BRW_SURFACEFORMAT_RAW,
|
||||
brw->shader_time.bo->size, 1, true);
|
||||
}
|
||||
|
||||
uint32_t *bind = (uint32_t*) brw_state_batch(brw, AUB_TRACE_BINDING_TABLE,
|
||||
prog_data->binding_table.size_bytes,
|
||||
32, &stage_state->bind_bo_offset);
|
||||
|
|
|
|||
|
|
@ -758,6 +758,11 @@ fs_visitor::emit_shader_time_end()
|
|||
reset_type = ST_FS16_RESET;
|
||||
}
|
||||
break;
|
||||
case MESA_SHADER_COMPUTE:
|
||||
type = ST_CS;
|
||||
written_type = ST_CS_WRITTEN;
|
||||
reset_type = ST_CS_RESET;
|
||||
break;
|
||||
default:
|
||||
unreachable("fs_visitor::emit_shader_time_end missing code");
|
||||
}
|
||||
|
|
@ -4139,6 +4144,9 @@ fs_visitor::run_cs()
|
|||
|
||||
setup_cs_payload();
|
||||
|
||||
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
|
||||
emit_shader_time_begin();
|
||||
|
||||
emit_nir_code();
|
||||
|
||||
if (failed)
|
||||
|
|
@ -4146,6 +4154,9 @@ fs_visitor::run_cs()
|
|||
|
||||
emit_cs_terminate();
|
||||
|
||||
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
|
||||
emit_shader_time_end();
|
||||
|
||||
calculate_cfg();
|
||||
|
||||
optimize();
|
||||
|
|
|
|||
|
|
@ -323,7 +323,8 @@ get_written_and_reset(struct brw_context *brw, int i,
|
|||
uint64_t *written, uint64_t *reset)
|
||||
{
|
||||
enum shader_time_shader_type type = brw->shader_time.types[i];
|
||||
assert(type == ST_VS || type == ST_GS || type == ST_FS8 || type == ST_FS16);
|
||||
assert(type == ST_VS || type == ST_GS || type == ST_FS8 ||
|
||||
type == ST_FS16 || type == ST_CS);
|
||||
|
||||
/* Find where we recorded written and reset. */
|
||||
int wi, ri;
|
||||
|
|
@ -363,7 +364,7 @@ brw_report_shader_time(struct brw_context *brw)
|
|||
|
||||
uint64_t scaled[brw->shader_time.num_entries];
|
||||
uint64_t *sorted[brw->shader_time.num_entries];
|
||||
uint64_t total_by_type[ST_FS16 + 1];
|
||||
uint64_t total_by_type[ST_CS + 1];
|
||||
memset(total_by_type, 0, sizeof(total_by_type));
|
||||
double total = 0;
|
||||
for (int i = 0; i < brw->shader_time.num_entries; i++) {
|
||||
|
|
@ -381,6 +382,8 @@ brw_report_shader_time(struct brw_context *brw)
|
|||
case ST_FS8_RESET:
|
||||
case ST_FS16_WRITTEN:
|
||||
case ST_FS16_RESET:
|
||||
case ST_CS_WRITTEN:
|
||||
case ST_CS_RESET:
|
||||
/* We'll handle these when along with the time. */
|
||||
scaled[i] = 0;
|
||||
continue;
|
||||
|
|
@ -389,6 +392,7 @@ brw_report_shader_time(struct brw_context *brw)
|
|||
case ST_GS:
|
||||
case ST_FS8:
|
||||
case ST_FS16:
|
||||
case ST_CS:
|
||||
get_written_and_reset(brw, i, &written, &reset);
|
||||
break;
|
||||
|
||||
|
|
@ -413,6 +417,7 @@ brw_report_shader_time(struct brw_context *brw)
|
|||
case ST_GS:
|
||||
case ST_FS8:
|
||||
case ST_FS16:
|
||||
case ST_CS:
|
||||
total_by_type[type] += scaled[i];
|
||||
break;
|
||||
default:
|
||||
|
|
@ -455,6 +460,9 @@ brw_report_shader_time(struct brw_context *brw)
|
|||
case ST_FS16:
|
||||
stage = "fs16";
|
||||
break;
|
||||
case ST_CS:
|
||||
stage = "cs";
|
||||
break;
|
||||
default:
|
||||
stage = "other";
|
||||
break;
|
||||
|
|
@ -469,6 +477,7 @@ brw_report_shader_time(struct brw_context *brw)
|
|||
print_shader_time_line("total", "gs", 0, total_by_type[ST_GS], total);
|
||||
print_shader_time_line("total", "fs8", 0, total_by_type[ST_FS8], total);
|
||||
print_shader_time_line("total", "fs16", 0, total_by_type[ST_FS16], total);
|
||||
print_shader_time_line("total", "cs", 0, total_by_type[ST_CS], total);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue