summaryrefslogtreecommitdiff
path: root/src/panfrost
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@collabora.com>2020-11-16 11:41:59 +0100
committerBoris Brezillon <boris.brezillon@collabora.com>2020-11-17 08:41:05 +0100
commit1176cc12978d78025a435aa4d17bb90c1045df9d (patch)
treead18c3825336116830dc8da70ff847bee214d881 /src/panfrost
parent4321b4fc935c2ec4946d47d5e606dfa4810d7aaa (diff)
pan/bi: Pass LD_VAR update mode explicitly
Let the compiler pass the update mode instead of inferring from the constant value. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7636>
Diffstat (limited to 'src/panfrost')
-rw-r--r--src/panfrost/bifrost/bi_print.c8
-rw-r--r--src/panfrost/bifrost/bifrost.h7
-rw-r--r--src/panfrost/bifrost/bifrost_compile.c4
-rw-r--r--src/panfrost/bifrost/compiler.h1
-rw-r--r--src/panfrost/bifrost/gen_pack.py11
5 files changed, 21 insertions, 10 deletions
diff --git a/src/panfrost/bifrost/bi_print.c b/src/panfrost/bifrost/bi_print.c
index db86fb055f0..c546bd6af7f 100644
--- a/src/panfrost/bifrost/bi_print.c
+++ b/src/panfrost/bifrost/bi_print.c
@@ -245,6 +245,14 @@ bi_print_load_vary(struct bi_load_vary *load, FILE *fp)
if (load->flat)
fprintf(fp, ".flat");
+
+ switch (load->update_mode) {
+ case BIFROST_UPDATE_STORE: fprintf(fp, ".store"); break;
+ case BIFROST_UPDATE_RETRIEVE: fprintf(fp, ".retrieve"); break;
+ case BIFROST_UPDATE_CONDITIONAL: fprintf(fp, ".conditional"); break;
+ case BIFROST_UPDATE_CLOBBER: fprintf(fp, ".conditional"); break;
+ default: unreachable("Invalid update mode");
+ }
}
const char *
diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h
index a0d7d7fbc73..64ded49c7a1 100644
--- a/src/panfrost/bifrost/bifrost.h
+++ b/src/panfrost/bifrost/bifrost.h
@@ -228,6 +228,13 @@ enum bifrost_interp_mode {
BIFROST_INTERP_NONE = 0x4,
};
+enum bifrost_update_mode {
+ BIFROST_UPDATE_STORE,
+ BIFROST_UPDATE_RETRIEVE,
+ BIFROST_UPDATE_CONDITIONAL,
+ BIFROST_UPDATE_CLOBBER,
+};
+
/* Fixed location for gl_FragCoord.zw */
#define BIFROST_FRAGZ (23)
#define BIFROST_FRAGW (22)
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index c4604855da4..32429b0ae26 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -567,6 +567,7 @@ bi_emit_ld_frag_coord(bi_context *ctx, nir_intrinsic_instr *instr)
.type = BI_LOAD_VAR,
.load_vary = {
.interp_mode = BIFROST_INTERP_CENTER,
+ .update_mode = BIFROST_UPDATE_CLOBBER,
.reuse = false,
.flat = true
},
@@ -724,6 +725,9 @@ bi_emit_point_coord(bi_context *ctx, nir_intrinsic_instr *instr)
{
bi_instruction ins = {
.type = BI_LOAD_VAR,
+ .load_vary = {
+ .update_mode = BIFROST_UPDATE_CLOBBER,
+ },
.vector_channels = 2,
.dest = pan_dest_index(&instr->dest),
.dest_type = nir_type_float32,
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index c044b5803ed..1eb3149efe6 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -134,6 +134,7 @@ extern unsigned bi_class_props[BI_NUM_CLASSES];
/* BI_LD_VARY */
struct bi_load_vary {
enum bifrost_interp_mode interp_mode;
+ enum bifrost_update_mode update_mode;
bool reuse;
bool flat;
};
diff --git a/src/panfrost/bifrost/gen_pack.py b/src/panfrost/bifrost/gen_pack.py
index e9025ae3fbc..93ee42020ac 100644
--- a/src/panfrost/bifrost/gen_pack.py
+++ b/src/panfrost/bifrost/gen_pack.py
@@ -215,15 +215,6 @@ def pack_seg(mod, opts, body, pack_exprs):
else:
assert(False)
-# TODO: Update modes (perf / slow) For now just force store, except for special
-# varyings for which we force clobber
-def pack_update(mod, opts, body, pack_exprs):
- if opts == ['store', 'retrieve', 'conditional', 'clobber']:
- return '(ins->constant.u64 >= 20) ? 3 : 0'
- else:
- assert(opts[0] == 'store')
- return '0'
-
# Processes modifiers. If used directly, emits a pack. Otherwise, just
# processes the value (grabbing it from the IR). This must sync with the IR.
@@ -273,7 +264,7 @@ modifier_map = {
"not_result": pack_not_result,
"register_format": pack_register_format,
"seg": pack_seg,
- "update": pack_update,
+ "update": lambda a,b,c,d: 'ins->load_vary.update_mode',
# Just a minus one modifier
"vecsize": lambda a,b,c,d: 'ins->vector_channels - 1',