From: Alyssa Rosenzweig Date: Tue, 13 Aug 2019 15:51:40 +0000 (-0700) Subject: pan/midgard: Identify UBO/SSBO op symmetry X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ec2f0b580ff030112214cf2fc83d08927f1b1fb7;p=mesa.git pan/midgard: Identify UBO/SSBO op symmetry It's the same thing, just shifted. Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/panfrost/midgard/disassemble.c b/src/panfrost/midgard/disassemble.c index 28f0b40e476..1c061eb6df7 100644 --- a/src/panfrost/midgard/disassemble.c +++ b/src/panfrost/midgard/disassemble.c @@ -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; diff --git a/src/panfrost/midgard/helpers.h b/src/panfrost/midgard/helpers.h index d7df9ad01a8..afed7d97e2d 100644 --- a/src/panfrost/midgard/helpers.h +++ b/src/panfrost/midgard/helpers.h @@ -67,9 +67,11 @@ ) #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) ( \ diff --git a/src/panfrost/midgard/midgard.h b/src/panfrost/midgard/midgard.h index 4f6a58e94b3..a43b7f309ed 100644 --- a/src/panfrost/midgard/midgard.h +++ b/src/panfrost/midgard/midgard.h @@ -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, diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 499dbb6e9c3..475b12f4ee5 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -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; diff --git a/src/panfrost/midgard/midgard_ops.c b/src/panfrost/midgard/midgard_ops.c index 172a50fc77c..d8fd80df277 100644 --- a/src/panfrost/midgard/midgard_ops.c +++ b/src/panfrost/midgard/midgard_ops.c @@ -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",