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 <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5300>
This commit is contained in:
Alyssa Rosenzweig 2020-06-02 14:12:29 -04:00 committed by Marge Bot
parent 2447b3b9d3
commit dce7722ef8
3 changed files with 8 additions and 3 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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;