[Mesa-dev] [PATCH 18/20] pan/midgard: Treat cubemaps "stores" as loads
Alyssa Rosenzweig
alyssa.rosenzweig at collabora.com
Fri Aug 16 15:35:58 UTC 2019
It's always been ambiguous which they are, but their primary register is
their output, not their input; therefore, they are loads.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
src/panfrost/midgard/helpers.h | 5 ++---
src/panfrost/midgard/midgard.h | 9 ++++-----
src/panfrost/midgard/midgard_compile.c | 14 +++++++-------
src/panfrost/midgard/midgard_ops.c | 2 +-
src/panfrost/midgard/midgard_ra.c | 4 +---
5 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/src/panfrost/midgard/helpers.h b/src/panfrost/midgard/helpers.h
index afed7d97e2d..ffcf9d84de1 100644
--- a/src/panfrost/midgard/helpers.h
+++ b/src/panfrost/midgard/helpers.h
@@ -47,8 +47,7 @@
)
#define OP_IS_STORE(op) (\
- OP_IS_STORE_R26(op) || \
- op == midgard_op_st_cubemap_coords \
+ OP_IS_STORE_R26(op) \
)
#define OP_IS_PROJECTION(op) ( \
@@ -58,7 +57,7 @@
#define OP_IS_VEC4_ONLY(op) ( \
OP_IS_PROJECTION(op) || \
- op == midgard_op_st_cubemap_coords \
+ op == midgard_op_ld_cubemap_coords \
)
#define OP_IS_MOVE(op) ( \
diff --git a/src/panfrost/midgard/midgard.h b/src/panfrost/midgard/midgard.h
index a43b7f309ed..753da1c064e 100644
--- a/src/panfrost/midgard/midgard.h
+++ b/src/panfrost/midgard/midgard.h
@@ -391,12 +391,11 @@ midgard_writeout;
typedef enum {
midgard_op_ld_st_noop = 0x03,
- /* Unclear why this is on the L/S unit, but (with an address of 0,
- * appropriate swizzle, magic constant 0x24, and xy mask?) moves fp32 cube
- * map coordinates in r27 to its cube map texture coordinate
- * destination (e.g r29). 0x4 magic for lding from fp16 instead */
+ /* Unclear why this is on the L/S unit, but moves fp32 cube map
+ * coordinates in r27 to its cube map texture coordinate destination
+ * (e.g r29). */
- midgard_op_st_cubemap_coords = 0x0E,
+ midgard_op_ld_cubemap_coords = 0x0E,
/* Loads a global/local/group ID, depending on arguments */
midgard_op_ld_compute_id = 0x10,
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 705c3b32778..2b6e851167b 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -190,7 +190,7 @@ M_STORE(st_int4);
M_LOAD(ld_color_buffer_8);
//M_STORE(st_vary_16);
M_STORE(st_vary_32);
-M_LOAD(st_cubemap_coords);
+M_LOAD(ld_cubemap_coords);
M_LOAD(ld_compute_id);
static midgard_instruction
@@ -1792,12 +1792,12 @@ emit_texop_native(compiler_context *ctx, nir_tex_instr *instr,
* texture register */
unsigned temp = make_compiler_temp(ctx);
- midgard_instruction st = m_st_cubemap_coords(temp, 0);
- st.ssa_args.src[0] = index;
- st.mask = 0x3; /* xy */
- st.load_store.arg_1 = 0x20;
- st.load_store.swizzle = alu_src.swizzle;
- emit_mir_instruction(ctx, st);
+ midgard_instruction ld = m_ld_cubemap_coords(temp, 0);
+ ld.ssa_args.src[0] = index;
+ ld.mask = 0x3; /* xy */
+ ld.load_store.arg_1 = 0x20;
+ ld.load_store.swizzle = alu_src.swizzle;
+ emit_mir_instruction(ctx, ld);
ins.ssa_args.src[0] = temp;
ins.texture.in_reg_swizzle = SWIZZLE_XYXX;
diff --git a/src/panfrost/midgard/midgard_ops.c b/src/panfrost/midgard/midgard_ops.c
index d8fd80df277..dbc87386bc0 100644
--- a/src/panfrost/midgard/midgard_ops.c
+++ b/src/panfrost/midgard/midgard_ops.c
@@ -170,7 +170,7 @@ struct mir_op_props alu_opcode_props[256] = {
};
const char *load_store_opcode_names[256] = {
- [midgard_op_st_cubemap_coords] = "st_cubemap_coords",
+ [midgard_op_ld_cubemap_coords] = "ld_cubemap_coords",
[midgard_op_ld_compute_id] = "ld_compute_id",
[midgard_op_ldst_perspective_division_z] = "ldst_perspective_division_z",
[midgard_op_ldst_perspective_division_w] = "ldst_perspective_division_w",
diff --git a/src/panfrost/midgard/midgard_ra.c b/src/panfrost/midgard/midgard_ra.c
index 6a417d48c91..ebd085cd9a3 100644
--- a/src/panfrost/midgard/midgard_ra.c
+++ b/src/panfrost/midgard/midgard_ra.c
@@ -752,9 +752,7 @@ install_registers_instr(
* whether we are loading or storing -- think about the
* logical dataflow */
- bool encodes_src =
- OP_IS_STORE(ins->load_store.op) &&
- ins->load_store.op != midgard_op_st_cubemap_coords;
+ bool encodes_src = OP_IS_STORE(ins->load_store.op);
if (encodes_src) {
struct phys_reg src = index_to_reg(ctx, g, args.src[0]);
--
2.23.0.rc1
More information about the mesa-dev
mailing list