Debian Codegraph @

media_softlet/agnostic/common/hw/mhw_render_cmdpar.h

raw
1 /*
2 * Copyright (c) 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_cmdpar.h
24 //! \brief MHW command parameters
25 //! \details
26 //!
27
28 #ifndef __MHW_RENDER_CMDPAR_H__
29 #define __MHW_RENDER_CMDPAR_H__
30
31 #include "mhw_cmdpar.h"
32 #include "mhw_state_heap.h"
33
34 static constexpr uint32_t MHW_RENDER_ENGINE_SSH_SURFACES_PER_BT_MAX = 256;
35 static constexpr uint32_t MHW_RENDER_ENGINE_SAMPLERS_MAX = 16;
36 static constexpr uint32_t MHW_RENDER_ENGINE_SAMPLERS_AVS_MAX = 8;
37 static constexpr uint32_t MHW_RENDER_ENGINE_MEDIA_PALOAD_SIZE_MAX = 512;
38 static constexpr uint32_t MHW_RENDER_ENGINE_URB_SIZE_MAX = 2048;
39 static constexpr uint32_t MHW_RENDER_ENGINE_URB_ENTRIES_MAX = 128;
40 static constexpr uint32_t MHW_RENDER_ENGINE_INTERFACE_DESCRIPTOR_ENTRIES_MAX = 64;
41 static constexpr uint32_t MHW_RENDER_ENGINE_EU_INDEX_MAX = 12;
42 static constexpr uint32_t MHW_RENDER_ENGINE_SIZE_REGISTERS_PER_THREAD = 0x1800;
43 static constexpr uint32_t MHW_MAX_DEPENDENCY_COUNT = 8;
44
45 namespace mhw
46 {
47 namespace render
48 {
49 struct MHW_VFE_SCOREBOARD_DELTA
50 {
51 uint8_t x = 0;
52 uint8_t y = 0;
53 };
54
55 struct MHW_VFE_SCOREBOARD
56 {
57 uint8_t ScoreboardMask = 0;
58 uint8_t ScoreboardColor = 0;
59 bool ScoreboardType = false;
60 bool ScoreboardEnable = false;
61 MHW_VFE_SCOREBOARD_DELTA ScoreboardDelta[MHW_MAX_DEPENDENCY_COUNT] = {};
62 };
63
64 struct MHW_HEAPS_RESOURCE
65 {
66 PMOS_RESOURCE presInstructionBuffer = nullptr;
67 uint8_t *instructionBufferPtr = nullptr;
68 PMHW_INDIRECT_STATE_RESOURCE_PARAMS curbeResourceList = nullptr;
69 uint32_t curbeResourceListSize = 0;
70 PMHW_INDIRECT_STATE_RESOURCE_PARAMS inlineResourceList = nullptr;
71 uint32_t inlineResourceListSize = 0;
72 };
73
74 enum MHW_VFE_SLICE_DISABLE
75 {
76 MHW_VFE_SLICE_ALL = 0,
77 MHW_VFE_SLICE0_SUBSLICE_ALL,
78 MHW_VFE_SLICE0_SUBSLICE0
79 };
80
81 struct MHW_WALKER_XY
82 {
83 uint16_t x = 0;
84 uint16_t y = 0;
85 };
86
87 enum MHW_WALKER_MODE
88 {
89 MHW_WALKER_MODE_NOT_SET = -1,
90 MHW_WALKER_MODE_DISABLED = 0,
91 MHW_WALKER_MODE_SINGLE = 1, // dual = 0, repel = 1
92 MHW_WALKER_MODE_DUAL = 2, // dual = 1, repel = 0)
93 MHW_WALKER_MODE_TRI = 3, // applies in BDW GT2 which has 1 slice and 3 sampler/VME per slice
94 MHW_WALKER_MODE_QUAD = 4, // applies in HSW GT3 which has 2 slices and 2 sampler/VME per slice
95 MHW_WALKER_MODE_HEX = 6, // applies in BDW GT2 which has 2 slices and 3 sampler/VME per slice
96 MHW_WALKER_MODE_OCT = 8 // may apply in future Gen media architectures
97 };
98
99 enum MHW_EMIT_LOCAL_MODE
100 {
101 MHW_EMIT_LOCAL_NONE = 0,
102 MHW_EMIT_LOCAL_X = 1,
103 MHW_EMIT_LOCAL_XY = 3,
104 MHW_EMIT_LOCAL_XYZ = 7
105 };
106
107 struct MHW_RENDER_ENGINE_CAPS
108 {
109 uint32_t dwMaxUnormSamplers = 0; // Max UNORM Sampler States supported
110 uint32_t dwMaxAVSSamplers = 0; // Max AVS Sampler States supported
111 uint32_t dwMaxBTIndex = 0; // Max Binding Table index per Binding Table
112 uint32_t dwMaxThreads = 0; // Max Threads supported
113 uint32_t dwMaxMediaPayloadSize = 0; // Max Media payload size
114 uint32_t dwMaxURBSize = 0; // Max URB Size
115 uint32_t dwMaxURBEntries = 0; // Max URB Entries
116 uint32_t dwMaxURBEntryAllocationSize = 0; // Max URB Entry Allocation Size
117 uint32_t dwMaxCURBEAllocationSize = 0;
118 uint32_t dwMaxInterfaceDescriptorEntries = 0; // Max Interface Descriptor Entries
119 uint32_t dwMaxSubslice = 0; // Max number of subslice
120 uint32_t dwMaxEUIndex = 0; // Max EU index (sometimes != number of EU)
121 uint32_t dwNumThreadsPerEU = 0; // Num threads per EU
122 uint32_t dwSizeRegistersPerThread = 0; // Size of all registers per thread (for ASM Debug)
123 };
124
125 struct MHW_RENDER_ENGINE_L3_CACHE_SETTINGS
126 {
127 uint32_t dwCntlReg = 0;
128 uint32_t dwCntlReg2 = 0;
129 uint32_t dwCntlReg3 = 0;
130 uint32_t dwSqcReg1 = 0;
131 uint32_t dwSqcReg4 = 0;
132 uint32_t dwLra1Reg = 0;
133 uint32_t dwTcCntlReg = 0;
134 uint32_t dwAllocReg = 0;
135 bool bUpdateDefault = 0;
136 };
137
138 struct MHW_RENDER_ENGINE_L3_CACHE_CONFIG
139 {
140 uint32_t dwL3CacheCntlReg_Register = 0;
141 uint32_t dwL3CacheCntlReg_Setting = 0;
142 uint32_t dwL3CacheCntlReg2_Register = 0;
143 uint32_t dwL3CacheCntlReg2_Setting = 0;
144 uint32_t dwL3CacheCntlReg3_Register = 0;
145 uint32_t dwL3CacheCntlReg3_Setting = 0;
146 uint32_t dwL3CacheSqcReg1_Register = 0;
147 uint32_t dwL3CacheSqcReg1_Setting = 0;
148 uint32_t dwL3CacheSqcReg4_Register = 0;
149 uint32_t dwL3CacheSqcReg4_Setting = 0;
150 uint32_t dwL3LRA1Reg_Register = 0;
151 uint32_t dwL3LRA1Reg_Setting = 0;
152 bool bL3CachingEnabled = false;
153 bool bL3LRA1Reset = false;
154 uint32_t dwRcsL3CacheTcCntlReg_Register = 0;
155 uint32_t dwL3CacheTcCntlReg_Setting = 0;
156 uint32_t dwRcsL3CacheAllocReg_Register = 0;
157 uint32_t dwL3CacheAllocReg_Setting = 0;
158 uint32_t dwCcs0L3CacheTcCntlReg_Register = 0;
159 uint32_t dwCcs0L3CacheAllocReg_Register = 0;
160
161 };
162
163 struct MHW_VFE_PARAMS
164 {
165 uint32_t dwDebugCounterControl = 0; // Debug Counter Control
166 uint32_t dwMaximumNumberofThreads = 0;
167 uint32_t dwNumberofURBEntries = 0;
168 uint32_t dwCURBEAllocationSize = 0;
169 uint32_t dwURBEntryAllocationSize = 0;
170 uint32_t dwPerThreadScratchSpace = 0;
171 uint32_t dwScratchSpaceBasePointer = 0;
172 MHW_VFE_SLICE_DISABLE eVfeSliceDisable = MHW_VFE_SLICE_ALL;
173 MHW_VFE_SCOREBOARD Scoreboard = {};
174 PMHW_KERNEL_STATE pKernelState = nullptr;
175 bool bFusedEuDispatch = 0;
176 uint32_t numOfWalkers = 0;
177 bool enableSingleSliceDispatchCcsMode = 0;
178 // Surface state offset of scratch space buffer.
179 uint32_t scratchStateOffset = 0;
180 };
181
182 struct _MHW_PAR_T(MEDIA_OBJECT)
183 {
184 uint32_t dwInterfaceDescriptorOffset = 0;
185 uint32_t dwHalfSliceDestinationSelect = 0;
186 uint32_t dwSliceDestinationSelect = 0;
187 uint32_t dwIndirectLoadLength = 0;
188 uint32_t dwIndirectDataStartAddress = 0;
189 void* pInlineData = nullptr;
190 uint32_t dwInlineDataSize = 0;
191 bool bForceDestination = false;
192 MHW_VFE_SCOREBOARD VfeScoreboard = {};
193 };
194
195 struct _MHW_PAR_T(PIPE_MODE_SELECT)
196 {
197 uint32_t dwInterfaceDescriptorOffset = 0;
198 uint32_t dwHalfSliceDestinationSelect = 0;
199 uint32_t dwSliceDestinationSelect = 0;
200 uint32_t dwIndirectLoadLength = 0;
201 uint32_t dwIndirectDataStartAddress = 0;
202 void* pInlineData = nullptr;
203 uint32_t dwInlineDataSize = 0;
204 bool bForceDestination = false;
205 MHW_VFE_SCOREBOARD VfeScoreboard = {};
206 };
207
208 struct _MHW_PAR_T(PIPELINE_SELECT)
209 {
210 uint32_t pipelineSelection = 0;
211 bool gpGpuPipe = false;
212 };
213
214 struct _MHW_PAR_T(STATE_BASE_ADDRESS)
215 {
216 PMOS_RESOURCE presGeneralState = nullptr;
217 uint32_t dwGeneralStateSize = 0;
218 PMOS_RESOURCE presDynamicState = nullptr;
219 uint32_t dwDynamicStateSize = 0;
220 bool bDynamicStateRenderTarget = false;
221 PMOS_RESOURCE presIndirectObjectBuffer = nullptr;
222 uint32_t dwIndirectObjectBufferSize = 0;
223 PMOS_RESOURCE presInstructionBuffer = nullptr;
224 uint32_t dwInstructionBufferSize = 0;
225 uint32_t mocs4InstructionCache = 0;
226 uint32_t mocs4GeneralState = 0;
227 uint32_t mocs4DynamicState = 0;
228 uint32_t mocs4SurfaceState = 0;
229 uint32_t mocs4IndirectObjectBuffer = 0;
230 uint32_t mocs4StatelessDataport = 0;
231 uint32_t l1CacheConfig = 0;
232 bool addressDis = false;
233 };
234
235 struct _MHW_PAR_T(MEDIA_VFE_STATE)
236 {
237 uint32_t dwDebugCounterControl = 0; // Debug Counter Control
238 uint32_t dwMaximumNumberofThreads = 0;
239 uint32_t dwNumberofURBEntries = 0;
240 uint32_t dwCURBEAllocationSize = 0;
241 uint32_t dwURBEntryAllocationSize = 0;
242 uint32_t dwPerThreadScratchSpace = 0;
243 uint32_t dwScratchSpaceBasePointer = 0;
244 MHW_VFE_SLICE_DISABLE eVfeSliceDisable = MHW_VFE_SLICE_ALL;
245 MHW_VFE_SCOREBOARD Scoreboard = {};
246 PMHW_KERNEL_STATE pKernelState = nullptr;
247 MHW_RENDER_ENGINE_CAPS* pHwCaps = nullptr;
248 };
249
250 struct _MHW_PAR_T(MEDIA_CURBE_LOAD)
251 {
252 PMHW_KERNEL_STATE pKernelState = nullptr;
253 bool bOldInterface = false;
254 uint32_t dwCURBETotalDataLength = 0;
255 uint32_t dwCURBEDataStartAddress = 0;
256 };
257
258 struct _MHW_PAR_T(MEDIA_INTERFACE_DESCRIPTOR_LOAD)
259 {
260 PMHW_KERNEL_STATE pKernelState = nullptr;
261 uint32_t dwNumKernelsLoaded = 0;
262 uint32_t dwIdIdx = 0;
263 uint32_t dwInterfaceDescriptorStartOffset = 0;
264 uint32_t dwInterfaceDescriptorLength = 0;
265 };
266
267 struct _MHW_PAR_T(MEDIA_OBJECT_WALKER)
268 {
269 uint16_t InterfaceDescriptorOffset = 0;
270 bool CmWalkerEnable = false;
271 uint16_t ColorCountMinusOne = 0;
272 uint16_t UseScoreboard = 0;
273 uint16_t ScoreboardMask = 0;
274 uint8_t MidLoopUnitX = 0;
275 uint8_t MidLoopUnitY = 0;
276 uint8_t MiddleLoopExtraSteps = 0;
277 uint32_t GroupIdLoopSelect = 0;
278 uint32_t InlineDataLength = 0;
279 uint8_t* pInlineData = nullptr ;
280 uint32_t dwLocalLoopExecCount = 0;
281 uint32_t dwGlobalLoopExecCount = 0;
282 MHW_WALKER_MODE WalkerMode = {};
283 MHW_WALKER_XY BlockResolution = {};
284 MHW_WALKER_XY LocalStart = {};
285 MHW_WALKER_XY LocalEnd = {};
286 MHW_WALKER_XY LocalOutLoopStride = {};
287 MHW_WALKER_XY LocalInnerLoopUnit = {};
288 MHW_WALKER_XY GlobalResolution = {};
289 MHW_WALKER_XY GlobalStart = {};
290 MHW_WALKER_XY GlobalOutlerLoopStride = {};
291 MHW_WALKER_XY GlobalInnerLoopUnit = {};
292 bool bAddMediaFlush = false;
293 bool bRequestSingleSlice = false;
294 uint32_t IndirectDataLength = 0;
295 uint32_t IndirectDataStartAddress = 0;
296 };
297
298 struct _MHW_PAR_T(GPGPU_WALKER)
299 {
300 uint8_t InterfaceDescriptorOffset = 0;
301 bool GpGpuEnable = false;
302 uint32_t ThreadWidth = 0;
303 uint32_t ThreadHeight = 0;
304 uint32_t ThreadDepth = 0;
305 uint32_t GroupWidth = 0;
306 uint32_t GroupHeight = 0;
307 uint32_t GroupDepth = 0;
308 uint32_t GroupStartingX = 0;
309 uint32_t GroupStartingY = 0;
310 uint32_t GroupStartingZ = 0;
311 uint32_t SLMSize = 0;
312 uint32_t IndirectDataLength = 0;
313 uint32_t IndirectDataStartAddress = 0;
314 uint32_t BindingTableID = 0;
315 };
316
317 struct _MHW_PAR_T(_3DSTATE_CHROMA_KEY)
318 {
319 uint32_t dwIndex = 0; //!< Chroma Key Index
320 uint32_t dwLow = 0; //!< Chroma Key Low
321 uint32_t dwHigh = 0; //!< Chroma Key High
322 };
323
324 struct _MHW_PAR_T(PALETTE_ENTRY)
325 {
326 int32_t iPaletteID = 0; //!< Palette ID
327 int32_t iNumEntries = 0; //!< Palette entries in use
328 void* pPaletteData = nullptr; //!< Palette data
329 };
330
331 struct _MHW_PAR_T(STATE_SIP)
332 {
333 bool bSipKernel = false;
334 uint32_t dwSipBase = 0;
335 };
336
337 struct _MHW_PAR_T(GPGPU_CSR_BASE_ADDRESS)
338 {
339 };
340
341 struct _MHW_PAR_T(_3DSTATE_BINDING_TABLE_POOL_ALLOC)
342 {
343 uint32_t mocs4SurfaceState = 0;
344 };
345
346 struct _MHW_PAR_T(CFE_STATE)
347 {
348 uint32_t dwDebugCounterControl = 0; // Debug Counter Control
349 uint32_t dwMaximumNumberofThreads = 0;
350 uint32_t dwNumberofURBEntries = 0;
351 uint32_t dwCURBEAllocationSize = 0;
352 uint32_t dwURBEntryAllocationSize = 0;
353 uint32_t dwPerThreadScratchSpace = 0;
354 uint32_t dwScratchSpaceBasePointer = 0;
355 uint32_t ScratchSpaceBuffer = 0;
356 bool FusedEuDispatch = 0;
357 bool NumberOfWalkers = 0;
358 bool SingleSliceDispatchCcsMode = 0;
359 MHW_VFE_SLICE_DISABLE eVfeSliceDisable = MHW_VFE_SLICE_ALL;
360 MHW_VFE_SCOREBOARD Scoreboard = {};
361 PMHW_KERNEL_STATE pKernelState = nullptr;
362 };
363
364 struct _MHW_PAR_T(COMPUTE_WALKER)
365 {
366 uint8_t InterfaceDescriptorOffset = 0;
367 bool GpGpuEnable = false;
368 uint32_t ThreadWidth = 0;
369 uint32_t ThreadHeight = 0;
370 uint32_t ThreadDepth = 0;
371 uint32_t GroupWidth = 0;
372 uint32_t GroupHeight = 0;
373 uint32_t GroupDepth = 0;
374 uint32_t GroupStartingX = 0;
375 uint32_t GroupStartingY = 0;
376 uint32_t GroupStartingZ = 0;
377 uint32_t SLMSize = 0;
378 uint32_t IndirectDataLength = 0;
379 uint32_t IndirectDataStartAddress = 0;
380 uint32_t BindingTableID = 0;
381 uint32_t dwMediaIdOffset = 0; //! Offset of the first Media Interface Descriptor (in DSH)
382 uint32_t iMediaId = 0; //! Media Interface Descriptor #
383 uint32_t dwKernelOffset = 0; //! Kernel offset (in ISH)
384 uint32_t kernelSize = 0;
385 uint32_t dwSamplerOffset = 0; //! Sampler offset (in DSH)
386 uint32_t dwSamplerCount = 0; //! Sample count
387 uint32_t dwBindingTableOffset = 0; //! Binding table offset (in DSH)
388 uint32_t iCurbeOffset = 0; //! Curbe offset (in DSH)
389 uint32_t iCurbeLength = 0; //! Curbe lenght
390 bool bBarrierEnable = false; //! Enable Barrier
391 bool bGlobalBarrierEnable = false; //! Enable Global Barrier (SKL+)
392 uint32_t dwNumberofThreadsInGPGPUGroup = 0; //! Number of threads per group
393 uint32_t dwSharedLocalMemorySize = 0; //! Size of SharedLocalMemory (SLM)
394 int32_t forcePreferredSLMZero = 0; //! force preferredSLM value as 0
395 int32_t iCrsThdConDataRdLn = 0;
396 PMHW_STATE_HEAP pGeneralStateHeap = 0; //! General state heap in use
397 MemoryBlock *memoryBlock = nullptr; //! Memory block associated with the state heap
398 MOS_RESOURCE *postsyncResource = nullptr;
399 uint32_t resourceOffset = 0;
400 bool isEmitInlineParameter = false;
401 uint32_t inlineDataLength = 0;
402 uint8_t *inlineData = nullptr;
403 bool isGenerateLocalId = false;
404 MHW_EMIT_LOCAL_MODE emitLocal = MHW_EMIT_LOCAL_NONE;
405 uint32_t preferredSlmAllocationSize = 0;
406 uint32_t simdSize = 0;
407 uint32_t registersPerThread = 0;
408 _MHW_PAR_T(CFE_STATE) cfeState = {};
409 MHW_HEAPS_RESOURCE heapsResource = {};
410 };
411
412 struct _MHW_PAR_T(STATE_COMPUTE_MODE)
413 {
414 bool enableLargeGrf = false;
415 uint32_t forceEuThreadSchedulingMode = 0;
416 bool enableVariableRegisterSizeAllocationVrt = false;
417 };
418
419 } // namespace render
420 } // namespace mhw
421
422 #endif // __MHW_RENDER_CMDPAR_H__