pan/midgard: Identify UBO/SSBO op symmetry
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 13 Aug 2019 15:51:40 +0000 (08:51 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 14 Aug 2019 23:57:24 +0000 (16:57 -0700)
It's the same thing, just shifted.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/disassemble.c
src/panfrost/midgard/helpers.h
src/panfrost/midgard/midgard.h
src/panfrost/midgard/midgard_compile.c
src/panfrost/midgard/midgard_ops.c

index 28f0b40e476e6a4405eba8a962955303381423aa..1c061eb6df7e86e56db7ae76819f75558558fd60 100644 (file)
@@ -1034,8 +1034,8 @@ print_load_store_instr(uint64_t data,
 
         int address = word->address;
 
-        if (word->op == midgard_op_ld_uniform_32) {
-                /* Uniforms use their own addressing scheme */
+        if (OP_IS_UBO_READ(word->op)) {
+                /* UBOs use their own addressing scheme */
 
                 int lo = word->varying_parameters >> 7;
                 int hi = word->address;
index d7df9ad01a8ebe71d392407cf2257c42cfa2a72a..afed7d97e2d9bea19b77c47099ebef486f2fb61f 100644 (file)
         )
 
 #define OP_IS_UBO_READ(op) ( \
-                op == midgard_op_ld_uniform_32  || \
-                op == midgard_op_ld_uniform_16  || \
-                op == midgard_op_ld_uniform_32i \
+                op == midgard_op_ld_ubo_char  || \
+                op == midgard_op_ld_ubo_char2  || \
+                op == midgard_op_ld_ubo_char4  || \
+                op == midgard_op_ld_ubo_short4  || \
+                op == midgard_op_ld_ubo_int4 \
         )
 
 #define OP_IS_CSEL(op) ( \
index 4f6a58e94b39250017f64f1e49294a686c41a0b0..a43b7f309edcefa4a577f7c462453c4163e7b3b2 100644 (file)
@@ -441,10 +441,20 @@ typedef enum {
         midgard_op_ld_vary_32i = 0x9B,
         midgard_op_ld_color_buffer_16 = 0x9D,
 
-        midgard_op_ld_uniform_16 = 0xAC,
-        midgard_op_ld_uniform_32i = 0xA8,
+        /* The distinction between these ops is the alignment requirement /
+         * accompanying shift. Thus, the offset to ld_ubo_int4 is in 16-byte
+         * units and can load 128-bit. The offset to ld_ubo_short4 is in 8-byte
+         * units; ld_ubo_char4 in 4-byte units. ld_ubo_char/ld_ubo_char2 are
+         * purely theoretical (never seen in the wild) since int8/int16/fp16
+         * UBOs don't really exist. The ops are still listed to maintain
+         * symmetry with generic I/O ops. */
+
+        midgard_op_ld_ubo_char   = 0xA0, /* theoretical */
+        midgard_op_ld_ubo_char2  = 0xA4, /* theoretical */
+        midgard_op_ld_ubo_char4  = 0xA8,
+        midgard_op_ld_ubo_short4 = 0xAC,
+        midgard_op_ld_ubo_int4   = 0xB0,
 
-        midgard_op_ld_uniform_32 = 0xB0,
         midgard_op_ld_color_buffer_8 = 0xBA,
 
         midgard_op_st_char = 0xC0,
index 499dbb6e9c32a5adcb452c2885ef77884ccfec01..475b12f4ee563a44049e9d3cf7be7e767dfee8a0 100644 (file)
@@ -181,8 +181,7 @@ vector_alu_modifiers(nir_alu_src *src, bool is_int, unsigned broadcast_count,
 M_LOAD(ld_attr_32);
 //M_LOAD(ld_vary_16);
 M_LOAD(ld_vary_32);
-//M_LOAD(ld_uniform_16);
-M_LOAD(ld_uniform_32);
+M_LOAD(ld_ubo_int4);
 M_LOAD(ld_int4);
 M_STORE(st_int4);
 M_LOAD(ld_color_buffer_8);
@@ -1162,7 +1161,7 @@ emit_ubo_read(
 {
         /* TODO: half-floats */
 
-        midgard_instruction ins = m_ld_uniform_32(dest, offset);
+        midgard_instruction ins = m_ld_ubo_int4(dest, offset);
 
         /* TODO: Don't split */
         ins.load_store.varying_parameters = (offset & 7) << 7;
index 172a50fc77ca2a35d4c23fcd011bb2790e19daa4..d8fd80df2773370c0522e540c83344bfbe825b1d 100644 (file)
@@ -202,12 +202,14 @@ const char *load_store_opcode_names[256] = {
         [midgard_op_ld_vary_32i] = "ld_vary_32i",
         [midgard_op_ld_vary_32u] = "ld_vary_32u",
 
+        [midgard_op_ld_color_buffer_8] = "ld_color_buffer_8",
         [midgard_op_ld_color_buffer_16] = "ld_color_buffer_16",
 
-        [midgard_op_ld_uniform_16] = "ld_uniform_16",
-        [midgard_op_ld_uniform_32] = "ld_uniform_32",
-        [midgard_op_ld_uniform_32i] = "ld_uniform_32i",
-        [midgard_op_ld_color_buffer_8] = "ld_color_buffer_8",
+        [midgard_op_ld_ubo_char] = "ld_ubo_char",
+        [midgard_op_ld_ubo_char2] = "ld_ubo_char2",
+        [midgard_op_ld_ubo_char4] = "ld_ubo_char4",
+        [midgard_op_ld_ubo_short4] = "ld_ubo_short4",
+        [midgard_op_ld_ubo_int4] = "ld_ubo_int4",
 
         [midgard_op_st_char] = "st_char",
         [midgard_op_st_char2] = "st_char2",