X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fpanfrost%2Fbifrost%2Fbifrost.h;h=12fb13a2c0c432be2ffe3f3f0d0fda0ee3646c90;hb=3e7fd2a0346ee364b1b0ccf58cc9214a602fcc35;hp=3e8e0229e9d0f43638c7c900aec5a47039a8eecd;hpb=07b31f3437ef60779f0fea83425521da3b7441f9;p=mesa.git diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h index 3e8e0229e9d..12fb13a2c0c 100644 --- a/src/panfrost/bifrost/bifrost.h +++ b/src/panfrost/bifrost/bifrost.h @@ -42,6 +42,7 @@ enum bifrost_clause_type { BIFROST_CLAUSE_SSBO_LOAD = 5, BIFROST_CLAUSE_SSBO_STORE = 6, BIFROST_CLAUSE_BLEND = 9, + BIFROST_CLAUSE_FRAGZ = 12, BIFROST_CLAUSE_ATEST = 13, BIFROST_CLAUSE_64BIT = 15 }; @@ -114,6 +115,10 @@ struct bifrost_fma_inst { unsigned op : 20; } __attribute__((packed)); +#define BIFROST_FMA_IADD_32 (0x4ff98 >> 3) +#define BIFROST_FMA_ISUB_32 (0x4ffd8 >> 3) +#define BIFROST_FMA_IMUL_32 ((BIFROST_FMA_EXT | 0x7818) >> 3) + struct bifrost_fma_2src { unsigned src0 : 3; unsigned src1 : 3; @@ -158,19 +163,47 @@ struct bifrost_fma_mscale { #define BIFROST_ADD_OP_FRSQ_FAST_F16_X (0x0ce50) #define BIFROST_ADD_OP_FRSQ_FAST_F16_Y (0x0ce70) #define BIFROST_ADD_OP_LOG2_HELP (0x0cc68) -#define BIFROST_ADD_OP_FEXP2_FAST (0x0cd58) +#define BIFROST_ADD_OP_IABS_32 (0x07bd4) struct bifrost_add_inst { unsigned src0 : 3; unsigned op : 17; } __attribute__((packed)); +#define BIFROST_ADD_OP_DISCARD (0x19100 >> 8) + +enum bifrost_discard_cond { + BIFROST_DISCARD_FEQ = 0, + BIFROST_DISCARD_FNE = 1, + BIFROST_DISCARD_FLE = 2, + BIFROST_DISCARD_FLT = 3, +}; + +struct bifrost_add_discard { + unsigned src0 : 3; + unsigned src1 : 3; + enum bifrost_discard_cond cond : 2; + /* Zero for fp32 */ + unsigned src0_select : 1; + unsigned src1_select : 1; + unsigned fp32 : 1; + unsigned op : 9; +} __attribute__((packed)); + #define BIFROST_ADD_OP_LD_UBO_1 (0x0c1a0 >> 3) #define BIFROST_ADD_OP_LD_UBO_2 (0x0c1e0 >> 3) #define BIFROST_ADD_OP_LD_UBO_3 (0x0caa0 >> 3) #define BIFROST_ADD_OP_LD_UBO_4 (0x0c220 >> 3) #define BIFROST_ADD_SEL_16(swiz) ((0xea60 >> 3) | (swiz)) +#define BIFROST_ADD_IADD_8 (0x17880 >> 3) +#define BIFROST_ADD_IADD_16 (0x17900 >> 3) +#define BIFROST_ADD_IADD_32 (0x178c0 >> 3) +#define BIFROST_ADD_ISUB_8 (0x17a80 >> 3) +#define BIFROST_ADD_ISUB_16 (0x17b00 >> 3) +#define BIFROST_ADD_ISUB_32 (0x17ac0 >> 3) +#define BIFROST_ADD_OP_FEXP2_FAST (0x0cd58 >> 3) + struct bifrost_add_2src { unsigned src0 : 3; unsigned src1 : 3; @@ -416,6 +449,7 @@ enum bifrost_fcmp_cond { BIFROST_OLE = 5, }; +/* "gl" version produces 0/1. "d3d" version produces 0/~0 */ #define BIFROST_FMA_OP_FCMP_GL (0x48000 >> 13) #define BIFROST_FMA_OP_FCMP_D3D (0x4c000 >> 13) @@ -442,6 +476,7 @@ struct bifrost_add_fcmp { unsigned op : 6; } __attribute__((packed)); +/* "gl" version produces 0/1. "d3d" version produces 0/~0 */ #define BIFROST_FMA_OP_FCMP_GL_16 (0xc8000 >> 13) #define BIFROST_FMA_OP_FCMP_D3D_16 (0xcc000 >> 13) @@ -476,11 +511,13 @@ struct bifrost_add_fcmp16 { enum bifrost_icmp_cond { BIFROST_ICMP_IGT = 0, - BIFROST_ICMP_IGE = 1, - BIFROST_ICMP_UGT = 2, + BIFROST_ICMP_IGE = 1, /* swapped for 16-bit */ + BIFROST_ICMP_UGT = 2, /* swapped for 16-bit */ BIFROST_ICMP_UGE = 3, BIFROST_ICMP_EQ = 4, BIFROST_ICMP_NEQ = 5, + BIFROST_ICMP_32_OR_8 = 6, /* nested */ + BIFROST_ICMP_64 = 7, /* nested */ }; struct bifrost_fma_icmp32 { @@ -488,7 +525,7 @@ struct bifrost_fma_icmp32 { unsigned src1 : 3; enum bifrost_icmp_cond cond : 3; unsigned unk1 : 1; /* set */ - unsigned d3d : 1; + unsigned d3d : 1; /* if set, true is ~0. otherwise, true is 1 */ unsigned op : 12; } __attribute__((packed)); @@ -500,15 +537,28 @@ struct bifrost_fma_icmp16 { unsigned op : 9; } __attribute__((packed)); +#define BIFROST_ADD_OP_ICMP_32 (0x0f600 >> 8) +#define BIFROST_ADD_OP_ICMP_16 (0x0f000 >> 11) + struct bifrost_add_icmp { unsigned src0 : 3; unsigned src1 : 3; enum bifrost_icmp_cond cond : 3; unsigned sz : 1; /* 1 for 32, 0 for 8 */ - unsigned d3d : 1; + unsigned d3d : 1; /* if set, true is ~0. otherwise, true is 1 */ unsigned op : 9; } __attribute__((packed)); +struct bifrost_add_icmp16 { + unsigned src0 : 3; + unsigned src1 : 3; + unsigned src0_swizzle : 2; + unsigned src1_swizzle : 2; + unsigned d3d : 1; /* if set, true is ~0. otherwise, true is 1 */ + enum bifrost_icmp_cond cond : 3; + unsigned op : 6; +} __attribute__((packed)); + /* Two sources for vectorization */ #define BIFROST_FMA_FLOAT32_TO_16 (0xdd000 >> 3) #define BIFROST_ADD_FLOAT32_TO_16 (0x0EC00 >> 3) @@ -578,6 +628,10 @@ enum bifrost_interp_mode { #define BIFROST_ADD_OP_LD_VAR_16 (0x1a << 1) #define BIFROST_ADD_OP_LD_VAR_32 (0x0a << 1) +/* Fixed location for gl_FragCoord.zw */ +#define BIFROST_FRAGZ (23) +#define BIFROST_FRAGW (22) + struct bifrost_ld_var { unsigned src0 : 3; @@ -618,14 +672,14 @@ struct bifrost_dual_tex_ctrl { unsigned unk1 : 22; } __attribute__((packed)); -#define BIFROST_ADD_OP_TEX_COMPACT_F32 (0x0b000 >> 10) -#define BIFROST_ADD_OP_TEX_COMPACT_F16 (0x1b000 >> 10) +#define BIFROST_ADD_OP_TEX_COMPACT_F32(vtx) ((0x0b000 | ((vtx) ? (0x400) : (0))) >> 10) +#define BIFROST_ADD_OP_TEX_COMPACT_F16(vtx) ((0x1b000 | ((vtx) ? (0x400) : (0))) >> 10) struct bifrost_tex_compact { unsigned src0 : 3; unsigned src1 : 3; unsigned tex_index : 3; - unsigned unknown : 1; + unsigned compute_lod : 1; unsigned sampler_index : 3; unsigned op : 7; } __attribute__((packed)); @@ -684,6 +738,8 @@ enum bifrost_branch_code { BR_ALWAYS = 63, }; +#define BIFROST_ADD_OP_BRANCH (0x0d000 >> 12) + struct bifrost_branch { unsigned src0 : 3;