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 83f80d24dfbc9d226232dedac28a06547463e421..d1f8c754182bc94f838a960ca8e570967a9c2aef 100644 (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,
index 86380cd5d8aafceac52e6c73d9bb853c1c523a38..92544d2a37bd3a68d69c3d500dbad08de34c9719 100644 (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,
index 3932e11ccfccfb39eb9876c10d33d189943b3e78..d2cb94037f52be992a06db4e5b6e2cd4be314534 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,