Module: Mesa Branch: main Commit: d8803c724bcb83eb08e038984eb8cd6b5f3f64b8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d8803c724bcb83eb08e038984eb8cd6b5f3f64b8
Author: Icecream95 <[email protected]> Date: Fri Jun 10 23:03:33 2022 +1200 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> --- src/gallium/drivers/panfrost/pan_job.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index 3ba8948387a..6df87ea7016 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -149,8 +149,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, @@ -176,7 +175,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); @@ -224,7 +223,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); } @@ -264,7 +263,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); } } @@ -745,8 +744,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); @@ -793,7 +791,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); @@ -820,21 +818,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]); } } } @@ -848,7 +845,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); } } @@ -865,7 +862,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); } }
