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 <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>
This commit is contained in:
Boris Brezillon 2020-03-05 18:53:08 +01:00
parent 8e0a08bc8e
commit 528384cb6d
3 changed files with 41 additions and 21 deletions

View file

@ -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);
}

View file

@ -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__ */

View file

@ -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);
}