From 2447b3b9d3306b33c75d503c9caf9e7322c957bf Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 2 Jun 2020 14:05:34 -0400 Subject: [PATCH] panfrost: Document MALI_WRITES_GLOBAL bit We've been setting this unconditionally -- oops! Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 2 +- src/panfrost/include/panfrost-job.h | 7 +++++++ src/panfrost/pandecode/decode.c | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 14d013f08c9..6edc7a80ed7 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -353,7 +353,7 @@ 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 = 0x220; + meta->midgard1.flags_lo = MALI_WRITES_GLOBAL | 0x20; meta->midgard1.uniform_buffer_count = panfrost_ubo_count(ctx, st); } } diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index 66db429e3b9..0829b9bfb57 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -408,6 +408,13 @@ enum mali_format { * it might read depth/stencil in particular, also set MALI_READS_ZS */ #define MALI_READS_ZS (1 << 8) + +/* The shader might write to global memory (via OpenCL, SSBOs, or images). + * Reading is okay, as are ordinary writes to the tilebuffer/varyings. Setting + * incurs a performance penalty. On a fragment shader, this bit implies there + * are side effects, hence it interacts with early-z. */ +#define MALI_WRITES_GLOBAL (1 << 9) + #define MALI_READS_TILEBUFFER (1 << 12) /* Applies to midgard1.flags_hi */ diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c index f9bfa190fbf..8358603feaf 100644 --- a/src/panfrost/pandecode/decode.c +++ b/src/panfrost/pandecode/decode.c @@ -274,6 +274,7 @@ static const struct pandecode_flag_info shader_midgard1_flag_lo_info [] = { FLAG_INFO(WRITES_Z), FLAG_INFO(EARLY_Z), FLAG_INFO(READS_TILEBUFFER), + FLAG_INFO(WRITES_GLOBAL), FLAG_INFO(READS_ZS), {} }; -- 2.30.2