pan/mdg: Use a 32-bit ld_color_buffer op when needed
authorIcecream95 <ixn@keemail.me>
Thu, 9 Jul 2020 11:44:41 +0000 (23:44 +1200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 13 Jul 2020 13:35:11 +0000 (13:35 +0000)
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

src/panfrost/midgard/midgard.h
src/panfrost/midgard/midgard_compile.c
src/panfrost/midgard/midgard_ops.c

index bb93d0d653dea367d73763005698b568cdd727ee..0b6ab9e28be29501c728cb750c9617ad55f908ea 100644 (file)
@@ -478,6 +478,7 @@ typedef enum {
         midgard_op_ld_vary_32i = 0x9B,
 
         /* Old version of midgard_op_ld_color_buffer_as_fp16, for T720 */
+        midgard_op_ld_color_buffer_as_fp32_old = 0x9C,
         midgard_op_ld_color_buffer_as_fp16_old = 0x9D,
         midgard_op_ld_color_buffer_32u_old = 0x9E,
 
@@ -496,6 +497,7 @@ typedef enum {
         midgard_op_ld_ubo_int4   = 0xB0,
 
         /* New-style blending ops. Works on T760/T860 */
+        midgard_op_ld_color_buffer_as_fp32 = 0xB8,
         midgard_op_ld_color_buffer_as_fp16 = 0xB9,
         midgard_op_ld_color_buffer_32u = 0xBA,
 
index dec1f38e094b73c0f6b9806ba06cde527ef4e0b2..35af805ea19f0a66fdb9730445ca06261295df20 100644 (file)
@@ -137,6 +137,7 @@ M_LOAD(ld_int4, nir_type_uint32);
 M_STORE(st_int4, nir_type_uint32);
 M_LOAD(ld_color_buffer_32u, nir_type_uint32);
 M_LOAD(ld_color_buffer_as_fp16, nir_type_float16);
+M_LOAD(ld_color_buffer_as_fp32, nir_type_float32);
 M_STORE(st_vary_32, nir_type_uint32);
 M_LOAD(ld_cubemap_coords, nir_type_uint32);
 M_LOAD(ld_compute_id, nir_type_uint32);
@@ -1769,7 +1770,13 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr)
         case nir_intrinsic_load_output: {
                 reg = nir_dest_index(&instr->dest);
 
-                midgard_instruction ld = m_ld_color_buffer_as_fp16(reg, 0);
+                unsigned bits = nir_dest_bit_size(instr->dest);
+
+                midgard_instruction ld;
+                if (bits == 16)
+                        ld = m_ld_color_buffer_as_fp16(reg, 0);
+                else
+                        ld = m_ld_color_buffer_as_fp32(reg, 0);
 
                 ld.load_store.arg_2 = output_load_rt_addr(ctx->nir, instr);
 
@@ -1777,7 +1784,10 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr)
                         ld.swizzle[0][c] = 0;
 
                 if (ctx->quirks & MIDGARD_OLD_BLEND) {
-                        ld.load_store.op = midgard_op_ld_color_buffer_as_fp16_old;
+                        if (bits == 16)
+                                ld.load_store.op = midgard_op_ld_color_buffer_as_fp16_old;
+                        else
+                                ld.load_store.op = midgard_op_ld_color_buffer_as_fp32_old;
                         ld.load_store.address = 1;
                         ld.load_store.arg_2 = 0x1E;
                 }
index 73e471c5e853251efe1a5b2b99f6c613c36a748b..b56d3730babc8f2014c072f0fac6cbddf702928d 100644 (file)
@@ -229,7 +229,9 @@ struct mir_ldst_op_props load_store_opcode_props[256] = {
         [midgard_op_ld_color_buffer_32u]  = {"ld_color_buffer_32u",  M32},
         [midgard_op_ld_color_buffer_32u_old]  = {"ld_color_buffer_32u_old",  M32},
         [midgard_op_ld_color_buffer_as_fp16] = {"ld_color_buffer_as_fp16", M16},
+        [midgard_op_ld_color_buffer_as_fp32] = {"ld_color_buffer_as_fp32", M32},
         [midgard_op_ld_color_buffer_as_fp16_old] = {"ld_color_buffer_as_fp16_old", M16 | LDST_SPECIAL_MASK},
+        [midgard_op_ld_color_buffer_as_fp32_old] = {"ld_color_buffer_as_fp32_old", M32 | LDST_SPECIAL_MASK},
 
         [midgard_op_ld_ubo_char]   = {"ld_ubo_char",   M32},
         [midgard_op_ld_ubo_char2]  = {"ld_ubo_char2",  M16},