panfrost: Add an helper to update the occclusion query part of a tiler job desc

That's part of our attempt to make panfrost_emit_for_draw() a bit more
dry and eventually get rid of it by inlining the code in
panfrost_draw_vbo(). This is just one step in this direction.

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 11:47:04 +01:00
parent 5f043cc776
commit 56aeb921e9
3 changed files with 16 additions and 4 deletions

View file

@ -59,6 +59,17 @@ panfrost_vt_attach_framebuffer(struct panfrost_context *ctx,
vt->postfix.shared_memory = batch->framebuffer.gpu;
}
void
panfrost_vt_update_occlusion_query(struct panfrost_context *ctx,
struct midgard_payload_vertex_tiler *tp)
{
SET_BIT(tp->gl_enables, MALI_OCCLUSION_QUERY, ctx->occlusion_query);
if (ctx->occlusion_query)
tp->postfix.occlusion_counter = ctx->occlusion_query->bo->gpu;
else
tp->postfix.occlusion_counter = 0;
}
void
panfrost_emit_shader_meta(struct panfrost_batch *batch,
enum pipe_shader_type st,

View file

@ -36,6 +36,10 @@ void
panfrost_vt_attach_framebuffer(struct panfrost_context *ctx,
struct midgard_payload_vertex_tiler *vt);
void
panfrost_vt_update_occlusion_query(struct panfrost_context *ctx,
struct midgard_payload_vertex_tiler *tp);
void
panfrost_emit_shader_meta(struct panfrost_batch *batch,
enum pipe_shader_type st,

View file

@ -553,10 +553,7 @@ panfrost_emit_for_draw(struct panfrost_context *ctx)
panfrost_batch_set_requirements(batch);
if (ctx->occlusion_query) {
ctx->payloads[PIPE_SHADER_FRAGMENT].gl_enables |= MALI_OCCLUSION_QUERY;
ctx->payloads[PIPE_SHADER_FRAGMENT].postfix.occlusion_counter = ctx->occlusion_query->bo->gpu;
}
panfrost_vt_update_occlusion_query(ctx, &ctx->payloads[PIPE_SHADER_FRAGMENT]);
panfrost_patch_shader_state(ctx, PIPE_SHADER_VERTEX);
panfrost_emit_shader_meta(batch, PIPE_SHADER_VERTEX,