From: Boris Brezillon Date: Thu, 5 Mar 2020 10:47:04 +0000 (+0100) Subject: panfrost: Add an helper to update the occclusion query part of a tiler job desc X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=56aeb921e92ace34e84440ff679590b98895b9e7;p=mesa.git 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 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 83f80d24dfb..d1f8c754182 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -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, diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.h b/src/gallium/drivers/panfrost/pan_cmdstream.h index 86380cd5d8a..92544d2a37b 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.h +++ b/src/gallium/drivers/panfrost/pan_cmdstream.h @@ -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, diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 3932e11ccfc..d2cb94037f5 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -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,