Path: blob/21.2-virgl/src/intel/compiler/brw_eu_defines.h
4550 views
/*1Copyright (C) Intel Corp. 2006. All Rights Reserved.2Intel funded Tungsten Graphics to3develop this 3D driver.45Permission is hereby granted, free of charge, to any person obtaining6a copy of this software and associated documentation files (the7"Software"), to deal in the Software without restriction, including8without limitation the rights to use, copy, modify, merge, publish,9distribute, sublicense, and/or sell copies of the Software, and to10permit persons to whom the Software is furnished to do so, subject to11the following conditions:1213The above copyright notice and this permission notice (including the14next paragraph) shall be included in all copies or substantial15portions of the Software.1617THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,18EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.20IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE21LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION22OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION23WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.2425**********************************************************************/26/*27* Authors:28* Keith Whitwell <[email protected]>29*/3031#ifndef BRW_EU_DEFINES_H32#define BRW_EU_DEFINES_H3334#include <stdint.h>35#include <stdlib.h>36#include "util/macros.h"37#include "dev/intel_device_info.h"3839/* The following hunk, up-to "Execution Unit" is used by both the40* intel/compiler and i965 codebase. */4142#define INTEL_MASK(high, low) (((1u<<((high)-(low)+1))-1)<<(low))43/* Using the GNU statement expression extension */44#define SET_FIELD(value, field) \45({ \46uint32_t fieldval = (uint32_t)(value) << field ## _SHIFT; \47assert((fieldval & ~ field ## _MASK) == 0); \48fieldval & field ## _MASK; \49})5051#define SET_BITS(value, high, low) \52({ \53const uint32_t fieldval = (uint32_t)(value) << (low); \54assert((fieldval & ~INTEL_MASK(high, low)) == 0); \55fieldval & INTEL_MASK(high, low); \56})5758#define GET_BITS(data, high, low) ((data & INTEL_MASK((high), (low))) >> (low))59#define GET_FIELD(word, field) (((word) & field ## _MASK) >> field ## _SHIFT)6061#define _3DPRIM_POINTLIST 0x0162#define _3DPRIM_LINELIST 0x0263#define _3DPRIM_LINESTRIP 0x0364#define _3DPRIM_TRILIST 0x0465#define _3DPRIM_TRISTRIP 0x0566#define _3DPRIM_TRIFAN 0x0667#define _3DPRIM_QUADLIST 0x0768#define _3DPRIM_QUADSTRIP 0x0869#define _3DPRIM_LINELIST_ADJ 0x09 /* G45+ */70#define _3DPRIM_LINESTRIP_ADJ 0x0A /* G45+ */71#define _3DPRIM_TRILIST_ADJ 0x0B /* G45+ */72#define _3DPRIM_TRISTRIP_ADJ 0x0C /* G45+ */73#define _3DPRIM_TRISTRIP_REVERSE 0x0D74#define _3DPRIM_POLYGON 0x0E75#define _3DPRIM_RECTLIST 0x0F76#define _3DPRIM_LINELOOP 0x1077#define _3DPRIM_POINTLIST_BF 0x1178#define _3DPRIM_LINESTRIP_CONT 0x1279#define _3DPRIM_LINESTRIP_BF 0x1380#define _3DPRIM_LINESTRIP_CONT_BF 0x1481#define _3DPRIM_TRIFAN_NOSTIPPLE 0x1682#define _3DPRIM_PATCHLIST(n) ({ assert(n > 0 && n <= 32); 0x20 + (n - 1); })8384/* Bitfields for the URB_WRITE message, DW2 of message header: */85#define URB_WRITE_PRIM_END 0x186#define URB_WRITE_PRIM_START 0x287#define URB_WRITE_PRIM_TYPE_SHIFT 28889#define BRW_SPRITE_POINT_ENABLE 169091# define GFX7_GS_CONTROL_DATA_FORMAT_GSCTL_CUT 092# define GFX7_GS_CONTROL_DATA_FORMAT_GSCTL_SID 19394/* Execution Unit (EU) defines95*/9697#define BRW_ALIGN_1 098#define BRW_ALIGN_16 199100#define BRW_ADDRESS_DIRECT 0101#define BRW_ADDRESS_REGISTER_INDIRECT_REGISTER 1102103#define BRW_CHANNEL_X 0104#define BRW_CHANNEL_Y 1105#define BRW_CHANNEL_Z 2106#define BRW_CHANNEL_W 3107108enum brw_compression {109BRW_COMPRESSION_NONE = 0,110BRW_COMPRESSION_2NDHALF = 1,111BRW_COMPRESSION_COMPRESSED = 2,112};113114#define GFX6_COMPRESSION_1Q 0115#define GFX6_COMPRESSION_2Q 1116#define GFX6_COMPRESSION_3Q 2117#define GFX6_COMPRESSION_4Q 3118#define GFX6_COMPRESSION_1H 0119#define GFX6_COMPRESSION_2H 2120121enum PACKED brw_conditional_mod {122BRW_CONDITIONAL_NONE = 0,123BRW_CONDITIONAL_Z = 1,124BRW_CONDITIONAL_NZ = 2,125BRW_CONDITIONAL_EQ = 1, /* Z */126BRW_CONDITIONAL_NEQ = 2, /* NZ */127BRW_CONDITIONAL_G = 3,128BRW_CONDITIONAL_GE = 4,129BRW_CONDITIONAL_L = 5,130BRW_CONDITIONAL_LE = 6,131BRW_CONDITIONAL_R = 7, /* Gen <= 5 */132BRW_CONDITIONAL_O = 8,133BRW_CONDITIONAL_U = 9,134};135136#define BRW_DEBUG_NONE 0137#define BRW_DEBUG_BREAKPOINT 1138139#define BRW_DEPENDENCY_NORMAL 0140#define BRW_DEPENDENCY_NOTCLEARED 1141#define BRW_DEPENDENCY_NOTCHECKED 2142#define BRW_DEPENDENCY_DISABLE 3143144enum PACKED brw_execution_size {145BRW_EXECUTE_1 = 0,146BRW_EXECUTE_2 = 1,147BRW_EXECUTE_4 = 2,148BRW_EXECUTE_8 = 3,149BRW_EXECUTE_16 = 4,150BRW_EXECUTE_32 = 5,151};152153enum PACKED brw_horizontal_stride {154BRW_HORIZONTAL_STRIDE_0 = 0,155BRW_HORIZONTAL_STRIDE_1 = 1,156BRW_HORIZONTAL_STRIDE_2 = 2,157BRW_HORIZONTAL_STRIDE_4 = 3,158};159160enum PACKED gfx10_align1_3src_src_horizontal_stride {161BRW_ALIGN1_3SRC_SRC_HORIZONTAL_STRIDE_0 = 0,162BRW_ALIGN1_3SRC_SRC_HORIZONTAL_STRIDE_1 = 1,163BRW_ALIGN1_3SRC_SRC_HORIZONTAL_STRIDE_2 = 2,164BRW_ALIGN1_3SRC_SRC_HORIZONTAL_STRIDE_4 = 3,165};166167enum PACKED gfx10_align1_3src_dst_horizontal_stride {168BRW_ALIGN1_3SRC_DST_HORIZONTAL_STRIDE_1 = 0,169BRW_ALIGN1_3SRC_DST_HORIZONTAL_STRIDE_2 = 1,170};171172#define BRW_INSTRUCTION_NORMAL 0173#define BRW_INSTRUCTION_SATURATE 1174175#define BRW_MASK_ENABLE 0176#define BRW_MASK_DISABLE 1177178/** @{179*180* Gfx6 has replaced "mask enable/disable" with WECtrl, which is181* effectively the same but much simpler to think about. Now, there182* are two contributors ANDed together to whether channels are183* executed: The predication on the instruction, and the channel write184* enable.185*/186/**187* This is the default value. It means that a channel's write enable is set188* if the per-channel IP is pointing at this instruction.189*/190#define BRW_WE_NORMAL 0191/**192* This is used like BRW_MASK_DISABLE, and causes all channels to have193* their write enable set. Note that predication still contributes to194* whether the channel actually gets written.195*/196#define BRW_WE_ALL 1197/** @} */198199enum opcode {200/* These are the actual hardware instructions. */201BRW_OPCODE_ILLEGAL,202BRW_OPCODE_SYNC,203BRW_OPCODE_MOV,204BRW_OPCODE_SEL,205BRW_OPCODE_MOVI, /**< G45+ */206BRW_OPCODE_NOT,207BRW_OPCODE_AND,208BRW_OPCODE_OR,209BRW_OPCODE_XOR,210BRW_OPCODE_SHR,211BRW_OPCODE_SHL,212BRW_OPCODE_DIM, /**< Gfx7.5 only */213BRW_OPCODE_SMOV, /**< Gfx8+ */214BRW_OPCODE_ASR,215BRW_OPCODE_ROR, /**< Gfx11+ */216BRW_OPCODE_ROL, /**< Gfx11+ */217BRW_OPCODE_CMP,218BRW_OPCODE_CMPN,219BRW_OPCODE_CSEL, /**< Gfx8+ */220BRW_OPCODE_F32TO16, /**< Gfx7 only */221BRW_OPCODE_F16TO32, /**< Gfx7 only */222BRW_OPCODE_BFREV, /**< Gfx7+ */223BRW_OPCODE_BFE, /**< Gfx7+ */224BRW_OPCODE_BFI1, /**< Gfx7+ */225BRW_OPCODE_BFI2, /**< Gfx7+ */226BRW_OPCODE_JMPI,227BRW_OPCODE_BRD, /**< Gfx7+ */228BRW_OPCODE_IF,229BRW_OPCODE_IFF, /**< Pre-Gfx6 */230BRW_OPCODE_BRC, /**< Gfx7+ */231BRW_OPCODE_ELSE,232BRW_OPCODE_ENDIF,233BRW_OPCODE_DO, /**< Pre-Gfx6 */234BRW_OPCODE_CASE, /**< Gfx6 only */235BRW_OPCODE_WHILE,236BRW_OPCODE_BREAK,237BRW_OPCODE_CONTINUE,238BRW_OPCODE_HALT,239BRW_OPCODE_CALLA, /**< Gfx7.5+ */240BRW_OPCODE_MSAVE, /**< Pre-Gfx6 */241BRW_OPCODE_CALL, /**< Gfx6+ */242BRW_OPCODE_MREST, /**< Pre-Gfx6 */243BRW_OPCODE_RET, /**< Gfx6+ */244BRW_OPCODE_PUSH, /**< Pre-Gfx6 */245BRW_OPCODE_FORK, /**< Gfx6 only */246BRW_OPCODE_GOTO, /**< Gfx8+ */247BRW_OPCODE_POP, /**< Pre-Gfx6 */248BRW_OPCODE_WAIT,249BRW_OPCODE_SEND,250BRW_OPCODE_SENDC,251BRW_OPCODE_SENDS, /**< Gfx9+ */252BRW_OPCODE_SENDSC, /**< Gfx9+ */253BRW_OPCODE_MATH, /**< Gfx6+ */254BRW_OPCODE_ADD,255BRW_OPCODE_MUL,256BRW_OPCODE_AVG,257BRW_OPCODE_FRC,258BRW_OPCODE_RNDU,259BRW_OPCODE_RNDD,260BRW_OPCODE_RNDE,261BRW_OPCODE_RNDZ,262BRW_OPCODE_MAC,263BRW_OPCODE_MACH,264BRW_OPCODE_LZD,265BRW_OPCODE_FBH, /**< Gfx7+ */266BRW_OPCODE_FBL, /**< Gfx7+ */267BRW_OPCODE_CBIT, /**< Gfx7+ */268BRW_OPCODE_ADDC, /**< Gfx7+ */269BRW_OPCODE_SUBB, /**< Gfx7+ */270BRW_OPCODE_SAD2,271BRW_OPCODE_SADA2,272BRW_OPCODE_DP4,273BRW_OPCODE_DPH,274BRW_OPCODE_DP3,275BRW_OPCODE_DP2,276BRW_OPCODE_LINE,277BRW_OPCODE_PLN, /**< G45+ */278BRW_OPCODE_MAD, /**< Gfx6+ */279BRW_OPCODE_LRP, /**< Gfx6+ */280BRW_OPCODE_MADM, /**< Gfx8+ */281BRW_OPCODE_NENOP, /**< G45 only */282BRW_OPCODE_NOP,283284NUM_BRW_OPCODES,285286/* These are compiler backend opcodes that get translated into other287* instructions.288*/289FS_OPCODE_FB_WRITE = NUM_BRW_OPCODES,290291/**292* Same as FS_OPCODE_FB_WRITE but expects its arguments separately as293* individual sources instead of as a single payload blob. The294* position/ordering of the arguments are defined by the enum295* fb_write_logical_srcs.296*/297FS_OPCODE_FB_WRITE_LOGICAL,298299FS_OPCODE_REP_FB_WRITE,300301FS_OPCODE_FB_READ,302FS_OPCODE_FB_READ_LOGICAL,303304SHADER_OPCODE_RCP,305SHADER_OPCODE_RSQ,306SHADER_OPCODE_SQRT,307SHADER_OPCODE_EXP2,308SHADER_OPCODE_LOG2,309SHADER_OPCODE_POW,310SHADER_OPCODE_INT_QUOTIENT,311SHADER_OPCODE_INT_REMAINDER,312SHADER_OPCODE_SIN,313SHADER_OPCODE_COS,314315/**316* A generic "send" opcode. The first two sources are the message317* descriptor and extended message descriptor respectively. The third318* and optional fourth sources are the message payload319*/320SHADER_OPCODE_SEND,321322/**323* An "undefined" write which does nothing but indicates to liveness that324* we don't care about any values in the register which predate this325* instruction. Used to prevent partial writes from causing issues with326* live ranges.327*/328SHADER_OPCODE_UNDEF,329330/**331* Texture sampling opcodes.332*333* LOGICAL opcodes are eventually translated to the matching non-LOGICAL334* opcode but instead of taking a single payload blob they expect their335* arguments separately as individual sources. The position/ordering of the336* arguments are defined by the enum tex_logical_srcs.337*/338SHADER_OPCODE_TEX,339SHADER_OPCODE_TEX_LOGICAL,340SHADER_OPCODE_TXD,341SHADER_OPCODE_TXD_LOGICAL,342SHADER_OPCODE_TXF,343SHADER_OPCODE_TXF_LOGICAL,344SHADER_OPCODE_TXF_LZ,345SHADER_OPCODE_TXL,346SHADER_OPCODE_TXL_LOGICAL,347SHADER_OPCODE_TXL_LZ,348SHADER_OPCODE_TXS,349SHADER_OPCODE_TXS_LOGICAL,350FS_OPCODE_TXB,351FS_OPCODE_TXB_LOGICAL,352SHADER_OPCODE_TXF_CMS,353SHADER_OPCODE_TXF_CMS_LOGICAL,354SHADER_OPCODE_TXF_CMS_W,355SHADER_OPCODE_TXF_CMS_W_LOGICAL,356SHADER_OPCODE_TXF_UMS,357SHADER_OPCODE_TXF_UMS_LOGICAL,358SHADER_OPCODE_TXF_MCS,359SHADER_OPCODE_TXF_MCS_LOGICAL,360SHADER_OPCODE_LOD,361SHADER_OPCODE_LOD_LOGICAL,362SHADER_OPCODE_TG4,363SHADER_OPCODE_TG4_LOGICAL,364SHADER_OPCODE_TG4_OFFSET,365SHADER_OPCODE_TG4_OFFSET_LOGICAL,366SHADER_OPCODE_SAMPLEINFO,367SHADER_OPCODE_SAMPLEINFO_LOGICAL,368369SHADER_OPCODE_IMAGE_SIZE_LOGICAL,370371/**372* Combines multiple sources of size 1 into a larger virtual GRF.373* For example, parameters for a send-from-GRF message. Or, updating374* channels of a size 4 VGRF used to store vec4s such as texturing results.375*376* This will be lowered into MOVs from each source to consecutive offsets377* of the destination VGRF.378*379* src[0] may be BAD_FILE. If so, the lowering pass skips emitting the MOV,380* but still reserves the first channel of the destination VGRF. This can be381* used to reserve space for, say, a message header set up by the generators.382*/383SHADER_OPCODE_LOAD_PAYLOAD,384385/**386* Packs a number of sources into a single value. Unlike LOAD_PAYLOAD, this387* acts intra-channel, obtaining the final value for each channel by388* combining the sources values for the same channel, the first source389* occupying the lowest bits and the last source occupying the highest390* bits.391*/392FS_OPCODE_PACK,393394SHADER_OPCODE_SHADER_TIME_ADD,395396/**397* Typed and untyped surface access opcodes.398*399* LOGICAL opcodes are eventually translated to the matching non-LOGICAL400* opcode but instead of taking a single payload blob they expect their401* arguments separately as individual sources:402*403* Source 0: [required] Surface coordinates.404* Source 1: [optional] Operation source.405* Source 2: [required] Surface index.406* Source 3: [required] Number of coordinate components (as UD immediate).407* Source 4: [required] Opcode-specific control immediate, same as source 2408* of the matching non-LOGICAL opcode.409*/410VEC4_OPCODE_UNTYPED_ATOMIC,411SHADER_OPCODE_UNTYPED_ATOMIC_LOGICAL,412SHADER_OPCODE_UNTYPED_ATOMIC_FLOAT_LOGICAL,413VEC4_OPCODE_UNTYPED_SURFACE_READ,414SHADER_OPCODE_UNTYPED_SURFACE_READ_LOGICAL,415VEC4_OPCODE_UNTYPED_SURFACE_WRITE,416SHADER_OPCODE_UNTYPED_SURFACE_WRITE_LOGICAL,417418SHADER_OPCODE_OWORD_BLOCK_READ_LOGICAL,419SHADER_OPCODE_UNALIGNED_OWORD_BLOCK_READ_LOGICAL,420SHADER_OPCODE_OWORD_BLOCK_WRITE_LOGICAL,421422/**423* Untyped A64 surface access opcodes.424*425* Source 0: 64-bit address426* Source 1: Operational source427* Source 2: [required] Opcode-specific control immediate, same as source 2428* of the matching non-LOGICAL opcode.429*/430SHADER_OPCODE_A64_UNTYPED_READ_LOGICAL,431SHADER_OPCODE_A64_UNTYPED_WRITE_LOGICAL,432SHADER_OPCODE_A64_BYTE_SCATTERED_READ_LOGICAL,433SHADER_OPCODE_A64_BYTE_SCATTERED_WRITE_LOGICAL,434SHADER_OPCODE_A64_OWORD_BLOCK_READ_LOGICAL,435SHADER_OPCODE_A64_UNALIGNED_OWORD_BLOCK_READ_LOGICAL,436SHADER_OPCODE_A64_OWORD_BLOCK_WRITE_LOGICAL,437SHADER_OPCODE_A64_UNTYPED_ATOMIC_LOGICAL,438SHADER_OPCODE_A64_UNTYPED_ATOMIC_INT16_LOGICAL,439SHADER_OPCODE_A64_UNTYPED_ATOMIC_INT64_LOGICAL,440SHADER_OPCODE_A64_UNTYPED_ATOMIC_FLOAT16_LOGICAL,441SHADER_OPCODE_A64_UNTYPED_ATOMIC_FLOAT32_LOGICAL,442443SHADER_OPCODE_TYPED_ATOMIC_LOGICAL,444SHADER_OPCODE_TYPED_SURFACE_READ_LOGICAL,445SHADER_OPCODE_TYPED_SURFACE_WRITE_LOGICAL,446447SHADER_OPCODE_RND_MODE,448SHADER_OPCODE_FLOAT_CONTROL_MODE,449450/**451* Byte scattered write/read opcodes.452*453* LOGICAL opcodes are eventually translated to the matching non-LOGICAL454* opcode, but instead of taking a single payload blog they expect their455* arguments separately as individual sources, like untyped write/read.456*/457SHADER_OPCODE_BYTE_SCATTERED_READ_LOGICAL,458SHADER_OPCODE_BYTE_SCATTERED_WRITE_LOGICAL,459SHADER_OPCODE_DWORD_SCATTERED_READ_LOGICAL,460SHADER_OPCODE_DWORD_SCATTERED_WRITE_LOGICAL,461462/**463* Memory fence messages.464*465* Source 0: Must be register g0, used as header.466* Source 1: Immediate bool to indicate whether control is returned to the467* thread only after the fence has been honored.468* Source 2: Immediate byte indicating which memory to fence. Zero means469* global memory; GFX7_BTI_SLM means SLM (for Gfx11+ only).470*471* Vec4 backend only uses Source 0.472*/473SHADER_OPCODE_MEMORY_FENCE,474475/**476* Scheduling-only fence.477*478* Sources can be used to force a stall until the registers in those are479* available. This might generate MOVs or SYNC_NOPs (Gfx12+).480*/481FS_OPCODE_SCHEDULING_FENCE,482483SHADER_OPCODE_GFX4_SCRATCH_READ,484SHADER_OPCODE_GFX4_SCRATCH_WRITE,485SHADER_OPCODE_GFX7_SCRATCH_READ,486487SHADER_OPCODE_SCRATCH_HEADER,488489/**490* Gfx8+ SIMD8 URB Read messages.491*/492SHADER_OPCODE_URB_READ_SIMD8,493SHADER_OPCODE_URB_READ_SIMD8_PER_SLOT,494495SHADER_OPCODE_URB_WRITE_SIMD8,496SHADER_OPCODE_URB_WRITE_SIMD8_PER_SLOT,497SHADER_OPCODE_URB_WRITE_SIMD8_MASKED,498SHADER_OPCODE_URB_WRITE_SIMD8_MASKED_PER_SLOT,499500/**501* Return the index of an arbitrary live channel (i.e. one of the channels502* enabled in the current execution mask) and assign it to the first503* component of the destination. Expected to be used as input for the504* BROADCAST pseudo-opcode.505*/506SHADER_OPCODE_FIND_LIVE_CHANNEL,507508/**509* Return the current execution mask in the specified flag subregister.510* Can be CSE'ed more easily than a plain MOV from the ce0 ARF register.511*/512FS_OPCODE_LOAD_LIVE_CHANNELS,513514/**515* Pick the channel from its first source register given by the index516* specified as second source. Useful for variable indexing of surfaces.517*518* Note that because the result of this instruction is by definition519* uniform and it can always be splatted to multiple channels using a520* scalar regioning mode, only the first channel of the destination region521* is guaranteed to be updated, which implies that BROADCAST instructions522* should usually be marked force_writemask_all.523*/524SHADER_OPCODE_BROADCAST,525526/* Pick the channel from its first source register given by the index527* specified as second source.528*529* This is similar to the BROADCAST instruction except that it takes a530* dynamic index and potentially puts a different value in each output531* channel.532*/533SHADER_OPCODE_SHUFFLE,534535/* Select between src0 and src1 based on channel enables.536*537* This instruction copies src0 into the enabled channels of the538* destination and copies src1 into the disabled channels.539*/540SHADER_OPCODE_SEL_EXEC,541542/* This turns into an align16 mov from src0 to dst with a swizzle543* provided as an immediate in src1.544*/545SHADER_OPCODE_QUAD_SWIZZLE,546547/* Take every Nth element in src0 and broadcast it to the group of N548* channels in which it lives in the destination. The offset within the549* cluster is given by src1 and the cluster size is given by src2.550*/551SHADER_OPCODE_CLUSTER_BROADCAST,552553SHADER_OPCODE_GET_BUFFER_SIZE,554555SHADER_OPCODE_INTERLOCK,556557/** Target for a HALT558*559* All HALT instructions in a shader must target the same jump point and560* that point is denoted by a HALT_TARGET instruction.561*/562SHADER_OPCODE_HALT_TARGET,563564VEC4_OPCODE_MOV_BYTES,565VEC4_OPCODE_PACK_BYTES,566VEC4_OPCODE_UNPACK_UNIFORM,567VEC4_OPCODE_DOUBLE_TO_F32,568VEC4_OPCODE_DOUBLE_TO_D32,569VEC4_OPCODE_DOUBLE_TO_U32,570VEC4_OPCODE_TO_DOUBLE,571VEC4_OPCODE_PICK_LOW_32BIT,572VEC4_OPCODE_PICK_HIGH_32BIT,573VEC4_OPCODE_SET_LOW_32BIT,574VEC4_OPCODE_SET_HIGH_32BIT,575VEC4_OPCODE_MOV_FOR_SCRATCH,576VEC4_OPCODE_ZERO_OOB_PUSH_REGS,577578FS_OPCODE_DDX_COARSE,579FS_OPCODE_DDX_FINE,580/**581* Compute dFdy(), dFdyCoarse(), or dFdyFine().582*/583FS_OPCODE_DDY_COARSE,584FS_OPCODE_DDY_FINE,585FS_OPCODE_LINTERP,586FS_OPCODE_PIXEL_X,587FS_OPCODE_PIXEL_Y,588FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD,589FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD_GFX7,590FS_OPCODE_VARYING_PULL_CONSTANT_LOAD_GFX4,591FS_OPCODE_VARYING_PULL_CONSTANT_LOAD_LOGICAL,592FS_OPCODE_SET_SAMPLE_ID,593FS_OPCODE_PACK_HALF_2x16_SPLIT,594FS_OPCODE_INTERPOLATE_AT_SAMPLE,595FS_OPCODE_INTERPOLATE_AT_SHARED_OFFSET,596FS_OPCODE_INTERPOLATE_AT_PER_SLOT_OFFSET,597598VS_OPCODE_URB_WRITE,599VS_OPCODE_PULL_CONSTANT_LOAD,600VS_OPCODE_PULL_CONSTANT_LOAD_GFX7,601602VS_OPCODE_UNPACK_FLAGS_SIMD4X2,603604/**605* Write geometry shader output data to the URB.606*607* Unlike VS_OPCODE_URB_WRITE, this opcode doesn't do an implied move from608* R0 to the first MRF. This allows the geometry shader to override the609* "Slot {0,1} Offset" fields in the message header.610*/611GS_OPCODE_URB_WRITE,612613/**614* Write geometry shader output data to the URB and request a new URB615* handle (gfx6).616*617* This opcode doesn't do an implied move from R0 to the first MRF.618*/619GS_OPCODE_URB_WRITE_ALLOCATE,620621/**622* Terminate the geometry shader thread by doing an empty URB write.623*624* This opcode doesn't do an implied move from R0 to the first MRF. This625* allows the geometry shader to override the "GS Number of Output Vertices626* for Slot {0,1}" fields in the message header.627*/628GS_OPCODE_THREAD_END,629630/**631* Set the "Slot {0,1} Offset" fields of a URB_WRITE message header.632*633* - dst is the MRF containing the message header.634*635* - src0.x indicates which portion of the URB should be written to (e.g. a636* vertex number)637*638* - src1 is an immediate multiplier which will be applied to src0639* (e.g. the size of a single vertex in the URB).640*641* Note: the hardware will apply this offset *in addition to* the offset in642* vec4_instruction::offset.643*/644GS_OPCODE_SET_WRITE_OFFSET,645646/**647* Set the "GS Number of Output Vertices for Slot {0,1}" fields of a648* URB_WRITE message header.649*650* - dst is the MRF containing the message header.651*652* - src0.x is the vertex count. The upper 16 bits will be ignored.653*/654GS_OPCODE_SET_VERTEX_COUNT,655656/**657* Set DWORD 2 of dst to the value in src.658*/659GS_OPCODE_SET_DWORD_2,660661/**662* Prepare the dst register for storage in the "Channel Mask" fields of a663* URB_WRITE message header.664*665* DWORD 4 of dst is shifted left by 4 bits, so that later,666* GS_OPCODE_SET_CHANNEL_MASKS can OR DWORDs 0 and 4 together to form the667* final channel mask.668*669* Note: since GS_OPCODE_SET_CHANNEL_MASKS ORs DWORDs 0 and 4 together to670* form the final channel mask, DWORDs 0 and 4 of the dst register must not671* have any extraneous bits set prior to execution of this opcode (that is,672* they should be in the range 0x0 to 0xf).673*/674GS_OPCODE_PREPARE_CHANNEL_MASKS,675676/**677* Set the "Channel Mask" fields of a URB_WRITE message header.678*679* - dst is the MRF containing the message header.680*681* - src.x is the channel mask, as prepared by682* GS_OPCODE_PREPARE_CHANNEL_MASKS. DWORDs 0 and 4 are OR'ed together to683* form the final channel mask.684*/685GS_OPCODE_SET_CHANNEL_MASKS,686687/**688* Get the "Instance ID" fields from the payload.689*690* - dst is the GRF for gl_InvocationID.691*/692GS_OPCODE_GET_INSTANCE_ID,693694/**695* Send a FF_SYNC message to allocate initial URB handles (gfx6).696*697* - dst will be used as the writeback register for the FF_SYNC operation.698*699* - src0 is the number of primitives written.700*701* - src1 is the value to hold in M0.0: number of SO vertices to write702* and number of SO primitives needed. Its value will be overwritten703* with the SVBI values if transform feedback is enabled.704*705* Note: This opcode uses an implicit MRF register for the ff_sync message706* header, so the caller is expected to set inst->base_mrf and initialize707* that MRF register to r0. This opcode will also write to this MRF register708* to include the allocated URB handle so it can then be reused directly as709* the header in the URB write operation we are allocating the handle for.710*/711GS_OPCODE_FF_SYNC,712713/**714* Move r0.1 (which holds PrimitiveID information in gfx6) to a separate715* register.716*717* - dst is the GRF where PrimitiveID information will be moved.718*/719GS_OPCODE_SET_PRIMITIVE_ID,720721/**722* Write transform feedback data to the SVB by sending a SVB WRITE message.723* Used in gfx6.724*725* - dst is the MRF register containing the message header.726*727* - src0 is the register where the vertex data is going to be copied from.728*729* - src1 is the destination register when write commit occurs.730*/731GS_OPCODE_SVB_WRITE,732733/**734* Set destination index in the SVB write message payload (M0.5). Used735* in gfx6 for transform feedback.736*737* - dst is the header to save the destination indices for SVB WRITE.738* - src is the register that holds the destination indices value.739*/740GS_OPCODE_SVB_SET_DST_INDEX,741742/**743* Prepare Mx.0 subregister for being used in the FF_SYNC message header.744* Used in gfx6 for transform feedback.745*746* - dst will hold the register with the final Mx.0 value.747*748* - src0 has the number of vertices emitted in SO (NumSOVertsToWrite)749*750* - src1 has the number of needed primitives for SO (NumSOPrimsNeeded)751*752* - src2 is the value to hold in M0: number of SO vertices to write753* and number of SO primitives needed.754*/755GS_OPCODE_FF_SYNC_SET_PRIMITIVES,756757/**758* Terminate the compute shader.759*/760CS_OPCODE_CS_TERMINATE,761762/**763* GLSL barrier()764*/765SHADER_OPCODE_BARRIER,766767/**768* Calculate the high 32-bits of a 32x32 multiply.769*/770SHADER_OPCODE_MULH,771772/** Signed subtraction with saturation. */773SHADER_OPCODE_ISUB_SAT,774775/** Unsigned subtraction with saturation. */776SHADER_OPCODE_USUB_SAT,777778/**779* A MOV that uses VxH indirect addressing.780*781* Source 0: A register to start from (HW_REG).782* Source 1: An indirect offset (in bytes, UD GRF).783* Source 2: The length of the region that could be accessed (in bytes,784* UD immediate).785*/786SHADER_OPCODE_MOV_INDIRECT,787788/** Fills out a relocatable immediate */789SHADER_OPCODE_MOV_RELOC_IMM,790791VEC4_OPCODE_URB_READ,792TCS_OPCODE_GET_INSTANCE_ID,793TCS_OPCODE_URB_WRITE,794TCS_OPCODE_SET_INPUT_URB_OFFSETS,795TCS_OPCODE_SET_OUTPUT_URB_OFFSETS,796TCS_OPCODE_GET_PRIMITIVE_ID,797TCS_OPCODE_CREATE_BARRIER_HEADER,798TCS_OPCODE_SRC0_010_IS_ZERO,799TCS_OPCODE_RELEASE_INPUT,800TCS_OPCODE_THREAD_END,801802TES_OPCODE_GET_PRIMITIVE_ID,803TES_OPCODE_CREATE_INPUT_READ_HEADER,804TES_OPCODE_ADD_INDIRECT_URB_OFFSET,805806SHADER_OPCODE_GET_DSS_ID,807SHADER_OPCODE_BTD_SPAWN_LOGICAL,808SHADER_OPCODE_BTD_RETIRE_LOGICAL,809810RT_OPCODE_TRACE_RAY_LOGICAL,811};812813enum brw_urb_write_flags {814BRW_URB_WRITE_NO_FLAGS = 0,815816/**817* Causes a new URB entry to be allocated, and its address stored in the818* destination register (gen < 7).819*/820BRW_URB_WRITE_ALLOCATE = 0x1,821822/**823* Causes the current URB entry to be deallocated (gen < 7).824*/825BRW_URB_WRITE_UNUSED = 0x2,826827/**828* Causes the thread to terminate.829*/830BRW_URB_WRITE_EOT = 0x4,831832/**833* Indicates that the given URB entry is complete, and may be sent further834* down the 3D pipeline (gen < 7).835*/836BRW_URB_WRITE_COMPLETE = 0x8,837838/**839* Indicates that an additional offset (which may be different for the two840* vec4 slots) is stored in the message header (gen == 7).841*/842BRW_URB_WRITE_PER_SLOT_OFFSET = 0x10,843844/**845* Indicates that the channel masks in the URB_WRITE message header should846* not be overridden to 0xff (gen == 7).847*/848BRW_URB_WRITE_USE_CHANNEL_MASKS = 0x20,849850/**851* Indicates that the data should be sent to the URB using the852* URB_WRITE_OWORD message rather than URB_WRITE_HWORD (gen == 7). This853* causes offsets to be interpreted as multiples of an OWORD instead of an854* HWORD, and only allows one OWORD to be written.855*/856BRW_URB_WRITE_OWORD = 0x40,857858/**859* Convenient combination of flags: end the thread while simultaneously860* marking the given URB entry as complete.861*/862BRW_URB_WRITE_EOT_COMPLETE = BRW_URB_WRITE_EOT | BRW_URB_WRITE_COMPLETE,863864/**865* Convenient combination of flags: mark the given URB entry as complete866* and simultaneously allocate a new one.867*/868BRW_URB_WRITE_ALLOCATE_COMPLETE =869BRW_URB_WRITE_ALLOCATE | BRW_URB_WRITE_COMPLETE,870};871872enum fb_write_logical_srcs {873FB_WRITE_LOGICAL_SRC_COLOR0, /* REQUIRED */874FB_WRITE_LOGICAL_SRC_COLOR1, /* for dual source blend messages */875FB_WRITE_LOGICAL_SRC_SRC0_ALPHA,876FB_WRITE_LOGICAL_SRC_SRC_DEPTH, /* gl_FragDepth */877FB_WRITE_LOGICAL_SRC_DST_DEPTH, /* GFX4-5: passthrough from thread */878FB_WRITE_LOGICAL_SRC_SRC_STENCIL, /* gl_FragStencilRefARB */879FB_WRITE_LOGICAL_SRC_OMASK, /* Sample Mask (gl_SampleMask) */880FB_WRITE_LOGICAL_SRC_COMPONENTS, /* REQUIRED */881FB_WRITE_LOGICAL_NUM_SRCS882};883884enum tex_logical_srcs {885/** Texture coordinates */886TEX_LOGICAL_SRC_COORDINATE,887/** Shadow comparator */888TEX_LOGICAL_SRC_SHADOW_C,889/** dPdx if the operation takes explicit derivatives, otherwise LOD value */890TEX_LOGICAL_SRC_LOD,891/** dPdy if the operation takes explicit derivatives */892TEX_LOGICAL_SRC_LOD2,893/** Min LOD */894TEX_LOGICAL_SRC_MIN_LOD,895/** Sample index */896TEX_LOGICAL_SRC_SAMPLE_INDEX,897/** MCS data */898TEX_LOGICAL_SRC_MCS,899/** REQUIRED: Texture surface index */900TEX_LOGICAL_SRC_SURFACE,901/** Texture sampler index */902TEX_LOGICAL_SRC_SAMPLER,903/** Texture surface bindless handle */904TEX_LOGICAL_SRC_SURFACE_HANDLE,905/** Texture sampler bindless handle */906TEX_LOGICAL_SRC_SAMPLER_HANDLE,907/** Texel offset for gathers */908TEX_LOGICAL_SRC_TG4_OFFSET,909/** REQUIRED: Number of coordinate components (as UD immediate) */910TEX_LOGICAL_SRC_COORD_COMPONENTS,911/** REQUIRED: Number of derivative components (as UD immediate) */912TEX_LOGICAL_SRC_GRAD_COMPONENTS,913914TEX_LOGICAL_NUM_SRCS,915};916917enum surface_logical_srcs {918/** Surface binding table index */919SURFACE_LOGICAL_SRC_SURFACE,920/** Surface bindless handle */921SURFACE_LOGICAL_SRC_SURFACE_HANDLE,922/** Surface address; could be multi-dimensional for typed opcodes */923SURFACE_LOGICAL_SRC_ADDRESS,924/** Data to be written or used in an atomic op */925SURFACE_LOGICAL_SRC_DATA,926/** Surface number of dimensions. Affects the size of ADDRESS */927SURFACE_LOGICAL_SRC_IMM_DIMS,928/** Per-opcode immediate argument. For atomics, this is the atomic opcode */929SURFACE_LOGICAL_SRC_IMM_ARG,930/**931* Some instructions with side-effects should not be predicated on932* sample mask, e.g. lowered stores to scratch.933*/934SURFACE_LOGICAL_SRC_ALLOW_SAMPLE_MASK,935936SURFACE_LOGICAL_NUM_SRCS937};938939#ifdef __cplusplus940/**941* Allow brw_urb_write_flags enums to be ORed together.942*/943inline brw_urb_write_flags944operator|(brw_urb_write_flags x, brw_urb_write_flags y)945{946return static_cast<brw_urb_write_flags>(static_cast<int>(x) |947static_cast<int>(y));948}949#endif950951enum PACKED brw_predicate {952BRW_PREDICATE_NONE = 0,953BRW_PREDICATE_NORMAL = 1,954BRW_PREDICATE_ALIGN1_ANYV = 2,955BRW_PREDICATE_ALIGN1_ALLV = 3,956BRW_PREDICATE_ALIGN1_ANY2H = 4,957BRW_PREDICATE_ALIGN1_ALL2H = 5,958BRW_PREDICATE_ALIGN1_ANY4H = 6,959BRW_PREDICATE_ALIGN1_ALL4H = 7,960BRW_PREDICATE_ALIGN1_ANY8H = 8,961BRW_PREDICATE_ALIGN1_ALL8H = 9,962BRW_PREDICATE_ALIGN1_ANY16H = 10,963BRW_PREDICATE_ALIGN1_ALL16H = 11,964BRW_PREDICATE_ALIGN1_ANY32H = 12,965BRW_PREDICATE_ALIGN1_ALL32H = 13,966BRW_PREDICATE_ALIGN16_REPLICATE_X = 2,967BRW_PREDICATE_ALIGN16_REPLICATE_Y = 3,968BRW_PREDICATE_ALIGN16_REPLICATE_Z = 4,969BRW_PREDICATE_ALIGN16_REPLICATE_W = 5,970BRW_PREDICATE_ALIGN16_ANY4H = 6,971BRW_PREDICATE_ALIGN16_ALL4H = 7,972};973974enum PACKED brw_reg_file {975BRW_ARCHITECTURE_REGISTER_FILE = 0,976BRW_GENERAL_REGISTER_FILE = 1,977BRW_MESSAGE_REGISTER_FILE = 2,978BRW_IMMEDIATE_VALUE = 3,979980ARF = BRW_ARCHITECTURE_REGISTER_FILE,981FIXED_GRF = BRW_GENERAL_REGISTER_FILE,982MRF = BRW_MESSAGE_REGISTER_FILE,983IMM = BRW_IMMEDIATE_VALUE,984985/* These are not hardware values */986VGRF,987ATTR,988UNIFORM, /* prog_data->params[reg] */989BAD_FILE,990};991992enum PACKED gfx10_align1_3src_reg_file {993BRW_ALIGN1_3SRC_GENERAL_REGISTER_FILE = 0,994BRW_ALIGN1_3SRC_IMMEDIATE_VALUE = 1, /* src0, src2 */995BRW_ALIGN1_3SRC_ACCUMULATOR = 1, /* dest, src1 */996};997998/* CNL adds Align1 support for 3-src instructions. Bit 35 of the instruction999* word is "Execution Datatype" which controls whether the instruction operates1000* on float or integer types. The register arguments have fields that offer1001* more fine control their respective types.1002*/1003enum PACKED gfx10_align1_3src_exec_type {1004BRW_ALIGN1_3SRC_EXEC_TYPE_INT = 0,1005BRW_ALIGN1_3SRC_EXEC_TYPE_FLOAT = 1,1006};10071008#define BRW_ARF_NULL 0x001009#define BRW_ARF_ADDRESS 0x101010#define BRW_ARF_ACCUMULATOR 0x201011#define BRW_ARF_FLAG 0x301012#define BRW_ARF_MASK 0x401013#define BRW_ARF_MASK_STACK 0x501014#define BRW_ARF_MASK_STACK_DEPTH 0x601015#define BRW_ARF_STATE 0x701016#define BRW_ARF_CONTROL 0x801017#define BRW_ARF_NOTIFICATION_COUNT 0x901018#define BRW_ARF_IP 0xA01019#define BRW_ARF_TDR 0xB01020#define BRW_ARF_TIMESTAMP 0xC010211022#define BRW_MRF_COMPR4 (1 << 7)10231024#define BRW_AMASK 01025#define BRW_IMASK 11026#define BRW_LMASK 21027#define BRW_CMASK 31028102910301031#define BRW_THREAD_NORMAL 01032#define BRW_THREAD_ATOMIC 11033#define BRW_THREAD_SWITCH 210341035enum PACKED brw_vertical_stride {1036BRW_VERTICAL_STRIDE_0 = 0,1037BRW_VERTICAL_STRIDE_1 = 1,1038BRW_VERTICAL_STRIDE_2 = 2,1039BRW_VERTICAL_STRIDE_4 = 3,1040BRW_VERTICAL_STRIDE_8 = 4,1041BRW_VERTICAL_STRIDE_16 = 5,1042BRW_VERTICAL_STRIDE_32 = 6,1043BRW_VERTICAL_STRIDE_ONE_DIMENSIONAL = 0xF,1044};10451046enum PACKED gfx10_align1_3src_vertical_stride {1047BRW_ALIGN1_3SRC_VERTICAL_STRIDE_0 = 0,1048BRW_ALIGN1_3SRC_VERTICAL_STRIDE_1 = 1,1049BRW_ALIGN1_3SRC_VERTICAL_STRIDE_2 = 1,1050BRW_ALIGN1_3SRC_VERTICAL_STRIDE_4 = 2,1051BRW_ALIGN1_3SRC_VERTICAL_STRIDE_8 = 3,1052};10531054enum PACKED brw_width {1055BRW_WIDTH_1 = 0,1056BRW_WIDTH_2 = 1,1057BRW_WIDTH_4 = 2,1058BRW_WIDTH_8 = 3,1059BRW_WIDTH_16 = 4,1060};10611062/**1063* Gfx12+ SWSB SBID synchronization mode.1064*1065* This is represented as a bitmask including any required SBID token1066* synchronization modes, used to synchronize out-of-order instructions. Only1067* the strongest mode of the mask will be provided to the hardware in the SWSB1068* field of an actual hardware instruction, but virtual instructions may be1069* able to take into account multiple of them.1070*/1071enum tgl_sbid_mode {1072TGL_SBID_NULL = 0,1073TGL_SBID_SRC = 1,1074TGL_SBID_DST = 2,1075TGL_SBID_SET = 41076};10771078#ifdef __cplusplus1079/**1080* Allow bitwise arithmetic of tgl_sbid_mode enums.1081*/1082inline tgl_sbid_mode1083operator|(tgl_sbid_mode x, tgl_sbid_mode y)1084{1085return tgl_sbid_mode(unsigned(x) | unsigned(y));1086}10871088inline tgl_sbid_mode1089operator&(tgl_sbid_mode x, tgl_sbid_mode y)1090{1091return tgl_sbid_mode(unsigned(x) & unsigned(y));1092}10931094inline tgl_sbid_mode &1095operator|=(tgl_sbid_mode &x, tgl_sbid_mode y)1096{1097return x = x | y;1098}10991100#endif11011102/**1103* TGL+ SWSB RegDist synchronization pipeline.1104*1105* On TGL all instructions that use the RegDist synchronization mechanism are1106* considered to be executed as a single in-order pipeline, therefore only the1107* TGL_PIPE_FLOAT pipeline is applicable. On XeHP+ platforms there are two1108* additional asynchronous ALU pipelines (which still execute instructions1109* in-order and use the RegDist synchronization mechanism). TGL_PIPE_NONE1110* doesn't provide any RegDist pipeline synchronization information and allows1111* the hardware to infer the pipeline based on the source types of the1112* instruction. TGL_PIPE_ALL can be used when synchronization with all ALU1113* pipelines is intended.1114*/1115enum tgl_pipe {1116TGL_PIPE_NONE = 0,1117TGL_PIPE_FLOAT,1118TGL_PIPE_INT,1119TGL_PIPE_LONG,1120TGL_PIPE_ALL1121};11221123/**1124* Logical representation of the SWSB scheduling information of a hardware1125* instruction. The binary representation is slightly more compact.1126*/1127struct tgl_swsb {1128unsigned regdist : 3;1129enum tgl_pipe pipe : 3;1130unsigned sbid : 4;1131enum tgl_sbid_mode mode : 3;1132};11331134/**1135* Construct a scheduling annotation with a single RegDist dependency. This1136* synchronizes with the completion of the d-th previous in-order instruction.1137* The index is one-based, zero causes a no-op tgl_swsb to be constructed.1138*/1139static inline struct tgl_swsb1140tgl_swsb_regdist(unsigned d)1141{1142const struct tgl_swsb swsb = { d, d ? TGL_PIPE_ALL : TGL_PIPE_NONE };1143assert(swsb.regdist == d);1144return swsb;1145}11461147/**1148* Construct a scheduling annotation that synchronizes with the specified SBID1149* token.1150*/1151static inline struct tgl_swsb1152tgl_swsb_sbid(enum tgl_sbid_mode mode, unsigned sbid)1153{1154const struct tgl_swsb swsb = { 0, TGL_PIPE_NONE, sbid, mode };1155assert(swsb.sbid == sbid);1156return swsb;1157}11581159/**1160* Construct a no-op scheduling annotation.1161*/1162static inline struct tgl_swsb1163tgl_swsb_null(void)1164{1165return tgl_swsb_regdist(0);1166}11671168/**1169* Return a scheduling annotation that allocates the same SBID synchronization1170* token as \p swsb. In addition it will synchronize against a previous1171* in-order instruction if \p regdist is non-zero.1172*/1173static inline struct tgl_swsb1174tgl_swsb_dst_dep(struct tgl_swsb swsb, unsigned regdist)1175{1176swsb.regdist = regdist;1177swsb.mode = swsb.mode & TGL_SBID_SET;1178swsb.pipe = (regdist ? TGL_PIPE_ALL : TGL_PIPE_NONE);1179return swsb;1180}11811182/**1183* Return a scheduling annotation that synchronizes against the same SBID and1184* RegDist dependencies as \p swsb, but doesn't allocate any SBID token.1185*/1186static inline struct tgl_swsb1187tgl_swsb_src_dep(struct tgl_swsb swsb)1188{1189swsb.mode = swsb.mode & (TGL_SBID_SRC | TGL_SBID_DST);1190return swsb;1191}11921193/**1194* Convert the provided tgl_swsb to the hardware's binary representation of an1195* SWSB annotation.1196*/1197static inline uint8_t1198tgl_swsb_encode(const struct intel_device_info *devinfo, struct tgl_swsb swsb)1199{1200if (!swsb.mode) {1201const unsigned pipe = devinfo->verx10 < 125 ? 0 :1202swsb.pipe == TGL_PIPE_FLOAT ? 0x10 :1203swsb.pipe == TGL_PIPE_INT ? 0x18 :1204swsb.pipe == TGL_PIPE_LONG ? 0x50 :1205swsb.pipe == TGL_PIPE_ALL ? 0x8 : 0;1206return pipe | swsb.regdist;1207} else if (swsb.regdist) {1208return 0x80 | swsb.regdist << 4 | swsb.sbid;1209} else {1210return swsb.sbid | (swsb.mode & TGL_SBID_SET ? 0x40 :1211swsb.mode & TGL_SBID_DST ? 0x20 : 0x30);1212}1213}12141215/**1216* Convert the provided binary representation of an SWSB annotation to a1217* tgl_swsb.1218*/1219static inline struct tgl_swsb1220tgl_swsb_decode(const struct intel_device_info *devinfo, const enum opcode opcode,1221const uint8_t x)1222{1223if (x & 0x80) {1224const struct tgl_swsb swsb = { (x & 0x70u) >> 4, TGL_PIPE_NONE,1225x & 0xfu,1226(opcode == BRW_OPCODE_SEND ||1227opcode == BRW_OPCODE_SENDC ||1228opcode == BRW_OPCODE_MATH) ?1229TGL_SBID_SET : TGL_SBID_DST };1230return swsb;1231} else if ((x & 0x70) == 0x20) {1232return tgl_swsb_sbid(TGL_SBID_DST, x & 0xfu);1233} else if ((x & 0x70) == 0x30) {1234return tgl_swsb_sbid(TGL_SBID_SRC, x & 0xfu);1235} else if ((x & 0x70) == 0x40) {1236return tgl_swsb_sbid(TGL_SBID_SET, x & 0xfu);1237} else {1238const struct tgl_swsb swsb = { x & 0x7u,1239((x & 0x78) == 0x10 ? TGL_PIPE_FLOAT :1240(x & 0x78) == 0x18 ? TGL_PIPE_INT :1241(x & 0x78) == 0x50 ? TGL_PIPE_LONG :1242(x & 0x78) == 0x8 ? TGL_PIPE_ALL :1243TGL_PIPE_NONE) };1244assert(devinfo->verx10 >= 125 || swsb.pipe == TGL_PIPE_NONE);1245return swsb;1246}1247}12481249enum tgl_sync_function {1250TGL_SYNC_NOP = 0x0,1251TGL_SYNC_ALLRD = 0x2,1252TGL_SYNC_ALLWR = 0x3,1253TGL_SYNC_BAR = 0xe,1254TGL_SYNC_HOST = 0xf1255};12561257/**1258* Message target: Shared Function ID for where to SEND a message.1259*1260* These are enumerated in the ISA reference under "send - Send Message".1261* In particular, see the following tables:1262* - G45 PRM, Volume 4, Table 14-15 "Message Descriptor Definition"1263* - Sandybridge PRM, Volume 4 Part 2, Table 8-16 "Extended Message Descriptor"1264* - Ivybridge PRM, Volume 1 Part 1, section 3.2.7 "GPE Function IDs"1265*/1266enum brw_message_target {1267BRW_SFID_NULL = 0,1268BRW_SFID_MATH = 1, /* Only valid on Gfx4-5 */1269BRW_SFID_SAMPLER = 2,1270BRW_SFID_MESSAGE_GATEWAY = 3,1271BRW_SFID_DATAPORT_READ = 4,1272BRW_SFID_DATAPORT_WRITE = 5,1273BRW_SFID_URB = 6,1274BRW_SFID_THREAD_SPAWNER = 7,1275BRW_SFID_VME = 8,12761277GFX6_SFID_DATAPORT_SAMPLER_CACHE = 4,1278GFX6_SFID_DATAPORT_RENDER_CACHE = 5,1279GFX6_SFID_DATAPORT_CONSTANT_CACHE = 9,12801281GFX7_SFID_DATAPORT_DATA_CACHE = 10,1282GFX7_SFID_PIXEL_INTERPOLATOR = 11,1283HSW_SFID_DATAPORT_DATA_CACHE_1 = 12,1284HSW_SFID_CRE = 13,12851286GFX12_SFID_TGM = 13, /* Typed Global Memory */1287GFX12_SFID_SLM = 14, /* Shared Local Memory */1288GFX12_SFID_UGM = 15, /* Untyped Global Memory */12891290GEN_RT_SFID_BINDLESS_THREAD_DISPATCH = 7,1291GEN_RT_SFID_RAY_TRACE_ACCELERATOR = 8,1292};12931294#define GFX7_MESSAGE_TARGET_DP_DATA_CACHE 1012951296#define BRW_SAMPLER_RETURN_FORMAT_FLOAT32 01297#define BRW_SAMPLER_RETURN_FORMAT_UINT32 21298#define BRW_SAMPLER_RETURN_FORMAT_SINT32 312991300#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE 01301#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE 01302#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS 01303#define BRW_SAMPLER_MESSAGE_SIMD8_KILLPIX 11304#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_LOD 11305#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_LOD 11306#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_GRADIENTS 21307#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_GRADIENTS 21308#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_COMPARE 01309#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE 21310#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_BIAS_COMPARE 01311#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_LOD_COMPARE 11312#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_LOD_COMPARE 11313#define BRW_SAMPLER_MESSAGE_SIMD4X2_RESINFO 21314#define BRW_SAMPLER_MESSAGE_SIMD16_RESINFO 21315#define BRW_SAMPLER_MESSAGE_SIMD4X2_LD 31316#define BRW_SAMPLER_MESSAGE_SIMD8_LD 31317#define BRW_SAMPLER_MESSAGE_SIMD16_LD 313181319#define GFX5_SAMPLER_MESSAGE_SAMPLE 01320#define GFX5_SAMPLER_MESSAGE_SAMPLE_BIAS 11321#define GFX5_SAMPLER_MESSAGE_SAMPLE_LOD 21322#define GFX5_SAMPLER_MESSAGE_SAMPLE_COMPARE 31323#define GFX5_SAMPLER_MESSAGE_SAMPLE_DERIVS 41324#define GFX5_SAMPLER_MESSAGE_SAMPLE_BIAS_COMPARE 51325#define GFX5_SAMPLER_MESSAGE_SAMPLE_LOD_COMPARE 61326#define GFX5_SAMPLER_MESSAGE_SAMPLE_LD 71327#define GFX7_SAMPLER_MESSAGE_SAMPLE_GATHER4 81328#define GFX5_SAMPLER_MESSAGE_LOD 91329#define GFX5_SAMPLER_MESSAGE_SAMPLE_RESINFO 101330#define GFX6_SAMPLER_MESSAGE_SAMPLE_SAMPLEINFO 111331#define GFX7_SAMPLER_MESSAGE_SAMPLE_GATHER4_C 161332#define GFX7_SAMPLER_MESSAGE_SAMPLE_GATHER4_PO 171333#define GFX7_SAMPLER_MESSAGE_SAMPLE_GATHER4_PO_C 181334#define HSW_SAMPLER_MESSAGE_SAMPLE_DERIV_COMPARE 201335#define GFX9_SAMPLER_MESSAGE_SAMPLE_LZ 241336#define GFX9_SAMPLER_MESSAGE_SAMPLE_C_LZ 251337#define GFX9_SAMPLER_MESSAGE_SAMPLE_LD_LZ 261338#define GFX9_SAMPLER_MESSAGE_SAMPLE_LD2DMS_W 281339#define GFX7_SAMPLER_MESSAGE_SAMPLE_LD_MCS 291340#define GFX7_SAMPLER_MESSAGE_SAMPLE_LD2DMS 301341#define GFX7_SAMPLER_MESSAGE_SAMPLE_LD2DSS 3113421343/* for GFX5 only */1344#define BRW_SAMPLER_SIMD_MODE_SIMD4X2 01345#define BRW_SAMPLER_SIMD_MODE_SIMD8 11346#define BRW_SAMPLER_SIMD_MODE_SIMD16 21347#define BRW_SAMPLER_SIMD_MODE_SIMD32_64 313481349/* GFX9 changes SIMD mode 0 to mean SIMD8D, but lets us get the SIMD4x21350* behavior by setting bit 22 of dword 2 in the message header. */1351#define GFX9_SAMPLER_SIMD_MODE_SIMD8D 01352#define GFX9_SAMPLER_SIMD_MODE_EXTENSION_SIMD4X2 (1 << 22)13531354#define BRW_DATAPORT_OWORD_BLOCK_1_OWORDLOW 01355#define BRW_DATAPORT_OWORD_BLOCK_1_OWORDHIGH 11356#define BRW_DATAPORT_OWORD_BLOCK_2_OWORDS 21357#define BRW_DATAPORT_OWORD_BLOCK_4_OWORDS 31358#define BRW_DATAPORT_OWORD_BLOCK_8_OWORDS 41359#define GFX12_DATAPORT_OWORD_BLOCK_16_OWORDS 51360#define BRW_DATAPORT_OWORD_BLOCK_OWORDS(n) \1361((n) == 1 ? BRW_DATAPORT_OWORD_BLOCK_1_OWORDLOW : \1362(n) == 2 ? BRW_DATAPORT_OWORD_BLOCK_2_OWORDS : \1363(n) == 4 ? BRW_DATAPORT_OWORD_BLOCK_4_OWORDS : \1364(n) == 8 ? BRW_DATAPORT_OWORD_BLOCK_8_OWORDS : \1365(n) == 16 ? GFX12_DATAPORT_OWORD_BLOCK_16_OWORDS : \1366(abort(), ~0))1367#define BRW_DATAPORT_OWORD_BLOCK_DWORDS(n) \1368((n) == 4 ? BRW_DATAPORT_OWORD_BLOCK_1_OWORDLOW : \1369(n) == 8 ? BRW_DATAPORT_OWORD_BLOCK_2_OWORDS : \1370(n) == 16 ? BRW_DATAPORT_OWORD_BLOCK_4_OWORDS : \1371(n) == 32 ? BRW_DATAPORT_OWORD_BLOCK_8_OWORDS : \1372(abort(), ~0))13731374#define BRW_DATAPORT_OWORD_DUAL_BLOCK_1OWORD 01375#define BRW_DATAPORT_OWORD_DUAL_BLOCK_4OWORDS 213761377#define BRW_DATAPORT_DWORD_SCATTERED_BLOCK_8DWORDS 21378#define BRW_DATAPORT_DWORD_SCATTERED_BLOCK_16DWORDS 313791380/* This one stays the same across generations. */1381#define BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ 01382/* GFX4 */1383#define BRW_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ 11384#define BRW_DATAPORT_READ_MESSAGE_MEDIA_BLOCK_READ 21385#define BRW_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ 31386/* G45, GFX5 */1387#define G45_DATAPORT_READ_MESSAGE_RENDER_UNORM_READ 11388#define G45_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ 21389#define G45_DATAPORT_READ_MESSAGE_AVC_LOOP_FILTER_READ 31390#define G45_DATAPORT_READ_MESSAGE_MEDIA_BLOCK_READ 41391#define G45_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ 61392/* GFX6 */1393#define GFX6_DATAPORT_READ_MESSAGE_RENDER_UNORM_READ 11394#define GFX6_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ 21395#define GFX6_DATAPORT_READ_MESSAGE_MEDIA_BLOCK_READ 41396#define GFX6_DATAPORT_READ_MESSAGE_OWORD_UNALIGN_BLOCK_READ 51397#define GFX6_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ 613981399#define BRW_DATAPORT_READ_TARGET_DATA_CACHE 01400#define BRW_DATAPORT_READ_TARGET_RENDER_CACHE 11401#define BRW_DATAPORT_READ_TARGET_SAMPLER_CACHE 214021403#define BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE 01404#define BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE_REPLICATED 11405#define BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_DUAL_SOURCE_SUBSPAN01 21406#define BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_DUAL_SOURCE_SUBSPAN23 31407#define BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_SINGLE_SOURCE_SUBSPAN01 414081409#define BRW_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE 01410#define BRW_DATAPORT_WRITE_MESSAGE_OWORD_DUAL_BLOCK_WRITE 11411#define BRW_DATAPORT_WRITE_MESSAGE_MEDIA_BLOCK_WRITE 21412#define BRW_DATAPORT_WRITE_MESSAGE_DWORD_SCATTERED_WRITE 31413#define BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE 41414#define BRW_DATAPORT_WRITE_MESSAGE_STREAMED_VERTEX_BUFFER_WRITE 51415#define BRW_DATAPORT_WRITE_MESSAGE_FLUSH_RENDER_CACHE 714161417/* GFX6 */1418#define GFX6_DATAPORT_WRITE_MESSAGE_DWORD_ATOMIC_WRITE 71419#define GFX6_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE 81420#define GFX6_DATAPORT_WRITE_MESSAGE_OWORD_DUAL_BLOCK_WRITE 91421#define GFX6_DATAPORT_WRITE_MESSAGE_MEDIA_BLOCK_WRITE 101422#define GFX6_DATAPORT_WRITE_MESSAGE_DWORD_SCATTERED_WRITE 111423#define GFX6_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE 121424#define GFX6_DATAPORT_WRITE_MESSAGE_STREAMED_VB_WRITE 131425#define GFX6_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_UNORM_WRITE 1414261427/* GFX7 */1428#define GFX7_DATAPORT_RC_MEDIA_BLOCK_READ 41429#define GFX7_DATAPORT_RC_TYPED_SURFACE_READ 51430#define GFX7_DATAPORT_RC_TYPED_ATOMIC_OP 61431#define GFX7_DATAPORT_RC_MEMORY_FENCE 71432#define GFX7_DATAPORT_RC_MEDIA_BLOCK_WRITE 101433#define GFX7_DATAPORT_RC_RENDER_TARGET_WRITE 121434#define GFX7_DATAPORT_RC_TYPED_SURFACE_WRITE 131435#define GFX7_DATAPORT_DC_OWORD_BLOCK_READ 01436#define GFX7_DATAPORT_DC_UNALIGNED_OWORD_BLOCK_READ 11437#define GFX7_DATAPORT_DC_OWORD_DUAL_BLOCK_READ 21438#define GFX7_DATAPORT_DC_DWORD_SCATTERED_READ 31439#define GFX7_DATAPORT_DC_BYTE_SCATTERED_READ 41440#define GFX7_DATAPORT_DC_UNTYPED_SURFACE_READ 51441#define GFX7_DATAPORT_DC_UNTYPED_ATOMIC_OP 61442#define GFX7_DATAPORT_DC_MEMORY_FENCE 71443#define GFX7_DATAPORT_DC_OWORD_BLOCK_WRITE 81444#define GFX7_DATAPORT_DC_OWORD_DUAL_BLOCK_WRITE 101445#define GFX7_DATAPORT_DC_DWORD_SCATTERED_WRITE 111446#define GFX7_DATAPORT_DC_BYTE_SCATTERED_WRITE 121447#define GFX7_DATAPORT_DC_UNTYPED_SURFACE_WRITE 1314481449#define GFX7_DATAPORT_SCRATCH_READ ((1 << 18) | \1450(0 << 17))1451#define GFX7_DATAPORT_SCRATCH_WRITE ((1 << 18) | \1452(1 << 17))1453#define GFX7_DATAPORT_SCRATCH_NUM_REGS_SHIFT 1214541455#define GFX7_PIXEL_INTERPOLATOR_LOC_SHARED_OFFSET 01456#define GFX7_PIXEL_INTERPOLATOR_LOC_SAMPLE 11457#define GFX7_PIXEL_INTERPOLATOR_LOC_CENTROID 21458#define GFX7_PIXEL_INTERPOLATOR_LOC_PER_SLOT_OFFSET 314591460/* HSW */1461#define HSW_DATAPORT_DC_PORT0_OWORD_BLOCK_READ 01462#define HSW_DATAPORT_DC_PORT0_UNALIGNED_OWORD_BLOCK_READ 11463#define HSW_DATAPORT_DC_PORT0_OWORD_DUAL_BLOCK_READ 21464#define HSW_DATAPORT_DC_PORT0_DWORD_SCATTERED_READ 31465#define HSW_DATAPORT_DC_PORT0_BYTE_SCATTERED_READ 41466#define HSW_DATAPORT_DC_PORT0_MEMORY_FENCE 71467#define HSW_DATAPORT_DC_PORT0_OWORD_BLOCK_WRITE 81468#define HSW_DATAPORT_DC_PORT0_OWORD_DUAL_BLOCK_WRITE 101469#define HSW_DATAPORT_DC_PORT0_DWORD_SCATTERED_WRITE 111470#define HSW_DATAPORT_DC_PORT0_BYTE_SCATTERED_WRITE 1214711472#define HSW_DATAPORT_DC_PORT1_UNTYPED_SURFACE_READ 11473#define HSW_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_OP 21474#define HSW_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_OP_SIMD4X2 31475#define HSW_DATAPORT_DC_PORT1_MEDIA_BLOCK_READ 41476#define HSW_DATAPORT_DC_PORT1_TYPED_SURFACE_READ 51477#define HSW_DATAPORT_DC_PORT1_TYPED_ATOMIC_OP 61478#define HSW_DATAPORT_DC_PORT1_TYPED_ATOMIC_OP_SIMD4X2 71479#define HSW_DATAPORT_DC_PORT1_UNTYPED_SURFACE_WRITE 91480#define HSW_DATAPORT_DC_PORT1_MEDIA_BLOCK_WRITE 101481#define HSW_DATAPORT_DC_PORT1_ATOMIC_COUNTER_OP 111482#define HSW_DATAPORT_DC_PORT1_ATOMIC_COUNTER_OP_SIMD4X2 121483#define HSW_DATAPORT_DC_PORT1_TYPED_SURFACE_WRITE 131484#define GFX9_DATAPORT_DC_PORT1_A64_SCATTERED_READ 0x101485#define GFX8_DATAPORT_DC_PORT1_A64_UNTYPED_SURFACE_READ 0x111486#define GFX8_DATAPORT_DC_PORT1_A64_UNTYPED_ATOMIC_OP 0x121487#define GFX12_DATAPORT_DC_PORT1_A64_UNTYPED_ATOMIC_HALF_INT_OP 0x131488#define GFX9_DATAPORT_DC_PORT1_A64_OWORD_BLOCK_READ 0x141489#define GFX9_DATAPORT_DC_PORT1_A64_OWORD_BLOCK_WRITE 0x151490#define GFX8_DATAPORT_DC_PORT1_A64_UNTYPED_SURFACE_WRITE 0x191491#define GFX8_DATAPORT_DC_PORT1_A64_SCATTERED_WRITE 0x1a1492#define GFX9_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_FLOAT_OP 0x1b1493#define GFX9_DATAPORT_DC_PORT1_A64_UNTYPED_ATOMIC_FLOAT_OP 0x1d1494#define GFX12_DATAPORT_DC_PORT1_A64_UNTYPED_ATOMIC_HALF_FLOAT_OP 0x1e14951496/* GFX9 */1497#define GFX9_DATAPORT_RC_RENDER_TARGET_WRITE 121498#define GFX9_DATAPORT_RC_RENDER_TARGET_READ 1314991500/* A64 scattered message subtype */1501#define GFX8_A64_SCATTERED_SUBTYPE_BYTE 01502#define GFX8_A64_SCATTERED_SUBTYPE_DWORD 11503#define GFX8_A64_SCATTERED_SUBTYPE_QWORD 21504#define GFX8_A64_SCATTERED_SUBTYPE_HWORD 315051506/* Dataport special binding table indices: */1507#define BRW_BTI_STATELESS 2551508#define GFX7_BTI_SLM 25415091510#define HSW_BTI_STATELESS_LOCALLY_COHERENT 2551511#define HSW_BTI_STATELESS_NON_COHERENT 2531512#define HSW_BTI_STATELESS_GLOBALLY_COHERENT 2521513#define HSW_BTI_STATELESS_LLC_COHERENT 2511514#define HSW_BTI_STATELESS_L3_UNCACHED 25015151516/* The hardware docs are a bit contradictory here. On Haswell, where they1517* first added cache ability control, there were 5 different cache modes (see1518* HSW_BTI_STATELESS_* above). On Broadwell, they reduced to two:1519*1520* - IA-Coherent (BTI=255): Coherent within Gen and coherent within the1521* entire IA cache memory hierarchy.1522*1523* - Non-Coherent (BTI=253): Coherent within Gen, same cache type.1524*1525* Information about stateless cache coherency can be found in the "A321526* Stateless" section of the "3D Media GPGPU" volume of the PRM for each1527* hardware generation.1528*1529* Unfortunately, the docs for MDC_STATELESS appear to have been copied and1530* pasted from Haswell and give the Haswell definitions for the BTI values of1531* 255 and 253 including a warning about accessing 253 surfaces from multiple1532* threads. This seems to be a copy+paste error and the definitions from the1533* "A32 Stateless" section should be trusted instead.1534*1535* Note that because the DRM sets bit 4 of HDC_CHICKEN0 on BDW, CHV and at1536* least some pre-production steppings of SKL due to WaForceEnableNonCoherent,1537* HDC memory access may have been overridden by the kernel to be non-coherent1538* (matching the behavior of the same BTI on pre-Gfx8 hardware) and BTI 2551539* may actually be an alias for BTI 253.1540*/1541#define GFX8_BTI_STATELESS_IA_COHERENT 2551542#define GFX8_BTI_STATELESS_NON_COHERENT 2531543#define GFX9_BTI_BINDLESS 25215441545/* Dataport atomic operations for Untyped Atomic Integer Operation message1546* (and others).1547*/1548#define BRW_AOP_AND 11549#define BRW_AOP_OR 21550#define BRW_AOP_XOR 31551#define BRW_AOP_MOV 41552#define BRW_AOP_INC 51553#define BRW_AOP_DEC 61554#define BRW_AOP_ADD 71555#define BRW_AOP_SUB 81556#define BRW_AOP_REVSUB 91557#define BRW_AOP_IMAX 101558#define BRW_AOP_IMIN 111559#define BRW_AOP_UMAX 121560#define BRW_AOP_UMIN 131561#define BRW_AOP_CMPWR 141562#define BRW_AOP_PREDEC 1515631564/* Dataport atomic operations for Untyped Atomic Float Operation message. */1565#define BRW_AOP_FMAX 11566#define BRW_AOP_FMIN 21567#define BRW_AOP_FCMPWR 315681569#define BRW_MATH_FUNCTION_INV 11570#define BRW_MATH_FUNCTION_LOG 21571#define BRW_MATH_FUNCTION_EXP 31572#define BRW_MATH_FUNCTION_SQRT 41573#define BRW_MATH_FUNCTION_RSQ 51574#define BRW_MATH_FUNCTION_SIN 61575#define BRW_MATH_FUNCTION_COS 71576#define BRW_MATH_FUNCTION_SINCOS 8 /* gfx4, gfx5 */1577#define BRW_MATH_FUNCTION_FDIV 9 /* gfx6+ */1578#define BRW_MATH_FUNCTION_POW 101579#define BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER 111580#define BRW_MATH_FUNCTION_INT_DIV_QUOTIENT 121581#define BRW_MATH_FUNCTION_INT_DIV_REMAINDER 131582#define GFX8_MATH_FUNCTION_INVM 141583#define GFX8_MATH_FUNCTION_RSQRTM 1515841585#define BRW_MATH_INTEGER_UNSIGNED 01586#define BRW_MATH_INTEGER_SIGNED 115871588#define BRW_MATH_PRECISION_FULL 01589#define BRW_MATH_PRECISION_PARTIAL 115901591#define BRW_MATH_SATURATE_NONE 01592#define BRW_MATH_SATURATE_SATURATE 115931594#define BRW_MATH_DATA_VECTOR 01595#define BRW_MATH_DATA_SCALAR 115961597#define BRW_URB_OPCODE_WRITE_HWORD 01598#define BRW_URB_OPCODE_WRITE_OWORD 11599#define BRW_URB_OPCODE_READ_HWORD 21600#define BRW_URB_OPCODE_READ_OWORD 31601#define GFX7_URB_OPCODE_ATOMIC_MOV 41602#define GFX7_URB_OPCODE_ATOMIC_INC 51603#define GFX8_URB_OPCODE_ATOMIC_ADD 61604#define GFX8_URB_OPCODE_SIMD8_WRITE 71605#define GFX8_URB_OPCODE_SIMD8_READ 816061607#define BRW_URB_SWIZZLE_NONE 01608#define BRW_URB_SWIZZLE_INTERLEAVE 11609#define BRW_URB_SWIZZLE_TRANSPOSE 216101611#define BRW_SCRATCH_SPACE_SIZE_1K 01612#define BRW_SCRATCH_SPACE_SIZE_2K 11613#define BRW_SCRATCH_SPACE_SIZE_4K 21614#define BRW_SCRATCH_SPACE_SIZE_8K 31615#define BRW_SCRATCH_SPACE_SIZE_16K 41616#define BRW_SCRATCH_SPACE_SIZE_32K 51617#define BRW_SCRATCH_SPACE_SIZE_64K 61618#define BRW_SCRATCH_SPACE_SIZE_128K 71619#define BRW_SCRATCH_SPACE_SIZE_256K 81620#define BRW_SCRATCH_SPACE_SIZE_512K 91621#define BRW_SCRATCH_SPACE_SIZE_1M 101622#define BRW_SCRATCH_SPACE_SIZE_2M 1116231624#define BRW_MESSAGE_GATEWAY_SFID_OPEN_GATEWAY 01625#define BRW_MESSAGE_GATEWAY_SFID_CLOSE_GATEWAY 11626#define BRW_MESSAGE_GATEWAY_SFID_FORWARD_MSG 21627#define BRW_MESSAGE_GATEWAY_SFID_GET_TIMESTAMP 31628#define BRW_MESSAGE_GATEWAY_SFID_BARRIER_MSG 41629#define BRW_MESSAGE_GATEWAY_SFID_UPDATE_GATEWAY_STATE 51630#define BRW_MESSAGE_GATEWAY_SFID_MMIO_READ_WRITE 6163116321633/* Gfx7 "GS URB Entry Allocation Size" is a U9-1 field, so the maximum gs_size1634* is 2^9, or 512. It's counted in multiples of 64 bytes.1635*1636* Identical for VS, DS, and HS.1637*/1638#define GFX7_MAX_GS_URB_ENTRY_SIZE_BYTES (512*64)1639#define GFX7_MAX_DS_URB_ENTRY_SIZE_BYTES (512*64)1640#define GFX7_MAX_HS_URB_ENTRY_SIZE_BYTES (512*64)1641#define GFX7_MAX_VS_URB_ENTRY_SIZE_BYTES (512*64)16421643#define BRW_GS_EDGE_INDICATOR_0 (1 << 8)1644#define BRW_GS_EDGE_INDICATOR_1 (1 << 9)16451646/* Gfx6 "GS URB Entry Allocation Size" is defined as a number of 1024-bit1647* (128 bytes) URB rows and the maximum allowed value is 5 rows.1648*/1649#define GFX6_MAX_GS_URB_ENTRY_SIZE_BYTES (5*128)16501651/* GS Thread Payload1652*/16531654/* 3DSTATE_GS "Output Vertex Size" has an effective maximum of 62. It's1655* counted in multiples of 16 bytes.1656*/1657#define GFX7_MAX_GS_OUTPUT_VERTEX_SIZE_BYTES (62*16)165816591660/* R0 */1661# define GFX7_GS_PAYLOAD_INSTANCE_ID_SHIFT 2716621663/* CR0.0[5:4] Floating-Point Rounding Modes1664* Skylake PRM, Volume 7 Part 1, "Control Register", page 7561665*/16661667#define BRW_CR0_RND_MODE_MASK 0x301668#define BRW_CR0_RND_MODE_SHIFT 416691670enum PACKED brw_rnd_mode {1671BRW_RND_MODE_RTNE = 0, /* Round to Nearest or Even */1672BRW_RND_MODE_RU = 1, /* Round Up, toward +inf */1673BRW_RND_MODE_RD = 2, /* Round Down, toward -inf */1674BRW_RND_MODE_RTZ = 3, /* Round Toward Zero */1675BRW_RND_MODE_UNSPECIFIED, /* Unspecified rounding mode */1676};16771678#define BRW_CR0_FP64_DENORM_PRESERVE (1 << 6)1679#define BRW_CR0_FP32_DENORM_PRESERVE (1 << 7)1680#define BRW_CR0_FP16_DENORM_PRESERVE (1 << 10)16811682#define BRW_CR0_FP_MODE_MASK (BRW_CR0_FP64_DENORM_PRESERVE | \1683BRW_CR0_FP32_DENORM_PRESERVE | \1684BRW_CR0_FP16_DENORM_PRESERVE | \1685BRW_CR0_RND_MODE_MASK)16861687/* MDC_DS - Data Size Message Descriptor Control Field1688* Skylake PRM, Volume 2d, page 1291689*1690* Specifies the number of Bytes to be read or written per Dword used at1691* byte_scattered read/write and byte_scaled read/write messages.1692*/1693#define GFX7_BYTE_SCATTERED_DATA_ELEMENT_BYTE 01694#define GFX7_BYTE_SCATTERED_DATA_ELEMENT_WORD 11695#define GFX7_BYTE_SCATTERED_DATA_ELEMENT_DWORD 216961697#define GEN_RT_BTD_MESSAGE_SPAWN 116981699#define GEN_RT_TRACE_RAY_INITAL 01700#define GEN_RT_TRACE_RAY_INSTANCE 11701#define GEN_RT_TRACE_RAY_COMMIT 21702#define GEN_RT_TRACE_RAY_CONTINUE 317031704#define GEN_RT_BTD_SHADER_TYPE_ANY_HIT 01705#define GEN_RT_BTD_SHADER_TYPE_CLOSEST_HIT 11706#define GEN_RT_BTD_SHADER_TYPE_MISS 21707#define GEN_RT_BTD_SHADER_TYPE_INTERSECTION 317081709/* Starting with Xe-HPG, the old dataport was massively reworked dataport.1710* The new thing, called Load/Store Cache or LSC, has a significantly improved1711* interface. Instead of bespoke messages for every case, there's basically1712* one or two messages with different bits to control things like address1713* size, how much data is read/written, etc. It's way nicer but also means we1714* get to rewrite all our dataport encoding/decoding code. This patch kicks1715* off the party with all of the new enums.1716*/1717enum lsc_opcode {1718LSC_OP_LOAD = 0,1719LSC_OP_LOAD_CMASK = 2,1720LSC_OP_STORE = 4,1721LSC_OP_STORE_CMASK = 6,1722LSC_OP_ATOMIC_INC = 8,1723LSC_OP_ATOMIC_DEC = 9,1724LSC_OP_ATOMIC_LOAD = 10,1725LSC_OP_ATOMIC_STORE = 11,1726LSC_OP_ATOMIC_ADD = 12,1727LSC_OP_ATOMIC_SUB = 13,1728LSC_OP_ATOMIC_MIN = 14,1729LSC_OP_ATOMIC_MAX = 15,1730LSC_OP_ATOMIC_UMIN = 16,1731LSC_OP_ATOMIC_UMAX = 17,1732LSC_OP_ATOMIC_CMPXCHG = 18,1733LSC_OP_ATOMIC_FADD = 19,1734LSC_OP_ATOMIC_FSUB = 20,1735LSC_OP_ATOMIC_FMIN = 21,1736LSC_OP_ATOMIC_FMAX = 22,1737LSC_OP_ATOMIC_FCMPXCHG = 23,1738LSC_OP_ATOMIC_AND = 24,1739LSC_OP_ATOMIC_OR = 25,1740LSC_OP_ATOMIC_XOR = 26,1741LSC_OP_FENCE = 311742};17431744/*1745* Specifies the size of the dataport address payload in registers.1746*/1747enum PACKED lsc_addr_reg_size {1748LSC_ADDR_REG_SIZE_1 = 1,1749LSC_ADDR_REG_SIZE_2 = 2,1750LSC_ADDR_REG_SIZE_3 = 3,1751LSC_ADDR_REG_SIZE_4 = 4,1752LSC_ADDR_REG_SIZE_6 = 6,1753LSC_ADDR_REG_SIZE_8 = 8,1754};17551756/*1757* Specifies the size of the address payload item in a dataport message.1758*/1759enum PACKED lsc_addr_size {1760LSC_ADDR_SIZE_A16 = 1, /* 16-bit address offset */1761LSC_ADDR_SIZE_A32 = 2, /* 32-bit address offset */1762LSC_ADDR_SIZE_A64 = 3, /* 64-bit address offset */1763};17641765/*1766* Specifies the type of the address payload item in a dataport message. The1767* address type specifies how the dataport message decodes the Extended1768* Descriptor for the surface attributes and address calculation.1769*/1770enum PACKED lsc_addr_surface_type {1771LSC_ADDR_SURFTYPE_FLAT = 0, /* Flat */1772LSC_ADDR_SURFTYPE_BSS = 1, /* Bindless surface state */1773LSC_ADDR_SURFTYPE_SS = 2, /* Surface state */1774LSC_ADDR_SURFTYPE_BTI = 3, /* Binding table index */1775};17761777/*1778* Specifies the dataport message override to the default L1 and L3 memory1779* cache policies. Dataport L1 cache policies are uncached (UC), cached (C),1780* cache streaming (S) and invalidate-after-read (IAR). Dataport L3 cache1781* policies are uncached (UC) and cached (C).1782*/1783enum lsc_cache_load {1784/* No override. Use the non-pipelined state or surface state cache settings1785* for L1 and L3.1786*/1787LSC_CACHE_LOAD_L1STATE_L3MOCS = 0,1788/* Override to L1 uncached and L3 uncached */1789LSC_CACHE_LOAD_L1UC_L3UC = 1,1790/* Override to L1 uncached and L3 cached */1791LSC_CACHE_LOAD_L1UC_L3C = 2,1792/* Override to L1 cached and L3 uncached */1793LSC_CACHE_LOAD_L1C_L3UC = 3,1794/* Override to cache at both L1 and L3 */1795LSC_CACHE_LOAD_L1C_L3C = 4,1796/* Override to L1 streaming load and L3 uncached */1797LSC_CACHE_LOAD_L1S_L3UC = 5,1798/* Override to L1 streaming load and L3 cached */1799LSC_CACHE_LOAD_L1S_L3C = 6,1800/* For load messages, override to L1 invalidate-after-read, and L3 cached. */1801LSC_CACHE_LOAD_L1IAR_L3C = 7,1802};18031804/*1805* Specifies the dataport message override to the default L1 and L3 memory1806* cache policies. Dataport L1 cache policies are uncached (UC), write-through1807* (WT), write-back (WB) and streaming (S). Dataport L3 cache policies are1808* uncached (UC) and cached (WB).1809*/1810enum PACKED lsc_cache_store {1811/* No override. Use the non-pipelined or surface state cache settings for L11812* and L3.1813*/1814LSC_CACHE_STORE_L1STATE_L3MOCS = 0,1815/* Override to L1 uncached and L3 uncached */1816LSC_CACHE_STORE_L1UC_L3UC = 1,1817/* Override to L1 uncached and L3 cached */1818LSC_CACHE_STORE_L1UC_L3WB = 2,1819/* Override to L1 write-through and L3 uncached */1820LSC_CACHE_STORE_L1WT_L3UC = 3,1821/* Override to L1 write-through and L3 cached */1822LSC_CACHE_STORE_L1WT_L3WB = 4,1823/* Override to L1 streaming and L3 uncached */1824LSC_CACHE_STORE_L1S_L3UC = 5,1825/* Override to L1 streaming and L3 cached */1826LSC_CACHE_STORE_L1S_L3WB = 6,1827/* Override to L1 write-back, and L3 cached */1828LSC_CACHE_STORE_L1WB_L3WB = 7,18291830};18311832/*1833* Specifies which components of the data payload 4-element vector (X,Y,Z,W) is1834* packed into the register payload.1835*/1836enum PACKED lsc_cmask {1837LSC_CMASK_X = 0x1,1838LSC_CMASK_Y = 0x2,1839LSC_CMASK_XY = 0x3,1840LSC_CMASK_Z = 0x4,1841LSC_CMASK_XZ = 0x5,1842LSC_CMASK_YZ = 0x6,1843LSC_CMASK_XYZ = 0x7,1844LSC_CMASK_W = 0x8,1845LSC_CMASK_XW = 0x9,1846LSC_CMASK_YW = 0xa,1847LSC_CMASK_XYW = 0xb,1848LSC_CMASK_ZW = 0xc,1849LSC_CMASK_XZW = 0xd,1850LSC_CMASK_YZW = 0xe,1851LSC_CMASK_XYZW = 0xf,1852};18531854/*1855* Specifies the size of the data payload item in a dataport message.1856*/1857enum PACKED lsc_data_size {1858/* 8-bit scalar data value in memory, packed into a 8-bit data value in1859* register.1860*/1861LSC_DATA_SIZE_D8 = 0,1862/* 16-bit scalar data value in memory, packed into a 16-bit data value in1863* register.1864*/1865LSC_DATA_SIZE_D16 = 1,1866/* 32-bit scalar data value in memory, packed into 32-bit data value in1867* register.1868*/1869LSC_DATA_SIZE_D32 = 2,1870/* 64-bit scalar data value in memory, packed into 64-bit data value in1871* register.1872*/1873LSC_DATA_SIZE_D64 = 3,1874/* 8-bit scalar data value in memory, packed into 32-bit unsigned data value1875* in register.1876*/1877LSC_DATA_SIZE_D8U32 = 4,1878/* 16-bit scalar data value in memory, packed into 32-bit unsigned data1879* value in register.1880*/1881LSC_DATA_SIZE_D16U32 = 5,1882/* 16-bit scalar BigFloat data value in memory, packed into 32-bit float1883* value in register.1884*/1885LSC_DATA_SIZE_D16BF32 = 6,1886};18871888/*1889* Enum specifies the scope of the fence.1890*/1891enum PACKED lsc_fence_scope {1892/* Wait until all previous memory transactions from this thread are observed1893* within the local thread-group.1894*/1895LSC_FENCE_THREADGROUP = 0,1896/* Wait until all previous memory transactions from this thread are observed1897* within the local sub-slice.1898*/1899LSC_FENCE_LOCAL = 1,1900/* Wait until all previous memory transactions from this thread are observed1901* in the local tile.1902*/1903LSC_FENCE_TILE = 2,1904/* Wait until all previous memory transactions from this thread are observed1905* in the local GPU.1906*/1907LSC_FENCE_GPU = 3,1908/* Wait until all previous memory transactions from this thread are observed1909* across all GPUs in the system.1910*/1911LSC_FENCE_ALL_GPU = 4,1912/* Wait until all previous memory transactions from this thread are observed1913* at the "system" level.1914*/1915LSC_FENCE_SYSTEM_RELEASE = 5,1916/* For GPUs that do not follow PCIe Write ordering for downstream writes1917* targeting device memory, a fence message with scope=System_Acquire will1918* commit to device memory all downstream and peer writes that have reached1919* the device.1920*/1921LSC_FENCE_SYSTEM_ACQUIRE = 6,1922};19231924/*1925* Specifies the type of cache flush operation to perform after a fence is1926* complete.1927*/1928enum PACKED lsc_flush_type {1929LSC_FLUSH_TYPE_NONE = 0,1930/*1931* For a R/W cache, evict dirty lines (M to I state) and invalidate clean1932* lines. For a RO cache, invalidate clean lines.1933*/1934LSC_FLUSH_TYPE_EVICT = 1,1935/*1936* For both R/W and RO cache, invalidate clean lines in the cache.1937*/1938LSC_FLUSH_TYPE_INVALIDATE = 2,1939/*1940* For a R/W cache, invalidate dirty lines (M to I state), without1941* write-back to next level. This opcode does nothing for a RO cache.1942*/1943LSC_FLUSH_TYPE_DISCARD = 3,1944/*1945* For a R/W cache, write-back dirty lines to the next level, but kept in1946* the cache as "clean" (M to V state). This opcode does nothing for a RO1947* cache.1948*/1949LSC_FLUSH_TYPE_CLEAN = 4,1950/*1951* Flush "RW" section of the L3 cache, but leave L1 and L2 caches untouched.1952*/1953LSC_FLUSH_TYPE_L3ONLY = 5,1954};19551956enum PACKED lsc_backup_fence_routing {1957/* Normal routing: UGM fence is routed to UGM pipeline. */1958LSC_NORMAL_ROUTING,1959/* Route UGM fence to LSC unit. */1960LSC_ROUTE_TO_LSC,1961};19621963/*1964* Specifies the size of the vector in a dataport message.1965*/1966enum PACKED lsc_vect_size {1967LSC_VECT_SIZE_V1 = 0, /* vector length 1 */1968LSC_VECT_SIZE_V2 = 1, /* vector length 2 */1969LSC_VECT_SIZE_V3 = 2, /* Vector length 3 */1970LSC_VECT_SIZE_V4 = 3, /* Vector length 4 */1971LSC_VECT_SIZE_V8 = 4, /* Vector length 8 */1972LSC_VECT_SIZE_V16 = 5, /* Vector length 16 */1973LSC_VECT_SIZE_V32 = 6, /* Vector length 32 */1974LSC_VECT_SIZE_V64 = 7, /* Vector length 64 */1975};19761977#define LSC_ONE_ADDR_REG 119781979#endif /* BRW_EU_DEFINES_H */198019811982