Debian Codegraph @

media_driver/agnostic/gen12/hw/mhw_mi_hwcmd_g12_X.h

raw
1 /*
2 * Copyright (c) 2015-2019, 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 #ifndef __MHW_MI_HWCMD_G12_X_H__
23 #define __MHW_MI_HWCMD_G12_X_H__
24
25 #pragma once
26
27 #include <cstdint>
28 #include <cstddef>
29
30 #pragma pack(1)
31
32 class mhw_mi_g12_X
33 {
34 public:
35 // Internal Macros
36 #define __CODEGEN_MAX(_a, _b) (((_a) > (_b)) ? (_a) : (_b))
37 #define __CODEGEN_BITFIELD(l, h) (h) - (l) + 1
38 #define __CODEGEN_OP_LENGTH_BIAS 2
39 #define __CODEGEN_OP_LENGTH(x) (uint32_t)((__CODEGEN_MAX(x, __CODEGEN_OP_LENGTH_BIAS)) - __CODEGEN_OP_LENGTH_BIAS)
40
41 static uint32_t GetOpLength(uint32_t uiLength) { return __CODEGEN_OP_LENGTH(uiLength); }
42
43 //!
44 //! \brief MI_BATCH_BUFFER_END
45 //! \details
46 //! The MI_BATCH_BUFFER_END command is used to terminate the execution of
47 //! commands stored in a batch buffer initiated using a
48 //! MI_BATCH_BUFFER_START command.
49 //!
50 struct MI_BATCH_BUFFER_END_CMD
51 {
52 union
53 {
54 //!< DWORD 0
55 struct
56 {
57 uint32_t EndContext : __CODEGEN_BITFIELD( 0, 0) ; //!< End Context
58 uint32_t Reserved1 : __CODEGEN_BITFIELD( 1, 22) ; //!< Reserved
59 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
60 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
61 };
62 uint32_t Value;
63 } DW0;
64
65 //! \name Local enumerations
66
67 enum MI_COMMAND_OPCODE
68 {
69 MI_COMMAND_OPCODE_MIBATCHBUFFEREND = 10, //!< No additional details
70 };
71
72 enum COMMAND_TYPE
73 {
74 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
75 };
76
77 //! \name Initializations
78
79 //! \brief Explicit member initialization function
80 MI_BATCH_BUFFER_END_CMD();
81
82 static const size_t dwSize = 1;
83 static const size_t byteSize = 4;
84 };
85
86 //!
87 //! \brief MI_NOOP
88 //! \details
89 //! The MI_NOOP command basically performs a "no operation" in the command
90 //! stream and is typically used to pad the command stream (e.g., in order
91 //! to pad out a batch buffer to a QWord boundary). However, there is one
92 //! minor (optional) function this command can perform - a 22-bit value can
93 //! be loaded into the MI NOPID register. This provides a general-purpose
94 //! command stream tagging ("breadcrumb") mechanism (e.g., to provide
95 //! sequencing information for a subsequent breakpoint interrupt).
96 //!
97 struct MI_NOOP_CMD
98 {
99 union
100 {
101 //!< DWORD 0
102 struct
103 {
104 uint32_t IdentificationNumber : __CODEGEN_BITFIELD( 0, 21) ; //!< Identification Number
105 uint32_t IdentificationNumberRegisterWriteEnable : __CODEGEN_BITFIELD(22, 22) ; //!< IDENTIFICATION_NUMBER_REGISTER_WRITE_ENABLE
106 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
107 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
108 };
109 uint32_t Value;
110 } DW0;
111
112 //! \name Local enumerations
113
114 //! \brief IDENTIFICATION_NUMBER_REGISTER_WRITE_ENABLE
115 //! \details
116 //! This field enables the value in the Identification Number field to be
117 //! written into the MI NOPID register. If disabled, that register is
118 //! unmodified - making this command an effective "no operation" function.
119 enum IDENTIFICATION_NUMBER_REGISTER_WRITE_ENABLE
120 {
121 IDENTIFICATION_NUMBER_REGISTER_WRITE_ENABLE_WRITETHENOPIDREGISTER = 1, //!< No additional details
122 };
123
124 enum MI_COMMAND_OPCODE
125 {
126 MI_COMMAND_OPCODE_MINOOP = 0, //!< No additional details
127 };
128
129 enum COMMAND_TYPE
130 {
131 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
132 };
133
134 //! \name Initializations
135
136 //! \brief Explicit member initialization function
137 MI_NOOP_CMD();
138
139 static const size_t dwSize = 1;
140 static const size_t byteSize = 4;
141 };
142
143 //!
144 //! \brief MI_ARB_CHECK
145 //! \details
146 //! This command allows software to enable or disable pre-fetch mechanism
147 //! for command buffers in hardware.
148 //!
149 //! The command allows software to add preemption points in the ring buffer.
150 //! The command streamer will preempt in the case arbitration is enabled,
151 //! there is a pending execution list and this command is currently being
152 //! parsed.
153 //!
154 //! MI_ARB_CHK command can be programmed in a ring buffer or batch buffer.
155 //! MI_ARB_CHK command must not be programmed in INDIRECT_CTX and
156 //! BB_PER_CTX_PTR buffers.
157 //!
158 struct MI_ARB_CHECK_CMD
159 {
160 union
161 {
162 //!< DWORD 0
163 struct
164 {
165 uint32_t PreFetchDisable : __CODEGEN_BITFIELD( 0, 0) ; //!< PRE_FETCH_DISABLE
166 uint32_t Reserved1 : __CODEGEN_BITFIELD( 1, 7) ; //!< Reserved
167 uint32_t MaskBits : __CODEGEN_BITFIELD( 8, 15) ; //!< Mask Bits
168 uint32_t Reserved16 : __CODEGEN_BITFIELD(16, 22) ; //!< Reserved
169 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
170 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
171 };
172 uint32_t Value;
173 } DW0;
174
175 //! \name Local enumerations
176
177 //! \brief PRE_FETCH_DISABLE
178 //! \details
179 //! <p>This command allows software to enable or disable pre-fetch of
180 //! command buffer functionality from within a command sequence on per
181 //! context basis.</p>
182 enum PRE_FETCH_DISABLE
183 {
184 PRE_FETCH_DISABLE_UNNAMED0 = 0, //!< When reset pre-fetch of command buffers is enabled in hardware when "Pre-Fetch Disable" in GFX_MODE register is not set.
185 PRE_FETCH_DISABLE_UNNAMED1 = 1, //!< When set pre-fetch of command buffers is disabled in hardware.
186 };
187
188 enum MI_COMMAND_OPCODE
189 {
190 MI_COMMAND_OPCODE_MIARBCHECK = 5, //!< No additional details
191 };
192
193 enum COMMAND_TYPE
194 {
195 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
196 };
197
198 //! \name Initializations
199
200 //! \brief Explicit member initialization function
201 MI_ARB_CHECK_CMD();
202
203 static const size_t dwSize = 1;
204 static const size_t byteSize = 4;
205 };
206
207 //!
208 //! \brief MI_LOAD_REGISTER_IMM
209 //! \details
210 //! The MI_LOAD_REGISTER_IMM command requests a write of up to a DWord
211 //! constant supplied in the command to the specified Register Offset (i.e.,
212 //! offset into Memory-Mapped Register Range).
213 //! Any offset that is to a destination outside of the GT core will allow
214 //! the parser to continue once the cycle is at the GT boundry and not
215 //! destination. Any other address will ensure the destination is updated
216 //! prior to parsing the next command
217 //!
218 //! Many MMIO bits require the engine to be IDLE prior to updating the
219 //! value. Command streamer does not implicitly put in a pipeline flush in
220 //! the cases a MMIO bit requires the engine to be IDLE. In the case there
221 //! was a 3DPRIMITIVE command or GPGPU_WALKER command without any stalling
222 //! PIPE_CONTROL, one must be inserted prior to a MI_LOAD_REGISTER_IMMEDIATE
223 //! that is updating a bit that requires the engine to be IDLE.
224 //!
225 //! When executed from a non-privileged batch buffer, MMIO writes are only
226 //! allowed to the registers listed in User Mode Non-Privileged Registers
227 //! for the corresponding engine, any writes targeting the register not
228 //! listed in the User Mode Non-Privileged Register will convert this
229 //! command to a NOOP.
230 //!
231 //! The following addresses should NOT be used for LRIs:
232 //!
233 //! 0x8800 - 0x88FF
234 //!
235 //! >= 0xC0000
236 //!
237 //!
238 //!
239 //! Limited LRI cycles to the Display Engine (0x40000-0xBFFFF) are allowed,
240 //! but must be spaced to allow only one pending at a time. This can be done
241 //! by issuing an SRM to the same address immediately after each LRI.
242 //!
243 //! Programming an MMIO register is equivalent to programming a non-pipeline
244 //! state to the hardware and hence an explicit stalling flush needs to be
245 //! programmed prior to programming this command. However for certain MMIO
246 //! registers based on their functionality doing an explicit stalling flush
247 //! is exempted. Listed below are the exempted registers.
248 //!
249 //! 3DPRIM_END_OFFSET - Auto Draw End Offset [IVB+]
250 //!
251 //! 3DPRIM_START_VERTEX - Load Indirect Start Vertex [IVB+]
252 //!
253 //! 3DPRIM_VERTEX_COUNT - Load Indirect Vertex Count [IVB+]
254 //!
255 //! 3DPRIM_INSTANCE_COUNT - Load Indirect Instance Count [IVB+]
256 //!
257 //! 3DPRIM_START_INSTANCE - Load Indirect Start Instance [IVB+]
258 //!
259 //! 3DPRIM_BASE_VERTEX - Load Indirect Base Vertex [IVB+]
260 //!
261 //! 3DPRIM_XP0 - Load Indirect Extended Parameter 0
262 //!
263 //! 3DPRIM_XP1 - Load Indirect Extended Parameter 1
264 //!
265 //! 3DPRIM_XP2 - Load Indirect Extended Parameter 2
266 //!
267 //!
268 //!
269 struct MI_LOAD_REGISTER_IMM_CMD
270 {
271 union
272 {
273 //!< DWORD 0
274 struct
275 {
276 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
277 uint32_t ByteWriteDisables : __CODEGEN_BITFIELD( 8, 11) ; //!< Byte Write Disables
278 uint32_t Reserved12 : __CODEGEN_BITFIELD(12, 16) ; //!< Reserved
279 uint32_t MmioRemapEnable : __CODEGEN_BITFIELD(17, 17) ; //!< MMIO_REMAP_ENABLE
280 uint32_t Reserved18 : __CODEGEN_BITFIELD(18, 18) ; //!< Reserved
281 uint32_t AddCsMmioStartOffset : __CODEGEN_BITFIELD(19, 19) ; //!< ADD_CS_MMIO_START_OFFSET
282 uint32_t Reserved20 : __CODEGEN_BITFIELD(20, 22) ; //!< Reserved
283 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
284 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
285 };
286 uint32_t Value;
287 } DW0;
288 union
289 {
290 //!< DWORD 1
291 struct
292 {
293 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
294 uint32_t RegisterOffset : __CODEGEN_BITFIELD( 2, 22) ; //!< Register Offset
295 uint32_t Reserved55 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved
296 };
297 uint32_t Value;
298 } DW1;
299 union
300 {
301 //!< DWORD 2
302 struct
303 {
304 uint32_t DataDword ; //!< Data DWord
305 };
306 uint32_t Value;
307 } DW2;
308
309 //! \name Local enumerations
310
311 //! \brief MMIO_REMAP_ENABLE
312 //! \details
313 //! <p>This bit provides a mechanism in HW to remap the MMIO address in the
314 //! MI command to the engine instance on which the command is getting
315 //! executed, remapping in HW is done using engine specific remap table.
316 //! Render and Compute engine share a common remapping table to facilitate
317 //! remapping across engines, where as a dedicated remap table for each of
318 //! Video Decode and Video Enhancement engine class.</p>
319 //! <p>A MMIO remapping table per engine class is created with MMIO address
320 //! belonging to multiple instances of an engine within an engine class.
321 //! However Render and Compute engine share a common remapping table to
322 //! facilitate remapping across engines, where as a dedicated remap table
323 //! for each of Video Decode and Video Enhancement engine class.</p>
324 //! <p>This mode provides mechanism for SW to always use MMIO address
325 //! belonging to fixed instance (instance zero) with in an engine class
326 //! during command buffer creation agnostic to the instance on which it will
327 //! get scheduled. This willalso allow context interoperability across
328 //! instances with in an engine class and extends to across engines in case
329 //! of Render and Compute.</p>
330 enum MMIO_REMAP_ENABLE
331 {
332 MMIO_REMAP_ENABLE_UNNAMED0 = 0, //!< MMIO remapping will not be applied to the MMIO address.
333 MMIO_REMAP_ENABLE_UNNAMED1 = 1, //!< MMIO remapping will be applied to the MMIO address prior to using for any other functionality of the command.
334 };
335
336 //! \brief ADD_CS_MMIO_START_OFFSET
337 //! \details
338 //! <p>This bit controls the functionality of the "Register Address" field
339 //! in the command.</p>
340 enum ADD_CS_MMIO_START_OFFSET
341 {
342 ADD_CS_MMIO_START_OFFSET_UNNAMED0 = 0, //!< "Register Address" field in the command is absolute and not an offset from the executing command streamer MMIO start offset..
343 ADD_CS_MMIO_START_OFFSET_UNNAMED1 = 1, //!< "Register Address" field in the command is treated as an offset from the executing Command Streamer’s MMIO start offset. Bits [22:2] of the "Register Address" are considered as dword offset to be added to the MMIO start offset of the corresponding command streamer. However, during context restore bits [11:2] of the "Register Address" are considered as dword offset to be added to the MMIO start offset of the corresponding command streamer. Command executed from Ring Buffer or Batch BufferExample: MI_LOAD_REGISTER_IMMEDIATE, ADD_CS_MMIO_START_OFFSET: true, Data:0xABCD, Register Address: 0x00_2000The above command when executed on RenderCS will result in a write to MMIO offset 0x00_4000 (0x00_2000 + 0x00_2000) instead to 0x00_2000. Note that RenderCS MMIO start offset is 0x2000. Table below shows the result of this command executed by various command streamers.<div>
344 };
345
346 enum MI_COMMAND_OPCODE
347 {
348 MI_COMMAND_OPCODE_MILOADREGISTERIMM = 34, //!< No additional details
349 };
350
351 enum COMMAND_TYPE
352 {
353 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
354 };
355
356 //! \name Initializations
357
358 //! \brief Explicit member initialization function
359 MI_LOAD_REGISTER_IMM_CMD();
360
361 static const size_t dwSize = 3;
362 static const size_t byteSize = 12;
363 };
364
365 //!
366 //! \brief MI_LOAD_REGISTER_MEM
367 //! \details
368 //! The MI_LOAD_REGISTER_MEM command requests from a memory location and
369 //! stores that DWord to a register.
370 //!
371 //! The command temporarily halts commands that will cause cycles down the
372 //! 3D pipeline.
373 //!
374 //! The following addresses should NOT be used for MMIO writes:
375 //!
376 //! 0x8800 - 0x88FF
377 //!
378 //! >= 0xC0000
379 //!
380 //!
381 //!
382 //! Limited MMIO writes cycles to the Display Engine 0x40000-0xBFFFF) are
383 //! allowed, but must be spaced to allow only one pending at a time. This
384 //! can be done by issuing an SRM to the same address immediately after each
385 //! MMIO write.
386 //!
387 //! This command should not be used within a non-privilege batch buffer to
388 //! access global virtual space, doing so will be treated as privilege
389 //! access violation. Refer "User Mode Privilege Command" in
390 //! MI_BATCH_BUFFER_START command section to know HW behavior on
391 //! encountering privilege access violation.
392 //!
393 //! This command is not allowed to update the privilege register range when
394 //! executed from a non-privilege batch buffer.
395 //!
396 struct MI_LOAD_REGISTER_MEM_CMD
397 {
398 union
399 {
400 //!< DWORD 0
401 struct
402 {
403 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
404 uint32_t MemoryObjectControlState : __CODEGEN_BITFIELD( 8, 14) ; //!< Memory Object Control State
405 uint32_t MemoryObjectControlStateEnable : __CODEGEN_BITFIELD(15, 15) ; //!< MEMORY_OBJECT_CONTROL_STATE_ENABLE
406 uint32_t Reserved16 : __CODEGEN_BITFIELD(16, 16) ; //!< Reserved
407 uint32_t MmioRemapEnable : __CODEGEN_BITFIELD(17, 17) ; //!< MMIO_REMAP_ENABLE
408 uint32_t Reserved18 : __CODEGEN_BITFIELD(18, 18) ; //!< Reserved
409 uint32_t AddCsMmioStartOffset : __CODEGEN_BITFIELD(19, 19) ; //!< ADD_CS_MMIO_START_OFFSET
410 uint32_t Reserved20 : __CODEGEN_BITFIELD(20, 20) ; //!< Reserved
411 uint32_t AsyncModeEnable : __CODEGEN_BITFIELD(21, 21) ; //!< Async Mode Enable
412 uint32_t UseGlobalGtt : __CODEGEN_BITFIELD(22, 22) ; //!< Use Global GTT
413 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
414 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
415 };
416 uint32_t Value;
417 } DW0;
418 union
419 {
420 //!< DWORD 1
421 struct
422 {
423 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
424 uint32_t RegisterAddress : __CODEGEN_BITFIELD( 2, 22) ; //!< Register Address
425 uint32_t Reserved55 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved
426 };
427 uint32_t Value;
428 } DW1;
429 union
430 {
431 //!< DWORD 2..3
432 struct
433 {
434 uint64_t Reserved64 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
435 uint64_t MemoryAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Memory Address
436 };
437 uint32_t Value[2];
438 } DW2_3;
439
440 //! \name Local enumerations
441
442 enum MEMORY_OBJECT_CONTROL_STATE_ENABLE
443 {
444 MEMORY_OBJECT_CONTROL_STATE_ENABLE_USEDEFAULT = 0, //!< MOCS value will be derived fromCS Read Format Overridefield in Cache Control Register for Command Stream register.
445 MEMORY_OBJECT_CONTROL_STATE_ENABLE_USEINLINE = 1, //!< MOCS value will be derived from Memory Object Control State field in the header of this command.
446 };
447
448 //! \brief MMIO_REMAP_ENABLE
449 //! \details
450 //! <p>This bit provides a mechanism in HW to remap the MMIO address in the
451 //! MI command to the engine instance on which the command is getting
452 //! executed, remapping in HW is done using engine specific remap table.
453 //! Render and Compute engine share a common remapping table to facilitate
454 //! remapping across engines, where as a dedicated remap table for each of
455 //! Video Decode and Video Enhancement engine class.</p>
456 //! <p>A MMIO remapping table per engine class is created with MMIO address
457 //! belonging to multiple instances of an engine within an engine class.
458 //! However Render and Compute engine share a common remapping table to
459 //! facilitate remapping across engines, where as a dedicated remap table
460 //! for each of Video Decode and Video Enhancement engine class.</p>
461 //! <p>This mode provides mechanism for SW to always use MMIO address
462 //! belonging to fixed instance (instance zero) with in an engine class
463 //! during command buffer creation agnostic to the instance on which it will
464 //! get scheduled. This willalso allow context interoperability across
465 //! instances with in an engine class and extends to across engines in case
466 //! of Render and Compute.</p>
467 enum MMIO_REMAP_ENABLE
468 {
469 MMIO_REMAP_ENABLE_UNNAMED0 = 0, //!< MMIO remapping will not be applied to the MMIO address.
470 MMIO_REMAP_ENABLE_UNNAMED1 = 1, //!< MMIO remapping will be applied to the MMIO address prior to using for any other functionality of the command.
471 };
472
473 //! \brief ADD_CS_MMIO_START_OFFSET
474 //! \details
475 //! This bit controls the functionality of the "Register Address" field in
476 //! the command.
477 enum ADD_CS_MMIO_START_OFFSET
478 {
479 ADD_CS_MMIO_START_OFFSET_UNNAMED0 = 0, //!< "Register Address" field in the command is absolute and not an offset from the executing command streamer MMIO start offset.
480 ADD_CS_MMIO_START_OFFSET_UNNAMED1 = 1, //!< "Register Address" field in the command is treated as an offset from the executing Command Streamer’s MMIO start offset.Bits [22:2] of the "Register Address" are considered as dword offset to be added to the MMIO start offset of the corresponding command streamer.Example: MI_LOAD_REGISTER_MEM, ADD_CS_MMIO_START_OFFSET: true, Memory Address:0xABCD, Register Address: 0x1C_0030The above command when executed on RenderCS will result in a write to MMIO offset 0x1C_2030 (0x00_2000 + 0x1C_0030) instead to 0x1C_0030. Note that RenderCS MMIO start offset is 0x2000.
481 };
482
483 enum MI_COMMAND_OPCODE
484 {
485 MI_COMMAND_OPCODE_MILOADREGISTERMEM = 41, //!< No additional details
486 };
487
488 enum COMMAND_TYPE
489 {
490 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
491 };
492
493 //! \name Initializations
494
495 //! \brief Explicit member initialization function
496 MI_LOAD_REGISTER_MEM_CMD();
497
498 static const size_t dwSize = 4;
499 static const size_t byteSize = 16;
500 };
501
502 //!
503 //! \brief MI_LOAD_REGISTER_REG
504 //! \details
505 //! The MI_LOAD_REGISTER_REG command reads from a source register location
506 //! and writes that value to a destination register location.
507 //! Any offset that is to a destination outside of the GT core will allow
508 //! the parser to continue once the cycle is at the GT boundry and not
509 //! destination.  Any other address will ensure the destination is updated
510 //! prior to parsing the next command
511 //!
512 //! The command temporarily halts commands that will cause cycles down the
513 //! 3D pipeline.
514 //!
515 //! Destination register with mask implemented (Ex: some
516 //! registers have bits [31:16] as mask bits and bits[15:0] as data) will
517 //! not get updated unless the value read from source register has the bits
518 //! corresponding to the mask bits set. Note that any mask implemented
519 //! register when read returns "0" for the bits corresponding to mask
520 //! location. When the source and destination are mask implemented
521 //! registers, destination register will not get updated with the source
522 //! register contents.
523 //!
524 //! This command is not allowed to update the privilege register range when
525 //! executed from a non-privilege batch buffer.
526 //!
527 struct MI_LOAD_REGISTER_REG_CMD
528 {
529 union
530 {
531 //!< DWORD 0
532 struct
533 {
534 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
535 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 15) ; //!< Reserved
536 uint32_t MmioRemapEnableSource : __CODEGEN_BITFIELD(16, 16) ; //!< MMIO_REMAP_ENABLE_SOURCE
537 uint32_t MmioRemapEnableDestination : __CODEGEN_BITFIELD(17, 17) ; //!< MMIO_REMAP_ENABLE_DESTINATION
538 uint32_t AddCsMmioStartOffsetSource : __CODEGEN_BITFIELD(18, 18) ; //!< ADD_CS_MMIO_START_OFFSET_SOURCE
539 uint32_t AddCsMmioStartOffsetDestination : __CODEGEN_BITFIELD(19, 19) ; //!< ADD_CS_MMIO_START_OFFSET_DESTINATION
540 uint32_t Reserved20 : __CODEGEN_BITFIELD(20, 22) ; //!< Reserved
541 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
542 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
543 };
544 uint32_t Value;
545 } DW0;
546 union
547 {
548 //!< DWORD 1
549 struct
550 {
551 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
552 uint32_t SourceRegisterAddress : __CODEGEN_BITFIELD( 2, 22) ; //!< Source Register Address
553 uint32_t Reserved55 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved
554 };
555 uint32_t Value;
556 } DW1;
557 union
558 {
559 //!< DWORD 2
560 struct
561 {
562 uint32_t Reserved64 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
563 uint32_t DestinationRegisterAddress : __CODEGEN_BITFIELD( 2, 22) ; //!< Destination Register Address
564 uint32_t Reserved87 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved
565 };
566 uint32_t Value;
567 } DW2;
568
569 //! \name Local enumerations
570
571 //! \brief MMIO_REMAP_ENABLE_SOURCE
572 //! \details
573 //! <p>This bit provides a mechanism in HW to remap the "Source
574 //! Register"MMIO address in the MI command to the engine instance on which
575 //! the command is getting executed, remapping in HW is done using engine
576 //! specific remap table. Render and Compute engine share a common remapping
577 //! table to facilitate remapping across engines, where as a dedicated remap
578 //! table for each of Video Decode and Video Enhancement engine class.</p>
579 //! <p>A MMIO remapping table per engine class is created with MMIO address
580 //! belonging to multiple instances of an engine within an engine class.
581 //! However Render and Compute engine share a common remapping table to
582 //! facilitate remapping across engines, where as a dedicated remap table
583 //! for each of Video Decode and Video Enhancement engine class.</p>
584 //! <p>This mode provides mechanism for SW to always use MMIO address
585 //! belonging to fixed instance (instance zero) with in an engine class
586 //! during command buffer creation agnostic to the instance on which it will
587 //! get scheduled. This willalso allow context interoperability across
588 //! instances with in an engine class and extends to across engines in case
589 //! of Render and Compute.</p>
590 enum MMIO_REMAP_ENABLE_SOURCE
591 {
592 MMIO_REMAP_ENABLE_SOURCE_UNNAMED0 = 0, //!< MMIO remapping will not be applied to the MMIO address.
593 MMIO_REMAP_ENABLE_SOURCE_UNNAMED1 = 1, //!< MMIO remapping will be applied to the MMIO address prior to using for any other functionality of the command.
594 };
595
596 //! \brief MMIO_REMAP_ENABLE_DESTINATION
597 //! \details
598 //! <p>This bit provides a mechanism in HW to remap the " Destination
599 //! Register" MMIO address in the MI command to the engine instance on which
600 //! the command is getting executed, remapping in HW is done using engine
601 //! specific remap table. Render and Compute engine share a common remapping
602 //! table to facilitate remapping across engines, where as a dedicated remap
603 //! table for each of Video Decode and Video Enhancement engine class.</p>
604 //! <p>A MMIO remapping table per engine class is created with MMIO address
605 //! belonging to multiple instances of an engine within an engine class.
606 //! However Render and Compute engine share a common remapping table to
607 //! facilitate remapping across engines, where as a dedicated remap table
608 //! for each of Video Decode and Video Enhancement engine class.</p>
609 //! <p>This mode provides mechanism for SW to always use MMIO address
610 //! belonging to fixed instance (instance zero) with in an engine class
611 //! during command buffer creation agnostic to the instance on which it will
612 //! get scheduled. This willalso allow context interoperability across
613 //! instances with in an engine class and extends to across engines in case
614 //! of Render and Compute.</p>
615 enum MMIO_REMAP_ENABLE_DESTINATION
616 {
617 MMIO_REMAP_ENABLE_DESTINATION_UNNAMED0 = 0, //!< MMIO remapping will not be applied to the MMIO address.
618 MMIO_REMAP_ENABLE_DESTINATION_UNNAMED1 = 1, //!< MMIO remapping will be applied to the MMIO address prior to using for any other functionality of the command.
619 };
620
621 //! \brief ADD_CS_MMIO_START_OFFSET_SOURCE
622 //! \details
623 //! <p>This bit controls the functionality of the "Register Address Source"
624 //! field in the command.</p>
625 enum ADD_CS_MMIO_START_OFFSET_SOURCE
626 {
627 ADD_CS_MMIO_START_OFFSET_SOURCE_UNNAMED0 = 0, //!< "Register Address" field in the command is absolute and not an offset from the executing command streamer MMIO start offset.
628 ADD_CS_MMIO_START_OFFSET_SOURCE_UNNAMED1 = 1, //!< "Source Register Address" field in the command is treated as an offset from the executing Command Streamer’s MMIO start offset. Bits [22:2] of the "Source Register Address" are considered as dword offset to be added to the MMIO start offset of the corresponding command streamer.Example: MI_LOAD_REGISTER_REGISTER_REG, DEST_ADD_CS_MMIO_START_OFFSET: false, SRC_ADD_CS_MMIO_START_OFFSET:true, Source Register Address:0x1C_0130, Destination Register Address: 0x1C_0030The above command when executed on RenderCS will result in a MMIO read from 0x1C _2130 instead of read from 0x1C_0130 and write to MMIO offset 0x1C_0030. Note that RenderCS MMIO start offset is 0x2000.
629 };
630
631 //! \brief ADD_CS_MMIO_START_OFFSET_DESTINATION
632 //! \details
633 //! <p>This bit controls the functionality of the "Register Address
634 //! Destination" field in the command.</p>
635 enum ADD_CS_MMIO_START_OFFSET_DESTINATION
636 {
637 ADD_CS_MMIO_START_OFFSET_DESTINATION_UNNAMED0 = 0, //!< "Destination Register Address" field in the command is absolute and not an offset from the executing command streamer MMIO start offset.
638 ADD_CS_MMIO_START_OFFSET_DESTINATION_UNNAMED1 = 1, //!< "Destination Register Address" field in the command is treated as an offset from the executing Command Streamer’s MMIO start offset. Bits [22:2] of the "Destination Register Address" are considered as dword offset to be added to the MMIO start offset of the corresponding command streamer.Example: MI_LOAD_REGISTER_REGISTER_REG, DEST_ADD_CS_MMIO_START_OFFSET: true, SRC_ADD_CS_MMIO_START_OFFSET:true, Source Register Address:0x1C_0130, Destination Register Address: 0x1C_0030The above command when executed on RenderCS will result in a MMIO read from 0x1C_2130 (0x00_2000 + 0x1C_0130) and write to MMIO offset 0x1C_2030 (0x00_2000 + 0x1C_0030) instead of read from 0x1C_0130 and write to 0x1C_0030. Note that RenderCS MMIO start offset is 0x2000.
639 };
640
641 enum MI_COMMAND_OPCODE
642 {
643 MI_COMMAND_OPCODE_MILOADREGISTERREG = 42, //!< No additional details
644 };
645
646 enum COMMAND_TYPE
647 {
648 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
649 };
650
651 //! \name Initializations
652
653 //! \brief Explicit member initialization function
654 MI_LOAD_REGISTER_REG_CMD();
655
656 static const size_t dwSize = 3;
657 static const size_t byteSize = 12;
658 };
659
660 //!
661 //! \brief MI_STORE_REGISTER_MEM
662 //! \details
663 //! The MI_STORE_REGISTER_MEM command requests a register read from a
664 //! specified memory mapped register location in the device and store of
665 //! that DWord to memory. The register address is specified along with the
666 //! command to perform the read.
667 //!
668 //!
669 //! The command temporarily halts command execution.
670 //!
671 //! The memory address for the write is snooped on the host bus.
672 //!
673 //! This command should not be used from within a "non-privilege" batch
674 //! buffer to access global virtual space. doing so will be treated as
675 //! privilege access violation. Refer "User Mode Privilege Command" in
676 //! MI_BATCH_BUFFER_START command section to know HW behavior on
677 //! encountering privilege access violation. This command can be used within
678 //! ring buffers and/or "privilege" batch buffers to access global virtual
679 //! space.
680 //!
681 //! This command will cause undefined data to be written to memory if given
682 //! register addresses for the PGTBL_CTL_0 or FENCE registers.
683 //!
684 //!
685 //!
686 struct MI_STORE_REGISTER_MEM_CMD
687 {
688 union
689 {
690 //!< DWORD 0
691 struct
692 {
693 uint32_t DwordLength : __CODEGEN_BITFIELD(0, 7); //!< DWORD_LENGTH
694 uint32_t Reserved8 : __CODEGEN_BITFIELD(8, 16); //!< Reserved
695 uint32_t MmioRemapEnable : __CODEGEN_BITFIELD(17, 17); //!< MMIO_REMAP_ENABLE
696 uint32_t Reserved18 : __CODEGEN_BITFIELD(18, 18); //!< Reserved
697 uint32_t AddCsMmioStartOffset : __CODEGEN_BITFIELD(19, 19); //!< ADD_CS_MMIO_START_OFFSET
698 uint32_t Reserved20 : __CODEGEN_BITFIELD(20, 21); //!< Reserved
699 uint32_t UseGlobalGtt : __CODEGEN_BITFIELD(22, 22); //!< Use Global GTT
700 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28); //!< MI_COMMAND_OPCODE
701 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31); //!< COMMAND_TYPE
702 };
703 uint32_t Value;
704 } DW0;
705 union
706 {
707 //!< DWORD 1
708 struct
709 {
710 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
711 uint32_t RegisterAddress : __CODEGEN_BITFIELD( 2, 22) ; //!< Register Address
712 uint32_t Reserved55 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved
713 };
714 uint32_t Value;
715 } DW1;
716 union
717 {
718 //!< DWORD 2..3
719 struct
720 {
721 uint64_t Reserved64 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
722 uint64_t MemoryAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Memory Address
723 };
724 uint32_t Value[2];
725 } DW2_3;
726
727 //! \name Local enumerations
728
729 enum MEMORY_OBJECT_CONTROL_STATE_ENABLE
730 {
731 MEMORY_OBJECT_CONTROL_STATE_ENABLE_USEDEFAULT = 0, //!< MOCS value will be derived fromCS Write Format Overridefield inCache Control Register for Command Stream register.
732 MEMORY_OBJECT_CONTROL_STATE_ENABLE_USEINLINE = 1, //!< MOCS value will be derived from Memory Object Control State field in the header of this command.
733 };
734
735 //! \brief MMIO_REMAP_ENABLE
736 //! \details
737 //! <p>This bit provides a mechanism in HW to remap the MMIO address in the
738 //! MI command to the engine instance on which the command is getting
739 //! executed, remapping in HW is done using engine specific remap table.
740 //! Render and Compute engine share a common remapping table to facilitate
741 //! remapping across engines, where as a dedicated remap table for each of
742 //! Video Decode and Video Enhancement engine class.</p>
743 //! <p>A MMIO remapping table per engine class is created with MMIO address
744 //! belonging to multiple instances of an engine within an engine class.
745 //! However Render and Compute engine share a common remapping table to
746 //! facilitate remapping across engines, where as a dedicated remap table
747 //! for each of Video Decode and Video Enhancement engine class.</p>
748 //! <p>This mode provides mechanism for SW to always use MMIO address
749 //! belonging to fixed instance (instance zero) with in an engine class
750 //! during command buffer creation agnostic to the instance on which it will
751 //! get scheduled. This willalso allow context interoperability across
752 //! instances with in an engine class and extends to across engines in case
753 //! of Render and Compute.</p>
754 enum MMIO_REMAP_ENABLE
755 {
756 MMIO_REMAP_ENABLE_UNNAMED0 = 0, //!< MMIO remapping will not be applied to the MMIO address.
757 MMIO_REMAP_ENABLE_UNNAMED1 = 1, //!< MMIO remapping will be applied to the MMIO address prior to using for any other functionality of the command.
758 };
759
760 //! \brief ADD_CS_MMIO_START_OFFSET
761 //! \details
762 //! <p>This bit controls the functionality of the "Register Address" field
763 //! in the command.</p>
764 enum ADD_CS_MMIO_START_OFFSET
765 {
766 ADD_CS_MMIO_START_OFFSET_UNNAMED0 = 0, //!< "Register Address" field in the command is absolute and not an offset from the executing command streamer MMIO start offset.
767 ADD_CS_MMIO_START_OFFSET_UNNAMED1 = 1, //!< "Register Address" field in the command is treated as an offset from the executing Command Streamer’s MMIO start offset. Bits [22:2] of the "Register Address" are considered as dword offset to be added to the MMIO start offset of the corresponding command streamer.Example: MI_STORE_REGISTER_MEM, ADD_CS_MMIO_START_OFFSET: true, Memory Address:0xABCD, Register Address: 0x1C_0030The above command when executed on RenderCS will result in updating the memory address with the content of the MMIO offset 0x1C_2030 (0x00_2000 + 0x1C_0030) instead to 0x1C_0030. Note that RenderCS MMIO start offset is 0x2000.
768 };
769
770 enum MI_COMMAND_OPCODE
771 {
772 MI_COMMAND_OPCODE_MISTOREREGISTERMEM = 36, //!< No additional details
773 };
774
775 enum COMMAND_TYPE
776 {
777 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
778 };
779
780 //! \name Initializations
781
782 //! \brief Explicit member initialization function
783 MI_STORE_REGISTER_MEM_CMD();
784
785 static const size_t dwSize = 4;
786 static const size_t byteSize = 16;
787 };
788
789 //!
790 //! \brief MI_BATCH_BUFFER_START
791 //! \details
792 //! The MI_BATCH_BUFFER_START command is used to initiate the execution of
793 //! commands stored in a batch buffer. For restrictions on the location of
794 //! batch buffers, see Batch Buffers in the Device Programming Interface
795 //! chapter of MI Functions. The batch buffer can be specified as privileged
796 //! or non-privileged, determining the operations considered valid when
797 //! initiated from within the buffer and any attached (chained) batch
798 //! buffers. See Batch Buffer Protection in the Device Programming Interface
799 //! chapter of MI Functions.
800 //!
801 //! A batch buffer initiated with this command must end either with a
802 //! MI_BATCH_BUFFER_END command or by chaining to another batch buffer with
803 //! an MI_BATCH_BUFFER_START command.
804 //! It is essential that the address location beyond the current page be
805 //! populated inside the GTT. HW performs over-fetch of the command
806 //! addresses and any over-fetch requires a valid TLB entry. A single extra
807 //! page beyond the batch buffer is sufficient.
808 //!
809 //!
810 //!
811 struct MI_BATCH_BUFFER_START_CMD
812 {
813 union
814 {
815 //!< DWORD 0
816 struct
817 {
818 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH,
819 uint32_t AddressSpaceIndicator : __CODEGEN_BITFIELD( 8, 8) ; //!< ADDRESS_SPACE_INDICATOR,
820 uint32_t Reserved9 : __CODEGEN_BITFIELD( 9, 31) ; //!< Reserved,
821 } Obj0;
822 struct
823 {
824 uint32_t Reserved0 : __CODEGEN_BITFIELD( 0, 14) ; //!< Reserved,
825 uint32_t PredicationEnable : __CODEGEN_BITFIELD(15, 15) ; //!< Predication Enable,
826 uint32_t Reserved16 : __CODEGEN_BITFIELD(16, 18) ; //!< Reserved,
827 uint32_t EnableCommandCache : __CODEGEN_BITFIELD(19, 19) ; //!< ENABLE_COMMAND_CACHE,
828 uint32_t PoshEnable : __CODEGEN_BITFIELD(20, 20) ; //!< POSH_ENABLE,
829 uint32_t PoshStart : __CODEGEN_BITFIELD(21, 21) ; //!< POSH_START,
830 uint32_t Reserved22 : __CODEGEN_BITFIELD(22, 22) ; //!< Reserved,
831 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE,
832 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE,
833 } Obj1;
834 struct
835 {
836 uint32_t Reserved0 : __CODEGEN_BITFIELD( 0, 21) ; //!< Reserved,
837 uint32_t NestedLevelBatchBuffer : __CODEGEN_BITFIELD(22, 22) ; //!< NESTED_LEVEL_BATCH_BUFFER, MI_MODE:NestedBatchBufferEnable=='1'
838 uint32_t Reserved23 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved, MI_MODE:NestedBatchBufferEnable=='1'
839 } Obj2;
840 struct
841 {
842 uint32_t Reserved0 : __CODEGEN_BITFIELD( 0, 21) ; //!< Reserved, MI_MODE:NestedBatchBufferEnable=='1'
843 uint32_t SecondLevelBatchBuffer : __CODEGEN_BITFIELD(22, 22) ; //!< SECOND_LEVEL_BATCH_BUFFER, MI_MODE:NestedBatchBufferEnable=='0'
844 uint32_t Reserved23 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved, MI_MODE:NestedBatchBufferEnable=='0'
845 } Obj3;
846 uint32_t Value;
847 } DW0;
848 union
849 {
850 //!< DWORD 1..2
851 struct
852 {
853 uint64_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
854 uint64_t BatchBufferStartAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Batch Buffer Start Address
855 };
856 uint32_t Value[2];
857 } DW1_2;
858
859 //! \name Local enumerations
860
861 //! \brief ADDRESS_SPACE_INDICATOR
862 //! \details
863 //! <p>Batch buffers accessed via PPGTT are considered as non-privileged.
864 //! Certain operations (e.g., MI_STORE_DATA_IMM commands to GGTT memory) are
865 //! prohibited within non-privileged buffers. More details mentioned in User
866 //! Mode Privileged command section. When MI_BATCH_BUFFER_START command is
867 //! executed from within a batch buffer (i.e., is a "chained" or "second
868 //! level" batch buffer command), the current active batch buffer's "Address
869 //! Space Indicator" and this field determine the "Address Space Indicator"
870 //! of the next buffer in the chain.</p>
871 //! <ul>
872 //! <li>Chained or Second level batch buffer can be in GGTT or PPGTT if the
873 //! parent batch buffer is in GGTT.</li>
874 //! <li>Chained or Second level batch buffer can only be in PPGTT if the
875 //! parent batch buffer is in PPGTT. This is enforced by Hardware.</li>
876 //! </ul>
877 enum ADDRESS_SPACE_INDICATOR
878 {
879 ADDRESS_SPACE_INDICATOR_GGTT = 0, //!< This batch buffer is located in GGTT memory and is privileged.
880 ADDRESS_SPACE_INDICATOR_PPGTT = 1, //!< This batch buffer is located in PPGTT memory and is Non-Privileged.
881 };
882
883 //! \brief ENABLE_COMMAND_CACHE
884 //! \details
885 //! <p>Command Buffer DMA engine on processing the MI_BATCH_BUFFER_START
886 //! command with "Enable Command Cache" set will make the corresponding
887 //! command buffer read requests cacheable in L3, it also applies the
888 //! command caching to all subsequent chained and next level batch buffers.
889 //! Command buffer DMA engine uses the "Command Buffer Cache Size"
890 //! programmed in the CMD_BUF_CCTL register to limit the read requests of a
891 //! cacheable batch buffer to be cached in L3. DMA engine does this by
892 //! tracking the amount of read requests made cacheable and stops caching
893 //! when the read requested data size equals to the size of the command
894 //! cache allocated. This avoids thrashing of cache for Batch Buffers larger
895 //! in size compared to the command buffer cache allocated in L3. DMA engine
896 //! resets the command caching tracker on events listed below.</p>
897 //! <ul>
898 //! <li>On an End Of Tile in PTRBR/POSH mode of operation.</li>
899 //! <li>On a context save of a context.</li>
900 //! <li>On command cache invalidation through PIPE_CONTROL.</li>
901 //! </ul>
902 //!
903 //! <p>Command buffer caching must not be enabled for batch buffers in GGTT
904 //! address space.</p>
905 enum ENABLE_COMMAND_CACHE
906 {
907 ENABLE_COMMAND_CACHE_UNNAMED0 = 0, //!< Command Cache disable
908 ENABLE_COMMAND_CACHE_UNNAMED1 = 1, //!< Command Cache enabled
909 };
910
911 //! \brief POSH_ENABLE
912 //! \details
913 //! <p> "POSH Enable" field in the MI_BATCH_BUFFER_START command is a hint
914 //! to POCS to traverse (parse, don’t execute) the batch buffer to look for
915 //! "POSH Start" batch buffers. "POSH Enable" field is only inherited to the
916 //! chained batch buffer and doesn’t get inherit to the next level batch
917 //! buffers unlike "POSH Start" field. "POSH Enable" field must be
918 //! explicitly set in the MI_BATCH_BUFFER_START command which calls the next
919 //! level batch buffers in order for the POCS to parse them to look for
920 //! "POSH Start" batch buffers. "POSH Start" field  takes precedence over
921 //! the "POSH Enable" field in POCS.</p>
922 //! <p>Example:</p>
923 //! <ul>
924 //! <li>Once "POSH Enable" is encountered in a first level batch buffer,
925 //! POCS will traverse the whole of the first level batch buffers (including
926 //! chained first level) to check for "POSH Start" field in
927 //! MI_BATCH_BUFFER_START command. POCS by default will not traverse the
928 //! second level batch buffers. SW must explicitly set the "POSH Enable"
929 //! field for the second level batch buffer called from first level batch
930 //! buffer if the second level batch buffer have to be traversed by
931 //! POCS.</li>
932 //! <li>Similarly, Once "POSH Enable" is encountered in a second level
933 //! batch buffer, POCS will traverse the whole of the second level batch
934 //! buffers (including chained second level) to check for "POSH Start" field
935 //! in MI_BATCH_BUFFER_START command. POCS by default will not traverse the
936 //! third level batch buffers. SW must explicitly set the "POSH Enable"
937 //! field for the third level batch buffer called from second level batch
938 //! buffer if the third level batch buffer have to be traversed by
939 //! POCS.</li>
940 //! <li>Similarly, Once "POSH Enable" is encountered in a third level
941 //! batch buffer, POCS will traverse the whole of the third level batch
942 //! buffers (including chained second level) to check for "POSH Start" field
943 //! in MI_BATCH_BUFFER_START command.</li>
944 //! </ul>
945 //!
946 //! <p>RCS ignores "POSH Enable" field and has no implications due to the
947 //! "POSH Enable" field set in the MI_BATCH_BUFFER_START command.</p>
948 enum POSH_ENABLE
949 {
950 POSH_ENABLE_UNNAMED0 = 0, //!< Batch buffer is  not "POSH Enable".
951 POSH_ENABLE_UNNAMED1 = 1, //!< Batch buffer is "POSH Enable"/
952 };
953
954 //! \brief POSH_START
955 //! \details
956 //! <p>Batch buffers dedicated to be executed by POSH pipe are indicated by
957 //! setting the field "POSH Start" in the MI_BATCH_BUFFER_START command
958 //! header. Once "POSH Start" is set in a batch buffer all the following
959 //! chained batch buffers and next level batch buffers will implicitly
960 //! inherit the "POSH Start" field value. Once "POSH Start" is set in a
961 //! batch buffer all the following command sequences are to be
962 //! <b>executed</b> by POCS until the corresponding batch buffer sequencing
963 //! is terminated through
964 //! MI_BATCH_BUFFER_END/MI_CONDITIONAL_BATCH_BUFFER_END command.</p>
965 //! <p>Example:</p>
966 //! <ul>
967 //! <li>Once "POSH Start" is encountered in a first level batch buffer
968 //! by POCS, it will get reset only when the first level batch buffer
969 //! execution is terminated through batch buffer end and the command
970 //! execution sequence goes back to the ring buffer,</li>
971 //! <li>Similarly, once "POSH Start" is encountered in a second level
972 //! batch buffer by POCS, it will get reset only when the second level batch
973 //! buffer execution is terminated through batch buffer end and the command
974 //! execution sequence goes back to the first level buffer,</li>
975 //! <li>Similarly, once when "POSH Start" is encountered in a third
976 //! level batch buffer by POCS, it will get reset only when the third level
977 //! batch buffer execution is terminated through batch buffer end and the
978 //! command execution sequence goes back to the second level batch
979 //! buffer.</li>
980 //! </ul>
981 //!
982 //! <p>Command sequences executed from the "POSH Start" batch buffer may
983 //! lead to chained batch buffers or next level batch buffers.  Batch
984 //! buffers executed by POCS may have MI Commands, 3DSATE commands and
985 //! 3DPRIMTIVE commands for POSH pipe. RCS on parsing MI_BATCH_BUFFER_START
986 //! command with "POSH Start" enabled NOOPS the command and moves on the
987 //! following command.</p>
988 enum POSH_START
989 {
990 POSH_START_UNNAMED0 = 0, //!< Batch buffer is not "POSH Start" enabled.
991 POSH_START_UNNAMED1 = 1, //!< Batch buffer is "POSH Start" enabled.
992 };
993
994 //! \brief NESTED_LEVEL_BATCH_BUFFER
995 //! \details
996 //! <p>If this bit is set, the command streamer will move to the next level
997 //! of batch buffer. Once it executes a MI_BATCH_BUFFER_END in the next
998 //! level, it will return to the batch buffer executing this command and
999 //! execute the next command.</p>
1000 //! <p>If clear then itwill remain in the same batch buffer level and on
1001 //! executingMI_BATCH_BUFFER_END, it will return to the previous level.
1002 //! Otherwise known as batch buffer chaining.</p>
1003 //! <p>Hardware supports threelevels of nesting, namely First Level, Second
1004 //! Level and Third Level.</p>
1005 //! <p>This bit must not be set in any of the MI_BATCH_BUFFER_START commands
1006 //! programmed as part of the 3rd level batch buffer's command sequence.</p>
1007 //! <p></p>
1008 //! <p></p>
1009 enum NESTED_LEVEL_BATCH_BUFFER
1010 {
1011 NESTED_LEVEL_BATCH_BUFFER_CHAIN = 0, //!< Stay in the same batch buffer level.
1012 NESTED_LEVEL_BATCH_BUFFER_NESTED = 1, //!< Move to the next level of batch buffer.
1013 };
1014
1015 //! \brief SECOND_LEVEL_BATCH_BUFFER
1016 //! \details
1017 //! <p>The command streamer contains three storage elements; one for the
1018 //! ring head address, one for the batch head address, and one for the
1019 //! secondlevel batch head address. When performing batch buffer chaining,
1020 //! hardware simply updates the head pointer of the firstlevel batch address
1021 //! storage. There is no stack in hardware. When this bit is set, hardware
1022 //! uses the 2nd level batch head address storage element.Chaining of second
1023 //! level batch buffers is supported. A chained second level batch buffer is
1024 //! inferred in hardware when aMI_BATCH_BUFFER_START command with "Second
1025 //! Level Batch Buffer" bit field set is executed from asecond level batch
1026 //! buffer, hardware simply updates the head pointer of the second level
1027 //! batch addres storage. Upon MI_BATCH_BUFFER_END, it will automatically
1028 //! return to the first level batch buffer address. This allows hardware to
1029 //! mimic a simple 3-level stack.</p>
1030 enum SECOND_LEVEL_BATCH_BUFFER
1031 {
1032 SECOND_LEVEL_BATCH_BUFFER_FIRSTLEVELBATCH = 0, //!< Place the batch buffer address in the 1st (traditional) level batch address storage element.
1033 SECOND_LEVEL_BATCH_BUFFER_SECONDLEVELBATCH = 1, //!< Place the batch buffer address in the second-level batch address storage element.
1034 };
1035
1036 enum MI_COMMAND_OPCODE
1037 {
1038 MI_COMMAND_OPCODE_MIBATCHBUFFERSTART = 49, //!< No additional details
1039 };
1040
1041 enum COMMAND_TYPE
1042 {
1043 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1044 };
1045
1046 //! \name Initializations
1047
1048 //! \brief Explicit member initialization function
1049 MI_BATCH_BUFFER_START_CMD();
1050
1051 static const size_t dwSize = 3;
1052 static const size_t byteSize = 12;
1053 };
1054
1055 //!
1056 //! \brief MI_SET_PREDICATE
1057 //! \details
1058 //! This command provides a mechanism to NOOP a section of commands
1059 //! programmed in the command buffer. This command on execution evaluates
1060 //! the condition based on the "Predicate Enable" field and sets the
1061 //! predicate status accordingly in HW. On predicate status set, HW NOOPS
1062 //! the commands subsequently parsed until the predicate status is
1063 //! re-evaluated and reset on executing MI_SET_PREDICATE. MI_SET_PREDICATE
1064 //! is the only command executed by HW when parsed during predicate status
1065 //! set. Resource Streamer doesn't take any action on parsing this command.
1066 //!
1067 //!
1068 //! MI_SET_PREDICATE predication scope must be confined within a Batch
1069 //! Buffer to set of commands.
1070 //!
1071 //! MI_SET_PREDICATE with Predicate Enable Must always have a corresponding
1072 //! MI_SET_PREDICATE with Predicate Disable within the same Batch Buffer.
1073 //!
1074 //!
1075 //!
1076 //! Only the following command(s) can be programmed between the
1077 //! MI_SET_PREDICATE command enabled for predication: 3DSTATE_URB_VS
1078 //! 3DSTATE_URB_HS 3DSTATE_URB_DS 3DSTATE_URB_GS
1079 //! 3DSTATE_PUSH_CONSTANT_ALLOC_VS 3DSTATE_PUSH_CONSTANT_ALLOC_HS
1080 //! 3DSTATE_PUSH_CONSTANT_ALLOC_DS 3DSTATE_PUSH_CONSTANT_ALLOC_GS
1081 //! 3DSTATE_PUSH_CONSTANT_ALLOC_PS MI_LOAD_REGISTER_IMM MEDIA_VFE_STATE
1082 //! MEDIA_OBJECT MEDIA_OBJJECT_WALKER MEDIA_INTERFACE_DESCRIPTOR_LOAD
1083 //! 3DSTATE_WM_HZ_OP MI_STORE_DATA_IMM
1084 //!
1085 struct MI_SET_PREDICATE_CMD
1086 {
1087 union
1088 {
1089 //!< DWORD 0
1090 struct
1091 {
1092 uint32_t PredicateEnable : __CODEGEN_BITFIELD( 0, 3) ; //!< PREDICATE_ENABLE
1093 uint32_t Reserved4 : __CODEGEN_BITFIELD( 4, 22) ; //!< Reserved
1094 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1095 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1096 };
1097 uint32_t Value;
1098 } DW0;
1099
1100 //! \name Local enumerations
1101
1102 enum PREDICATE_ENABLE
1103 {
1104 PREDICATE_ENABLE_PREDICATEDISABLE = 0, //!< Predication is Disabled and CS will process commands as usual.
1105 PREDICATE_ENABLE_PREDICATEONCLEAR = 1, //!< Following Commands will be NOOPED by CS only if the MI_PREDICATE_RESULT_2 is clear.
1106 PREDICATE_ENABLE_PREDICATEONSET = 2, //!< Following Commands will be NOOPED by CS only if the MI_PREDICATE_RESULT_2 is set.
1107 PREDICATE_ENABLE_NOOPALWAYS = 15, //!< Following Commands will be NOOPED by CS unconditionally.
1108 };
1109
1110 enum MI_COMMAND_OPCODE
1111 {
1112 MI_COMMAND_OPCODE_MISETPREDICATE = 1, //!< No additional details
1113 };
1114
1115 enum COMMAND_TYPE
1116 {
1117 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1118 };
1119
1120 //! \name Initializations
1121
1122 //! \brief Explicit member initialization function
1123 MI_SET_PREDICATE_CMD();
1124
1125 static const size_t dwSize = 1;
1126 static const size_t byteSize = 4;
1127 };
1128
1129 //!
1130 //! \brief MI_COPY_MEM_MEM
1131 //! \details
1132 //! The MI_COPY_MEM_MEM command reads a DWord from memory and stores the
1133 //! value of that DWord to back to memory. The source and destination
1134 //! addresses are specified in the command. The command temporarily halts
1135 //! command execution.
1136 //!
1137 //! This command should not be used within a "non_privilege"batch buffer to
1138 //! access global virtual space, doing so will be treated as privilege
1139 //! access violation. Refer "User Mode Privilege Command" in
1140 //! MI_BATCH_BUFFER_START command section to know HW behavior on
1141 //! encountering privilege access violation. This command can be used within
1142 //! ring buffers and/or privilege batch buffers to access global virtual
1143 //! space.
1144 //!
1145 struct MI_COPY_MEM_MEM_CMD
1146 {
1147 union
1148 {
1149 //!< DWORD 0
1150 struct
1151 {
1152 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1153 uint32_t MocsIndexForRead : __CODEGEN_BITFIELD( 8, 13) ; //!< MOCS Index for Read
1154 uint32_t MemoryObjectControlStateEnable : __CODEGEN_BITFIELD(14, 14) ; //!< MEMORY_OBJECT_CONTROL_STATE_ENABLE
1155 uint32_t MocsIndexForWrite : __CODEGEN_BITFIELD(15, 20) ; //!< MOCS Index for Write
1156 uint32_t UseGlobalGttDestination : __CODEGEN_BITFIELD(21, 21) ; //!< USE_GLOBAL_GTT_DESTINATION
1157 uint32_t UseGlobalGttSource : __CODEGEN_BITFIELD(22, 22) ; //!< USE_GLOBAL_GTT_SOURCE
1158 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1159 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1160 };
1161 uint32_t Value;
1162 } DW0;
1163 union
1164 {
1165 //!< DWORD 1..2
1166 struct
1167 {
1168 uint64_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
1169 uint64_t DestinationMemoryAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Destination Memory Address
1170 };
1171 uint32_t Value[2];
1172 } DW1_2;
1173 union
1174 {
1175 //!< DWORD 3..4
1176 struct
1177 {
1178 uint64_t Reserved96 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
1179 uint64_t SourceMemoryAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Source Memory Address
1180 };
1181 uint32_t Value[2];
1182 } DW3_4;
1183
1184 //! \name Local enumerations
1185
1186 enum MEMORY_OBJECT_CONTROL_STATE_ENABLE
1187 {
1188 MEMORY_OBJECT_CONTROL_STATE_ENABLE_USEDEFAULT = 0, //!< MOCS value will be derived fromCS Write Format Overridefield and CS Read Format Overridefor both write and read respectively in Cache Control Register for Command Stream register.
1189 MEMORY_OBJECT_CONTROL_STATE_ENABLE_USEINLINE = 1, //!< MOCS value will be derived from MOCS Index for ReadandMOCS Index for Write valuefor the read and write respectivelyin the header of this command.
1190 };
1191
1192 //! \brief USE_GLOBAL_GTT_DESTINATION
1193 //! \details
1194 //! This bit will be ignored and treated as if clear when executing from a
1195 //! non-privileged batch buffer. It is allowed for this bit to be clear
1196 //! when executing this command from a privileged (secure) batch buffer.
1197 //! This bit <i>must</i> be '1' if the <b>Per Process GTT Enable</b> bit is
1198 //! clear. This bit will determine write to memory uses Global or Per
1199 //! Process GTT.
1200 enum USE_GLOBAL_GTT_DESTINATION
1201 {
1202 USE_GLOBAL_GTT_DESTINATION_PERPROCESSGRAPHICSADDRESS = 0, //!< No additional details
1203 USE_GLOBAL_GTT_DESTINATION_GLOBALGRAPHICSADDRESS = 1, //!< This command will use the global GTT to translate the Address and this command must be executing from a privileged (secure) batch buffer.
1204 };
1205
1206 //! \brief USE_GLOBAL_GTT_SOURCE
1207 //! \details
1208 //! It is allowed for this bit to be set when executing this command from a
1209 //! privileged (secure) batch buffer or ring buffer. This bit must be clear
1210 //! when programmed from within a non-privileged batch buffer. This bit must
1211 //! be 1 if the Per Process GTT Enable bit is clear.
1212 enum USE_GLOBAL_GTT_SOURCE
1213 {
1214 USE_GLOBAL_GTT_SOURCE_PERPROCESSGRAPHICSADDRESS = 0, //!< No additional details
1215 USE_GLOBAL_GTT_SOURCE_GLOBALGRAPHICSADDRESS = 1, //!< It is allowed for this bit to be set when executing this command from a privileged (secure) batch buffer or ring buffer. This bit must be clear when programmed from within a non-privileged batch buffer. This bit must be 1 if the Per Process GTT Enable bit is clear.
1216 };
1217
1218 enum MI_COMMAND_OPCODE
1219 {
1220 MI_COMMAND_OPCODE_MICOPYMEMTOMEM = 46, //!< No additional details
1221 };
1222
1223 enum COMMAND_TYPE
1224 {
1225 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1226 };
1227
1228 //! \name Initializations
1229
1230 //! \brief Explicit member initialization function
1231 MI_COPY_MEM_MEM_CMD();
1232
1233 static const size_t dwSize = 5;
1234 static const size_t byteSize = 20;
1235 };
1236
1237 //!
1238 //! \brief MI_STORE_DATA_IMM
1239 //! \details
1240 //! The MI_STORE_DATA_IMM command requests a write of the QWord constant
1241 //! supplied in the packet to the specified Memory Address. As the write
1242 //! targets a System Memory Address, the write operation is coherent with
1243 //! the CPU cache (i.e., the processor cache is snooped).
1244 //!
1245 //! This command supports writing to multiple consecutive dwords or qwords
1246 //! memory locations from the starting address.
1247 //!
1248 //! This command should not be used within a "non-privilege" batch buffer
1249 //! to access global virtual space, doing so will be treated as privilege
1250 //! access violation. Refer "User Mode Privilege Command" in
1251 //! MI_BATCH_BUFFER_START command section to know HW behavior on
1252 //! encountering privilege access violation. This command can be used within
1253 //! ring buffers and/or privilege batch buffers to access global virtual
1254 //! space.
1255 //! This command can be used for general software synchronization through
1256 //! variables in cacheable memory (i.e., where software does not need to
1257 //! poll un-cached memory or device registers).
1258 //! This command simply initiates the write operation with command
1259 //! execution proceeding normally. Although the write operation is
1260 //! guaranteed to complete eventually, there is no mechanism to synchronize
1261 //! command execution with the completion (or even initiation) of these
1262 //! operations.
1263 //!
1264 //!
1265 //!
1266 struct MI_STORE_DATA_IMM_CMD
1267 {
1268 union
1269 {
1270 //!< DWORD 0
1271 struct
1272 {
1273 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 9) ; //!< DWORD_LENGTH
1274 uint32_t Reserved10 : __CODEGEN_BITFIELD(10, 12) ; //!< Reserved
1275 uint32_t MemoryObjectControlState : __CODEGEN_BITFIELD(13, 19) ; //!< Memory Object Control State
1276 uint32_t MemoryObjectControlStateEnable : __CODEGEN_BITFIELD(20, 20) ; //!< MEMORY_OBJECT_CONTROL_STATE_ENABLE
1277 uint32_t StoreQword : __CODEGEN_BITFIELD(21, 21) ; //!< Store Qword
1278 uint32_t UseGlobalGtt : __CODEGEN_BITFIELD(22, 22) ; //!< Use Global GTT
1279 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1280 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1281 };
1282 uint32_t Value;
1283 } DW0;
1284 union
1285 {
1286 //!< DWORD 1..2
1287 struct
1288 {
1289 uint64_t CoreModeEnable : __CODEGEN_BITFIELD( 0, 0) ; //!< Core Mode Enable
1290 uint64_t Reserved33 : __CODEGEN_BITFIELD( 1, 1) ; //!< Reserved
1291 uint64_t Address : __CODEGEN_BITFIELD( 2, 63) ; //!< Address
1292 };
1293 uint32_t Value[2];
1294 } DW1_2;
1295 union
1296 {
1297 //!< DWORD 3
1298 struct
1299 {
1300 uint32_t DataDword0 ; //!< Data DWord 0
1301 };
1302 uint32_t Value;
1303 } DW3;
1304 union
1305 {
1306 //!< DWORD 4
1307 struct
1308 {
1309 uint32_t DataDword1 ; //!< Data DWord 1
1310 };
1311 uint32_t Value;
1312 } DW4;
1313
1314 //! \name Local enumerations
1315
1316 enum MEMORY_OBJECT_CONTROL_STATE_ENABLE
1317 {
1318 MEMORY_OBJECT_CONTROL_STATE_ENABLE_USEDEFAULT = 0, //!< MOCS value will be derived fromCS Write Format Overridefield inCache Control Register for Command Stream register.
1319 MEMORY_OBJECT_CONTROL_STATE_ENABLE_USEINLINE = 1, //!< MOCS value will be derived from Memory Object Control State field in the header of this command.
1320 };
1321
1322 enum MI_COMMAND_OPCODE
1323 {
1324 MI_COMMAND_OPCODE_MISTOREDATAIMM = 32, //!< No additional details
1325 };
1326
1327 enum COMMAND_TYPE
1328 {
1329 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1330 };
1331
1332 //! \name Initializations
1333
1334 //! \brief Explicit member initialization function
1335 MI_STORE_DATA_IMM_CMD();
1336
1337 static const size_t dwSize = 5;
1338 static const size_t byteSize = 20;
1339 };
1340
1341 //!
1342 //! \brief MI_SEMAPHORE_SIGNAL
1343 //! \details
1344 //! An engine on executing this command generates a signal (interrupt) to
1345 //! the GUC (scheduler or FW) by reporting the "Producer Token Number"
1346 //! programmed in SEMAPHORE_TOKEN register. Each engine implements its own
1347 //! SEMAPHORE_TOKEN register. SEMAPHORE_TOKEN register is privileged and
1348 //! context save/restored. Scheduler can take appropriate action on decoding
1349 //! the reported "Producer Token Number". Typically MI_ATOMIC (non-posted)
1350 //! command will be used to update the memory semaphore before signaling the
1351 //! consumer context.
1352 //! Each engine implements SEMAPHORE_SIGNAL_PORT register for receiving
1353 //! semaphore signal from the scheduler (SW or FW). A write to the
1354 //! SEMAPHORE_SIGNAL_PORT with data as 0xFFFF_FFFF is decoded as semaphore
1355 //! signal received by the corresponding engine. An engine waiting on
1356 //! un-successful MI_SEMAPHORE_WAIT (signal mode) command will reacquire the
1357 //! semaphore data from memory and re-evaluate the semaphore comparison on
1358 //! receiving the semaphore signal. SEMAPHORE_SIGNAL_PORT register is
1359 //! privileged. Writing to the SEMAPHORE_SIGNAL_PORT of an idle engine (no
1360 //! context) does not trigger any action in HW and is of no use.
1361 //! SEMAPHORE_TOKEN, MI_SEMAPHORE_SIGNAL, SEMAPHORE_SIGNAL_PORT and
1362 //! MI_SEMAPHORE_WAIT together can be used to create semaphores between
1363 //! producer context and consumer context. MI_SEMPAHORE_SIGNAL command from
1364 //! a producer context can be used to signal a consumer context waiting on
1365 //! MI_SEMAPHORE_WAIT (signal mode) command through scheduler (SW or FW).
1366 //!
1367 //! Typically MI_ATOMIC (non-posted) command will be used to update the
1368 //! memory semaphore by the producer context before signaling the consumer
1369 //! context.
1370 //!
1371 //! Scheduler on receiving the signal will process the "Producer Token
1372 //! Number" and if required will signal the consumer context running on an
1373 //! engine by writing 0xFFFF_FFFF to the corresponding engines
1374 //! SEMAPHORE_SIGNAL_PORT.
1375 //!
1376 //! A consumer context will wait on MI_SEMAPHORE_WAIT (signal mode) command
1377 //! until the semaphore comparison is successful. An engine waiting on
1378 //! un-successful MI_SEMAPHORE_WAIT (signal mode) command will reacquire the
1379 //! semaphore data from memory and re-evaluate the semaphore comparison on
1380 //! receiving the semaphore signal.MI_SEMAPHORE_WAIT command has "Wait Token
1381 //! Number" as inline data programmed by the SW. Context switched out an
1382 //! un-successful MI_SEMAPHORE_WAIT command will report "Wait Token Number"
1383 //! as "Wait Detail" field in the CSB structure.
1384 //!
1385 //!
1386 //!
1387 //!
1388 //!
1389 //!
1390 //!
1391 //! : Post-Sync operation bit must not be set when Target Engine Select is
1392 //! set to RCS.
1393 //!
1394 struct MI_SEMAPHORE_SIGNAL_CMD
1395 {
1396 union
1397 {
1398 //!< DWORD 0
1399 struct
1400 {
1401 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1402 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 20) ; //!< Reserved
1403 uint32_t PostSyncOperation : __CODEGEN_BITFIELD(21, 21) ; //!< POST_SYNC_OPERATION
1404 uint32_t Reserved22 : __CODEGEN_BITFIELD(22, 22) ; //!< Reserved
1405 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1406 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1407 };
1408 uint32_t Value;
1409 } DW0;
1410 union
1411 {
1412 //!< DWORD 1
1413 struct
1414 {
1415 uint32_t Reserved32 ; //!< Reserved
1416 };
1417 uint32_t Value;
1418 } DW1;
1419
1420 //! \name Local enumerations
1421
1422 //! \brief POST_SYNC_OPERATION
1423 //! \details
1424 //! <p>Any desired pipeline flush operation can be achieved by programming
1425 //! PIPE_CONTROL command prior to this command.</p>
1426 //!
1427 //! <p>When this bit is set Command Streamer sends a flush down the pipe and
1428 //! the atomic operation is saved as post sync operation. Command streamer
1429 //! goes on executing the following commands. Atomic operation saved as post
1430 //! sync operation is executed at some point later on completion of
1431 //! corresponding flush issued.</p>
1432 //!
1433 //! <p>When this bit is set atomic semaphore signal operation will be out of
1434 //! order with rest of the MI commands programmed in the ring buffer or
1435 //! batch buffer, it will be in order with respect to the post sync
1436 //! operations resulting due to PIPE_CONTROL command.</p>
1437 enum POST_SYNC_OPERATION
1438 {
1439 POST_SYNC_OPERATION_NOPOSTSYNCOPERATION = 0, //!< Command is executed as usual.
1440 POST_SYNC_OPERATION_POSTSYNCOPERATION = 1, //!< MI_SEMAPHORE_SIGNAL command is executed as a pipelined PIPE_CONTROL flush command with Semaphore Signal as post sync operation. Flush completion only guarantees the workload prior to this command is pushed till Windower unit and completion of any outstanding flushes issued prior to this command.
1441 };
1442
1443 enum MI_COMMAND_OPCODE
1444 {
1445 MI_COMMAND_OPCODE_MISEMAPHORESIGNAL = 27, //!< No additional details
1446 };
1447
1448 enum COMMAND_TYPE
1449 {
1450 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1451 };
1452
1453 //! \name Initializations
1454
1455 //! \brief Explicit member initialization function
1456 MI_SEMAPHORE_SIGNAL_CMD();
1457
1458 static const size_t dwSize = 2;
1459 static const size_t byteSize = 8;
1460 };
1461
1462 //!
1463 //! \brief MI_SEMAPHORE_WAIT
1464 //! \details
1465 //!
1466 //! This command supports memory based Semaphore WAIT. Memory based
1467 //! semaphores will be used for synchronization between the Producer and the
1468 //! Consumer contexts. Producer and Consumer Contexts could be running on
1469 //! different engines or on the same engine inside GT. Producer Context
1470 //! implements a Signal and Consumer context implements a Wait.
1471 //! Command Streamer on parsing this command fetches data from the Semaphore
1472 //! Address mentioned in this command and compares it with the inline
1473 //! Semaphore Data Dword.
1474 //!
1475 //! If comparison passes, the command streamer moves to the next command.
1476 //!
1477 //! If comparison fails Command streamer switches out the context. Context
1478 //! switch can be inhibited by setting "Inhibit Synchronous Context Switch"
1479 //! in CTXT_SR_CTL register.
1480 //!
1481 //! If "Inhibit Synchronous context Switch" is enabled and comparison fails,
1482 //! Command Streamer evaluates the Compare Operation based on the Wait Mode
1483 //! until the compare operation is true or Wait is canceled by SW.
1484 //!
1485 //! CS generates semaphore wait interrupt to the scheduler when
1486 //! MI_SEMAPHORE_WAIT command is un-successful and when "Inhibit Synchronous
1487 //! Context Switch" is set. Scheduler can use this interrupt to preempt the
1488 //! context waiting on semaphore wait.
1489 //!
1490 //!
1491 //!
1492 //!
1493 //! MI_SEMAPHORE_WAIT command also supports register based Semaphore WAIT.
1494 //! Command Streamer on parsing this command fetches data from the MMIO
1495 //! offset mentioned in this command and compares it with the inline
1496 //! Semaphore Data Dword. This functionality is supported when "Register
1497 //! Poll" bit is set in the command header. In register poll mode of
1498 //! operation "Wait Mode" supported is always Poll mode and no Signal mode
1499 //! is supported.
1500 //!
1501 //! If comparison passes, the command streamer moves to the next command.
1502 //!
1503 //! Unlike in Memory based semaphore, there is no context switch on an
1504 //! un-successful semaphore wait in "Register Poll" mode, however preemption
1505 //! is supported on unsuccessful semaphore wait in "Register Poll" mode.
1506 //! Semaphore wait interrupt is not generated by default on wait
1507 //! un-successful in "Register Poll" mode. However interrupt generation can
1508 //! be enabled by setting debug mode bit "Semaphore Interrupt Enable in
1509 //! Register Poll Mode" in specified register
1510 //!
1511 //! Also unlike in Memory based semaphore, generation of an interrupt for a
1512 //! semaphore wait in "Register Poll" mode is not dependent on the value of
1513 //! bit "Inhibit Synchronous Context Switch" in register "CTXT_SR_CTL"
1514 //!
1515 //! Register Poll mode of Semaphore Wait command operation is non-privileged
1516 //! and will be supported from PPGTT batch buffers.
1517 //!
1518 //! HW will trigger Render DOP CG on semaphore wait unsuccessful by default
1519 //! and can be disabled if not desired by programming "Register
1520 //! Poll Mode Semaphore Wait Event IDLE message Disable" bit in "INSTPM"
1521 //! register. Note that Render DOP CG will not be triggered on register
1522 //! semaphore wait un-successfull from INDIRECT_CTX pointer or
1523 //! BB_PER_CTX_PTR buffers.
1524 //!
1525 //!
1526 //!
1527 //! MI_SEMAPHORE_WAIT command must not be used in the middle of a tile pass
1528 //! on the posh pipe.
1529 //!
1530 //!
1531 //!
1532 //! : [All Command Streamers][Ring Buffer Mode of Scheduling]:
1533 //! MI_SEMAPHORE_WAIT command must be always programmed with "Wait Mode" set
1534 //! to "Polling Mode" Or MI_SEMAPHORE_WAIT command with "Wait Mode" set to
1535 //! "Polling Mode" can be programmed when "Semaphore Wait Event IDLE message
1536 //! Disable" bit in "RC_PSMI_CTRL" register is set to disable Idle messaging
1537 //! on unsuccessful MI_SEMPAHORE_WAIT.
1538 //!
1539 struct MI_SEMAPHORE_WAIT_CMD
1540 {
1541 union
1542 {
1543 //!< DWORD 0
1544 struct
1545 {
1546 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1547 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 11) ; //!< Reserved
1548 uint32_t CompareOperation : __CODEGEN_BITFIELD(12, 14) ; //!< COMPARE_OPERATION
1549 uint32_t WaitMode : __CODEGEN_BITFIELD(15, 15) ; //!< WAIT_MODE
1550 uint32_t RegisterPollMode : __CODEGEN_BITFIELD(16, 16) ; //!< REGISTER_POLL_MODE
1551 uint32_t Reserved17 : __CODEGEN_BITFIELD(17, 21) ; //!< Reserved
1552 uint32_t MemoryType : __CODEGEN_BITFIELD(22, 22) ; //!< MEMORY_TYPE
1553 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1554 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1555 };
1556 uint32_t Value;
1557 } DW0;
1558 union
1559 {
1560 //!< DWORD 1
1561 struct
1562 {
1563 uint32_t SemaphoreDataDword ; //!< Semaphore Data Dword
1564 };
1565 uint32_t Value;
1566 } DW1;
1567 union
1568 {
1569 //!< DWORD 2..3
1570 struct
1571 {
1572 uint64_t Reserved64 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
1573 uint64_t SemaphoreAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Semaphore Address
1574 };
1575 uint32_t Value[2];
1576 } DW2_3;
1577 union
1578 {
1579 //!< DWORD 4
1580 struct
1581 {
1582 uint32_t Reserved128 : __CODEGEN_BITFIELD( 0, 4) ; //!< Reserved
1583 uint32_t WaitTokenNumber : __CODEGEN_BITFIELD( 5, 9) ; //!< Wait Token Number
1584 uint32_t Reserved138 : __CODEGEN_BITFIELD(10, 31) ; //!< Reserved
1585 };
1586 uint32_t Value;
1587 } DW4;
1588
1589 //! \name Local enumerations
1590
1591 //! \brief COMPARE_OPERATION
1592 //! \details
1593 //! This field specifies the operation that will be executed to create the
1594 //! result that will either allow the context to continue or wait.
1595 enum COMPARE_OPERATION
1596 {
1597 COMPARE_OPERATION_SADGREATERTHANSDD = 0, //!< If Indirect fetched data is greater than inline data then continue.
1598 COMPARE_OPERATION_SADGREATERTHANOREQUALSDD = 1, //!< If Indirect fetched data is greater than or equal to inline data then continue.
1599 COMPARE_OPERATION_SADLESSTHANSDD = 2, //!< If Indirect fetched data is less than inline data then continue.
1600 COMPARE_OPERATION_SADLESSTHANOREQUALSDD = 3, //!< If Indirect fetched data is less than or equal to inline data then continue.
1601 COMPARE_OPERATION_SADEQUALSDD = 4, //!< If Indirect fetched data is equalto inline data then continue.
1602 COMPARE_OPERATION_SADNOTEQUALSDD = 5, //!< If Indirect fetched data is not equal to inline data then continue.
1603 };
1604
1605 //! \brief WAIT_MODE
1606 //! \details
1607 //! This bit specifies the WAIT behavior when the semaphore comparison fails
1608 //! and before the context is switched out.
1609 enum WAIT_MODE
1610 {
1611 WAIT_MODE_SIGNALMODE = 0, //!< In this mode HW will reacquire the semaphore data from memory for evaluating semaphore wait condition on receiving SIGNAL.Scheduler or SW can generate a SIGNAL to an engine by writing a value 0xFFFF_FFFF to the engines corresponding SEMAPHORE_SIGNAL_PORT register.
1612 WAIT_MODE_POLLINGMODE = 1, //!< In this mode HW periodically reads the semaphore data from memory for comparison until it is context switched out. Periodicity will be mentioned in a SEMA_WAIT_POLL register.
1613 };
1614
1615 //! \brief REGISTER_POLL_MODE
1616 //! \details
1617 //! <p>This field control the seamphore wait behavior of polling from memory
1618 //! vs MMIO register.</p>
1619 enum REGISTER_POLL_MODE
1620 {
1621 REGISTER_POLL_MODE_MEMORYPOLL = 0, //!< In this mode HW will functional as in regular mode and checks for semaphore data in memory.
1622 REGISTER_POLL_MODE_REGISTERPOLL = 1, //!< In this mode HW periodically reads the semaphore data from MMIO register instead of memory for comparison until the condition is satisfied. Periodicity will be mentioned in a SEMA_WAIT_POLL register.When operating in register poll mode, DW2 "Semaphore Address" (bits 22:2) carries the register MMIO offset to be polled.In register poll mode "Memory Type" field of this command are ignored by HW. 
1623 };
1624
1625 //! \brief MEMORY_TYPE
1626 //! \details
1627 //! This bit will be ignored and treated as if clear when executing from a
1628 //! non-privileged batch buffer. It is allowed for this bit to be clear when
1629 //! executing this command from a privileged (secure) batch buffer. This bit
1630 //! <i>must</i> be 1 if the <b>Per Process GTT Enable</b> bit is clear.
1631 enum MEMORY_TYPE
1632 {
1633 MEMORY_TYPE_PERPROCESSGRAPHICSADDRESS = 0, //!< No additional details
1634 MEMORY_TYPE_GLOBALGRAPHICSADDRESS = 1, //!< This command will use the global GTT to translate the Address and this command must beexecuting from a privileged (secure) batch buffer.
1635 };
1636
1637 enum MI_COMMAND_OPCODE
1638 {
1639 MI_COMMAND_OPCODE_MISEMAPHOREWAIT = 28, //!< No additional details
1640 };
1641
1642 enum COMMAND_TYPE
1643 {
1644 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1645 };
1646
1647 //! \name Initializations
1648
1649 //! \brief Explicit member initialization function
1650 MI_SEMAPHORE_WAIT_CMD();
1651
1652 static const size_t dwSize = 5;
1653 static const size_t byteSize = 20;
1654 };
1655
1656 //!
1657 //! \brief MI_CONDITIONAL_BATCH_BUFFER_END
1658 //! \details
1659 //! The MI_CONDITIONAL_BATCH_BUFFER_END command is used to conditionally
1660 //! terminate the execution of commands stored in a batch buffer initiated
1661 //! using a MI_BATCH_BUFFER_START command.
1662 //! Termination of the current level of batch buffer from which
1663 //! MI_CONDITIONAL_BATCH_BUFFER_END is executed or termination of all levels
1664 //! of batch buffer behavior is controlled by the "End Current Batch Buffer
1665 //! Level" bit in the command header.
1666 //!
1667 //! Any updates to the memory location exercised by this command must be
1668 //! ensured to be coherent in memory prior to programming of this command.
1669 //! If the memory location is being updated by a prior executed MI command
1670 //! (ex: MI_STORE_REGISTER_MEM ..etc) on the same engine, SW must follow one
1671 //! of the below programming note prior to programming of this command to
1672 //! ensure data is coherent in memory.
1673 //! Option1: Programming of "4" dummy MI_STORE_DATA_IMM (write to scratch
1674 //! space) commands prior to programming of this command. Example:
1675 //! MI_STORE_REGISTE_MEM (0x2288, 0x2CF0_0000) ……… ……… MI_STORE_DATA_IMM (4
1676 //! times) (Dummy data, Scratch Address)
1677 //! MI_CONDITIONAL_BATCH_BUFFER_END(0x2CF0_0000)
1678 //! Option2: Programming of a PIPE_CONTROL with Post-Sync Operation selected
1679 //! to "Write Immediate Data" to scratch space address with "Command
1680 //! Streamer Stall Enable" set prior to programming of this command.
1681 //! Example: MI_STORE_REGISTE_MEM (0x2288, 0x2CF0_0000) ……… ……… PIPE_CONTROL
1682 //! (Stall, Write Immediate Data),
1683 //! MI_CONDITIONAL_BATCH_BUFFER_END(0x2CF0_0000).
1684 //! Option3: MI_ATOMIC (write to scratch space) with "CS STALL" set prior to
1685 //! programming of this command. Example: MI_STORE_REGISTE_MEM (0x2288,
1686 //! 0x2CF0_0000) ……… ……… MI_ATOMIC (MOV, Dummy data, Scratch Address),
1687 //! MI_CONDITIONAL_BATCH_BUFFER_END(0x2CF0_0000).
1688 //!
1689 struct MI_CONDITIONAL_BATCH_BUFFER_END_CMD
1690 {
1691 union
1692 {
1693 //!< DWORD 0
1694 struct
1695 {
1696 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1697 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 11) ; //!< Reserved
1698 uint32_t CompareOperation : __CODEGEN_BITFIELD(12, 14) ; //!< COMPARE_OPERATION
1699 uint32_t Reserved15 : __CODEGEN_BITFIELD(15, 17) ; //!< Reserved
1700 uint32_t EndCurrentBatchBufferLevel : __CODEGEN_BITFIELD(18, 18) ; //!< END_CURRENT_BATCH_BUFFER_LEVEL
1701 uint32_t CompareMaskMode : __CODEGEN_BITFIELD(19, 19) ; //!< COMPARE_MASK_MODE
1702 uint32_t Reserved20 : __CODEGEN_BITFIELD(20, 20) ; //!< Reserved
1703 uint32_t CompareSemaphore : __CODEGEN_BITFIELD(21, 21) ; //!< COMPARE_SEMAPHORE
1704 uint32_t UseGlobalGtt : __CODEGEN_BITFIELD(22, 22) ; //!< USE_GLOBAL_GTT
1705 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1706 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1707 };
1708 uint32_t Value;
1709 } DW0;
1710 union
1711 {
1712 //!< DWORD 1
1713 struct
1714 {
1715 uint32_t CompareDataDword ; //!< Compare Data Dword
1716 };
1717 uint32_t Value;
1718 } DW1;
1719 union
1720 {
1721 //!< DWORD 2..3
1722 struct
1723 {
1724 uint64_t Reserved64 : __CODEGEN_BITFIELD( 0, 2) ; //!< Reserved
1725 uint64_t CompareAddress : __CODEGEN_BITFIELD( 3, 63) ; //!< Compare Address
1726 };
1727 uint32_t Value[2];
1728 } DW2_3;
1729
1730 //! \name Local enumerations
1731
1732 //! \brief COMPARE_OPERATION
1733 //! \details
1734 //! <p>This field specifies the operation that will be executed to create
1735 //! the result that will either allow to continue or terminate the batch
1736 //! buffer.</p>
1737 enum COMPARE_OPERATION
1738 {
1739 COMPARE_OPERATION_MADGREATERTHANIDD = 0, //!< If Indirect fetched data is greater than inline data then continue.
1740 COMPARE_OPERATION_MADGREATERTHANOREQUALIDD = 1, //!< If Indirect fetched data is greater than or equal to inline data then continue.
1741 COMPARE_OPERATION_MADLESSTHANIDD = 2, //!< If Indirect fetched data is less than inline data then continue.
1742 COMPARE_OPERATION_MADLESSTHANOREQUALIDD = 3, //!< If Indirect fetched data is less than or equal to inline data then continue.
1743 COMPARE_OPERATION_MADEQUALIDD = 4, //!< If Indirect fetched data is equal to inline data then continue.
1744 COMPARE_OPERATION_MADNOTEQUALIDD = 5, //!< If Indirect fetched data is not equal to inline data then continue.
1745 };
1746
1747 //! \brief END_CURRENT_BATCH_BUFFER_LEVEL
1748 //! \details
1749 //! This field specifies if the current level of the batch buffer execution
1750 //! must or the complete batch (including parent) buffer execution must be
1751 //! terminated on compare operation evaluating false.
1752 enum END_CURRENT_BATCH_BUFFER_LEVEL
1753 {
1754 END_CURRENT_BATCH_BUFFER_LEVEL_UNNAMED0 = 0, //!< Execution of the command result in termination of all levels of batch buffer and command execution returns to the ring buffer.
1755 END_CURRENT_BATCH_BUFFER_LEVEL_UNNAMED1 = 1, //!< Execution of the command results in terminating the batch buffer level from which this command has been executed and command execution returns to the previous/parent batch buffer.Ex:when executed from a first level batch buffer, execution of batch buffer is terminated and the command execution resumes to the ring buffer. This is similar to as if MI_BATCH_BUFFER_END command was executed from first level batch buffer.when executed from a second level batch buffer, execution of second level batch buffer is terminated and the command execution resumes to the first level batch buffer. This is similar to as if MI_BATCH_BUFFER_END command was executed from second level batch buffer.when executed from a third level batch buffer (if supported), execution of third level batch buffer is terminated and the command execution resumes to the second level batch buffer. This is similar to as if MI_BATCH_BUFFER_END command was executed from third level batch buffer.
1756 };
1757
1758 //! \brief COMPARE_MASK_MODE
1759 //! \details
1760 //! When "Compare Mask Mode" is enabled, "Compare Address" must be qword
1761 //! aligned.
1762 enum COMPARE_MASK_MODE
1763 {
1764 COMPARE_MASK_MODE_COMPAREMASKMODEDISABLED = 0, //!< Compare address points to Dword in memory consisting of Data Dword(DW0). HW will compare Data Dword(DW0) against Semaphore Data Dword.
1765 COMPARE_MASK_MODE_COMPAREMASKMODEENABLED = 1, //!< Compare address points to Qword in memory consisting of compare Mask (DW0) and Data Dword(DW1). HW will do AND operation on Mask(DW0) with Data Dword(DW1) and then compare the result against Semaphore Data Dword.
1766 };
1767
1768 //! \brief COMPARE_SEMAPHORE
1769 //! \details
1770 //! <p>If set, the value from the Compare Data Dword is compared to the
1771 //! value from the Compare Address in memory. If the value at Compare
1772 //! Address is greater than the Compare Data Dword, execution of current
1773 //! command buffer should continue. If clear, the parser will continue to
1774 //! the next command and not exit the batch buffer.</p>
1775 enum COMPARE_SEMAPHORE
1776 {
1777 COMPARE_SEMAPHORE_UNNAMED0 = 0, //!< No additional details
1778 };
1779
1780 //! \brief USE_GLOBAL_GTT
1781 //! \details
1782 //! If set, this command will use the global GTT to translate the <b>Compare
1783 //! Address</b> and this command must be executing from a privileged
1784 //! (secure) batch buffer. If clear, the PPGTT will be used to translate the
1785 //! <b>Compare Address</b>.
1786 enum USE_GLOBAL_GTT
1787 {
1788 USE_GLOBAL_GTT_UNNAMED0 = 0, //!< No additional details
1789 };
1790
1791 enum MI_COMMAND_OPCODE
1792 {
1793 MI_COMMAND_OPCODE_MICONDITIONALBATCHBUFFEREND = 54, //!< No additional details
1794 };
1795
1796 enum COMMAND_TYPE
1797 {
1798 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1799 };
1800
1801 //! \name Initializations
1802
1803 //! \brief Explicit member initialization function
1804 MI_CONDITIONAL_BATCH_BUFFER_END_CMD();
1805
1806 static const size_t dwSize = 4;
1807 static const size_t byteSize = 16;
1808 };
1809
1810 //!
1811 //! \brief MI_ATOMIC
1812 //! \details
1813 //! MI_ATOMIC is used to carry atomic operation on data in graphics memory.
1814 //! Atomic operations are supported on data granularity of 4B, 8B and 16B.
1815 //! The atomic operation leads to a read-modify-write operation on the data
1816 //! in graphics memory with the option of returning value. The data in
1817 //! graphics memory is modified by doing arithmetic and logical operation
1818 //! with the inline/indirect data provided with the MI_ATOMIC command.
1819 //! Inline/Indirect provided in the command can be one or two operands based
1820 //! on the atomic operation. Ex: Atomic-Compare operation needs two operands
1821 //! while Atomic-Add operation needs single operand and Atomic-increment
1822 //! requires no operand. Refer "Atomics" sub-section of "L3 Cache and URB"
1823 //! section detailed atomic operations supported. Atomic
1824 //! operations can be enabled to return value by setting "Return Data
1825 //! Control" field in the command, return data is stored to CS_GPR
1826 //! registers.
1827 //! CS_GPR4/5 registers are updated with memory Return Data based on the
1828 //! "Data Size". Each GPR register is qword in size and occupies two MMIO
1829 //! registers.
1830 //! Note: Any references to CS_GPR registers in the command should be
1831 //! understood as the CS_GPR registers belonging to the corresponding
1832 //! engines *CS_GPR registers.
1833 //!
1834 //!
1835 //! Indirect Source Operands:
1836 //!
1837 //! Operand1 is sourced from [CS_GPR1, CS_GPR0]
1838 //!
1839 //! Operand2 is sourced from [CS_GPR3, CS_GPR2]
1840 //!
1841 //! Read return Data is stored in [CS_GPR_5, CS_GPR4]
1842 //!
1843 //! When "Data Size" is DWORD lower dword of CS_GPR4 (Qword) is updated with
1844 //! the dword data returned from memory. When "Data Size" is QWORD only
1845 //! CS_GPR4 (Qword) is updated with the qword data returned from memory.
1846 //! When the data size is OCTWORD CS_GPR4/5 are updated with the OCTWORD
1847 //! data returned from memory. CS_GPR4 is loaded with lower qword returned
1848 //! from memory and CS_GPR5 is loaded with upper qword returned from memory.
1849 //!
1850 //! When Inline Data mode is not set, Dwords 3..10 must not be included as
1851 //! part of the command. Dword Length field in the header must be programmed
1852 //! accordingly.
1853 //! When Inline Data Mode is set, Dwords3..10 must be included based on the
1854 //! Data Size field of the header. Both Operand-1 and Operand-2 dwords must
1855 //! be programmed based on the Data Size field. Operand-2 must be programmed
1856 //! to 0x0 if the atomic operation doesn't require it. Dword Length field in
1857 //! the header must be programmed accordingly.
1858 //!
1859 //!
1860 //!
1861 struct MI_ATOMIC_CMD
1862 {
1863 union
1864 {
1865 //!< DWORD 0
1866 struct
1867 {
1868 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1869 uint32_t AtomicOpcode : __CODEGEN_BITFIELD( 8, 15) ; //!< ATOMIC OPCODE
1870 uint32_t ReturnDataControl : __CODEGEN_BITFIELD(16, 16) ; //!< Return Data Control
1871 uint32_t CsStall : __CODEGEN_BITFIELD(17, 17) ; //!< CS STALL
1872 uint32_t InlineData : __CODEGEN_BITFIELD(18, 18) ; //!< Inline Data
1873 uint32_t DataSize : __CODEGEN_BITFIELD(19, 20) ; //!< DATA_SIZE
1874 uint32_t PostSyncOperation : __CODEGEN_BITFIELD(21, 21) ; //!< POST_SYNC_OPERATION
1875 uint32_t MemoryType : __CODEGEN_BITFIELD(22, 22) ; //!< MEMORY_TYPE
1876 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1877 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1878 };
1879 uint32_t Value;
1880 } DW0;
1881 union
1882 {
1883 //!< DWORD 1
1884 struct
1885 {
1886 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
1887 uint32_t MemoryAddress : __CODEGEN_BITFIELD( 2, 31) ; //!< Memory Address
1888 };
1889 uint32_t Value;
1890 } DW1;
1891 union
1892 {
1893 //!< DWORD 2
1894 struct
1895 {
1896 uint32_t MemoryAddressHigh : __CODEGEN_BITFIELD( 0, 15) ; //!< Memory Address High
1897 uint32_t Reserved80 : __CODEGEN_BITFIELD(16, 31) ; //!< Reserved
1898 };
1899 uint32_t Value;
1900 } DW2;
1901 union
1902 {
1903 //!< DWORD 3
1904 struct
1905 {
1906 uint32_t Operand1DataDword0 ; //!< Operand1 Data Dword 0
1907 };
1908 uint32_t Value;
1909 } DW3;
1910 union
1911 {
1912 //!< DWORD 4
1913 struct
1914 {
1915 uint32_t Operand2DataDword0 ; //!< Operand2 Data Dword 0
1916 };
1917 uint32_t Value;
1918 } DW4;
1919 union
1920 {
1921 //!< DWORD 5
1922 struct
1923 {
1924 uint32_t Operand1DataDword1 ; //!< Operand1 Data Dword 1
1925 };
1926 uint32_t Value;
1927 } DW5;
1928 union
1929 {
1930 //!< DWORD 6
1931 struct
1932 {
1933 uint32_t Operand2DataDword1 ; //!< Operand2 Data Dword 1
1934 };
1935 uint32_t Value;
1936 } DW6;
1937 union
1938 {
1939 //!< DWORD 7
1940 struct
1941 {
1942 uint32_t Operand1DataDword2 ; //!< Operand1 Data Dword 2
1943 };
1944 uint32_t Value;
1945 } DW7;
1946 union
1947 {
1948 //!< DWORD 8
1949 struct
1950 {
1951 uint32_t Operand2DataDword2 ; //!< Operand2 Data Dword 2
1952 };
1953 uint32_t Value;
1954 } DW8;
1955 union
1956 {
1957 //!< DWORD 9
1958 struct
1959 {
1960 uint32_t Operand1DataDword3 ; //!< Operand1 Data Dword 3
1961 };
1962 uint32_t Value;
1963 } DW9;
1964 union
1965 {
1966 //!< DWORD 10
1967 struct
1968 {
1969 uint32_t Operand2DataDword3 ; //!< Operand2 Data Dword 3
1970 };
1971 uint32_t Value;
1972 } DW10;
1973
1974 //! \name Local enumerations
1975
1976 //! \brief DATA_SIZE
1977 //! \details
1978 //! This field indicates the size of the operand in dword/qword/octword on
1979 //! which atomic operation will be performed. Data size must match with the
1980 //! Atomic Opcode. Operation Data size could be 4B, 8B or 16B
1981 enum DATA_SIZE
1982 {
1983 DATA_SIZE_DWORD = 0, //!< Operand size used by Atomic Operation is DWORD.
1984 DATA_SIZE_QWORD = 1, //!< Operand Size used by Atomic Operation is QWORD.
1985 DATA_SIZE_OCTWORD = 2, //!< Operand Size used by Atomic Operation is OCTWORD.
1986 };
1987
1988 //! \brief POST_SYNC_OPERATION
1989 //! \details
1990 //! Any desired pipeline flush operation can be achieved by programming
1991 //! PIPE_CONTROL command prior to this command.
1992 enum POST_SYNC_OPERATION
1993 {
1994 POST_SYNC_OPERATION_NOPOSTSYNCOPERATION = 0, //!< Command is executed as usual.
1995 POST_SYNC_OPERATION_POSTSYNCOPERATION = 1, //!< MI_ATOMIC command is executed as a pipelined PIPE_CONTROL flush command with Atomics operation as post sync operation. Flush completion only guarantees the workload prior to this command is pushed till Windower unit and completion of any outstanding flushes issued prior to this command.When this bit set following ristiriciton apply to atomic operation:Non-Compare atomic operations are supported on data granularity of 4B and 8B. DW3 is the lower dword of the operand and DW4 is the upper dword of the operand for the atomic operation.Compare atomic operations are supported on data granularity of 4B. DW3 is Operand-0 and DW4 is Operand-1 for the atomic operation.Atomic operations to GGTT/PPGTT memory surface are supported.Only Inline data mode for atomic operand is supported, no support for indirect data mode.No support for Return Data Control functionality.No support for atomic operations on data granularity of 16B.No support for compare atomic operations on data granularity of 8B.
1996 };
1997
1998 //! \brief MEMORY_TYPE
1999 //! \details
2000 //! This bit will be ignored and treated as if clear when executing from a
2001 //! non-privileged batch buffer. It is allowed for this bit to be clear when
2002 //! executing this command from a privileged (secure) batch buffer. This bit
2003 //! must be 1 if the <b>Per Process GTT Enable</b> bit is clear.
2004 enum MEMORY_TYPE
2005 {
2006 MEMORY_TYPE_PERPROCESSGRAPHICSADDRESS = 0, //!< No additional details
2007 MEMORY_TYPE_GLOBALGRAPHICSADDRESS = 1, //!< This command will use the global GTT to translate the Address and this command must be executing from a privileged (secure) batch buffer.
2008 };
2009
2010 enum MI_COMMAND_OPCODE
2011 {
2012 MI_COMMAND_OPCODE_MIATOMIC = 47, //!< No additional details
2013 };
2014
2015 enum COMMAND_TYPE
2016 {
2017 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
2018 };
2019
2020 //! \name Initializations
2021
2022 //! \brief Explicit member initialization function
2023 MI_ATOMIC_CMD();
2024
2025 static const size_t dwSize = 11;
2026 static const size_t byteSize = 44;
2027 };
2028
2029 //!
2030 //! \brief MI_MATH
2031 //! \details
2032 //! The MI_MATH command allows software to send instructions to the ALU in
2033 //! the Command Streamer. This command is the means by which the ALU is
2034 //! accessed. ALU instructions form the data payload of the MI_MATH command.
2035 //! An ALU instruction takes one DWord in size. The MI_MATH DWord Length is
2036 //! programmed based on the number of ALU instructions included, limited
2037 //! only by the max DWord Length supported. When the command streamer parses
2038 //! an MI_MATH command, it sends the included ALU instructions to the ALU.
2039 //! The ALU processes any instruction in a single clock. See the ALU section
2040 //! for more details.
2041 //!
2042 struct MI_MATH_CMD
2043 {
2044 union
2045 {
2046 //!< DWORD 0
2047 struct
2048 {
2049 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
2050 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 22) ; //!< Reserved
2051 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
2052 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
2053 };
2054 uint32_t Value;
2055 } DW0;
2056
2057 //! \name Local enumerations
2058
2059 enum MI_COMMAND_OPCODE
2060 {
2061 MI_COMMAND_OPCODE_MIMATH = 26, //!< No additional details
2062 };
2063
2064 enum COMMAND_TYPE
2065 {
2066 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
2067 };
2068
2069 //! \name Initializations
2070
2071 //! \brief Explicit member initialization function
2072 MI_MATH_CMD();
2073
2074 static const size_t dwSize = 1;
2075 static const size_t byteSize = 4;
2076 };
2077
2078 //!
2079 //! \brief MI_FLUSH_DW
2080 //! \details
2081 //! The MI_FLUSH_DW command is used to perform an internal "flush"
2082 //! operation. The parser pauses on an internal flush until all drawing
2083 //! engines have completed any pending operations. In addition, this command
2084 //! can also be used to:Flush any dirty data to memory. Invalidate the TLB
2085 //! cache inside the hardware Usage note: After this command is completed
2086 //! with a Store DWord enabled, CPU access to graphics memory will be
2087 //! coherent (assuming the Render Cache flush is not inhibited).
2088 //!
2089 struct MI_FLUSH_DW_CMD
2090 {
2091 union
2092 {
2093 //!< DWORD 0
2094 struct
2095 {
2096 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 5) ; //!< DWORD_LENGTH
2097 uint32_t Reserved6 : __CODEGEN_BITFIELD( 6, 6) ; //!< Reserved
2098 uint32_t VideoPipelineCacheInvalidate : __CODEGEN_BITFIELD( 7, 7) ; //!< Video Pipeline Cache invalidate
2099 uint32_t NotifyEnable : __CODEGEN_BITFIELD( 8, 8) ; //!< Notify Enable
2100 uint32_t FlushLlc : __CODEGEN_BITFIELD( 9, 9) ; //!< Flush LLC
2101 uint32_t Reserved10 : __CODEGEN_BITFIELD(10, 13) ; //!< Reserved
2102 uint32_t PostSyncOperation : __CODEGEN_BITFIELD(14, 15) ; //!< POST_SYNC_OPERATION
2103 uint32_t Reserved16 : __CODEGEN_BITFIELD(16, 17) ; //!< Reserved
2104 uint32_t TlbInvalidate : __CODEGEN_BITFIELD(18, 18) ; //!< TLB Invalidate
2105 uint32_t Reserved19 : __CODEGEN_BITFIELD(19, 20) ; //!< Reserved
2106 uint32_t StoreDataIndex : __CODEGEN_BITFIELD(21, 21) ; //!< Store Data Index
2107 uint32_t Reserved22 : __CODEGEN_BITFIELD(22, 22) ; //!< Reserved
2108 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
2109 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
2110 };
2111 uint32_t Value;
2112 } DW0;
2113 union
2114 {
2115 //!< DWORD 1..2
2116 struct
2117 {
2118 uint64_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
2119 uint64_t DestinationAddressType : __CODEGEN_BITFIELD( 2, 2) ; //!< DESTINATION_ADDRESS_TYPE
2120 uint64_t Address : __CODEGEN_BITFIELD( 3, 47) ; //!< Address
2121 uint64_t Reserved80 : __CODEGEN_BITFIELD(48, 63) ; //!< Reserved
2122 };
2123 uint32_t Value[2];
2124 } DW1_2;
2125 union
2126 {
2127 //!< DWORD 3..4
2128 struct
2129 {
2130 uint64_t ImmediateData ; //!< Immediate Data
2131 };
2132 uint32_t Value[2];
2133 } DW3_4;
2134
2135 //! \name Local enumerations
2136
2137 //! \brief POST_SYNC_OPERATION
2138 //! \details
2139 //! BitFieldDesc
2140 enum POST_SYNC_OPERATION
2141 {
2142 POST_SYNC_OPERATION_NOWRITE = 0, //!< No write occurs as a result of this instruction. This can be used to implement a "trap" operation, etc.
2143 POST_SYNC_OPERATION_WRITEIMMEDIATEDATA = 1, //!< HW implicitly detects the Data size to be Qword or Dword to be written to memory based on the command dword length programmed . When Dword Length indicates Qword, Writes the QWord containing Immediate Data Low, High DWs to the Destination Address . When Dword Length indicates Dword, Writes the DWord containing Immediate Data Low to the Destination Address
2144 POST_SYNC_OPERATION_UNNAMED3 = 3, //!< Write the TIMESTAMP register to the Destination Address. The upper 28 bits of the TIMESTAMP register are tied to '0'.
2145 };
2146
2147 enum MI_COMMAND_OPCODE
2148 {
2149 MI_COMMAND_OPCODE_MIFLUSHDW = 38, //!< No additional details
2150 };
2151
2152 enum COMMAND_TYPE
2153 {
2154 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
2155 };
2156
2157 //! \brief DESTINATION_ADDRESS_TYPE
2158 //! \details
2159 //! Defines address space of Destination Address
2160 enum DESTINATION_ADDRESS_TYPE
2161 {
2162 DESTINATION_ADDRESS_TYPE_PPGTT = 0, //!< Use PPGTT address space for DW write
2163 DESTINATION_ADDRESS_TYPE_GGTT = 1, //!< Use GGTT address space for DW write
2164 };
2165
2166 //! \name Initializations
2167
2168 //! \brief Explicit member initialization function
2169 MI_FLUSH_DW_CMD();
2170
2171 static const size_t dwSize = 5;
2172 static const size_t byteSize = 20;
2173 };
2174
2175 //!
2176 //! \brief MI_FORCE_WAKEUP
2177 //! \details
2178 //! This command is used to communicate Force Wakeup request to PM unit. No
2179 //! functionality is performed by this command when none of the mask bits
2180 //! are set and is equivalent to NOOP. Example for usage model: VCS Ring
2181 //! Buffer: MI_FORCE_WAKEUP (Force Render Awake set to '1')
2182 //! MI_SEMPAHORE_SIGNAL (Signal context id 0xABC to Render Command Streamer)
2183 //! MI_FORCE_WAKEUP (Force Render Awake set to '0') MI_BATCH_BUFFER_START
2184 //! STATE Commands .. ………….. MI_FORCE_WAKEUP (Force Render Awake set to '1')
2185 //! MI_LOAD_REGISTER_IMMEDIATE (Load register 0x23XX in render command
2186 //! streamer with data 0xFFF) MI_FORCE_WAKEUP (Force Render Awake set to
2187 //! '0') ………….. MI_BATCH_BUFFER_END
2188 //!
2189 struct MI_FORCE_WAKEUP_CMD
2190 {
2191 union
2192 {
2193 //!< DWORD 0
2194 struct
2195 {
2196 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
2197 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 22) ; //!< Reserved
2198 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
2199 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
2200 };
2201 uint32_t Value;
2202 } DW0;
2203 union
2204 {
2205 //!< DWORD 1
2206 struct
2207 {
2208 uint32_t ForceMediaSlice0Awake : __CODEGEN_BITFIELD( 0, 0) ; //!< Force Media-Slice0 Awake
2209 uint32_t ForceRenderAwake : __CODEGEN_BITFIELD( 1, 1) ; //!< Force Render Awake
2210 uint32_t ForceMediaSlice1Awake : __CODEGEN_BITFIELD( 2, 2) ; //!< Force Media-Slice1 Awake
2211 uint32_t ForceMediaSlice2Awake : __CODEGEN_BITFIELD( 3, 3) ; //!< Force Media-Slice2 Awake
2212 uint32_t ForceMediaSlice3Awake : __CODEGEN_BITFIELD( 4, 4) ; //!< Force Media-Slice3 Awake
2213 uint32_t Reserved37 : __CODEGEN_BITFIELD( 5, 7) ; //!< Reserved
2214 uint32_t HevcPowerWellControl : __CODEGEN_BITFIELD( 8, 8) ; //!< HEVC_POWER_WELL_CONTROL
2215 uint32_t MfxPowerWellControl : __CODEGEN_BITFIELD( 9, 9) ; //!< MFX_POWER_WELL_CONTROL
2216 uint32_t Reserved42 : __CODEGEN_BITFIELD(10, 15) ; //!< Reserved
2217 uint32_t MaskBits : __CODEGEN_BITFIELD(16, 31) ; //!< Mask Bits
2218 };
2219 uint32_t Value;
2220 } DW1;
2221
2222 //! \name Local enumerations
2223
2224 enum MI_COMMAND_OPCODE
2225 {
2226 MI_COMMAND_OPCODE_MIFORCEWAKEUP = 29, //!< No additional details
2227 };
2228
2229 enum COMMAND_TYPE
2230 {
2231 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
2232 };
2233
2234 //! \brief HEVC_POWER_WELL_CONTROL
2235 //! \details
2236 //! This Bit controls whether or not the HEVC Power Well is powered. When
2237 //! this bit is unmasked, all force awake bits programming are ignored.
2238 enum HEVC_POWER_WELL_CONTROL
2239 {
2240 HEVC_POWER_WELL_CONTROL_DISABLEPOWERWELL = 0, //!< No additional details
2241 HEVC_POWER_WELL_CONTROL_ENABLEPOWERWELL = 1, //!< No additional details
2242 };
2243
2244 //! \brief MFX_POWER_WELL_CONTROL
2245 //! \details
2246 //! This Bit controls whether or not the MFX Power Well is powered. When
2247 //! this bit is unmasked, all force awake bits programming are ignored.
2248 enum MFX_POWER_WELL_CONTROL
2249 {
2250 MFX_POWER_WELL_CONTROL_DISABLEPOWERWELL = 0, //!< No additional details
2251 MFX_POWER_WELL_CONTROL_ENABLEPOWERWELL = 1, //!< No additional details
2252 };
2253
2254 //! \name Initializations
2255
2256 //! \brief Explicit member initialization function
2257 MI_FORCE_WAKEUP_CMD();
2258
2259 static const size_t dwSize = 2;
2260 static const size_t byteSize = 8;
2261 };
2262
2263 //!
2264 //! \brief PIPE_CONTROL
2265 //! \details
2266 //! The PIPE_CONTROL command is used to effect the synchronization described
2267 //! above.
2268 //!
2269 //! SW must follow below programming restrictions when
2270 //! programming PIPECONTROL command ifor POCS:
2271 //!
2272 //!
2273 //! Write cache flush bits must not be set (Render Target Cache Flush
2274 //! Enable, DC Flush Enable, Depth Cache Flush Enable )
2275 //!
2276 //! Post Sync Operations must not be set to "Write PS Depth Count"
2277 //!
2278 //! "Stall at Pixel Scoreboard" must not be set
2279 //!
2280 //! "Notify Enable" must not be set.
2281 //!
2282 //! "Depth Stall Enable" must not be set.
2283 //!
2284 //! "Generic Media State Clear" must not be set.
2285 //!
2286 //! "PSD Sync Enable" must not be set.
2287 //!
2288 //! SW must follow below programming restrictions when
2289 //! programmingPIPE_CONTROL command for ComputeCS:
2290 //!
2291 //! "Command Streamer Stall Enable" must be always set.
2292 //!
2293 //! Post Sync Operations must not be set to "Write PS Depth Count"
2294 //!
2295 //! Following bits must not be set when programmed for ComputeCS
2296 //!
2297 //! "Render Target Cache Flush Enable", "Depth Cache Flush Enable" and "Tile
2298 //! Cache Flush Enable"
2299 //!
2300 //! "Depth Stall Enable", "Stall at Pixel Scoreboard" and "PSD Sync Enable".
2301 //!
2302 //! "OVR Tile 0 Flush", "TBIMR Force Batch Closure", "AMFS Flush Enable" "VF
2303 //! Cache Invalidation Enable" and "Global Snapshot Count Reset".
2304 //!
2305 //!
2306 //!
2307 //!
2308 //!
2309 //!
2310 struct PIPE_CONTROL_CMD
2311 {
2312 union
2313 {
2314 //!< DWORD 0
2315 struct
2316 {
2317 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
2318 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 8) ; //!< Reserved
2319 uint32_t HdcPipelineFlush : __CODEGEN_BITFIELD( 9, 9) ; //!< HDC Pipeline Flush
2320 uint32_t Reserved10 : __CODEGEN_BITFIELD(10, 11) ; //!< Reserved
2321 uint32_t PostSyncOperationL3CacheabilityControl : __CODEGEN_BITFIELD(12, 12) ; //!< POST_SYNC_OPERATION_L3_CACHEABILITY_CONTROL
2322 uint32_t Reserved13 : __CODEGEN_BITFIELD(13, 15) ; //!< Reserved
2323 uint32_t Command3DSubOpcode : __CODEGEN_BITFIELD(16, 23) ; //!< _3D_COMMAND_SUB_OPCODE
2324 uint32_t Command3DOpcode : __CODEGEN_BITFIELD(24, 26) ; //!< _3D_COMMAND_OPCODE
2325 uint32_t CommandSubtype : __CODEGEN_BITFIELD(27, 28) ; //!< COMMAND_SUBTYPE
2326 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
2327 };
2328 uint32_t Value;
2329 } DW0;
2330 union
2331 {
2332 //!< DWORD 1
2333 struct
2334 {
2335 uint32_t DepthCacheFlushEnable : __CODEGEN_BITFIELD( 0, 0) ; //!< DEPTH_CACHE_FLUSH_ENABLE
2336 uint32_t StallAtPixelScoreboard : __CODEGEN_BITFIELD( 1, 1) ; //!< STALL_AT_PIXEL_SCOREBOARD
2337 uint32_t StateCacheInvalidationEnable : __CODEGEN_BITFIELD( 2, 2) ; //!< State Cache Invalidation Enable
2338 uint32_t ConstantCacheInvalidationEnable : __CODEGEN_BITFIELD( 3, 3) ; //!< Constant Cache Invalidation Enable
2339 uint32_t VfCacheInvalidationEnable : __CODEGEN_BITFIELD( 4, 4) ; //!< VF Cache Invalidation Enable
2340 uint32_t DcFlushEnable : __CODEGEN_BITFIELD( 5, 5) ; //!< DC Flush Enable
2341 uint32_t Reserved38 : __CODEGEN_BITFIELD( 6, 6) ; //!< Reserved
2342 uint32_t PipeControlFlushEnable : __CODEGEN_BITFIELD( 7, 7) ; //!< Pipe Control Flush Enable
2343 uint32_t NotifyEnable : __CODEGEN_BITFIELD( 8, 8) ; //!< Notify Enable
2344 uint32_t IndirectStatePointersDisable : __CODEGEN_BITFIELD( 9, 9) ; //!< Indirect State Pointers Disable
2345 uint32_t TextureCacheInvalidationEnable : __CODEGEN_BITFIELD(10, 10) ; //!< Texture Cache Invalidation Enable
2346 uint32_t InstructionCacheInvalidateEnable : __CODEGEN_BITFIELD(11, 11) ; //!< Instruction Cache Invalidate Enable
2347 uint32_t RenderTargetCacheFlushEnable : __CODEGEN_BITFIELD(12, 12) ; //!< RENDER_TARGET_CACHE_FLUSH_ENABLE
2348 uint32_t DepthStallEnable : __CODEGEN_BITFIELD(13, 13) ; //!< DEPTH_STALL_ENABLE
2349 uint32_t PostSyncOperation : __CODEGEN_BITFIELD(14, 15) ; //!< POST_SYNC_OPERATION
2350 uint32_t GenericMediaStateClear : __CODEGEN_BITFIELD(16, 16) ; //!< Generic Media State Clear
2351 uint32_t PsdSyncEnable : __CODEGEN_BITFIELD(17, 17) ; //!< PSD Sync Enable
2352 uint32_t TlbInvalidate : __CODEGEN_BITFIELD(18, 18) ; //!< TLB Invalidate
2353 uint32_t GlobalSnapshotCountReset : __CODEGEN_BITFIELD(19, 19) ; //!< GLOBAL_SNAPSHOT_COUNT_RESET
2354 uint32_t CommandStreamerStallEnable : __CODEGEN_BITFIELD(20, 20) ; //!< Command Streamer Stall Enable
2355 uint32_t StoreDataIndex : __CODEGEN_BITFIELD(21, 21) ; //!< Store Data Index
2356 uint32_t Reserved54 : __CODEGEN_BITFIELD(22, 22) ; //!< Reserved
2357 uint32_t LriPostSyncOperation : __CODEGEN_BITFIELD(23, 23) ; //!< LRI_POST_SYNC_OPERATION
2358 uint32_t DestinationAddressType : __CODEGEN_BITFIELD(24, 24) ; //!< DESTINATION_ADDRESS_TYPE
2359 uint32_t AmfsFlushEnable : __CODEGEN_BITFIELD(25, 25) ; //!< AMFS Flush Enable
2360 uint32_t FlushLlc : __CODEGEN_BITFIELD(26, 26) ; //!< Flush LLC
2361 uint32_t Reserved59 : __CODEGEN_BITFIELD(27, 27) ; //!< Reserved
2362 uint32_t TileCacheFlushEnable : __CODEGEN_BITFIELD(28, 28) ; //!< TILE_CACHE_FLUSH_ENABLE
2363 uint32_t CommandCacheInvalidateEnable : __CODEGEN_BITFIELD(29, 29) ; //!< Command Cache Invalidate Enable
2364 uint32_t Reserved62 : __CODEGEN_BITFIELD(30, 31) ; //!< Reserved
2365 };
2366 uint32_t Value;
2367 } DW1;
2368 union
2369 {
2370 //!< DWORD 2
2371 struct
2372 {
2373 uint32_t Reserved64 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
2374 uint32_t Address : __CODEGEN_BITFIELD( 2, 31) ; //!< Address
2375 };
2376 uint32_t Value;
2377 } DW2;
2378 union
2379 {
2380 //!< DWORD 3
2381 struct
2382 {
2383 uint32_t AddressHigh ; //!< Address High
2384 };
2385 uint32_t Value;
2386 } DW3;
2387 union
2388 {
2389 //!< DWORD 4..5
2390 struct
2391 {
2392 uint64_t ImmediateData ; //!< Immediate Data
2393 };
2394 uint32_t Value[2];
2395 } DW4_5;
2396
2397 //! \name Local enumerations
2398
2399 enum POST_SYNC_OPERATION_L3_CACHEABILITY_CONTROL
2400 {
2401 POST_SYNC_OPERATION_L3_CACHEABILITY_CONTROL_DEFAULTMOCS = 0, //!< MOCS value will beCS Write Format Override0x20c4[13:7]
2402 POST_SYNC_OPERATION_L3_CACHEABILITY_CONTROL_CACHEABLEMOCS = 1, //!< MOCS value will beMOCS Index for Command Buffer Caching0x2084[6:0]
2403 };
2404
2405 enum _3D_COMMAND_SUB_OPCODE
2406 {
2407 _3D_COMMAND_SUB_OPCODE_PIPECONTROL = 0, //!< No additional details
2408 };
2409
2410 enum _3D_COMMAND_OPCODE
2411 {
2412 _3D_COMMAND_OPCODE_PIPECONTROL = 2, //!< No additional details
2413 };
2414
2415 enum COMMAND_SUBTYPE
2416 {
2417 COMMAND_SUBTYPE_GFXPIPE3D = 3, //!< No additional details
2418 };
2419
2420 enum COMMAND_TYPE
2421 {
2422 COMMAND_TYPE_GFXPIPE = 3, //!< No additional details
2423 };
2424
2425 //! \brief DEPTH_CACHE_FLUSH_ENABLE
2426 //! \details
2427 //! Setting this bit enables flushing (i.e. writing back the dirty lines to
2428 //! memory and invalidating the tags) of depth related caches. This bit
2429 //! applies to HiZ cache, Stencil cache and depth cache.
2430 enum DEPTH_CACHE_FLUSH_ENABLE
2431 {
2432 DEPTH_CACHE_FLUSH_ENABLE_FLUSHDISABLED = 0, //!< Depth relates caches (HiZ, Stencil and Depth) are NOT flushed.
2433 DEPTH_CACHE_FLUSH_ENABLE_FLUSHENABLED = 1, //!< Depth relates caches (HiZ, Stencil and Depth) are flushed.
2434 };
2435
2436 //! \brief STALL_AT_PIXEL_SCOREBOARD
2437 //! \details
2438 //! Defines the behavior of PIPE_CONTROL command at the pixel scoreboard.
2439 enum STALL_AT_PIXEL_SCOREBOARD
2440 {
2441 STALL_AT_PIXEL_SCOREBOARD_DISABLE = 0, //!< Stall at the pixel scoreboard is disabled.
2442 STALL_AT_PIXEL_SCOREBOARD_ENABLE = 1, //!< Stall at the pixel scoreboard is enabled.
2443 };
2444
2445 //! \brief RENDER_TARGET_CACHE_FLUSH_ENABLE
2446 //! \details
2447 //! <p>Setting this bit will force Render Cache to be flushed to memory
2448 //! prior to this synchronization point completing. This bit must be set for
2449 //! all write fence sync operations to assure that results from operations
2450 //! initiated prior to this command are visible in memory once software
2451 //! observes this synchronization.</p>
2452 enum RENDER_TARGET_CACHE_FLUSH_ENABLE
2453 {
2454 RENDER_TARGET_CACHE_FLUSH_ENABLE_DISABLEFLUSH = 0, //!< Render Target Cache is NOT flushed.
2455 RENDER_TARGET_CACHE_FLUSH_ENABLE_ENABLEFLUSH = 1, //!< Render Target Cache is flushed.
2456 };
2457
2458 //! \brief DEPTH_STALL_ENABLE
2459 //! \details
2460 //! <p>This bit must be set when obtaining a "visible pixel" count to
2461 //! preclude the possible inclusion in the PS_DEPTH_COUNT value written to
2462 //! memory of some fraction of pixels from objects initiated after the
2463 //! PIPE_CONTROL command.</p>
2464 enum DEPTH_STALL_ENABLE
2465 {
2466 DEPTH_STALL_ENABLE_DISABLE = 0, //!< 3D pipeline will not stall subsequent primitives at the Depth Test stage.
2467 DEPTH_STALL_ENABLE_ENABLE = 1, //!< 3D pipeline will stall any subsequent primitives at the Depth Test stage until the Sync and Post-Sync operations complete.
2468 };
2469
2470 //! \brief POST_SYNC_OPERATION
2471 //! \details
2472 //! This field specifies an optional action to be taken upon completion of
2473 //! the synchronization operation.
2474 enum POST_SYNC_OPERATION
2475 {
2476 POST_SYNC_OPERATION_NOWRITE = 0, //!< No write occurs as a result of this instruction. This can be used to implement a "trap" operation, etc.
2477 POST_SYNC_OPERATION_WRITEIMMEDIATEDATA = 1, //!< Write the QWord containing Immediate Data Low, High DWs to the Destination Address
2478 POST_SYNC_OPERATION_WRITEPSDEPTHCOUNT = 2, //!< Write the 64-bit PS_DEPTH_COUNT register to the Destination Address
2479 POST_SYNC_OPERATION_WRITETIMESTAMP = 3, //!< Write the 64-bit TIMESTAMP register(i.e. "Reported Timestamp Count" 0x2358 for render pipe) to the Destination Address.
2480 };
2481
2482 //! \brief GLOBAL_SNAPSHOT_COUNT_RESET
2483 //! \details
2484 //! <p>This debug mode bit must not be exercised on any product.</p>
2485 enum GLOBAL_SNAPSHOT_COUNT_RESET
2486 {
2487 GLOBAL_SNAPSHOT_COUNT_RESET_DONTRESET = 0, //!< Do not reset the snapshot counts or Statistics Counters.
2488 GLOBAL_SNAPSHOT_COUNT_RESET_RESET = 1, //!< Reset the snapshot count in Gen4 for all the units and reset the Statistics Counters except as noted above.
2489 };
2490
2491 //! \brief LRI_POST_SYNC_OPERATION
2492 //! \details
2493 //! This bit caues a post sync operation with an LRI (Load Register
2494 //! Immediate) operation. If this bit is set then the Post-Sync Operation
2495 //! field must be cleared.
2496 enum LRI_POST_SYNC_OPERATION
2497 {
2498 LRI_POST_SYNC_OPERATION_NOLRIOPERATION = 0, //!< No LRI operation occurs as a result of this instruction. The Post-Sync Operation field is valid and may be used to specify an operation.
2499 LRI_POST_SYNC_OPERATION_MMIOWRITEIMMEDIATEDATA = 1, //!< Write the DWord contained in Immediate Data Low (DW3) to the MMIO offset specifed in the Address field.
2500 };
2501
2502 //! \brief DESTINATION_ADDRESS_TYPE
2503 //! \details
2504 //! Defines address space of Destination Address
2505 enum DESTINATION_ADDRESS_TYPE
2506 {
2507 DESTINATION_ADDRESS_TYPE_PPGTT = 0, //!< Use PPGTT address space for DW write
2508 DESTINATION_ADDRESS_TYPE_GGTT = 1, //!< Use GGTT address space for DW write
2509 };
2510
2511 //! \brief TILE_CACHE_FLUSH_ENABLE
2512 //! \details
2513 //! <p>Setting this bit will force Tile Cache (contains both color and depth
2514 //! data) to be flushed to memory prior to this synchronization point
2515 //! completing. This bit must be set for all write fence sync operations to
2516 //! assure that results from operations initiated prior to this command are
2517 //! visible in memory once software observes this synchronization.</p>
2518 //! <p></p>
2519 enum TILE_CACHE_FLUSH_ENABLE
2520 {
2521 TILE_CACHE_FLUSH_ENABLE_UNNAMED0 = 0, //!< Tile Cache is not flushed.
2522 TILE_CACHE_FLUSH_ENABLE_UNNAMED1 = 1, //!< Tile cache is flushed.
2523 };
2524
2525 //! \name Initializations
2526
2527 //! \brief Explicit member initialization function
2528 PIPE_CONTROL_CMD();
2529
2530 static const size_t dwSize = 6;
2531 static const size_t byteSize = 24;
2532 };
2533
2534 //!
2535 //! \brief MFX_WAIT
2536 //! \details
2537 //! This command can be considered the same as an MI_NOOP except that the
2538 //! command parser will not parse the next command until the following
2539 //! happens AVC or VC1 BSD mode: The command will stall the parser until
2540 //! completion of the BSD object
2541 //! IT, encoder, and MPEG2 BSD mode: The command will stall the parser
2542 //! until the object package is sent down the pipelineThis command should be
2543 //! used to ensure the preemption enable window occurs during the time the
2544 //! object command is being executed down the pipeline.
2545 //!
2546 //!
2547 struct MFX_WAIT_CMD
2548 {
2549 union
2550 {
2551 //!< DWORD 0
2552 struct
2553 {
2554 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 5) ; //!< DWORD_LENGTH
2555 uint32_t Reserved6 : __CODEGEN_BITFIELD( 6, 7) ; //!< Reserved
2556 uint32_t MfxSyncControlFlag : __CODEGEN_BITFIELD( 8, 8) ; //!< MFX Sync Control Flag
2557 uint32_t Reserved9 : __CODEGEN_BITFIELD( 9, 15) ; //!< Reserved
2558 uint32_t SubOpcode : __CODEGEN_BITFIELD(16, 26) ; //!< SUB_OPCODE
2559 uint32_t CommandSubtype : __CODEGEN_BITFIELD(27, 28) ; //!< COMMAND_SUBTYPE
2560 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
2561 };
2562 uint32_t Value;
2563 } DW0;
2564
2565 //! \name Local enumerations
2566
2567 enum SUB_OPCODE
2568 {
2569 SUB_OPCODE_MFXWAIT = 0, //!< No additional details
2570 };
2571
2572 enum COMMAND_SUBTYPE
2573 {
2574 COMMAND_SUBTYPE_MFXSINGLEDW = 1, //!< No additional details
2575 };
2576
2577 enum COMMAND_TYPE
2578 {
2579 COMMAND_TYPE_PARALLELVIDEOPIPE = 3, //!< No additional details
2580 };
2581
2582 //! \name Initializations
2583
2584 //! \brief Explicit member initialization function
2585 MFX_WAIT_CMD();
2586
2587 static const size_t dwSize = 1;
2588 static const size_t byteSize = 4;
2589 };
2590
2591 //!
2592 //! \brief MEDIA_STATE_FLUSH
2593 //! \details
2594 //! This command updates the Message Gateway state. In particular, it
2595 //! updates the state for a selected Interface Descriptor.
2596 //!
2597 //! This command can be considered same as a MI_Flush except that only media
2598 //! parser will get flushed instead of the entire 3D/media render pipeline.
2599 //! The command should be programmed prior to new Media state, curbe and/or
2600 //! interface descriptor commands when switching to a new context or
2601 //! programming new state for the same context. With this command, pipelined
2602 //! state change is allowed for the media pipe.
2603 //!
2604 //! Be cautious when using this command when child_present flag in the media
2605 //! state is enabled. This is because that CURBE state as well as Interface
2606 //! Descriptor state are shared between root threads and child threads.
2607 //! Changing these states while child threads are generated on the fly may
2608 //! cause unexpected behavior. Combining with MI_ARB_ON/OFF command, it is
2609 //! possible to support interruptability with the following command sequence
2610 //! where interrupt may be allowed only when MI_ARB_ON_OFF is ON:
2611 //!
2612 //! <pre>MEDIA_STATE_FLUSH
2613 //! VFE_STATE VFE will hold CS if watermark isn't met
2614 //! MI_ARB_OFF There must be at least one VFE command before this one
2615 //! MEDIA_OBJECT ... MI_ARB_ON</pre>
2616 //!
2617 struct MEDIA_STATE_FLUSH_CMD
2618 {
2619 union
2620 {
2621 //!< DWORD 0
2622 struct
2623 {
2624 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 15) ; //!< DWORD_LENGTH
2625 uint32_t Subopcode : __CODEGEN_BITFIELD(16, 23) ; //!< SUBOPCODE
2626 uint32_t MediaCommandOpcode : __CODEGEN_BITFIELD(24, 26) ; //!< MEDIA_COMMAND_OPCODE
2627 uint32_t Pipeline : __CODEGEN_BITFIELD(27, 28) ; //!< PIPELINE
2628 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
2629 };
2630 uint32_t Value;
2631 } DW0;
2632 union
2633 {
2634 //!< DWORD 1
2635 struct
2636 {
2637 uint32_t InterfaceDescriptorOffset : __CODEGEN_BITFIELD( 0, 5) ; //!< Interface Descriptor Offset
2638 uint32_t Reserved38 : __CODEGEN_BITFIELD( 6, 6) ; //!< Reserved
2639 uint32_t FlushToGo : __CODEGEN_BITFIELD( 7, 7) ; //!< Flush to GO
2640 uint32_t Reserved40 : __CODEGEN_BITFIELD( 8, 31) ; //!< Reserved
2641 };
2642 uint32_t Value;
2643 } DW1;
2644
2645 //! \name Local enumerations
2646
2647 enum SUBOPCODE
2648 {
2649 SUBOPCODE_MEDIASTATEFLUSHSUBOP = 4, //!< No additional details
2650 };
2651
2652 enum MEDIA_COMMAND_OPCODE
2653 {
2654 MEDIA_COMMAND_OPCODE_MEDIASTATEFLUSH = 0, //!< No additional details
2655 };
2656
2657 enum PIPELINE
2658 {
2659 PIPELINE_MEDIA = 2, //!< No additional details
2660 };
2661
2662 enum COMMAND_TYPE
2663 {
2664 COMMAND_TYPE_GFXPIPE = 3, //!< No additional details
2665 };
2666
2667 //! \name Initializations
2668
2669 //! \brief Explicit member initialization function
2670 MEDIA_STATE_FLUSH_CMD();
2671
2672 static const size_t dwSize = 2;
2673 static const size_t byteSize = 8;
2674 };
2675
2676 //!
2677 //! \brief VD_CONTROL_STATE
2678 //! \details
2679 //! This command can be used in HCP or VDENC pipe.
2680 //! For HCP, it is selected withthe Media Instruction Opcode "7h".
2681 //! For VDENC, it is selected withthe Media Instruction Opcode "1h".
2682 //! Eachcommand has assigned a media instruction command as defined in DWord
2683 //! 0, BitField 22:16. It will be different between HCP and VDENC.
2684 //!
2685 //! This command is used to modify the control of HCP or VDENC pipe. It can
2686 //! be inserted anywhere within a frame. I can be inserted multiple times
2687 //! within a frame as well.
2688 //!
2689 struct VD_CONTROL_STATE_CMD
2690 {
2691 union
2692 {
2693 //!< DWORD 0
2694 struct
2695 {
2696 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 11) ; //!< DWORD_LENGTH
2697 uint32_t Reserved12 : __CODEGEN_BITFIELD(12, 15) ; //!< Reserved
2698 uint32_t MediaInstructionCommand : __CODEGEN_BITFIELD(16, 22) ; //!< MEDIA_INSTRUCTION_COMMAND
2699 uint32_t MediaInstructionOpcode : __CODEGEN_BITFIELD(23, 26) ; //!< MEDIA_INSTRUCTION_OPCODE
2700 uint32_t PipelineType : __CODEGEN_BITFIELD(27, 28) ; //!< PIPELINE_TYPE
2701 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
2702 };
2703 uint32_t Value;
2704 } DW0;
2705 union
2706 {
2707 //!< DWORD 1
2708 struct
2709 {
2710 uint32_t PipelineInitialization : __CODEGEN_BITFIELD( 0, 0) ; //!< Pipeline Initialization
2711 uint32_t Reserved33 : __CODEGEN_BITFIELD( 1, 31) ; //!< Reserved
2712 };
2713 uint32_t Value;
2714 } DW1;
2715 union
2716 {
2717 //!< DWORD 2
2718 struct
2719 {
2720 uint32_t ScalableModePipeLock : __CODEGEN_BITFIELD( 0, 0) ; //!< Scalable Mode Pipe Lock
2721 uint32_t ScalableModePipeUnlock : __CODEGEN_BITFIELD( 1, 1) ; //!< Scalable Mode Pipe Unlock
2722 uint32_t MemoryImplicitFlush : __CODEGEN_BITFIELD( 2, 2) ; //!< Memory Implicit Flush
2723 uint32_t Reserved67 : __CODEGEN_BITFIELD( 3, 31) ; //!< Reserved
2724 };
2725 uint32_t Value;
2726 } DW2;
2727
2728 //! \name Local enumerations
2729
2730 enum MEDIA_INSTRUCTION_COMMAND
2731 {
2732 MEDIA_INSTRUCTION_COMMAND_VDCONTROLSTATEFORHCP = 10, //!< No additional details
2733 MEDIA_INSTRUCTION_COMMAND_VDCONTROLSTATEFORVDENC = 11, //!< No additional details
2734 };
2735
2736 //! \brief MEDIA_INSTRUCTION_OPCODE
2737 //! \details
2738 //! <p>Codec/Engine Name = HCP = 7h;</p>
2739 //! <p>Codec/Engine Name = VDNEC = 1h;</p>
2740 //! <p>Codec/Engine Name = AVP = 3h;</p>
2741 enum MEDIA_INSTRUCTION_OPCODE
2742 {
2743 MEDIA_INSTRUCTION_OPCODE_CODECENGINENAMEFORVDENC = 1, //!< No additional details
2744 MEDIA_INSTRUCTION_OPCODE_CODECENGINENAMEFORHCP = 7, //!< No additional details
2745 MEDIA_INSTRUCTION_OPCODE_CODECENGINENAMEFORAVP = 3, //!< No additional details
2746 };
2747
2748 enum PIPELINE_TYPE
2749 {
2750 PIPELINE_TYPE_UNNAMED2 = 2, //!< No additional details
2751 };
2752
2753 enum COMMAND_TYPE
2754 {
2755 COMMAND_TYPE_PARALLELVIDEOPIPE = 3, //!< No additional details
2756 };
2757
2758 //! \name Initializations
2759
2760 //! \brief Explicit member initialization function
2761 VD_CONTROL_STATE_CMD();
2762
2763 static const size_t dwSize = 3;
2764 static const size_t byteSize = 12;
2765 };
2766
2767 };
2768
2769 #pragma pack()
2770
2771 #endif // __MHW_MI_HWCMD_G12_X_H__