mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
panfrost: Log reasons for flushes
Premature flushes (i.e. before pipe->flush() is called) can be expensive, particularly if they require extra reloads/resolves. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11830>
This commit is contained in:
parent
bcd915622b
commit
a266a0fbbb
6 changed files with 33 additions and 21 deletions
|
|
@ -1182,7 +1182,7 @@ panfrost_map_constant_buffer_cpu(struct panfrost_context *ctx,
|
|||
|
||||
if (rsrc) {
|
||||
panfrost_bo_mmap(rsrc->image.data.bo);
|
||||
panfrost_flush_writer(ctx, rsrc);
|
||||
panfrost_flush_writer(ctx, rsrc, "CPU constant buffer mapping");
|
||||
panfrost_bo_wait(rsrc->image.data.bo, INT64_MAX, false);
|
||||
|
||||
return rsrc->image.data.bo->ptr.cpu + cb->buffer_offset;
|
||||
|
|
@ -3151,7 +3151,7 @@ panfrost_launch_grid(struct pipe_context *pipe,
|
|||
|
||||
/* XXX - shouldn't be necessary with working memory barriers. Affected
|
||||
* test: KHR-GLES31.core.compute_shader.pipeline-post-xfb */
|
||||
panfrost_flush_all_batches(ctx);
|
||||
panfrost_flush_all_batches(ctx, "Launch grid pre-barrier");
|
||||
|
||||
struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
|
||||
|
||||
|
|
@ -3259,7 +3259,7 @@ panfrost_launch_grid(struct pipe_context *pipe,
|
|||
panfrost_add_job(&batch->pool.base, &batch->scoreboard,
|
||||
MALI_JOB_TYPE_COMPUTE, true, false,
|
||||
indirect_dep, 0, &t, false);
|
||||
panfrost_flush_all_batches(ctx);
|
||||
panfrost_flush_all_batches(ctx, "Launch grid post-barrier");
|
||||
}
|
||||
|
||||
static void *
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ panfrost_memory_barrier(struct pipe_context *pctx, unsigned flags)
|
|||
{
|
||||
/* TODO: Be smart and only flush the minimum needed, maybe emitting a
|
||||
* cache flush job if that would help */
|
||||
panfrost_flush_all_batches(pan_context(pctx));
|
||||
panfrost_flush_all_batches(pan_context(pctx), "Memory barrier");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ panfrost_flush(
|
|||
|
||||
|
||||
/* Submit all pending jobs */
|
||||
panfrost_flush_all_batches(ctx);
|
||||
panfrost_flush_all_batches(ctx, NULL);
|
||||
|
||||
if (fence) {
|
||||
struct pipe_fence_handle *f = panfrost_fence_create(ctx);
|
||||
|
|
@ -115,14 +115,14 @@ static void
|
|||
panfrost_texture_barrier(struct pipe_context *pipe, unsigned flags)
|
||||
{
|
||||
struct panfrost_context *ctx = pan_context(pipe);
|
||||
panfrost_flush_all_batches(ctx);
|
||||
panfrost_flush_all_batches(ctx, "Texture barrier");
|
||||
}
|
||||
|
||||
static void
|
||||
panfrost_set_frontend_noop(struct pipe_context *pipe, bool enable)
|
||||
{
|
||||
struct panfrost_context *ctx = pan_context(pipe);
|
||||
panfrost_flush_all_batches(ctx);
|
||||
panfrost_flush_all_batches(ctx, "Frontend no-op change");
|
||||
ctx->is_noop = enable;
|
||||
}
|
||||
|
||||
|
|
@ -916,7 +916,7 @@ panfrost_get_query_result(struct pipe_context *pipe,
|
|||
case PIPE_QUERY_OCCLUSION_COUNTER:
|
||||
case PIPE_QUERY_OCCLUSION_PREDICATE:
|
||||
case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
|
||||
panfrost_flush_writer(ctx, rsrc);
|
||||
panfrost_flush_writer(ctx, rsrc, "Occlusion query");
|
||||
panfrost_bo_wait(rsrc->image.data.bo, INT64_MAX, false);
|
||||
|
||||
/* Read back the query results */
|
||||
|
|
@ -939,7 +939,7 @@ panfrost_get_query_result(struct pipe_context *pipe,
|
|||
|
||||
case PIPE_QUERY_PRIMITIVES_GENERATED:
|
||||
case PIPE_QUERY_PRIMITIVES_EMITTED:
|
||||
panfrost_flush_all_batches(ctx);
|
||||
panfrost_flush_all_batches(ctx, "Primitive count query");
|
||||
vresult->u64 = query->end - query->start;
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -902,13 +902,16 @@ out:
|
|||
/* Submit all batches, applying the out_sync to the currently bound batch */
|
||||
|
||||
void
|
||||
panfrost_flush_all_batches(struct panfrost_context *ctx)
|
||||
panfrost_flush_all_batches(struct panfrost_context *ctx, const char *reason)
|
||||
{
|
||||
struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
|
||||
panfrost_batch_submit(batch, ctx->syncobj, ctx->syncobj);
|
||||
|
||||
for (unsigned i = 0; i < PAN_MAX_BATCHES; i++) {
|
||||
if (ctx->batches.slots[i].seqnum) {
|
||||
if (reason)
|
||||
perf_debug_ctx(ctx, "Flushing everything due to: %s", reason);
|
||||
|
||||
panfrost_batch_submit(&ctx->batches.slots[i],
|
||||
ctx->syncobj, ctx->syncobj);
|
||||
}
|
||||
|
|
@ -917,9 +920,11 @@ panfrost_flush_all_batches(struct panfrost_context *ctx)
|
|||
|
||||
void
|
||||
panfrost_flush_writer(struct panfrost_context *ctx,
|
||||
struct panfrost_resource *rsrc)
|
||||
struct panfrost_resource *rsrc,
|
||||
const char *reason)
|
||||
{
|
||||
if (rsrc->track.writer) {
|
||||
perf_debug_ctx(ctx, "Flushing writer due to: %s", reason);
|
||||
panfrost_batch_submit(rsrc->track.writer, ctx->syncobj, ctx->syncobj);
|
||||
rsrc->track.writer = NULL;
|
||||
}
|
||||
|
|
@ -927,10 +932,12 @@ panfrost_flush_writer(struct panfrost_context *ctx,
|
|||
|
||||
void
|
||||
panfrost_flush_batches_accessing_rsrc(struct panfrost_context *ctx,
|
||||
struct panfrost_resource *rsrc)
|
||||
struct panfrost_resource *rsrc,
|
||||
const char *reason)
|
||||
{
|
||||
unsigned i;
|
||||
BITSET_FOREACH_SET(i, rsrc->track.users, PAN_MAX_BATCHES) {
|
||||
perf_debug_ctx(ctx, "Flushing user due to: %s", reason);
|
||||
panfrost_batch_submit(&ctx->batches.slots[i],
|
||||
ctx->syncobj, ctx->syncobj);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,15 +170,17 @@ panfrost_batch_create_bo(struct panfrost_batch *batch, size_t size,
|
|||
const char *label);
|
||||
|
||||
void
|
||||
panfrost_flush_all_batches(struct panfrost_context *ctx);
|
||||
panfrost_flush_all_batches(struct panfrost_context *ctx, const char *reason);
|
||||
|
||||
void
|
||||
panfrost_flush_batches_accessing_rsrc(struct panfrost_context *ctx,
|
||||
struct panfrost_resource *rsrc);
|
||||
struct panfrost_resource *rsrc,
|
||||
const char *reason);
|
||||
|
||||
void
|
||||
panfrost_flush_writer(struct panfrost_context *ctx,
|
||||
struct panfrost_resource *rsrc);
|
||||
struct panfrost_resource *rsrc,
|
||||
const char *reason);
|
||||
|
||||
void
|
||||
panfrost_batch_adjust_stack_size(struct panfrost_batch *batch);
|
||||
|
|
|
|||
|
|
@ -844,7 +844,7 @@ panfrost_ptr_map(struct pipe_context *pctx,
|
|||
|
||||
if ((usage & PIPE_MAP_READ) && (valid || rsrc->track.writer)) {
|
||||
pan_blit_to_staging(pctx, transfer);
|
||||
panfrost_flush_writer(ctx, staging);
|
||||
panfrost_flush_writer(ctx, staging, "AFBC read staging blit");
|
||||
panfrost_bo_wait(staging->image.data.bo, INT64_MAX, false);
|
||||
}
|
||||
|
||||
|
|
@ -873,7 +873,7 @@ panfrost_ptr_map(struct pipe_context *pctx,
|
|||
* to flush and split the frame in two.
|
||||
*/
|
||||
|
||||
panfrost_flush_writer(ctx, rsrc);
|
||||
panfrost_flush_writer(ctx, rsrc, "Shadow resource creation");
|
||||
panfrost_bo_wait(bo, INT64_MAX, false);
|
||||
|
||||
create_new_bo = true;
|
||||
|
|
@ -916,7 +916,8 @@ panfrost_ptr_map(struct pipe_context *pctx,
|
|||
/* Allocation failed or was impossible, let's
|
||||
* fall back on a flush+wait.
|
||||
*/
|
||||
panfrost_flush_batches_accessing_rsrc(ctx, rsrc);
|
||||
panfrost_flush_batches_accessing_rsrc(ctx, rsrc,
|
||||
"Resource access with high memory pressure");
|
||||
panfrost_bo_wait(bo, INT64_MAX, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -926,10 +927,10 @@ panfrost_ptr_map(struct pipe_context *pctx,
|
|||
/* No flush for writes to uninitialized */
|
||||
} else if (!(usage & PIPE_MAP_UNSYNCHRONIZED)) {
|
||||
if (usage & PIPE_MAP_WRITE) {
|
||||
panfrost_flush_batches_accessing_rsrc(ctx, rsrc);
|
||||
panfrost_flush_batches_accessing_rsrc(ctx, rsrc, "Synchronized write");
|
||||
panfrost_bo_wait(bo, INT64_MAX, true);
|
||||
} else if (usage & PIPE_MAP_READ) {
|
||||
panfrost_flush_writer(ctx, rsrc);
|
||||
panfrost_flush_writer(ctx, rsrc, "Synchronized read");
|
||||
panfrost_bo_wait(bo, INT64_MAX, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -1099,7 +1100,9 @@ panfrost_ptr_unmap(struct pipe_context *pctx,
|
|||
panfrost_bo_reference(prsrc->image.data.bo);
|
||||
} else {
|
||||
pan_blit_from_staging(pctx, trans);
|
||||
panfrost_flush_batches_accessing_rsrc(pan_context(pctx), pan_resource(trans->staging.rsrc));
|
||||
panfrost_flush_batches_accessing_rsrc(pan_context(pctx),
|
||||
pan_resource(trans->staging.rsrc),
|
||||
"AFBC write staging blit");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue