From 528384cb6dedfa43980e89ef8dc8c8380d8645a3 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 5 Mar 2020 18:53:08 +0100 Subject: [PATCH] panfrost: Add an helper to emit a pair of vertex/tiler jobs Add the panfrost_emit_vertex_tiler_jobs() helper and use it in panfrost_queue_draw(). Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 33 ++++++++++++++++++++ src/gallium/drivers/panfrost/pan_cmdstream.h | 5 +++ src/gallium/drivers/panfrost/pan_context.c | 24 ++------------ 3 files changed, 41 insertions(+), 21 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 467884cdd0b..4a549cc3bf0 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -1045,3 +1045,36 @@ panfrost_emit_sampler_descriptors(struct panfrost_batch *batch, vtp->postfix.sampler_descriptor = transfer.gpu; } + +void +panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch, + struct midgard_payload_vertex_tiler *vp, + struct midgard_payload_vertex_tiler *tp) +{ + struct panfrost_context *ctx = batch->ctx; + bool wallpapering = ctx->wallpaper_batch && batch->tiler_dep; + + if (wallpapering) { + /* Inject in reverse order, with "predicted" job indices. + * THIS IS A HACK XXX */ + panfrost_new_job(batch, JOB_TYPE_TILER, false, + batch->job_index + 2, tp, sizeof(*tp), true); + panfrost_new_job(batch, JOB_TYPE_VERTEX, false, 0, + vp, sizeof(*vp), true); + return; + } + + /* If rasterizer discard is enable, only submit the vertex */ + + bool rasterizer_discard = ctx->rasterizer && + ctx->rasterizer->base.rasterizer_discard; + + unsigned vertex = panfrost_new_job(batch, JOB_TYPE_VERTEX, false, 0, + vp, sizeof(*vp), false); + + if (rasterizer_discard) + return; + + panfrost_new_job(batch, JOB_TYPE_TILER, false, vertex, tp, sizeof(*tp), + false); +} diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.h b/src/gallium/drivers/panfrost/pan_cmdstream.h index aa77b8b28e1..d3a5e1e64e1 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.h +++ b/src/gallium/drivers/panfrost/pan_cmdstream.h @@ -76,4 +76,9 @@ panfrost_emit_sampler_descriptors(struct panfrost_batch *batch, enum pipe_shader_type stage, struct midgard_payload_vertex_tiler *vtp); +void +panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch, + struct midgard_payload_vertex_tiler *vp, + struct midgard_payload_vertex_tiler *tp); + #endif /* __PAN_CMDSTREAM_H__ */ diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index ba844cb1ca0..528ae2e6282 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -325,29 +325,11 @@ panfrost_queue_draw(struct panfrost_context *ctx) /* Handle dirty flags now */ panfrost_emit_for_draw(ctx); - /* If rasterizer discard is enable, only submit the vertex */ - - bool rasterizer_discard = ctx->rasterizer - && ctx->rasterizer->base.rasterizer_discard; - - - struct midgard_payload_vertex_tiler *vertex_payload = &ctx->payloads[PIPE_SHADER_VERTEX]; - struct midgard_payload_vertex_tiler *tiler_payload = &ctx->payloads[PIPE_SHADER_FRAGMENT]; - struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx); - bool wallpapering = ctx->wallpaper_batch && batch->tiler_dep; - - if (wallpapering) { - /* Inject in reverse order, with "predicted" job indices. THIS IS A HACK XXX */ - panfrost_new_job(batch, JOB_TYPE_TILER, false, batch->job_index + 2, tiler_payload, sizeof(*tiler_payload), true); - panfrost_new_job(batch, JOB_TYPE_VERTEX, false, 0, vertex_payload, sizeof(*vertex_payload), true); - } else { - unsigned vertex = panfrost_new_job(batch, JOB_TYPE_VERTEX, false, 0, vertex_payload, sizeof(*vertex_payload), false); - - if (!rasterizer_discard) - panfrost_new_job(batch, JOB_TYPE_TILER, false, vertex, tiler_payload, sizeof(*tiler_payload), false); - } + panfrost_emit_vertex_tiler_jobs(batch, + &ctx->payloads[PIPE_SHADER_VERTEX], + &ctx->payloads[PIPE_SHADER_FRAGMENT]); panfrost_batch_adjust_stack_size(batch); } -- 2.30.2