Mesa (master): pan/bi: Pass LD_VAR update mode explicitly
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Nov 17 08:24:50 UTC 2020
Module: Mesa
Branch: master
Commit: 1176cc12978d78025a435aa4d17bb90c1045df9d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1176cc12978d78025a435aa4d17bb90c1045df9d
Author: Boris Brezillon <boris.brezillon at collabora.com>
Date: Mon Nov 16 11:41:59 2020 +0100
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 at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7636>
---
src/panfrost/bifrost/bi_print.c | 8 ++++++++
src/panfrost/bifrost/bifrost.h | 7 +++++++
src/panfrost/bifrost/bifrost_compile.c | 4 ++++
src/panfrost/bifrost/compiler.h | 1 +
src/panfrost/bifrost/gen_pack.py | 11 +----------
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',
More information about the mesa-commit
mailing list