panfrost: Remove sync arguments from panfrost_batch_submit

Whether a sync object is used cannot depend on where the batch is
submitted from, remove the in_sync and out_sync fields from
panfrost_batch_submit.

Always use an output syncobj, this is required for glFinish to work
correctly. This could be skipped for batches which another batch
depends on, but because of the existence of empty batches which emit
no job, doing so is not trivial.

Never use an input syncobj. There appears to be no point to this, the
kernel driver does implicit sync anyway.

Fixes "seconds per frame" rendering with Neverball; previously, every
batch was submitted with out_sync=0, so DRI's frame throttling could
do nothing. New jobs would keep getting submitted until more than a
thousand were queued in the kernel, which increased rendering latency
for the compositor far beyond acceptable levels.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16966>
(cherry picked from commit d8803c724b)
This commit is contained in:
Icecream95 2022-06-10 23:03:33 +12:00 committed by Dylan Baker
parent 0acb0f4a63
commit cb13e00f72
2 changed files with 12 additions and 15 deletions

View file

@ -1615,7 +1615,7 @@
"description": "panfrost: Remove sync arguments from panfrost_batch_submit",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -150,8 +150,7 @@ panfrost_batch_cleanup(struct panfrost_context *ctx, struct panfrost_batch *batc
static void
panfrost_batch_submit(struct panfrost_context *ctx,
struct panfrost_batch *batch,
uint32_t in_sync, uint32_t out_sync);
struct panfrost_batch *batch);
static struct panfrost_batch *
panfrost_get_batch(struct panfrost_context *ctx,
@ -177,7 +176,7 @@ panfrost_get_batch(struct panfrost_context *ctx,
/* The selected slot is used, we need to flush the batch */
if (batch->seqnum)
panfrost_batch_submit(ctx, batch, 0, 0);
panfrost_batch_submit(ctx, batch);
panfrost_batch_init(ctx, key, batch);
@ -225,7 +224,7 @@ panfrost_get_fresh_batch_for_fbo(struct panfrost_context *ctx, const char *reaso
if (batch->scoreboard.first_job) {
perf_debug_ctx(ctx, "Flushing the current FBO due to: %s", reason);
panfrost_batch_submit(ctx, batch, 0, 0);
panfrost_batch_submit(ctx, batch);
batch = panfrost_get_batch(ctx, &ctx->pipe_framebuffer);
}
@ -265,7 +264,7 @@ panfrost_batch_update_access(struct panfrost_batch *batch,
/* Submit if it's a user */
if (_mesa_set_search(batch->resources, rsrc))
panfrost_batch_submit(ctx, batch, 0, 0);
panfrost_batch_submit(ctx, batch);
}
}
@ -724,8 +723,7 @@ panfrost_emit_tile_map(struct panfrost_batch *batch, struct pan_fb_info *fb)
static void
panfrost_batch_submit(struct panfrost_context *ctx,
struct panfrost_batch *batch,
uint32_t in_sync, uint32_t out_sync)
struct panfrost_batch *batch)
{
struct pipe_screen *pscreen = ctx->base.screen;
struct panfrost_screen *screen = pan_screen(pscreen);
@ -752,7 +750,7 @@ panfrost_batch_submit(struct panfrost_context *ctx,
if (batch->scoreboard.first_tiler || batch->clear)
screen->vtbl.emit_fbd(batch, &fb);
ret = panfrost_batch_submit_jobs(batch, &fb, in_sync, out_sync);
ret = panfrost_batch_submit_jobs(batch, &fb, 0, ctx->syncobj);
if (ret)
fprintf(stderr, "panfrost_batch_submit failed: %d\n", ret);
@ -779,21 +777,20 @@ out:
panfrost_batch_cleanup(ctx, batch);
}
/* Submit all batches, applying the out_sync to the currently bound batch */
/* Submit all batches */
void
panfrost_flush_all_batches(struct panfrost_context *ctx, const char *reason)
{
struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
panfrost_batch_submit(ctx, batch, ctx->syncobj, ctx->syncobj);
panfrost_batch_submit(ctx, batch);
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, &ctx->batches.slots[i],
ctx->syncobj, ctx->syncobj);
panfrost_batch_submit(ctx, &ctx->batches.slots[i]);
}
}
}
@ -807,7 +804,7 @@ panfrost_flush_writer(struct panfrost_context *ctx,
if (entry) {
perf_debug_ctx(ctx, "Flushing writer due to: %s", reason);
panfrost_batch_submit(ctx, entry->data, ctx->syncobj, ctx->syncobj);
panfrost_batch_submit(ctx, entry->data);
}
}
@ -824,7 +821,7 @@ panfrost_flush_batches_accessing_rsrc(struct panfrost_context *ctx,
continue;
perf_debug_ctx(ctx, "Flushing user due to: %s", reason);
panfrost_batch_submit(ctx, batch, ctx->syncobj, ctx->syncobj);
panfrost_batch_submit(ctx, batch);
}
}