diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-06-02 14:12:29 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-06-03 20:48:24 +0000 |
commit | dce7722ef89100e5dea337064a9d6631bb18822a (patch) | |
tree | ca9c0631ddc0a89b27c9cefc1db90084e84338cd /src/gallium/drivers/panfrost | |
parent | 2447b3b9d3306b33c75d503c9caf9e7322c957bf (diff) |
panfrost: Handle writes_memory correctly
We need to pass it thru to EARLY_Z and WRITES_GLOBAL instead of ignoring
and assuming respectively. Nontrivial performance fix.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5300>
Diffstat (limited to 'src/gallium/drivers/panfrost')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_assemble.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_cmdstream.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.h | 1 |
3 files changed, 8 insertions, 3 deletions
diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c index 3bc384d49b4..d569b26732e 100644 --- a/src/gallium/drivers/panfrost/pan_assemble.c +++ b/src/gallium/drivers/panfrost/pan_assemble.c @@ -180,6 +180,8 @@ panfrost_shader_compile(struct panfrost_context *ctx, /* On Bifrost it's a sysval, on Midgard it's a varying */ state->reads_frag_coord = s->info.system_values_read & (1 << SYSTEM_VALUE_FRAG_COORD); + state->writes_global = s->info.writes_memory; + switch (stage) { case MESA_SHADER_VERTEX: state->attribute_count = util_bitcount64(s->info.inputs_read); diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 6edc7a80ed7..a40a1505817 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -353,8 +353,10 @@ panfrost_shader_meta_init(struct panfrost_context *ctx, /* TODO: This is not conformant on ES3 */ meta->midgard1.flags_hi = MALI_SUPPRESS_INF_NAN; - meta->midgard1.flags_lo = MALI_WRITES_GLOBAL | 0x20; + meta->midgard1.flags_lo = 0x20; meta->midgard1.uniform_buffer_count = panfrost_ubo_count(ctx, st); + + SET_BIT(meta->midgard1.flags_hi, MALI_WRITES_GLOBAL, ss->writes_global); } } @@ -839,10 +841,10 @@ panfrost_frag_shader_meta_init(struct panfrost_context *ctx, /* TODO */ } else { /* Depending on whether it's legal to in the given shader, we try to - * enable early-z testing (or forward-pixel kill?) */ + * enable early-z testing. TODO: respect e-z force */ SET_BIT(fragmeta->midgard1.flags_lo, MALI_EARLY_Z, - !fs->can_discard && !fs->writes_depth); + !fs->can_discard && !fs->writes_depth && !fs->writes_global); /* Add the writes Z/S flags if needed. */ SET_BIT(fragmeta->midgard1.flags_lo, MALI_WRITES_Z, fs->writes_depth); diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index a4ea44a96b9..aafb6ad138f 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -192,6 +192,7 @@ struct panfrost_shader_state { bool reads_point_coord; bool reads_face; bool reads_frag_coord; + bool writes_global; unsigned stack_size; unsigned shared_size; |