| 1 |
/* |
| 2 |
* Copyright (c) 2014-2021, Intel Corporation |
| 3 |
* |
| 4 |
* Permission is hereby granted, free of charge, to any person obtaining a |
| 5 |
* copy of this software and associated documentation files (the "Software"), |
| 6 |
* to deal in the Software without restriction, including without limitation |
| 7 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 |
* and/or sell copies of the Software, and to permit persons to whom the |
| 9 |
* Software is furnished to do so, subject to the following conditions: |
| 10 |
* |
| 11 |
* The above copyright notice and this permission notice shall be included |
| 12 |
* in all copies or substantial portions of the Software. |
| 13 |
* |
| 14 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 |
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 |
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 |
* OTHER DEALINGS IN THE SOFTWARE. |
| 21 |
*/ |
| 22 |
//! |
| 23 |
//! \file mhw_render.h |
| 24 |
//! \brief MHW interface for constructing commands for the render engine |
| 25 |
//! \details Impelements the functionalities common across all platforms for MHW_RENDER |
| 26 |
//! |
| 27 |
|
| 28 |
#ifndef __MHW_RENDER_H__ |
| 29 |
#define __MHW_RENDER_H__ |
| 30 |
|
| 31 |
#include "mos_os.h" |
| 32 |
#include "mhw_state_heap.h" |
| 33 |
#include "mhw_render_itf.h" |
| 34 |
|
| 35 |
#define MHW_RENDER_ENGINE_SSH_SURFACES_PER_BT_MAX 256 |
| 36 |
#define MHW_RENDER_ENGINE_SAMPLERS_MAX 16 |
| 37 |
#define MHW_RENDER_ENGINE_SAMPLERS_AVS_MAX 8 |
| 38 |
#define MHW_RENDER_ENGINE_MEDIA_PALOAD_SIZE_MAX 512 |
| 39 |
#define MHW_RENDER_ENGINE_URB_SIZE_MAX 2048 |
| 40 |
#define MHW_RENDER_ENGINE_URB_ENTRIES_MAX 128 |
| 41 |
#define MHW_RENDER_ENGINE_INTERFACE_DESCRIPTOR_ENTRIES_MAX 64 |
| 42 |
#define MHW_RENDER_ENGINE_EU_INDEX_MAX 12 |
| 43 |
#define MHW_RENDER_ENGINE_SIZE_REGISTERS_PER_THREAD 0x1800 |
| 44 |
#define MHW_RENDER_ENGINE_NUMBER_OF_THREAD_UNIT 32 |
| 45 |
|
| 46 |
#define MHW_MAX_DEPENDENCY_COUNT 8 |
| 47 |
|
| 48 |
typedef struct _MHW_RENDER_ENGINE_L3_CACHE_SETTINGS |
| 49 |
{ |
| 50 |
uint32_t dwCntlReg = 0; |
| 51 |
uint32_t dwCntlReg2 = 0; |
| 52 |
uint32_t dwCntlReg3 = 0; |
| 53 |
uint32_t dwSqcReg1 = 0; |
| 54 |
uint32_t dwSqcReg4 = 0; |
| 55 |
uint32_t dwLra1Reg = 0; |
| 56 |
virtual ~_MHW_RENDER_ENGINE_L3_CACHE_SETTINGS() {} |
| 57 |
} MHW_RENDER_ENGINE_L3_CACHE_SETTINGS, *PMHW_RENDER_ENGINE_L3_CACHE_SETTINGS; |
| 58 |
|
| 59 |
typedef struct _MHW_RENDER_ENGINE_L3_CACHE_CONFIG |
| 60 |
{ |
| 61 |
uint32_t dwL3CacheCntlReg_Register = 0; |
| 62 |
uint32_t dwL3CacheCntlReg_Setting = 0; |
| 63 |
uint32_t dwL3CacheCntlReg2_Register = 0; |
| 64 |
uint32_t dwL3CacheCntlReg2_Setting = 0; |
| 65 |
uint32_t dwL3CacheCntlReg3_Register = 0; |
| 66 |
uint32_t dwL3CacheCntlReg3_Setting = 0; |
| 67 |
uint32_t dwL3CacheSqcReg1_Register = 0; |
| 68 |
uint32_t dwL3CacheSqcReg1_Setting = 0; |
| 69 |
uint32_t dwL3CacheSqcReg4_Register = 0; |
| 70 |
uint32_t dwL3CacheSqcReg4_Setting = 0; |
| 71 |
uint32_t dwL3LRA1Reg_Register = 0; |
| 72 |
uint32_t dwL3LRA1Reg_Setting = 0; |
| 73 |
bool bL3CachingEnabled = false; |
| 74 |
bool bL3LRA1Reset = false; |
| 75 |
} MHW_RENDER_ENGINE_L3_CACHE_CONFIG, *PMHW_RENDER_ENGINE_L3_CACHE_CONFIG; |
| 76 |
|
| 77 |
typedef enum _MHW_RENDER_ENGINE_ADDRESS_SHIFT |
| 78 |
{ |
| 79 |
MHW_RENDER_ENGINE_KERNEL_POINTER_SHIFT = 6, |
| 80 |
MHW_RENDER_ENGINE_STATE_BASE_ADDRESS_SHIFT = 12 |
| 81 |
} MHW_RENDER_ENGINE_ADDRESS_SHIFT; |
| 82 |
|
| 83 |
typedef enum _MHW_VFE_SLICE_DISABLE |
| 84 |
{ |
| 85 |
MHW_VFE_SLICE_ALL = 0, |
| 86 |
MHW_VFE_SLICE0_SUBSLICE_ALL, |
| 87 |
MHW_VFE_SLICE0_SUBSLICE0 |
| 88 |
} MHW_VFE_SLICE_DISABLE; |
| 89 |
|
| 90 |
typedef enum _MHW_WALKER_MODE |
| 91 |
{ |
| 92 |
MHW_WALKER_MODE_NOT_SET = -1, |
| 93 |
MHW_WALKER_MODE_DISABLED = 0, |
| 94 |
MHW_WALKER_MODE_SINGLE = 1, // dual = 0, repel = 1 |
| 95 |
MHW_WALKER_MODE_DUAL = 2, // dual = 1, repel = 0) |
| 96 |
MHW_WALKER_MODE_TRI = 3, // applies in BDW GT2 which has 1 slice and 3 sampler/VME per slice |
| 97 |
MHW_WALKER_MODE_QUAD = 4, // applies in HSW GT3 which has 2 slices and 2 sampler/VME per slice |
| 98 |
MHW_WALKER_MODE_HEX = 6, // applies in BDW GT2 which has 2 slices and 3 sampler/VME per slice |
| 99 |
MHW_WALKER_MODE_OCT = 8 // may apply in future Gen media architectures |
| 100 |
} MHW_WALKER_MODE; |
| 101 |
|
| 102 |
typedef enum _MHW_EMIT_LOCAL_MODE |
| 103 |
{ |
| 104 |
MHW_EMIT_LOCAL_NONE = 0, |
| 105 |
MHW_EMIT_LOCAL_X = 1, |
| 106 |
MHW_EMIT_LOCAL_XY = 3, |
| 107 |
MHW_EMIT_LOCAL_XYZ = 7 |
| 108 |
} MHW_EMIT_LOCAL_MODE; |
| 109 |
|
| 110 |
//! |
| 111 |
//! \brief Structure to capture HW capabilities |
| 112 |
//! |
| 113 |
typedef struct _MHW_RENDER_ENGINE_CAPS |
| 114 |
{ |
| 115 |
uint32_t dwMaxUnormSamplers; // Max UNORM Sampler States supported |
| 116 |
uint32_t dwMaxAVSSamplers; // Max AVS Sampler States supported |
| 117 |
uint32_t dwMaxBTIndex; // Max Binding Table index per Binding Table |
| 118 |
uint32_t dwMaxThreads; // Max Threads supported |
| 119 |
uint32_t dwMaxMediaPayloadSize; // Max Media payload size |
| 120 |
uint32_t dwMaxURBSize; // Max URB Size |
| 121 |
uint32_t dwMaxURBEntries; // Max URB Entries |
| 122 |
uint32_t dwMaxURBEntryAllocationSize; // Max URB Entry Allocation Size |
| 123 |
uint32_t dwMaxCURBEAllocationSize; |
| 124 |
uint32_t dwMaxInterfaceDescriptorEntries; // Max Interface Descriptor Entries |
| 125 |
uint32_t dwMaxSubslice; // Max number of subslice |
| 126 |
uint32_t dwMaxEUIndex; // Max EU index (sometimes != number of EU) |
| 127 |
uint32_t dwNumThreadsPerEU; // Num threads per EU |
| 128 |
uint32_t dwSizeRegistersPerThread; // Size of all registers per thread (for ASM Debug) |
| 129 |
} MHW_RENDER_ENGINE_CAPS, *PMHW_RENDER_ENGINE_CAPS; |
| 130 |
|
| 131 |
typedef struct _MHW_STATE_BASE_ADDR_PARAMS |
| 132 |
{ |
| 133 |
PMOS_RESOURCE presGeneralState; |
| 134 |
uint32_t dwGeneralStateSize; |
| 135 |
PMOS_RESOURCE presDynamicState; |
| 136 |
uint32_t dwDynamicStateSize; |
| 137 |
bool bDynamicStateRenderTarget; |
| 138 |
PMOS_RESOURCE presIndirectObjectBuffer; |
| 139 |
uint32_t dwIndirectObjectBufferSize; |
| 140 |
PMOS_RESOURCE presInstructionBuffer; |
| 141 |
uint32_t dwInstructionBufferSize; |
| 142 |
uint32_t mocs4InstructionCache; |
| 143 |
uint32_t mocs4GeneralState; |
| 144 |
uint32_t mocs4DynamicState; |
| 145 |
uint32_t mocs4SurfaceState; |
| 146 |
uint32_t mocs4IndirectObjectBuffer; |
| 147 |
uint32_t mocs4StatelessDataport; |
| 148 |
uint32_t l1CacheConfig; |
| 149 |
bool addressDis; |
| 150 |
} MHW_STATE_BASE_ADDR_PARAMS, *PMHW_STATE_BASE_ADDR_PARAMS; |
| 151 |
|
| 152 |
typedef struct _MHW_VFE_SCOREBOARD_DELTA |
| 153 |
{ |
| 154 |
uint8_t x : 4; |
| 155 |
uint8_t y : 4; |
| 156 |
} MHW_VFE_SCOREBOARD_DELTA, *PMHW_VFE_SCOREBOARD_DELTA; |
| 157 |
|
| 158 |
typedef struct _MHW_VFE_SCOREBOARD |
| 159 |
{ |
| 160 |
struct |
| 161 |
{ |
| 162 |
uint32_t ScoreboardMask : 8; |
| 163 |
uint32_t ScoreboardColor : 4; |
| 164 |
uint32_t : 18; |
| 165 |
uint32_t ScoreboardType : 1; |
| 166 |
uint32_t ScoreboardEnable : 1; |
| 167 |
}; |
| 168 |
|
| 169 |
union |
| 170 |
{ |
| 171 |
MHW_VFE_SCOREBOARD_DELTA ScoreboardDelta[MHW_MAX_DEPENDENCY_COUNT]; |
| 172 |
struct |
| 173 |
{ |
| 174 |
uint32_t Value[2]; |
| 175 |
}; |
| 176 |
}; |
| 177 |
} MHW_VFE_SCOREBOARD, *PMHW_VFE_SCOREBOARD; |
| 178 |
|
| 179 |
struct MHW_VFE_PARAMS |
| 180 |
{ |
| 181 |
uint32_t dwDebugCounterControl = 0; // Debug Counter Control |
| 182 |
uint32_t dwMaximumNumberofThreads = 0; |
| 183 |
uint32_t dwNumberofURBEntries = 0; |
| 184 |
uint32_t dwCURBEAllocationSize = 0; |
| 185 |
uint32_t dwURBEntryAllocationSize = 0; |
| 186 |
uint32_t dwPerThreadScratchSpace = 0; |
| 187 |
uint32_t dwScratchSpaceBasePointer = 0; |
| 188 |
MHW_VFE_SLICE_DISABLE eVfeSliceDisable = MHW_VFE_SLICE_ALL; |
| 189 |
MHW_VFE_SCOREBOARD Scoreboard = {}; |
| 190 |
PMHW_KERNEL_STATE pKernelState = nullptr; |
| 191 |
virtual ~MHW_VFE_PARAMS() {} |
| 192 |
}; |
| 193 |
typedef MHW_VFE_PARAMS *PMHW_VFE_PARAMS; |
| 194 |
|
| 195 |
typedef struct _MHW_CURBE_LOAD_PARAMS |
| 196 |
{ |
| 197 |
PMHW_KERNEL_STATE pKernelState; |
| 198 |
bool bOldInterface; |
| 199 |
uint32_t dwCURBETotalDataLength; |
| 200 |
uint32_t dwCURBEDataStartAddress; |
| 201 |
} MHW_CURBE_LOAD_PARAMS, *PMHW_CURBE_LOAD_PARAMS; |
| 202 |
|
| 203 |
typedef struct _MHW_ID_LOAD_PARAMS |
| 204 |
{ |
| 205 |
PMHW_KERNEL_STATE pKernelState; |
| 206 |
uint32_t dwNumKernelsLoaded; |
| 207 |
uint32_t dwIdIdx; |
| 208 |
uint32_t dwInterfaceDescriptorStartOffset; |
| 209 |
uint32_t dwInterfaceDescriptorLength; |
| 210 |
} MHW_ID_LOAD_PARAMS, *PMHW_ID_LOAD_PARAMS; |
| 211 |
|
| 212 |
typedef struct _MHW_SIP_STATE_PARAMS |
| 213 |
{ |
| 214 |
bool bSipKernel; |
| 215 |
uint32_t dwSipBase; |
| 216 |
} MHW_SIP_STATE_PARAMS, *PMHW_SIP_STATE_PARAMS; |
| 217 |
|
| 218 |
typedef struct _MHW_WALKER_XY |
| 219 |
{ |
| 220 |
union |
| 221 |
{ |
| 222 |
struct |
| 223 |
{ |
| 224 |
uint32_t x : 16; |
| 225 |
uint32_t y : 16; |
| 226 |
}; |
| 227 |
uint32_t value; |
| 228 |
}; |
| 229 |
} MHW_WALKER_XY, *PMHW_WALKER_XY; |
| 230 |
|
| 231 |
typedef struct _MHW_PALETTE_PARAMS |
| 232 |
{ |
| 233 |
int32_t iPaletteID; //!< Palette ID |
| 234 |
int32_t iNumEntries; //!< Palette entries in use |
| 235 |
void* pPaletteData; //!< Palette data |
| 236 |
} MHW_PALETTE_PARAMS, *PMHW_PALETTE_PARAMS; |
| 237 |
|
| 238 |
typedef struct _MHW_CHROMAKEY_PARAMS |
| 239 |
{ |
| 240 |
uint32_t dwIndex; //!< Chroma Key Index |
| 241 |
uint32_t dwLow; //!< Chroma Key Low |
| 242 |
uint32_t dwHigh; //!< Chroma Key High |
| 243 |
} MHW_CHROMAKEY_PARAMS, *PMHW_CHROMAKEY_PARAMS; |
| 244 |
|
| 245 |
// IMPORTANT - changes in this structure must |
| 246 |
// be ported to CM_HAL_WALKER_PARAMS in cm_common.h |
| 247 |
typedef struct _MHW_WALKER_PARAMS |
| 248 |
{ |
| 249 |
uint32_t InterfaceDescriptorOffset : 5; |
| 250 |
uint32_t CmWalkerEnable : 1; |
| 251 |
uint32_t ColorCountMinusOne : 8; |
| 252 |
uint32_t UseScoreboard : 1; |
| 253 |
uint32_t ScoreboardMask : 8; |
| 254 |
uint32_t MidLoopUnitX : 2; |
| 255 |
uint32_t MidLoopUnitY : 2; |
| 256 |
uint32_t MiddleLoopExtraSteps : 5; |
| 257 |
|
| 258 |
uint32_t GroupIdLoopSelect : 24; |
| 259 |
uint32_t : 8; |
| 260 |
|
| 261 |
uint32_t InlineDataLength; |
| 262 |
uint8_t* pInlineData; |
| 263 |
uint32_t dwLocalLoopExecCount; |
| 264 |
uint32_t dwGlobalLoopExecCount; |
| 265 |
|
| 266 |
MHW_WALKER_MODE WalkerMode; |
| 267 |
MHW_WALKER_XY BlockResolution; |
| 268 |
MHW_WALKER_XY LocalStart; |
| 269 |
MHW_WALKER_XY LocalEnd; |
| 270 |
MHW_WALKER_XY LocalOutLoopStride; |
| 271 |
MHW_WALKER_XY LocalInnerLoopUnit; |
| 272 |
MHW_WALKER_XY GlobalResolution; |
| 273 |
MHW_WALKER_XY GlobalStart; |
| 274 |
MHW_WALKER_XY GlobalOutlerLoopStride; |
| 275 |
MHW_WALKER_XY GlobalInnerLoopUnit; |
| 276 |
|
| 277 |
bool bAddMediaFlush; |
| 278 |
bool bRequestSingleSlice; |
| 279 |
|
| 280 |
uint32_t IndirectDataLength; |
| 281 |
uint32_t IndirectDataStartAddress; |
| 282 |
} MHW_WALKER_PARAMS, *PMHW_WALKER_PARAMS; |
| 283 |
|
| 284 |
typedef struct _MHW_GPGPU_WALKER_PARAMS |
| 285 |
{ |
| 286 |
uint32_t InterfaceDescriptorOffset : 5; |
| 287 |
uint32_t GpGpuEnable : 1; |
| 288 |
uint32_t : 26; |
| 289 |
uint32_t ThreadWidth; |
| 290 |
uint32_t ThreadHeight; |
| 291 |
uint32_t ThreadDepth; |
| 292 |
uint32_t GroupWidth; |
| 293 |
uint32_t GroupHeight; |
| 294 |
uint32_t GroupDepth; |
| 295 |
uint32_t GroupStartingX; |
| 296 |
uint32_t GroupStartingY; |
| 297 |
uint32_t GroupStartingZ; |
| 298 |
uint32_t SLMSize; |
| 299 |
|
| 300 |
uint32_t IndirectDataLength; |
| 301 |
uint32_t IndirectDataStartAddress; |
| 302 |
uint32_t BindingTableID; |
| 303 |
uint32_t ForcePreferredSLMZero; |
| 304 |
|
| 305 |
bool isEmitInlineParameter; |
| 306 |
uint32_t inlineDataLength; |
| 307 |
uint8_t* inlineData; |
| 308 |
|
| 309 |
bool isGenerateLocalID; |
| 310 |
MHW_EMIT_LOCAL_MODE emitLocal; |
| 311 |
|
| 312 |
bool hasBarrier; |
| 313 |
|
| 314 |
uint32_t simdSize; |
| 315 |
uint32_t registersPerThread; |
| 316 |
|
| 317 |
PMHW_INDIRECT_STATE_RESOURCE_PARAMS curbeResourceList; |
| 318 |
uint32_t curbeResourceListSize; |
| 319 |
|
| 320 |
PMHW_INDIRECT_STATE_RESOURCE_PARAMS inlineResourceList; |
| 321 |
uint32_t inlineResourceListSize; |
| 322 |
|
| 323 |
} MHW_GPGPU_WALKER_PARAMS, *PMHW_GPGPU_WALKER_PARAMS; |
| 324 |
|
| 325 |
typedef struct _MHW_MEDIA_OBJECT_PARAMS |
| 326 |
{ |
| 327 |
uint32_t dwInterfaceDescriptorOffset; |
| 328 |
uint32_t dwHalfSliceDestinationSelect; |
| 329 |
uint32_t dwSliceDestinationSelect; |
| 330 |
uint32_t dwIndirectLoadLength; |
| 331 |
uint32_t dwIndirectDataStartAddress; |
| 332 |
void* pInlineData; |
| 333 |
uint32_t dwInlineDataSize; |
| 334 |
bool bForceDestination; |
| 335 |
MHW_VFE_SCOREBOARD VfeScoreboard; |
| 336 |
} MHW_MEDIA_OBJECT_PARAMS, *PMHW_MEDIA_OBJECT_PARAMS; |
| 337 |
|
| 338 |
#endif // __MHW_RENDER_H__ |