panfrost: Track surfaces drawn per-batch
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 15 Jul 2020 21:35:58 +0000 (17:35 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 15 Jul 2020 22:19:37 +0000 (22:19 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5929>

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

index 8fecdde0066da314a475291140787d4bdf38f88d..6e31d9bc4b97489f9edd1a07a48d42727b00ae9a 100644 (file)
@@ -668,6 +668,7 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
                                 struct mali_shader_meta *fragmeta,
                                 void *rts)
 {
+        struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
         const struct panfrost_device *dev = pan_device(ctx->base.screen);
         struct panfrost_shader_state *fs;
         fs = panfrost_get_shader_state(ctx, PIPE_SHADER_FRAGMENT);
@@ -749,6 +750,8 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
 
                 SET_BIT(fragmeta->unknown2_3, MALI_CAN_DISCARD,
                         !blend[0].no_blending || fs->can_discard); 
+
+                batch->draws |= PIPE_CLEAR_COLOR0;
                 return;
         }
 
@@ -769,6 +772,7 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
 
                 if (ctx->pipe_framebuffer.nr_cbufs > i && !blend[i].no_colour) {
                         flags = 0x200;
+                        batch->draws |= (PIPE_CLEAR_COLOR0 << i);
 
                         bool is_srgb = (ctx->pipe_framebuffer.nr_cbufs > i) &&
                                        (ctx->pipe_framebuffer.cbufs[i]) &&
index f83cbeaf4834f45a657974e809beab9a0b02d466..bc9dab58cf2250397729431b02e44ac296d9a1b0 100644 (file)
@@ -1182,8 +1182,13 @@ panfrost_batch_set_requirements(struct panfrost_batch *batch)
         if (ctx->rasterizer && ctx->rasterizer->base.multisample)
                 batch->requirements |= PAN_REQ_MSAA;
 
-        if (ctx->depth_stencil && ctx->depth_stencil->depth.writemask)
+        if (ctx->depth_stencil && ctx->depth_stencil->depth.writemask) {
                 batch->requirements |= PAN_REQ_DEPTH_WRITE;
+                batch->draws |= PIPE_CLEAR_DEPTH;
+        }
+
+        if (ctx->depth_stencil && ctx->depth_stencil->stencil[0].enabled)
+                batch->draws |= PIPE_CLEAR_STENCIL;
 }
 
 void
index b5f639894e0b3c8ec39390aec7f1197df1aedf70..409644d2cfdfdca0078d2af1c05740c7a790240b 100644 (file)
@@ -75,6 +75,9 @@ struct panfrost_batch {
         /* Buffers cleared (PIPE_CLEAR_* bitmask) */
         unsigned clear;
 
+        /* Buffers drawn */
+        unsigned draws;
+
         /* Packed clear values, indexed by both render target as well as word.
          * Essentially, a single pixel is packed, with some padding to bring it
          * up to a 32-bit interval; that pixel is then duplicated over to fill