panfrost: Add an helper to update the occclusion query part of a tiler job desc
authorBoris Brezillon <boris.brezillon@collabora.com>
Thu, 5 Mar 2020 10:47:04 +0000 (11:47 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Tue, 10 Mar 2020 11:47:34 +0000 (12:47 +0100)
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>

src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_cmdstream.h
src/gallium/drivers/panfrost/pan_context.c

index 83f80d2..d1f8c75 100644 (file)
@@ -60,6 +60,17 @@ panfrost_vt_attach_framebuffer(struct panfrost_context *ctx,
 }
 
 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,
                           struct midgard_payload_vertex_tiler *vtp)
index 86380cd..92544d2 100644 (file)
@@ -37,6 +37,10 @@ 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,
                           struct midgard_payload_vertex_tiler *vtp);
index 3932e11..d2cb940 100644 (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,