From: Alyssa Rosenzweig Date: Fri, 16 Aug 2019 14:50:12 +0000 (-0700) Subject: pan/midgard: Treat cubemaps "stores" as loads X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9ae4d3653ee1ef6c67f0fecd05a07fbb41aa627b;p=mesa.git pan/midgard: Treat cubemaps "stores" as loads 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 --- 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 f01740f5feb..c004c95eeb2 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]);