panfrost: Hoist blend finalize calls
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 18 Aug 2020 20:43:38 +0000 (16:43 -0400)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Tue, 25 Aug 2020 15:05:33 +0000 (17:05 +0200)
To prepare for a split.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6440>

src/gallium/drivers/panfrost/pan_cmdstream.c

index cb3a29c053e47821faa6aa9d7dfa65b6e80ba08f..bc9158b03af6b026b79709eac2de53cef317bc8e 100644 (file)
@@ -540,7 +540,8 @@ panfrost_fs_required(
 static void
 panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
                                 struct mali_shader_meta *fragmeta,
 static void
 panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
                                 struct mali_shader_meta *fragmeta,
-                                void *rts)
+                                void *rts,
+                                struct panfrost_blend_final *blend)
 {
         struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
         const struct panfrost_device *dev = pan_device(ctx->base.screen);
 {
         struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
         const struct panfrost_device *dev = pan_device(ctx->base.screen);
@@ -557,11 +558,6 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
         /* Get blending setup */
         unsigned rt_count = ctx->pipe_framebuffer.nr_cbufs;
 
         /* Get blending setup */
         unsigned rt_count = ctx->pipe_framebuffer.nr_cbufs;
 
-        struct panfrost_blend_final blend[PIPE_MAX_COLOR_BUFS];
-
-        for (unsigned c = 0; c < rt_count; ++c)
-                blend[c] = panfrost_get_blend_for_context(ctx, c);
-
         /* Disable shader execution if we can */
         if (dev->quirks & MIDGARD_SHADERLESS
                         && !panfrost_fs_required(fs, blend, rt_count)) {
         /* Disable shader execution if we can */
         if (dev->quirks & MIDGARD_SHADERLESS
                         && !panfrost_fs_required(fs, blend, rt_count)) {
@@ -709,7 +705,8 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
 static void
 panfrost_frag_shader_meta_init(struct panfrost_context *ctx,
                                struct mali_shader_meta *fragmeta,
 static void
 panfrost_frag_shader_meta_init(struct panfrost_context *ctx,
                                struct mali_shader_meta *fragmeta,
-                               void *rts)
+                               void *rts,
+                               struct panfrost_blend_final *blend)
 {
         const struct panfrost_device *dev = pan_device(ctx->base.screen);
         struct panfrost_shader_state *fs;
 {
         const struct panfrost_device *dev = pan_device(ctx->base.screen);
         struct panfrost_shader_state *fs;
@@ -768,7 +765,7 @@ panfrost_frag_shader_meta_init(struct panfrost_context *ctx,
 
         panfrost_frag_meta_rasterizer_update(ctx, fragmeta);
         panfrost_frag_meta_zsa_update(ctx, fragmeta);
 
         panfrost_frag_meta_rasterizer_update(ctx, fragmeta);
         panfrost_frag_meta_zsa_update(ctx, fragmeta);
-        panfrost_frag_meta_blend_update(ctx, fragmeta, rts);
+        panfrost_frag_meta_blend_update(ctx, fragmeta, rts, blend);
 }
 
 void
 }
 
 void
@@ -816,7 +813,12 @@ panfrost_emit_shader_meta(struct panfrost_batch *batch,
                 if (rt_size)
                         rts = rzalloc_size(ctx, rt_size * rt_count);
 
                 if (rt_size)
                         rts = rzalloc_size(ctx, rt_size * rt_count);
 
-                panfrost_frag_shader_meta_init(ctx, &meta, rts);
+                struct panfrost_blend_final blend[PIPE_MAX_COLOR_BUFS];
+
+                for (unsigned c = 0; c < ctx->pipe_framebuffer.nr_cbufs; ++c)
+                        blend[c] = panfrost_get_blend_for_context(ctx, c);
+
+                panfrost_frag_shader_meta_init(ctx, &meta, rts, blend);
 
                 xfer = panfrost_pool_alloc_aligned(&batch->pool, desc_size, sizeof(meta));
 
 
                 xfer = panfrost_pool_alloc_aligned(&batch->pool, desc_size, sizeof(meta));