Mesa (main): panfrost: Split out allow_fpk helper

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 7 18:02:37 UTC 2022


Module: Mesa
Branch: main
Commit: 270e3e02f2e7c4b4ae45bf9c3accce297ac2db58
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=270e3e02f2e7c4b4ae45bf9c3accce297ac2db58

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Thu Apr  7 10:28:44 2022 -0400

panfrost: Split out allow_fpk helper

For sharing between Bifrost's renderer state descriptor and Valhall's draw call
descriptor, which require the same logic in different places.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15797>

---

 src/gallium/drivers/panfrost/pan_cmdstream.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index e45fee63de9..1749dba5e14 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -430,6 +430,23 @@ panfrost_emit_blend(struct panfrost_batch *batch, void *rts, mali_ptr *blend_sha
 }
 #endif
 
+static inline bool
+pan_allow_forward_pixel_to_kill(struct panfrost_context *ctx, struct panfrost_shader_state *fs)
+{
+        /* Track if any colour buffer is reused across draws, either
+         * from reading it directly, or from failing to write it
+         */
+        unsigned rt_mask = ctx->fb_rt_mask;
+        uint64_t rt_written = (fs->info.outputs_written >> FRAG_RESULT_DATA0);
+        bool blend_reads_dest = (ctx->blend->load_dest_mask & rt_mask);
+        bool alpha_to_coverage = ctx->blend->base.alpha_to_coverage;
+
+        return fs->info.fs.can_fpk &&
+                !(rt_mask & ~rt_written) &&
+                !alpha_to_coverage &&
+                !blend_reads_dest;
+}
+
 /* Construct a partial RSD corresponding to no executed fragment shader, and
  * merge with the existing partial RSD. */
 
@@ -477,17 +494,8 @@ panfrost_prepare_fs_state(struct panfrost_context *ctx,
         pan_pack(rsd, RENDERER_STATE, cfg) {
                 if (panfrost_fs_required(fs, so, &ctx->pipe_framebuffer, zsa)) {
 #if PAN_ARCH >= 6
-                        /* Track if any colour buffer is reused across draws, either
-                         * from reading it directly, or from failing to write it */
-                        unsigned rt_mask = ctx->fb_rt_mask;
-                        uint64_t rt_written = (fs->info.outputs_written >> FRAG_RESULT_DATA0);
-                        bool blend_reads_dest = (so->load_dest_mask & rt_mask);
-
                         cfg.properties.allow_forward_pixel_to_kill =
-                                fs->info.fs.can_fpk &&
-                                !(rt_mask & ~rt_written) &&
-                                !alpha_to_coverage &&
-                                !blend_reads_dest;
+                                pan_allow_forward_pixel_to_kill(ctx, fs);
 #else
                         cfg.properties.force_early_z =
                                 fs->info.fs.can_early_z && !alpha_to_coverage &&



More information about the mesa-commit mailing list