From: Boris Brezillon Date: Thu, 5 Mar 2020 17:53:08 +0000 (+0100) Subject: panfrost: Add an helper to emit a pair of vertex/tiler jobs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=528384cb6dedfa43980e89ef8dc8c8380d8645a3;p=mesa.git 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: --- 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); }