Mesa (master): panfrost: Add a bitset of render targets read by shaders
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jul 13 14:04:06 UTC 2020
Module: Mesa
Branch: master
Commit: e603248e075f54ac6bde71486082e1e15aee4ff0
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e603248e075f54ac6bde71486082e1e15aee4ff0
Author: Icecream95 <ixn at keemail.me>
Date: Mon Jul 6 19:41:28 2020 +1200
panfrost: Add a bitset of render targets read by shaders
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>
---
src/gallium/drivers/panfrost/pan_assemble.c | 6 ++++++
src/gallium/drivers/panfrost/pan_cmdstream.c | 3 ++-
src/gallium/drivers/panfrost/pan_context.c | 15 +++++++++++++++
src/gallium/drivers/panfrost/pan_context.h | 1 +
4 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c
index d398d21ec54..06ee980ff3b 100644
--- a/src/gallium/drivers/panfrost/pan_assemble.c
+++ b/src/gallium/drivers/panfrost/pan_assemble.c
@@ -226,6 +226,12 @@ panfrost_shader_compile(struct panfrost_context *ctx,
if (s->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_STENCIL))
state->writes_stencil = true;
+ uint64_t outputs_read = s->info.outputs_read;
+ if (outputs_read & BITFIELD64_BIT(FRAG_RESULT_COLOR))
+ outputs_read |= BITFIELD64_BIT(FRAG_RESULT_DATA0);
+
+ state->outputs_read = outputs_read >> FRAG_RESULT_DATA0;
+
/* List of reasons we need to execute frag shaders when things
* are masked off */
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index abc0621782b..9806f74a1e7 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -878,7 +878,8 @@ panfrost_frag_shader_meta_init(struct panfrost_context *ctx,
bool depth_enabled = fs->writes_depth ||
(zsa && zsa->depth.enabled && zsa->depth.func != PIPE_FUNC_ALWAYS);
- SET_BIT(fragmeta->midgard1.flags_lo, MALI_READS_TILEBUFFER, !depth_enabled && fs->can_discard);
+ SET_BIT(fragmeta->midgard1.flags_lo, MALI_READS_TILEBUFFER,
+ fs->outputs_read || (!depth_enabled && fs->can_discard));
SET_BIT(fragmeta->midgard1.flags_lo, MALI_READS_ZS, depth_enabled && fs->can_discard);
}
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 7c438f61c14..0cf7b3e6e5c 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -664,6 +664,21 @@ panfrost_variant_matches(
}
}
+ if (variant->outputs_read) {
+ struct pipe_framebuffer_state *fb = &ctx->pipe_framebuffer;
+
+ unsigned i;
+ BITSET_FOREACH_SET(i, &variant->outputs_read, 8) {
+ enum pipe_format fmt = PIPE_FORMAT_R8G8B8A8_UNORM;
+
+ if ((fb->nr_cbufs > i) && fb->cbufs[i])
+ fmt = fb->cbufs[i]->format;
+
+ if (variant->rt_formats[i] != fmt)
+ return false;
+ }
+ }
+
/* Point sprites TODO on bifrost, always pass */
if (is_fragment && rasterizer && (rasterizer->sprite_coord_enable |
variant->point_sprite_mask)
diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index 2feb08fe302..3e5c6d614ed 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -225,6 +225,7 @@ struct panfrost_shader_state {
unsigned first_tag;
struct panfrost_bo *bo;
+ BITSET_WORD outputs_read;
enum pipe_format rt_formats[8];
};
More information about the mesa-commit
mailing list