iris: add hooks to call INTEL_MEASURE

These hooks were written in the initial IRIS_MEASURE implementation.
Minor changes by Mark Janes <markjanes@swizzler.org> to adapt to the
INTEL_MEASURE reimplementation.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7354>
This commit is contained in:
Kenneth Graunke
2020-10-27 15:56:06 -07:00
committed by Mark Janes
parent b338bb70e0
commit f7d4ebbf86
7 changed files with 36 additions and 4 deletions
+9 -1
View File
@@ -227,6 +227,8 @@ iris_init_batch(struct iris_context *ice,
batch->decoder.max_vbo_decoded_lines = 32;
}
iris_init_batch_measure(ice, batch);
iris_batch_reset(batch);
}
@@ -298,7 +300,8 @@ iris_use_pinned_bo(struct iris_batch *batch,
return;
}
if (bo != batch->bo) {
if (bo != batch->bo &&
(!batch->measure || bo != batch->measure->bo)) {
/* This is the first time our batch has seen this BO. Before we use it,
* we may need to flush and synchronize with other batches.
*/
@@ -442,6 +445,9 @@ iris_batch_free(struct iris_batch *batch)
iris_destroy_hw_context(bufmgr, batch->hw_ctx_id);
iris_destroy_batch_measure(batch->measure);
batch->measure = NULL;
_mesa_hash_table_destroy(batch->cache.render, NULL);
if (INTEL_DEBUG)
@@ -683,6 +689,8 @@ _iris_batch_flush(struct iris_batch *batch, const char *file, int line)
if (iris_batch_bytes_used(batch) == 0)
return;
iris_measure_batch_end(batch->ice, batch);
iris_finish_batch(batch);
if (INTEL_DEBUG & (DEBUG_BATCH | DEBUG_SUBMIT | DEBUG_PIPE_CONTROL)) {
+10 -1
View File
@@ -379,7 +379,16 @@ iris_blorp_exec(struct blorp_batch *blorp_batch,
static void
blorp_measure_start(struct blorp_batch *blorp_batch,
const struct blorp_params *params) { }
const struct blorp_params *params)
{
struct iris_context *ice = blorp_batch->blorp->driver_ctx;
struct iris_batch *batch = blorp_batch->driver_batch;
if (batch->measure == NULL)
return;
iris_measure_snapshot(ice, batch, params->snapshot_type, NULL, NULL, NULL);
}
void
genX(init_blorp)(struct iris_context *ice)
+3
View File
@@ -240,6 +240,9 @@ iris_destroy_context(struct pipe_context *ctx)
screen->vtbl.destroy_state(ice);
iris_destroy_program_cache(ice);
iris_destroy_border_color_pool(ice);
if (screen->measure.config)
iris_destroy_ctx_measure(ice);
u_upload_destroy(ice->state.surface_uploader);
u_upload_destroy(ice->state.dynamic_uploader);
u_upload_destroy(ice->query_buffer_uploader);
+4
View File
@@ -248,6 +248,10 @@ iris_fence_flush(struct pipe_context *ctx,
iris_batch_flush(&ice->batches[i]);
}
if (flags & PIPE_FLUSH_END_OF_FRAME) {
iris_measure_frame_end(ice);
}
if (!out_fence)
return;
+4 -2
View File
@@ -436,6 +436,8 @@ iris_mcs_partial_resolve(struct iris_context *ice,
assert(isl_aux_usage_has_mcs(res->aux.usage));
iris_batch_maybe_flush(batch, 1500);
struct blorp_surf surf;
iris_blorp_surf_for_resource(&batch->screen->isl_dev, &surf,
&res->base, res->aux.usage, 0, true);
@@ -513,6 +515,8 @@ iris_hiz_exec(struct iris_context *ice,
assert(op != ISL_AUX_OP_NONE);
UNUSED const char *name = NULL;
iris_batch_maybe_flush(batch, 1500);
switch (op) {
case ISL_AUX_OP_FULL_RESOLVE:
name = "depth resolve";
@@ -552,8 +556,6 @@ iris_hiz_exec(struct iris_context *ice,
assert(isl_aux_usage_has_hiz(res->aux.usage) && res->aux.bo);
iris_batch_maybe_flush(batch, 1500);
iris_batch_sync_region_start(batch);
struct blorp_surf surf;
+2
View File
@@ -613,6 +613,7 @@ iris_get_timestamp(struct pipe_screen *pscreen)
void
iris_screen_destroy(struct iris_screen *screen)
{
iris_destroy_screen_measure(screen);
glsl_type_singleton_decref();
iris_bo_unreference(screen->workaround_bo);
u_transfer_helper_destroy(screen->base.transfer_helper);
@@ -850,6 +851,7 @@ iris_screen_create(int fd, const struct pipe_screen_config *config)
iris_init_screen_fence_functions(pscreen);
iris_init_screen_resource_functions(pscreen);
iris_init_screen_measure(screen);
pscreen->destroy = iris_screen_unref;
pscreen->get_name = iris_get_name;
+4
View File
@@ -6691,6 +6691,8 @@ iris_upload_render_state(struct iris_context *ice,
_iris_emit_lri(batch, _3DPRIM_INSTANCE_COUNT, draw->instance_count);
}
iris_measure_snapshot(ice, batch, INTEL_SNAPSHOT_DRAW, draw, indirect, sc);
iris_emit_cmd(batch, GENX(3DPRIMITIVE), prim) {
prim.VertexAccessType = draw->index_size > 0 ? RANDOM : SEQUENTIAL;
prim.PredicateEnable = use_predicate;
@@ -6932,6 +6934,8 @@ iris_upload_gpgpu_walker(struct iris_context *ice,
const uint32_t right_mask = brw_cs_right_mask(group_size, simd_size);
iris_measure_snapshot(ice, batch, INTEL_SNAPSHOT_COMPUTE, NULL, NULL, NULL);
iris_emit_cmd(batch, GENX(GPGPU_WALKER), ggw) {
ggw.IndirectParameterEnable = grid->indirect != NULL;
ggw.SIMDSize = simd_size / 16;