pan/midgard: Treat cubemaps "stores" as loads
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 16 Aug 2019 14:50:12 +0000 (07:50 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 19 Aug 2019 15:32:17 +0000 (08:32 -0700)
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@collabora.com>
src/panfrost/midgard/helpers.h
src/panfrost/midgard/midgard.h
src/panfrost/midgard/midgard_compile.c
src/panfrost/midgard/midgard_ops.c
src/panfrost/midgard/midgard_ra.c

index afed7d97e2d9bea19b77c47099ebef486f2fb61f..ffcf9d84de1c39a5d30a10a8f5a5d51d8aa250a1 100644 (file)
@@ -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) ( \
index a43b7f309edcefa4a577f7c462453c4163e7b3b2..753da1c064ed756db957ff924941e0e4908eb869 100644 (file)
@@ -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,
index f01740f5feb13a76b207010e7ed5d40e94be44d0..c004c95eeb2991d8f95e16425f53c349b29e501e 100644 (file)
@@ -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;
index d8fd80df2773370c0522e540c83344bfbe825b1d..dbc87386bc08d96d198fc80aad743e5398167b44 100644 (file)
@@ -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",
index 6a417d48c9161949ee271959552c22f2839000a6..ebd085cd9a39e7cd80e3b9378f747d8885d11df7 100644 (file)
@@ -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]);