Debian Codegraph @

media_driver/agnostic/gen9/hw/mhw_mi_hwcmd_g9_X.h

raw
1 /*
2 * Copyright (c) 2017, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file mhw_mi_hwcmd_g9_X.h
24 //! \brief Auto-generated constructors for MHW and states.
25 //! \details This file may not be included outside of g9_X as other components
26 //! should use MHW interface to interact with MHW commands and states.
27 //!
28 #ifndef __MHW_MI_HWCMD_G9_X_H__
29 #define __MHW_MI_HWCMD_G9_X_H__
30
31 #pragma once
32
33 #include <cstdint>
34 #include <cstddef>
35
36 #pragma pack(1)
37
38 class mhw_mi_g9_X
39 {
40 public:
41 // Internal Macros
42 #define __CODEGEN_MAX(_a, _b) (((_a) > (_b)) ? (_a) : (_b))
43 #define __CODEGEN_BITFIELD(l, h) (h) - (l) + 1
44 #define __CODEGEN_OP_LENGTH_BIAS 2
45 #define __CODEGEN_OP_LENGTH(x) (uint32_t)((__CODEGEN_MAX(x, __CODEGEN_OP_LENGTH_BIAS)) - __CODEGEN_OP_LENGTH_BIAS)
46
47 static uint32_t GetOpLength(uint32_t uiLength) { return __CODEGEN_OP_LENGTH(uiLength); }
48
49 //!
50 //! \brief MI_BATCH_BUFFER_END
51 //! \details
52 //! The MI_BATCH_BUFFER_END command is used to terminate the execution of
53 //! commands stored in a batch buffer initiated using a
54 //! MI_BATCH_BUFFER_START command.
55 //!
56 struct MI_BATCH_BUFFER_END_CMD
57 {
58 union
59 {
60 //!< DWORD 0
61 struct
62 {
63 uint32_t Reserved0 : __CODEGEN_BITFIELD( 0, 22) ; //!< Reserved
64 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
65 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
66 };
67 uint32_t Value;
68 } DW0;
69
70 //! \name Local enumerations
71
72 enum MI_COMMAND_OPCODE
73 {
74 MI_COMMAND_OPCODE_MIBATCHBUFFEREND = 10, //!< No additional details
75 };
76
77 enum COMMAND_TYPE
78 {
79 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
80 };
81
82 //! \name Initializations
83
84 //! \brief Explicit member initialization function
85 MI_BATCH_BUFFER_END_CMD();
86
87 static const size_t dwSize = 1;
88 static const size_t byteSize = 4;
89 };
90
91 //!
92 //! \brief MI_NOOP
93 //! \details
94 //! The MI_NOOP command basically performs a "no operation" in the command
95 //! stream and is typically used to pad the command stream (e.g., in order
96 //! to pad out a batch buffer to a QWord boundary). However, there is one
97 //! minor (optional) function this command can perform - a 22-bit value can
98 //! be loaded into the MI NOPID register. This provides a general-purpose
99 //! command stream tagging ("breadcrumb") mechanism (e.g., to provide
100 //! sequencing information for a subsequent breakpoint interrupt).
101 //!
102 struct MI_NOOP_CMD
103 {
104 union
105 {
106 //!< DWORD 0
107 struct
108 {
109 uint32_t IdentificationNumber : __CODEGEN_BITFIELD( 0, 21) ; //!< Identification Number
110 uint32_t IdentificationNumberRegisterWriteEnable : __CODEGEN_BITFIELD(22, 22) ; //!< IDENTIFICATION_NUMBER_REGISTER_WRITE_ENABLE
111 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
112 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
113 };
114 uint32_t Value;
115 } DW0;
116
117 //! \name Local enumerations
118
119 //! \brief IDENTIFICATION_NUMBER_REGISTER_WRITE_ENABLE
120 //! \details
121 //! This field enables the value in the Identification Number field to be
122 //! written into the MI NOPID register. If disabled, that register is
123 //! unmodified - making this command an effective "no operation" function.
124 enum IDENTIFICATION_NUMBER_REGISTER_WRITE_ENABLE
125 {
126 IDENTIFICATION_NUMBER_REGISTER_WRITE_ENABLE_WRITETHENOPIDREGISTER = 1, //!< No additional details
127 };
128
129 enum MI_COMMAND_OPCODE
130 {
131 MI_COMMAND_OPCODE_MINOOP = 0, //!< No additional details
132 };
133
134 enum COMMAND_TYPE
135 {
136 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
137 };
138
139 //! \name Initializations
140
141 //! \brief Explicit member initialization function
142 MI_NOOP_CMD();
143
144 static const size_t dwSize = 1;
145 static const size_t byteSize = 4;
146 };
147
148 //!
149 //! \brief MI_ARB_CHECK
150 //! \details
151 //! The MI_ARB_CHECK is used to check for a change in arbitration. If
152 //! executed as part of a Ring Buffer the command checks the UHPTR valid bit
153 //! and if set the head of the ring will jump to the value of the head
154 //! pointer programmed in the UHPTR.
155 //!
156 //! This instruction cannot be placed in a batch buffer.
157 //!
158 //! If execlist is enabled, there is a pending execution list and this
159 //! command is parsed, then the command streamer will preempt the current
160 //! context and start executing the new execution list.
161 //!
162 struct MI_ARB_CHECK_CMD
163 {
164 union
165 {
166 //!< DWORD 0
167 struct
168 {
169 uint32_t Reserved0 : __CODEGEN_BITFIELD( 0, 22) ; //!< Reserved
170 uint32_t MiInstructionOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_INSTRUCTION_OPCODE
171 uint32_t MiInstructionType : __CODEGEN_BITFIELD(29, 31) ; //!< MI_INSTRUCTION_TYPE
172 };
173 uint32_t Value;
174 } DW0;
175
176 //! \name Local enumerations
177
178 enum MI_INSTRUCTION_OPCODE
179 {
180 MI_INSTRUCTION_OPCODE_MIARBCHECK = 5, //!< No additional details
181 };
182
183 enum MI_INSTRUCTION_TYPE
184 {
185 MI_INSTRUCTION_TYPE_MIINSTRUCTION = 0, //!< No additional details
186 };
187
188 //! \name Initializations
189
190 //! \brief Explicit member initialization function
191 MI_ARB_CHECK_CMD();
192
193 static const size_t dwSize = 1;
194 static const size_t byteSize = 4;
195 };
196
197 //!
198 //! \brief MI_LOAD_REGISTER_IMM
199 //! \details
200 //! The MI_LOAD_REGISTER_IMM command requests a write of up to a DWord
201 //! constant supplied in the command to the specified Register Offset (i.e.,
202 //! offset into Memory-Mapped Register Range).
203 //! Any offset that is to a destination outside of the GT core will allow
204 //! the parser to continue once the cycle is at the GT boundry and not
205 //! destination. Any other address will ensure the destination is updated
206 //! prior to parsing the next command
207 //!
208 //! When executed from a non-privileged batch buffer, MMIO writes are only
209 //! allowed to the registers listed in User Mode Non-Privileged Registers
210 //! for the corresponding engine, any writes targeting the register not
211 //! listed in the User Mode Non-Privileged Register will convert this
212 //! command to a NOOP.
213 //!
214 //! The following addresses should NOT be used for LRIs:
215 //!
216 //! 0x8800 - 0x88FF
217 //!
218 //! >= 0xC0000
219 //!
220 //!
221 //!
222 //! Limited LRI cycles to the Display Engine (0x40000-0xBFFFF) are allowed,
223 //! but must be spaced to allow only one pending at a time. This can be done
224 //! by issuing an SRM to the same address immediately after each LRI.
225 //!
226 struct MI_LOAD_REGISTER_IMM_CMD
227 {
228 union
229 {
230 //!< DWORD 0
231 struct
232 {
233 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
234 uint32_t ByteWriteDisables : __CODEGEN_BITFIELD( 8, 11) ; //!< Byte Write Disables
235 uint32_t Reserved12 : __CODEGEN_BITFIELD(12, 22) ; //!< Reserved
236 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
237 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
238 };
239 uint32_t Value;
240 } DW0;
241 union
242 {
243 //!< DWORD 1
244 struct
245 {
246 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
247 uint32_t RegisterOffset : __CODEGEN_BITFIELD( 2, 22) ; //!< Register Offset
248 uint32_t Reserved55 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved
249 };
250 uint32_t Value;
251 } DW1;
252 union
253 {
254 //!< DWORD 2
255 struct
256 {
257 uint32_t DataDword ; //!< Data DWord
258 };
259 uint32_t Value;
260 } DW2;
261
262 //! \name Local enumerations
263
264 enum MI_COMMAND_OPCODE
265 {
266 MI_COMMAND_OPCODE_MILOADREGISTERIMM = 34, //!< No additional details
267 };
268
269 enum COMMAND_TYPE
270 {
271 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
272 };
273
274 //! \name Initializations
275
276 //! \brief Explicit member initialization function
277 MI_LOAD_REGISTER_IMM_CMD();
278
279 static const size_t dwSize = 3;
280 static const size_t byteSize = 12;
281 };
282
283 //!
284 //! \brief MI_LOAD_REGISTER_MEM
285 //! \details
286 //! The MI_LOAD_REGISTER_MEM command requests from a memory location and
287 //! stores that DWord to a register.
288 //!
289 //! The command temporarily halts commands that will cause cycles down the
290 //! 3D pipeline.
291 //!
292 //! The following addresses should NOT be used for MMIO writes:
293 //!
294 //! 0x8800 - 0x88FF
295 //!
296 //! >= 0xC0000
297 //!
298 //!
299 //!
300 //! Limited MMIO writes cycles to the Display Engine 0x40000-0xBFFFF) are
301 //! allowed, but must be spaced to allow only one pending at a time. This
302 //! can be done by issuing an SRM to the same address immediately after each
303 //! MMIO write.
304 //!
305 //! This command should not be used within a non-privilege batch buffer to
306 //! access global virtual space, doing so will be treated as privilege
307 //! access violation. Refer "User Mode Privilege Command" in
308 //! MI_BATCH_BUFFER_START command section to know HW behavior on
309 //! encountering privilege access violation.
310 //!
311 //! This command is not allowed to update the privilege register range when
312 //! executed from a non-privilege batch buffer.
313 //!
314 struct MI_LOAD_REGISTER_MEM_CMD
315 {
316 union
317 {
318 //!< DWORD 0
319 struct
320 {
321 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
322 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 20) ; //!< Reserved
323 uint32_t AsyncModeEnable : __CODEGEN_BITFIELD(21, 21) ; //!< Async Mode Enable
324 uint32_t UseGlobalGtt : __CODEGEN_BITFIELD(22, 22) ; //!< Use Global GTT
325 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
326 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
327 };
328 uint32_t Value;
329 } DW0;
330 union
331 {
332 //!< DWORD 1
333 struct
334 {
335 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
336 uint32_t RegisterAddress : __CODEGEN_BITFIELD( 2, 22) ; //!< Register Address
337 uint32_t Reserved55 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved
338 };
339 uint32_t Value;
340 } DW1;
341 union
342 {
343 //!< DWORD 2..3
344 struct
345 {
346 uint64_t Reserved64 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
347 uint64_t MemoryAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Memory Address
348 };
349 uint32_t Value[2];
350 } DW2_3;
351
352 //! \name Local enumerations
353
354 enum MI_COMMAND_OPCODE
355 {
356 MI_COMMAND_OPCODE_MILOADREGISTERMEM = 41, //!< No additional details
357 };
358
359 enum COMMAND_TYPE
360 {
361 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
362 };
363
364 //! \name Initializations
365
366 //! \brief Explicit member initialization function
367 MI_LOAD_REGISTER_MEM_CMD();
368
369 static const size_t dwSize = 4;
370 static const size_t byteSize = 16;
371 };
372
373 //!
374 //! \brief MI_LOAD_REGISTER_REG
375 //! \details
376 //! The MI_LOAD_REGISTER_REG command reads from a source register location
377 //! and writes that value to a destination register location.
378 //! Any offset that is to a destination outside of the GT core will allow
379 //! the parser to continue once the cycle is at the GT boundry and not
380 //! destination.  Any other address will ensure the destination is updated
381 //! prior to parsing the next command
382 //!
383 //! The command temporarily halts commands that will cause cycles down the
384 //! 3D pipeline.
385 //!
386 //! Destination register with mask implemented (Ex: some
387 //! registers have bits [31:16] as mask bits and bits[15:0] as data) will
388 //! not get updated unless the value read from source register has the bits
389 //! corresponding to the mask bits set. Note that any mask implemented
390 //! register when read returns "0" for the bits corresponding to mask
391 //! location. When the source and destination are mask implemented
392 //! registers, destination register will not get updated with the source
393 //! register contents.
394 //!
395 //! This command is not allowed to update the privilege register range when
396 //! executed from a non-privilege batch buffer.
397 //!
398 struct MI_LOAD_REGISTER_REG_CMD
399 {
400 union
401 {
402 //!< DWORD 0
403 struct
404 {
405 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
406 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 22) ; //!< Reserved
407 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
408 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
409 };
410 uint32_t Value;
411 } DW0;
412 union
413 {
414 //!< DWORD 1
415 struct
416 {
417 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
418 uint32_t SourceRegisterAddress : __CODEGEN_BITFIELD( 2, 22) ; //!< Source Register Address
419 uint32_t Reserved55 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved
420 };
421 uint32_t Value;
422 } DW1;
423 union
424 {
425 //!< DWORD 2
426 struct
427 {
428 uint32_t Reserved64 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
429 uint32_t DestinationRegisterAddress : __CODEGEN_BITFIELD( 2, 22) ; //!< Destination Register Address
430 uint32_t Reserved87 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved
431 };
432 uint32_t Value;
433 } DW2;
434
435 //! \name Local enumerations
436
437 enum MI_COMMAND_OPCODE
438 {
439 MI_COMMAND_OPCODE_MILOADREGISTERREG = 42, //!< No additional details
440 };
441
442 enum COMMAND_TYPE
443 {
444 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
445 };
446
447 //! \name Initializations
448
449 //! \brief Explicit member initialization function
450 MI_LOAD_REGISTER_REG_CMD();
451
452 static const size_t dwSize = 3;
453 static const size_t byteSize = 12;
454 };
455
456 //!
457 //! \brief MI_STORE_REGISTER_MEM
458 //! \details
459 //! The MI_STORE_REGISTER_MEM command requests a register read from a
460 //! specified memory mapped register location in the device and store of
461 //! that DWord to memory. The register address is specified along with the
462 //! command to perform the read.
463 //!
464 //!
465 //! The command temporarily halts command execution.
466 //!
467 //! The memory address for the write is snooped on the host bus.
468 //!
469 //! This command should not be used from within a "non-privilege" batch
470 //! buffer to access global virtual space. doing so will be treated as
471 //! privilege access violation. Refer "User Mode Privilege Command" in
472 //! MI_BATCH_BUFFER_START command section to know HW behavior on
473 //! encountering privilege access violation. This command can be used within
474 //! ring buffers and/or "privilege" batch buffers to access global virtual
475 //! space.
476 //!
477 //! This command will cause undefined data to be written to memory if given
478 //! register addresses for the PGTBL_CTL_0 or FENCE registers.
479 //!
480 struct MI_STORE_REGISTER_MEM_CMD
481 {
482 union
483 {
484 //!< DWORD 0
485 struct
486 {
487 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
488 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 21) ; //!< Reserved
489 uint32_t UseGlobalGtt : __CODEGEN_BITFIELD(22, 22) ; //!< Use Global GTT
490 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
491 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
492 };
493 uint32_t Value;
494 } DW0;
495 union
496 {
497 //!< DWORD 1
498 struct
499 {
500 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
501 uint32_t RegisterAddress : __CODEGEN_BITFIELD( 2, 22) ; //!< Register Address
502 uint32_t Reserved55 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved
503 };
504 uint32_t Value;
505 } DW1;
506 union
507 {
508 //!< DWORD 2..3
509 struct
510 {
511 uint64_t Reserved64 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
512 uint64_t MemoryAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Memory Address
513 };
514 uint32_t Value[2];
515 } DW2_3;
516
517 //! \name Local enumerations
518
519 enum MI_COMMAND_OPCODE
520 {
521 MI_COMMAND_OPCODE_MISTOREREGISTERMEM = 36, //!< No additional details
522 };
523
524 enum COMMAND_TYPE
525 {
526 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
527 };
528
529 //! \name Initializations
530
531 //! \brief Explicit member initialization function
532 MI_STORE_REGISTER_MEM_CMD();
533
534 static const size_t dwSize = 4;
535 static const size_t byteSize = 16;
536 };
537
538 //!
539 //! \brief MI_BATCH_BUFFER_START
540 //! \details
541 //! The MI_BATCH_BUFFER_START command is used to initiate the execution of
542 //! commands stored in a batch buffer. For restrictions on the location of
543 //! batch buffers, see Batch Buffers in the Device Programming Interface
544 //! chapter of MI Functions. The batch buffer can be specified as privileged
545 //! or non-privileged, determining the operations considered valid when
546 //! initiated from within the buffer and any attached (chained) batch
547 //! buffers. See Batch Buffer Protection in the Device Programming Interface
548 //! chapter of MI Functions. 
549 //!
550 //! A batch buffer initiated with this command must end either with a
551 //! MI_BATCH_BUFFER_END command or by chaining to another batch buffer with
552 //! an MI_BATCH_BUFFER_START command.
553 //! It is essential that the address location beyond the current page be
554 //! populated inside the GTT. HW performs over-fetch of the command
555 //! addresses and any over-fetch requires a valid TLB entry. A single extra
556 //! page beyond the batch buffer is sufficient.
557 //!
558 //!
559 //!
560 //! SW must ensure to reset the state of the second level batch buffer prior
561 //! to programming second level batch buffer. This must be done by
562 //! programming MI_LOAD_REGISTER_IMM command to program SBB_STATE register
563 //! with 0x0 value prior to programming MI_BATCH_BUFFER_START command for
564 //! the second level batch buffer. SBB_STATE register seleected must be the
565 //! offset belonging to the command streamer on which the second level batch
566 //! buffer will be executed.  OR
567 //!
568 //! Above programming is not required if second level batch buffer
569 //! programmed in a given batch buffer chain is always non-privileged OR
570 //!
571 //! Above programming is not required if the second level batch buffer is
572 //! being called from a non-privileged batch buffer. 
573 //!
574 //! A batch buffer is treated as non-privileged if the Address Space
575 //! Indicator is set to PPGTT.
576 //!
577 struct MI_BATCH_BUFFER_START_CMD
578 {
579 union
580 {
581 //!< DWORD 0
582 struct
583 {
584 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
585 uint32_t AddressSpaceIndicator : __CODEGEN_BITFIELD( 8, 8) ; //!< ADDRESS_SPACE_INDICATOR
586 uint32_t Reserved9 : __CODEGEN_BITFIELD( 9, 21) ; //!< Reserved
587 uint32_t SecondLevelBatchBuffer : __CODEGEN_BITFIELD(22, 22) ; //!< SECOND_LEVEL_BATCH_BUFFER
588 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
589 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
590 };
591 uint32_t Value;
592 } DW0;
593 union
594 {
595 //!< DWORD 1..2
596 struct
597 {
598 uint64_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
599 uint64_t BatchBufferStartAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Batch Buffer Start Address
600 };
601 uint32_t Value[2];
602 } DW1_2;
603
604 //! \name Local enumerations
605
606 //! \brief ADDRESS_SPACE_INDICATOR
607 //! \details
608 //! <p>Batch buffers accessed via PPGTT are considered as non-privileged.
609 //! Certain operations (e.g., MI_STORE_DATA_IMM commands to GGTT memory) are
610 //! prohibited within non-privileged buffers. More details mentioned in User
611 //! Mode Privileged command section. When MI_BATCH_BUFFER_START command is
612 //! executed from within a batch buffer (i.e., is a "chained" or "second
613 //! level" batch buffer command), the current active batch buffer's "Address
614 //! Space Indicator" and this field determine the "Address Space Indicator"
615 //! of the next buffer in the chain.</p>
616 //! <ul>
617 //! <li>Chained or Second level batch buffer can be in GGTT or PPGTT if the
618 //! parent batch buffer is in GGTT.</li>
619 //! <li>Chained or Second level batch buffer can only be in PPGTT if the
620 //! parent batch buffer is in PPGTT. This is enforced by Hardware.</li>
621 //! </ul>
622 enum ADDRESS_SPACE_INDICATOR
623 {
624 ADDRESS_SPACE_INDICATOR_GGTT = 0, //!< This batch buffer is located in GGTT memory and is privileged.
625 ADDRESS_SPACE_INDICATOR_PPGTT = 1, //!< This batch buffer is located in PPGTT memory and is Non-Privileged.
626 };
627
628 //! \brief SECOND_LEVEL_BATCH_BUFFER
629 //! \details
630 //! <p>The command streamer contains three storage elements; one for the
631 //! ring head address, one for the batch head address, and one for the
632 //! second level batch head address. When performing batch buffer chaining,
633 //! hardware simply updates the head pointer of the first level batch
634 //! address storage. There is no stack in hardware. When this bit is set,
635 //! hardware uses the 2nd level batch head address storage element. Upon
636 //! MI_BATCH_BUFFER_END, it will automatically return to the first level
637 //! batch buffer address. This allows hardware to mimic a simple 3-level
638 //! stack.</p>
639 enum SECOND_LEVEL_BATCH_BUFFER
640 {
641 SECOND_LEVEL_BATCH_BUFFER_FIRSTLEVELBATCH = 0, //!< Place the batch buffer address in the 1st (traditional) level batch address storage element.
642 SECOND_LEVEL_BATCH_BUFFER_SECONDLEVELBATCH = 1, //!< Place the batch buffer address in the second-level batch address storage element.
643 };
644
645 enum MI_COMMAND_OPCODE
646 {
647 MI_COMMAND_OPCODE_MIBATCHBUFFERSTART = 49, //!< No additional details
648 };
649
650 enum COMMAND_TYPE
651 {
652 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
653 };
654
655 //! \name Initializations
656
657 //! \brief Explicit member initialization function
658 MI_BATCH_BUFFER_START_CMD();
659
660 static const size_t dwSize = 3;
661 static const size_t byteSize = 12;
662 };
663
664 //!
665 //! \brief MI_SET_PREDICATE
666 //! \details
667 //! This command sets the Predication Check for the subsequent commands in
668 //! the command buffer except for MI_SET_PREDICATE itself. Render Command
669 //! Streamer NOOPs the following commands based on the PREDICATE_ENABLE from
670 //! MI_SET_PREDICATE, MI_SET_PREDICATE_RESULT and MI_SET_PREDICATE_RESULT_2
671 //! status. Resource Streamer doesn't take any action of parsing
672 //! MI_SET_PREDICATE, this command is similar to any other command which is
673 //! not meant for resource streamer.
674 //!
675 //! Executing MI_SET_PREDICATE command sets PREDICATE_ENABLE bits in MI_MODE
676 //! register, MI_MODE register gets render context save restored.
677 //!
678 //! MI_SET_PREDICATE predication scope must be confined within a Batch
679 //! Buffer to set of commands.
680 //! MI_SET_PREDICATE with Predicate Enable Must always have a
681 //! corresponding MI_SET_PREDICATE with Predicate Disable within the same
682 //! Batch Buffer.
683 //! MI_ARB_CHK command must be programmed outside the Predication Scope of
684 //! MI_SET_PREDICATE.
685 //! MI_SET_PREDICATE Predication Scope must not involve any RC6 triggering
686 //! events.
687 //!
688 //!
689 //! Only the following command(s) can be programmed between the
690 //! MI_SET_PREDICATE command enabled for predication: 3DSTATE_URB_VS
691 //! 3DSTATE_URB_HS 3DSTATE_URB_DS 3DSTATE_URB_GS
692 //! 3DSTATE_PUSH_CONSTANT_ALLOC_VS 3DSTATE_PUSH_CONSTANT_ALLOC_HS
693 //! 3DSTATE_PUSH_CONSTANT_ALLOC_DS 3DSTATE_PUSH_CONSTANT_ALLOC_GS
694 //! 3DSTATE_PUSH_CONSTANT_ALLOC_PS MI_LOAD_REGISTER_IMM MEDIA_VFE_STATE
695 //! MEDIA_OBJECT MEDIA_OBJJECT_WALKER MEDIA_INTERFACE_DESCRIPTOR_LOAD
696 //! 3DSTATE_WM_HZ_OP
697 //!
698 struct MI_SET_PREDICATE_CMD
699 {
700 union
701 {
702 //!< DWORD 0
703 struct
704 {
705 uint32_t PredicateEnable : __CODEGEN_BITFIELD( 0, 3) ; //!< PREDICATE_ENABLE
706 uint32_t Reserved4 : __CODEGEN_BITFIELD( 4, 22) ; //!< Reserved
707 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
708 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
709 };
710 uint32_t Value;
711 } DW0;
712
713 //! \name Local enumerations
714
715 //! \brief PREDICATE_ENABLE
716 //! \details
717 //! This field sets the predication logic in render command streamer when
718 //! parsed. Predicate Disable is the default mode of operation.
719 enum PREDICATE_ENABLE
720 {
721 PREDICATE_ENABLE_NOOPNEVER = 0, //!< Predication is Disabled and RCS will process commands as usual.
722 PREDICATE_ENABLE_NOOPONRESULT2CLEAR = 1, //!< Following Commands will be NOOPED by RCS only if the MI_PREDICATE_RESULT_2 is clear.
723 PREDICATE_ENABLE_NOOPONRESULT2SET = 2, //!< Following Commands will be NOOPED by RCS only if the MI_PREDICATE_RESULT_2 is set.
724 PREDICATE_ENABLE_NOOPONRESULTCLEAR = 3, //!< Following Commands will be NOOPED by RCS only if the MI_PREDICATE_RESULT is clear.
725 PREDICATE_ENABLE_NOOPONRESULTSET = 4, //!< Following Commands will be NOOPED by RCS only if the MI_PREDICATE_RESULT is set.
726 PREDICATE_ENABLE_EXECUTEWHENONESLICEENABLED = 5, //!< Following Commands will be Executed by RCS only when one slice is enabled.
727 PREDICATE_ENABLE_EXECUTEWHENTWOSLICESAREENABLED = 6, //!< Following Commands will be Executed by RCS only when two slices are enabled.
728 PREDICATE_ENABLE_EXECUTEWHENTHREESLICESAREENABLED = 7, //!< Following Commands will be Executed by RCS only when all the three slices are enabled.
729 PREDICATE_ENABLE_NOOPALWAYS = 15, //!< Following Commands will be NOOPED by RCS unconditionally.
730 };
731
732 enum MI_COMMAND_OPCODE
733 {
734 MI_COMMAND_OPCODE_MISETPREDICATE = 1, //!< No additional details
735 };
736
737 enum COMMAND_TYPE
738 {
739 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
740 };
741
742 //! \name Initializations
743
744 //! \brief Explicit member initialization function
745 MI_SET_PREDICATE_CMD();
746
747 static const size_t dwSize = 1;
748 static const size_t byteSize = 4;
749 };
750
751 //!
752 //! \brief MI_COPY_MEM_MEM
753 //! \details
754 //! The MI_COPY_MEM_MEM command reads a DWord from memory and stores the
755 //! value of that DWord to back to memory. The source and destination
756 //! addresses are specified in the command. The command temporarily halts
757 //! command execution.
758 //!
759 //! This command should not be used within a "non-privileged" batch buffer
760 //! to access global virtual space; doing so will be treated as privilege
761 //! access violation. Refer to the "User Mode Privilege Command" in
762 //! MI_BATCH_BUFFER_START command section to learn more about HW behavior on
763 //! encountering a privilege access violation.
764 //!
765 //! This command can be used within ring buffers and/or privilege batch
766 //! buffers to access global virtual space.
767 //!
768 struct MI_COPY_MEM_MEM_CMD
769 {
770 union
771 {
772 //!< DWORD 0
773 struct
774 {
775 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
776 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 20) ; //!< Reserved
777 uint32_t UseGlobalGttDestination : __CODEGEN_BITFIELD(21, 21) ; //!< USE_GLOBAL_GTT_DESTINATION
778 uint32_t UseGlobalGttSource : __CODEGEN_BITFIELD(22, 22) ; //!< USE_GLOBAL_GTT_SOURCE
779 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
780 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
781 };
782 uint32_t Value;
783 } DW0;
784 union
785 {
786 //!< DWORD 1..2
787 struct
788 {
789 uint64_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
790 uint64_t DestinationMemoryAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Destination Memory Address
791 };
792 uint32_t Value[2];
793 } DW1_2;
794 union
795 {
796 //!< DWORD 3..4
797 struct
798 {
799 uint64_t Reserved96 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
800 uint64_t SourceMemoryAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Source Memory Address
801 };
802 uint32_t Value[2];
803 } DW3_4;
804
805 //! \name Local enumerations
806
807 //! \brief USE_GLOBAL_GTT_DESTINATION
808 //! \details
809 //! It is allowed for this bit to be set when executing this command from a
810 //! privileged (secure) batch buffer or ring buffer. This bit must be clear
811 //! when programmed from within a non-privileged batch buffer. This bit must
812 //! be 1 if the Per Process GTT Enable bit is clear.
813 enum USE_GLOBAL_GTT_DESTINATION
814 {
815 USE_GLOBAL_GTT_DESTINATION_PERPROCESSGRAPHICSADDRESS = 0, //!< No additional details
816 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.
817 };
818
819 //! \brief USE_GLOBAL_GTT_SOURCE
820 //! \details
821 //! It is allowed for this bit to be set when executing this command from a
822 //! privileged (secure) batch buffer or ring buffer. This bit must be clear
823 //! when programmed from within a non-privileged batch buffer. This bit must
824 //! be 1 if the Per Process GTT Enable bit is clear.
825 enum USE_GLOBAL_GTT_SOURCE
826 {
827 USE_GLOBAL_GTT_SOURCE_PERPROCESSGRAPHICSADDRESS = 0, //!< No additional details
828 USE_GLOBAL_GTT_SOURCE_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.
829 };
830
831 enum MI_COMMAND_OPCODE
832 {
833 MI_COMMAND_OPCODE_MIMEMTOMEM = 46, //!< No additional details
834 };
835
836 enum COMMAND_TYPE
837 {
838 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
839 };
840
841 //! \name Initializations
842
843 //! \brief Explicit member initialization function
844 MI_COPY_MEM_MEM_CMD();
845
846 static const size_t dwSize = 5;
847 static const size_t byteSize = 20;
848 };
849
850 //!
851 //! \brief MI_STORE_DATA_IMM
852 //! \details
853 //! The MI_STORE_DATA_IMM command requests a write of the QWord constant
854 //! supplied in the packet to the specified Memory Address. As the write
855 //! targets a System Memory Address, the write operation is coherent with
856 //! the CPU cache (i.e., the processor cache is snooped).
857 //!
858 //! This command supports writing to multiple consecutive dwords or qwords
859 //! memory locations from the starting address.
860 //!
861 //! This command should not be used within a "non-privilege" batch buffer
862 //! to access global virtual space, doing so will be treated as privilege
863 //! access violation. Refer "User Mode Privilege Command" in
864 //! MI_BATCH_BUFFER_START command section to know HW behavior on
865 //! encountering privilege access violation. This command can be used within
866 //! ring buffers and/or privilege batch buffers to access global virtual
867 //! space.
868 //! This command can be used for general software synchronization through
869 //! variables in cacheable memory (i.e., where software does not need to
870 //! poll un-cached memory or device registers).
871 //! This command simply initiates the write operation with command
872 //! execution proceeding normally. Although the write operation is
873 //! guaranteed to complete eventually, there is no mechanism to synchronize
874 //! command execution with the completion (or even initiation) of these
875 //! operations.
876 //!
877 //!
878 //!
879 struct MI_STORE_DATA_IMM_CMD
880 {
881 union
882 {
883 //!< DWORD 0
884 struct
885 {
886 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 9) ; //!< DWORD_LENGTH
887 uint32_t Reserved10 : __CODEGEN_BITFIELD(10, 20) ; //!< Reserved
888 uint32_t StoreQword : __CODEGEN_BITFIELD(21, 21) ; //!< Store Qword
889 uint32_t UseGlobalGtt : __CODEGEN_BITFIELD(22, 22) ; //!< Use Global GTT
890 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
891 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
892 };
893 uint32_t Value;
894 } DW0;
895 union
896 {
897 //!< DWORD 1..2
898 struct
899 {
900 uint64_t CoreModeEnable : __CODEGEN_BITFIELD( 0, 0) ; //!< Core Mode Enable
901 uint64_t Reserved33 : __CODEGEN_BITFIELD( 1, 1) ; //!< Reserved
902 uint64_t Address : __CODEGEN_BITFIELD( 2, 63) ; //!< Address
903 };
904 uint32_t Value[2];
905 } DW1_2;
906 union
907 {
908 //!< DWORD 3
909 struct
910 {
911 uint32_t DataDword0 ; //!< Data DWord 0
912 };
913 uint32_t Value;
914 } DW3;
915 union
916 {
917 //!< DWORD 4
918 struct
919 {
920 uint32_t DataDword1 ; //!< Data DWord 1
921 };
922 uint32_t Value;
923 } DW4;
924
925 //! \name Local enumerations
926
927 enum MI_COMMAND_OPCODE
928 {
929 MI_COMMAND_OPCODE_MISTOREDATAIMM = 32, //!< No additional details
930 };
931
932 enum COMMAND_TYPE
933 {
934 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
935 };
936
937 //! \name Initializations
938
939 //! \brief Explicit member initialization function
940 MI_STORE_DATA_IMM_CMD();
941
942 static const size_t dwSize = 5;
943 static const size_t byteSize = 20;
944 };
945
946 //!
947 //! \brief MI_SEMAPHORE_SIGNAL
948 //! \details
949 //! This command is used to signal the target engine stating the memory
950 //! semaphore update occurrence to one of its contexts with Target Context
951 //! ID. MI_SEMPHORE_SIGNAL and MI_SEMAPHORE_WAIT together replace the
952 //! MI_SEMAPHORE_MBOX command on BDW. MI_ATOMIC (non-posted) command will be
953 //! programmed prior to this command to update the semaphore data in memory.
954 //!
955 struct MI_SEMAPHORE_SIGNAL_CMD
956 {
957 union
958 {
959 //!< DWORD 0
960 struct
961 {
962 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
963 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 14) ; //!< Reserved
964 uint32_t TargetEngineSelect : __CODEGEN_BITFIELD(15, 17) ; //!< TARGET_ENGINE_SELECT
965 uint32_t Reserved18 : __CODEGEN_BITFIELD(18, 22) ; //!< Reserved
966 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
967 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
968 };
969 uint32_t Value;
970 } DW0;
971 union
972 {
973 //!< DWORD 1
974 struct
975 {
976 uint32_t TargetContextId ; //!< Target Context ID
977 };
978 uint32_t Value;
979 } DW1;
980
981 //! \name Local enumerations
982
983 //! \brief TARGET_ENGINE_SELECT
984 //! \details
985 //! This field selects the target engine to which SIGNAL will be send to.
986 enum TARGET_ENGINE_SELECT
987 {
988 TARGET_ENGINE_SELECT_RCS = 0, //!< No additional details
989 TARGET_ENGINE_SELECT_VCS0 = 1, //!< No additional details
990 TARGET_ENGINE_SELECT_BCS = 2, //!< No additional details
991 TARGET_ENGINE_SELECT_VECS = 3, //!< No additional details
992 TARGET_ENGINE_SELECT_VCS1 = 4, //!< No additional details
993 };
994
995 enum MI_COMMAND_OPCODE
996 {
997 MI_COMMAND_OPCODE_MISEMAPHORESIGNAL = 27, //!< No additional details
998 };
999
1000 enum COMMAND_TYPE
1001 {
1002 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1003 };
1004
1005 //! \name Initializations
1006
1007 //! \brief Explicit member initialization function
1008 MI_SEMAPHORE_SIGNAL_CMD();
1009
1010 static const size_t dwSize = 2;
1011 static const size_t byteSize = 8;
1012 };
1013
1014 //!
1015 //! \brief MI_SEMAPHORE_WAIT
1016 //! \details
1017 //! This command supports memory based Semaphore WAIT. Memory based
1018 //! semaphores will be used for synchronization between the Producer and the
1019 //! Consumer contexts. Producer and Consumer Contexts could be running on
1020 //! different engines or on the same engine inside GT. Running on the same
1021 //! engine is only possible when execlists are enabled. Producer Context
1022 //! implements a Signal and Consumer context implements a Wait.
1023 //! Command Streamer on parsing this command fetches data from the Semaphore
1024 //! Address mentioned in this command and compares it with the inline
1025 //! Semaphore Data Dword.
1026 //!
1027 //! If comparison passes, the command streamer moves to the next command.
1028 //!
1029 //! When execlists are enabled, if comparison fails Command streamer
1030 //! switches out the context. Context switch can be inhibited by setting
1031 //! "Inhibit Synchronous Context Switch" in CTXT_SR_CTL register.
1032 //!
1033 //! In ring buffer mode of scheduling or Execlist with "Inhibit Synchronous
1034 //! context Switch", if comparison fails, Command Streamer evaluates the
1035 //! Compare Operation based on the Wait Mode until the compare operation is
1036 //! true or Wait is canceled by SW.
1037 //!
1038 //! Exec-List Scheduling: CS generates semaphore wait interrupt to the
1039 //! scheduler when MI_SEMAPHORE_WAIT command is un-successful and when
1040 //! "Inhibit Synchronous Context Switch" is set. Scheduler can use this
1041 //! interrupt to preempt the context waiting on semaphore wait.
1042 //!
1043 //! Ring Buffer Scheduling: CS generates semaphore wait interrupt to the
1044 //! scheduler when MI_SEMAPHORE_WAIT command is un-successful. This is for
1045 //! debug mode
1046 //!
1047 //!
1048 //!
1049 //! MI_SEMPHORE_SIGNAL and MI_SEMAPHORE_WAIT together replace the
1050 //! MI_SEMAPHORE_MBOX command on DevBDW.
1051 //!
1052 //! MI_SEMAPHORE_WAIT command also supports register based Semaphore WAIT.
1053 //! Command Streamer on parsing this command fetches data from the MMIO
1054 //! offset mentioned in this command and compares it with the inline
1055 //! Semaphore Data Dword. This functionality is supported when "Register
1056 //! Poll" bit is set in the command header. In register poll mode of
1057 //! operation "Wait Mode" supported is always Poll mode and no Signal mode
1058 //! is supported.
1059 //!
1060 //! If comparison passes, the command streamer moves to the next command.
1061 //!
1062 //! Unlike in Memory based semaphore, there is no context switch or
1063 //! preemption supported in Register Poll mode of operation. Semaphore wait
1064 //! interrupt is not generated by default on wait un-successful in "Register
1065 //! Poll" mode. However interrupt generation can be enabled by setting debug
1066 //! mode bit "Semaphore Interrupt Enable in Register Poll Mode" in specified
1067 //! register
1068 //!
1069 //! Register Poll mode of Semaphore Wait command operation is privileged and
1070 //! will not be supported from PPGTT batch buffers.
1071 //!
1072 //! HW will not trigger Render DOP CG on semaphore wait unsuccessful in
1073 //! register poll mode of operation.
1074 //!
1075 struct MI_SEMAPHORE_WAIT_CMD
1076 {
1077 union
1078 {
1079 //!< DWORD 0
1080 struct
1081 {
1082 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1083 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 11) ; //!< Reserved
1084 uint32_t CompareOperation : __CODEGEN_BITFIELD(12, 14) ; //!< COMPARE_OPERATION
1085 uint32_t WaitMode : __CODEGEN_BITFIELD(15, 15) ; //!< WAIT_MODE
1086 uint32_t RegisterPollMode : __CODEGEN_BITFIELD(16, 16) ; //!< REGISTER_POLL_MODE
1087 uint32_t Reserved17 : __CODEGEN_BITFIELD(17, 21) ; //!< Reserved
1088 uint32_t MemoryType : __CODEGEN_BITFIELD(22, 22) ; //!< MEMORY_TYPE
1089 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1090 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1091 };
1092 uint32_t Value;
1093 } DW0;
1094 union
1095 {
1096 //!< DWORD 1
1097 struct
1098 {
1099 uint32_t SemaphoreDataDword ; //!< Semaphore Data Dword
1100 };
1101 uint32_t Value;
1102 } DW1;
1103 union
1104 {
1105 //!< DWORD 2..3
1106 struct
1107 {
1108 uint64_t Reserved64 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
1109 uint64_t SemaphoreAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Semaphore Address
1110 };
1111 uint32_t Value[2];
1112 } DW2_3;
1113
1114 //! \name Local enumerations
1115
1116 //! \brief COMPARE_OPERATION
1117 //! \details
1118 //! This field specifies the operation that will be executed to create the
1119 //! result that will either allow the context to continue or wait.
1120 enum COMPARE_OPERATION
1121 {
1122 COMPARE_OPERATION_SADGREATERTHANSDD = 0, //!< If Indirect fetched data is greater than inline data then continue.
1123 COMPARE_OPERATION_SADGREATERTHANOREQUALSDD = 1, //!< If Indirect fetched data is greater than or equal to inline data then continue.
1124 COMPARE_OPERATION_SADLESSTHANSDD = 2, //!< If Indirect fetched data is less than inline data then continue.
1125 COMPARE_OPERATION_SADLESSTHANOREQUALSDD = 3, //!< If Indirect fetched data is less than or equal to inline data then continue.
1126 COMPARE_OPERATION_SADEQUALSDD = 4, //!< If Indirect fetched data is equalto inline data then continue.
1127 COMPARE_OPERATION_SADNOTEQUALSDD = 5, //!< If Indirect fetched data is not equal to inline data then continue.
1128 };
1129
1130 //! \brief WAIT_MODE
1131 //! \details
1132 //! This bit specifies the WAIT behavior when the semaphore comparison fails
1133 //! and before the context is switched out.
1134 enum WAIT_MODE
1135 {
1136 WAIT_MODE_SIGNALMODE = 0, //!< In this mode HW will reacquire the semaphore data from memory on receiving SIGNAL with the same Context ID. In ring buffer mode of scheduling Context ID associated with SIGNAL is ignored and always treated as a match.
1137 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.
1138 };
1139
1140 //! \brief REGISTER_POLL_MODE
1141 //! \details
1142 //! <p>This field control the seamphore wait behavior of polling from memory
1143 //! vs MMIO register.</p>
1144 enum REGISTER_POLL_MODE
1145 {
1146 REGISTER_POLL_MODE_MEMORYPOLL = 0, //!< In this mode HW will functional as in regular mode and checks for semaphore data in memory.
1147 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. 
1148 };
1149
1150 //! \brief MEMORY_TYPE
1151 //! \details
1152 //! This bit will be ignored and treated as if clear when executing from a
1153 //! non-privileged batch buffer. It is allowed for this bit to be clear when
1154 //! executing this command from a privileged (secure) batch buffer. This bit
1155 //! <i>must</i> be 1 if the <b>Per Process GTT Enable</b> bit is clear.
1156 enum MEMORY_TYPE
1157 {
1158 MEMORY_TYPE_PERPROCESSGRAPHICSADDRESS = 0, //!< No additional details
1159 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.
1160 };
1161
1162 enum MI_COMMAND_OPCODE
1163 {
1164 MI_COMMAND_OPCODE_MISEMAPHOREWAIT = 28, //!< No additional details
1165 };
1166
1167 enum COMMAND_TYPE
1168 {
1169 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1170 };
1171
1172 //! \name Initializations
1173
1174 //! \brief Explicit member initialization function
1175 MI_SEMAPHORE_WAIT_CMD();
1176
1177 static const size_t dwSize = 4;
1178 static const size_t byteSize = 16;
1179 };
1180
1181 //!
1182 //! \brief MI_CONDITIONAL_BATCH_BUFFER_END
1183 //! \details
1184 //! The MI_CONDITIONAL_BATCH_BUFFER_END command is used to conditionally
1185 //! terminate the execution of commands stored in a batch buffer initiated
1186 //! using a MI_BATCH_BUFFER_START command. Termination of second level batch
1187 //! buffer due to this command will also terminate the parent/first level
1188 //! batch buffer.
1189 //!
1190 //!
1191 struct MI_CONDITIONAL_BATCH_BUFFER_END_CMD
1192 {
1193 union
1194 {
1195 //!< DWORD 0
1196 struct
1197 {
1198 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1199 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 18) ; //!< Reserved
1200 uint32_t CompareMaskMode : __CODEGEN_BITFIELD(19, 19) ; //!< COMPARE_MASK_MODE
1201 uint32_t Reserved20 : __CODEGEN_BITFIELD(20, 20) ; //!< Reserved
1202 uint32_t CompareSemaphore : __CODEGEN_BITFIELD(21, 21) ; //!< COMPARE_SEMAPHORE
1203 uint32_t UseGlobalGtt : __CODEGEN_BITFIELD(22, 22) ; //!< USE_GLOBAL_GTT
1204 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1205 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1206 };
1207 uint32_t Value;
1208 } DW0;
1209 union
1210 {
1211 //!< DWORD 1
1212 struct
1213 {
1214 uint32_t CompareDataDword ; //!< Compare Data Dword
1215 };
1216 uint32_t Value;
1217 } DW1;
1218 union
1219 {
1220 //!< DWORD 2..3
1221 struct
1222 {
1223 uint64_t Reserved64 : __CODEGEN_BITFIELD( 0, 2) ; //!< Reserved
1224 uint64_t CompareAddress : __CODEGEN_BITFIELD( 3, 63) ; //!< Compare Address
1225 };
1226 uint32_t Value[2];
1227 } DW2_3;
1228
1229 //! \name Local enumerations
1230
1231 //! \brief COMPARE_MASK_MODE
1232 //! \details
1233 //! When "Compare Mask Mode" is enabled, "Compare Address" must be qword
1234 //! aligned.
1235 enum COMPARE_MASK_MODE
1236 {
1237 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.
1238 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.
1239 };
1240
1241 //! \brief COMPARE_SEMAPHORE
1242 //! \details
1243 //! <p>If set, the value from the Compare Data Dword is compared to the
1244 //! value from the Compare Address in memory. If the value at Compare
1245 //! Address is greater than the Compare Data Dword, execution of current
1246 //! command buffer should continue. If clear, the parser will continue to
1247 //! the next command and not exit the batch buffer.</p>
1248 enum COMPARE_SEMAPHORE
1249 {
1250 COMPARE_SEMAPHORE_UNNAMED0 = 0, //!< No additional details
1251 };
1252
1253 //! \brief USE_GLOBAL_GTT
1254 //! \details
1255 //! If set, this command will use the global GTT to translate the <b>Compare
1256 //! Address</b> and this command must be executing from a privileged
1257 //! (secure) batch buffer. If clear, the PPGTT will be used to translate the
1258 //! <b>Compare Address</b>.
1259 enum USE_GLOBAL_GTT
1260 {
1261 USE_GLOBAL_GTT_UNNAMED0 = 0, //!< No additional details
1262 };
1263
1264 enum MI_COMMAND_OPCODE
1265 {
1266 MI_COMMAND_OPCODE_MICONDITIONALBATCHBUFFEREND = 54, //!< No additional details
1267 };
1268
1269 enum COMMAND_TYPE
1270 {
1271 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1272 };
1273
1274 //! \name Initializations
1275
1276 //! \brief Explicit member initialization function
1277 MI_CONDITIONAL_BATCH_BUFFER_END_CMD();
1278
1279 static const size_t dwSize = 4;
1280 static const size_t byteSize = 16;
1281 };
1282
1283 //!
1284 //! \brief MI_ATOMIC
1285 //! \details
1286 //! MI_ATOMIC is used to carry atomic operation on data in graphics memory.
1287 //! Atomic operations are supported on data granularity of 4B, 8B and 16B.
1288 //! The atomic operation leads to a read-modify-write operation on the data
1289 //! in graphics memory with the option of returning value. The data in
1290 //! graphics memory is modified by doing arithmetic and logical operation
1291 //! with the inline/indirect data provided with the MI_ATOMIC command.
1292 //! Inline/Indirect provided in the command can be one or two operands based
1293 //! on the atomic operation. Ex: Atomic-Compare operation needs two operands
1294 //! while Atomic-Add operation needs single operand and Atomic-increment
1295 //! requires no operand. Refer "Atomics" sub-section under "L3 Cache and
1296 //! URB" section for detailed atomic operations supported. Atomic operations
1297 //! can be enabled to return value by setting "Return Data Control" field in
1298 //! the command, return data is stored to CS_GPR registers.
1299 //! CS_GPR4/5 registers are updated with memory Return Data based on the
1300 //! "Data Size". Each GPR register is qword in size and occupies two MMIO
1301 //! registers.
1302 //! Note: Any references to CS_GPR registers in the command should be
1303 //! understood as the CS_GPR registers belonging to the corresponding
1304 //! engines *CS_GPR registers.
1305 //!
1306 //!
1307 //! Indirect Source Operands:
1308 //!
1309 //! Operand1 is sourced from [CS_GPR1, CS_GPR0]
1310 //!
1311 //! Operand2 is sourced from [CS_GPR3, CS_GPR2]
1312 //!
1313 //! Read return Data is stored in [CS_GPR_5, CS_GPR4]
1314 //!
1315 //! When "Data Size" is DWORD lower dword of CS_GPR4 (Qword) is updated with
1316 //! the dword data returned from memory. When "Data Size" is QWORD only
1317 //! CS_GPR4 (Qword) is updated with the qword data returned from memory.
1318 //! When the data size is OCTWORD CS_GPR4/5 are updated with the OCTWORD
1319 //! data returned from memory. CS_GPR4 is loaded with lower qword returned
1320 //! from memory and CS_GPR5 is loaded with upper qword returned from memory.
1321 //!
1322 //! When Inline Data mode is not set, Dwords 3..10 must not be included as
1323 //! part of the command. Dword Length field in the header must be programmed
1324 //! accordingly.
1325 //! When Inline Data Mode is set, Dwords3..10 must be included based on the
1326 //! Data Size field of the header. Both Operand-1 and Operand-2 dwords must
1327 //! be programmed based on the Data Size field. Operand-2 must be programmed
1328 //! to 0x0 if the atomic operation doesn't require it. Dword Length field in
1329 //! the header must be programmed accordingly.
1330 //!
1331 //!
1332 //!
1333 //! Engines must be IDLE prior to command stream parsing MI_ATOMIC command.
1334 //! MI_FLUSH_DW prior to the MI_ATOMIC command would ensure the engine is
1335 //! IDLE prior to the atomic operation.
1336 //!
1337 struct MI_ATOMIC_CMD
1338 {
1339 union
1340 {
1341 //!< DWORD 0
1342 struct
1343 {
1344 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1345 uint32_t AtomicOpcode : __CODEGEN_BITFIELD( 8, 15) ; //!< ATOMIC OPCODE
1346 uint32_t ReturnDataControl : __CODEGEN_BITFIELD(16, 16) ; //!< Return Data Control
1347 uint32_t CsStall : __CODEGEN_BITFIELD(17, 17) ; //!< CS STALL
1348 uint32_t InlineData : __CODEGEN_BITFIELD(18, 18) ; //!< Inline Data
1349 uint32_t DataSize : __CODEGEN_BITFIELD(19, 20) ; //!< DATA_SIZE
1350 uint32_t Reserved21 : __CODEGEN_BITFIELD(21, 21) ; //!< Reserved
1351 uint32_t MemoryType : __CODEGEN_BITFIELD(22, 22) ; //!< MEMORY_TYPE
1352 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1353 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1354 };
1355 uint32_t Value;
1356 } DW0;
1357 union
1358 {
1359 //!< DWORD 1
1360 struct
1361 {
1362 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
1363 uint32_t MemoryAddress : __CODEGEN_BITFIELD( 2, 31) ; //!< Memory Address
1364 };
1365 uint32_t Value;
1366 } DW1;
1367 union
1368 {
1369 //!< DWORD 2
1370 struct
1371 {
1372 uint32_t MemoryAddressHigh : __CODEGEN_BITFIELD( 0, 15) ; //!< Memory Address High
1373 uint32_t Reserved80 : __CODEGEN_BITFIELD(16, 31) ; //!< Reserved
1374 };
1375 uint32_t Value;
1376 } DW2;
1377 union
1378 {
1379 //!< DWORD 3
1380 struct
1381 {
1382 uint32_t Operand1DataDword0 ; //!< Operand1 Data Dword 0
1383 };
1384 uint32_t Value;
1385 } DW3;
1386 union
1387 {
1388 //!< DWORD 4
1389 struct
1390 {
1391 uint32_t Operand2DataDword0 ; //!< Operand2 Data Dword 0
1392 };
1393 uint32_t Value;
1394 } DW4;
1395 union
1396 {
1397 //!< DWORD 5
1398 struct
1399 {
1400 uint32_t Operand1DataDword1 ; //!< Operand1 Data Dword 1
1401 };
1402 uint32_t Value;
1403 } DW5;
1404 union
1405 {
1406 //!< DWORD 6
1407 struct
1408 {
1409 uint32_t Operand2DataDword1 ; //!< Operand2 Data Dword 1
1410 };
1411 uint32_t Value;
1412 } DW6;
1413 union
1414 {
1415 //!< DWORD 7
1416 struct
1417 {
1418 uint32_t Operand1DataDword2 ; //!< Operand1 Data Dword 2
1419 };
1420 uint32_t Value;
1421 } DW7;
1422 union
1423 {
1424 //!< DWORD 8
1425 struct
1426 {
1427 uint32_t Operand2DataDword2 ; //!< Operand2 Data Dword 2
1428 };
1429 uint32_t Value;
1430 } DW8;
1431 union
1432 {
1433 //!< DWORD 9
1434 struct
1435 {
1436 uint32_t Operand1DataDword3 ; //!< Operand1 Data Dword 3
1437 };
1438 uint32_t Value;
1439 } DW9;
1440 union
1441 {
1442 //!< DWORD 10
1443 struct
1444 {
1445 uint32_t Operand2DataDword3 ; //!< Operand2 Data Dword 3
1446 };
1447 uint32_t Value;
1448 } DW10;
1449
1450 //! \name Local enumerations
1451
1452 //! \brief DATA_SIZE
1453 //! \details
1454 //! This field indicates the size of the operand in dword/qword/octword on
1455 //! which atomic operation will be performed. Data size must match with the
1456 //! Atomic Opcode. Operation Data size could be 4B, 8B or 16B
1457 enum DATA_SIZE
1458 {
1459 DATA_SIZE_DWORD = 0, //!< Operand size used by Atomic Operation is DWORD.
1460 DATA_SIZE_QWORD = 1, //!< Operand Size used by Atomic Operation is QWORD.
1461 DATA_SIZE_OCTWORD = 2, //!< Operand Size used by Atomic Operation is OCTWORD.
1462 };
1463
1464 //! \brief MEMORY_TYPE
1465 //! \details
1466 //! This bit will be ignored and treated as if clear when executing from a
1467 //! non-privileged batch buffer. It is allowed for this bit to be clear when
1468 //! executing this command from a privileged (secure) batch buffer. This bit
1469 //! must be 1 if the <b>Per Process GTT Enable</b> bit is clear.
1470 enum MEMORY_TYPE
1471 {
1472 MEMORY_TYPE_PERPROCESSGRAPHICSADDRESS = 0, //!< No additional details
1473 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.
1474 };
1475
1476 enum MI_COMMAND_OPCODE
1477 {
1478 MI_COMMAND_OPCODE_MIATOMIC = 47, //!< No additional details
1479 };
1480
1481 enum COMMAND_TYPE
1482 {
1483 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1484 };
1485
1486 //! \name Initializations
1487
1488 //! \brief Explicit member initialization function
1489 MI_ATOMIC_CMD();
1490
1491 static const size_t dwSize = 11;
1492 static const size_t byteSize = 44;
1493 };
1494
1495 //!
1496 //! \brief MI_MATH
1497 //! \details
1498 //! The MI_MATH command allows software to send instructions to the ALU in
1499 //! the Command Streamer. This command is the means by which the ALU is
1500 //! accessed. ALU instructions form the data payload of the MI_MATH command.
1501 //! An ALU instruction takes one DWord in size. The MI_MATH DWord Length is
1502 //! programmed based on the number of ALU instructions included, limited
1503 //! only by the max DWord Length supported. When the command streamer parses
1504 //! an MI_MATH command, it sends the included ALU instructions to the ALU.
1505 //! The ALU processes any instruction in a single clock. See the ALU section
1506 //! for more details.
1507 //!
1508 struct MI_MATH_CMD
1509 {
1510 union
1511 {
1512 //!< DWORD 0
1513 struct
1514 {
1515 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1516 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 22) ; //!< Reserved
1517 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1518 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1519 };
1520 uint32_t Value;
1521 } DW0;
1522
1523 //! \name Local enumerations
1524
1525 enum MI_COMMAND_OPCODE
1526 {
1527 MI_COMMAND_OPCODE_MIMATH = 26, //!< No additional details
1528 };
1529
1530 enum COMMAND_TYPE
1531 {
1532 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1533 };
1534
1535 //! \name Initializations
1536
1537 //! \brief Explicit member initialization function
1538 MI_MATH_CMD();
1539
1540 static const size_t dwSize = 1;
1541 static const size_t byteSize = 4;
1542 };
1543
1544 //!
1545 //! \brief MI_FLUSH_DW
1546 //! \details
1547 //! The MI_FLUSH_DW command is used to perform an internal "flush"
1548 //! operation. The parser pauses on an internal flush until all drawing
1549 //! engines have completed any pending operations. In addition, this command
1550 //! can also be used to:Flush any dirty data to memory. Invalidate the TLB
1551 //! cache inside the hardware Usage note: After this command is completed
1552 //! with a Store DWord enabled, CPU access to graphics memory will be
1553 //! coherent (assuming the Render Cache flush is not inhibited).
1554 //!
1555 struct MI_FLUSH_DW_CMD
1556 {
1557 union
1558 {
1559 //!< DWORD 0
1560 struct
1561 {
1562 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 5) ; //!< DWORD_LENGTH
1563 uint32_t Reserved6 : __CODEGEN_BITFIELD( 6, 6) ; //!< Reserved
1564 uint32_t VideoPipelineCacheInvalidate : __CODEGEN_BITFIELD( 7, 7) ; //!< Video Pipeline Cache invalidate
1565 uint32_t NotifyEnable : __CODEGEN_BITFIELD( 8, 8) ; //!< Notify Enable
1566 uint32_t FlushLlc : __CODEGEN_BITFIELD( 9, 9) ; //!< Flush LLC
1567 uint32_t Reserved10 : __CODEGEN_BITFIELD(10, 13) ; //!< Reserved
1568 uint32_t PostSyncOperation : __CODEGEN_BITFIELD(14, 15) ; //!< POST_SYNC_OPERATION
1569 uint32_t Reserved16 : __CODEGEN_BITFIELD(16, 17) ; //!< Reserved
1570 uint32_t TlbInvalidate : __CODEGEN_BITFIELD(18, 18) ; //!< TLB Invalidate
1571 uint32_t Reserved19 : __CODEGEN_BITFIELD(19, 20) ; //!< Reserved
1572 uint32_t StoreDataIndex : __CODEGEN_BITFIELD(21, 21) ; //!< Store Data Index
1573 uint32_t Reserved22 : __CODEGEN_BITFIELD(22, 22) ; //!< Reserved
1574 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1575 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1576 };
1577 uint32_t Value;
1578 } DW0;
1579 union
1580 {
1581 //!< DWORD 1..2
1582 struct
1583 {
1584 uint64_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
1585 uint64_t DestinationAddressType : __CODEGEN_BITFIELD( 2, 2) ; //!< DESTINATION_ADDRESS_TYPE
1586 uint64_t Address : __CODEGEN_BITFIELD( 3, 47) ; //!< Address
1587 uint64_t Reserved80 : __CODEGEN_BITFIELD(48, 63) ; //!< Reserved
1588 };
1589 uint32_t Value[2];
1590 } DW1_2;
1591 union
1592 {
1593 //!< DWORD 3..4
1594 struct
1595 {
1596 uint64_t ImmediateData ; //!< Immediate Data
1597 };
1598 uint32_t Value[2];
1599 } DW3_4;
1600
1601 //! \name Local enumerations
1602
1603 //! \brief POST_SYNC_OPERATION
1604 //! \details
1605 //! BitFieldDesc
1606 enum POST_SYNC_OPERATION
1607 {
1608 POST_SYNC_OPERATION_NOWRITE = 0, //!< No write occurs as a result of this instruction. This can be used to implement a "trap" operation, etc.
1609 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
1610 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'.
1611 };
1612
1613 enum MI_COMMAND_OPCODE
1614 {
1615 MI_COMMAND_OPCODE_MIFLUSHDW = 38, //!< No additional details
1616 };
1617
1618 enum COMMAND_TYPE
1619 {
1620 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1621 };
1622
1623 //! \brief DESTINATION_ADDRESS_TYPE
1624 //! \details
1625 //! Defines address space of Destination Address
1626 enum DESTINATION_ADDRESS_TYPE
1627 {
1628 DESTINATION_ADDRESS_TYPE_PPGTT = 0, //!< Use PPGTT address space for DW write
1629 DESTINATION_ADDRESS_TYPE_GGTT = 1, //!< Use GGTT address space for DW write
1630 };
1631
1632 //! \name Initializations
1633
1634 //! \brief Explicit member initialization function
1635 MI_FLUSH_DW_CMD();
1636
1637 static const size_t dwSize = 5;
1638 static const size_t byteSize = 20;
1639 };
1640
1641 //!
1642 //! \brief PIPE_CONTROL
1643 //! \details
1644 //! The PIPE_CONTROL command is used to effect the synchronization described
1645 //! above.
1646 //!
1647 struct PIPE_CONTROL_CMD
1648 {
1649 union
1650 {
1651 //!< DWORD 0
1652 struct
1653 {
1654 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1655 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 15) ; //!< Reserved
1656 uint32_t Command3DSubOpcode : __CODEGEN_BITFIELD(16, 23) ; //!< _3D_COMMAND_SUB_OPCODE
1657 uint32_t Command3DOpcode : __CODEGEN_BITFIELD(24, 26) ; //!< _3D_COMMAND_OPCODE
1658 uint32_t CommandSubtype : __CODEGEN_BITFIELD(27, 28) ; //!< COMMAND_SUBTYPE
1659 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1660 };
1661 uint32_t Value;
1662 } DW0;
1663 union
1664 {
1665 //!< DWORD 1
1666 struct
1667 {
1668 uint32_t DepthCacheFlushEnable : __CODEGEN_BITFIELD( 0, 0) ; //!< DEPTH_CACHE_FLUSH_ENABLE
1669 uint32_t StallAtPixelScoreboard : __CODEGEN_BITFIELD( 1, 1) ; //!< STALL_AT_PIXEL_SCOREBOARD
1670 uint32_t StateCacheInvalidationEnable : __CODEGEN_BITFIELD( 2, 2) ; //!< State Cache Invalidation Enable
1671 uint32_t ConstantCacheInvalidationEnable : __CODEGEN_BITFIELD( 3, 3) ; //!< Constant Cache Invalidation Enable
1672 uint32_t VfCacheInvalidationEnable : __CODEGEN_BITFIELD( 4, 4) ; //!< VF Cache Invalidation Enable
1673 uint32_t DcFlushEnable : __CODEGEN_BITFIELD( 5, 5) ; //!< DC Flush Enable
1674 uint32_t Reserved38 : __CODEGEN_BITFIELD( 6, 6) ; //!< Reserved
1675 uint32_t PipeControlFlushEnable : __CODEGEN_BITFIELD( 7, 7) ; //!< Pipe Control Flush Enable
1676 uint32_t NotifyEnable : __CODEGEN_BITFIELD( 8, 8) ; //!< Notify Enable
1677 uint32_t IndirectStatePointersDisable : __CODEGEN_BITFIELD( 9, 9) ; //!< Indirect State Pointers Disable
1678 uint32_t TextureCacheInvalidationEnable : __CODEGEN_BITFIELD(10, 10) ; //!< Texture Cache Invalidation Enable
1679 uint32_t InstructionCacheInvalidateEnable : __CODEGEN_BITFIELD(11, 11) ; //!< Instruction Cache Invalidate Enable
1680 uint32_t RenderTargetCacheFlushEnable : __CODEGEN_BITFIELD(12, 12) ; //!< RENDER_TARGET_CACHE_FLUSH_ENABLE
1681 uint32_t DepthStallEnable : __CODEGEN_BITFIELD(13, 13) ; //!< DEPTH_STALL_ENABLE
1682 uint32_t PostSyncOperation : __CODEGEN_BITFIELD(14, 15) ; //!< POST_SYNC_OPERATION
1683 uint32_t GenericMediaStateClear : __CODEGEN_BITFIELD(16, 16) ; //!< Generic Media State Clear
1684 uint32_t Reserved49 : __CODEGEN_BITFIELD(17, 17) ; //!< Reserved
1685 uint32_t TlbInvalidate : __CODEGEN_BITFIELD(18, 18) ; //!< TLB Invalidate
1686 uint32_t GlobalSnapshotCountReset : __CODEGEN_BITFIELD(19, 19) ; //!< GLOBAL_SNAPSHOT_COUNT_RESET
1687 uint32_t CommandStreamerStallEnable : __CODEGEN_BITFIELD(20, 20) ; //!< Command Streamer Stall Enable
1688 uint32_t StoreDataIndex : __CODEGEN_BITFIELD(21, 21) ; //!< Store Data Index
1689 uint32_t Reserved54 : __CODEGEN_BITFIELD(22, 22) ; //!< Reserved
1690 uint32_t LriPostSyncOperation : __CODEGEN_BITFIELD(23, 23) ; //!< LRI_POST_SYNC_OPERATION
1691 uint32_t DestinationAddressType : __CODEGEN_BITFIELD(24, 24) ; //!< DESTINATION_ADDRESS_TYPE
1692 uint32_t Reserved57 : __CODEGEN_BITFIELD(25, 25) ; //!< Reserved
1693 uint32_t FlushLlc : __CODEGEN_BITFIELD(26, 26) ; //!< Flush LLC
1694 uint32_t Reserved59 : __CODEGEN_BITFIELD(27, 31) ; //!< Reserved
1695 };
1696 uint32_t Value;
1697 } DW1;
1698 union
1699 {
1700 //!< DWORD 2
1701 struct
1702 {
1703 uint32_t Reserved64 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
1704 uint32_t Address : __CODEGEN_BITFIELD( 2, 31) ; //!< Address
1705 };
1706 uint32_t Value;
1707 } DW2;
1708 union
1709 {
1710 //!< DWORD 3
1711 struct
1712 {
1713 uint32_t AddressHigh ; //!< Address High
1714 };
1715 uint32_t Value;
1716 } DW3;
1717 union
1718 {
1719 //!< DWORD 4..5
1720 struct
1721 {
1722 uint64_t ImmediateData ; //!< Immediate Data
1723 };
1724 uint32_t Value[2];
1725 } DW4_5;
1726
1727 //! \name Local enumerations
1728
1729 enum _3D_COMMAND_SUB_OPCODE
1730 {
1731 _3D_COMMAND_SUB_OPCODE_PIPECONTROL = 0, //!< No additional details
1732 };
1733
1734 enum _3D_COMMAND_OPCODE
1735 {
1736 _3D_COMMAND_OPCODE_PIPECONTROL = 2, //!< No additional details
1737 };
1738
1739 enum COMMAND_SUBTYPE
1740 {
1741 COMMAND_SUBTYPE_GFXPIPE3D = 3, //!< No additional details
1742 };
1743
1744 enum COMMAND_TYPE
1745 {
1746 COMMAND_TYPE_GFXPIPE = 3, //!< No additional details
1747 };
1748
1749 //! \brief DEPTH_CACHE_FLUSH_ENABLE
1750 //! \details
1751 //! Setting this bit enables flushing (i.e. writing back the dirty lines to
1752 //! memory and invalidating the tags) of depth related caches. This bit
1753 //! applies to HiZ cache, Stencil cache and depth cache.
1754 enum DEPTH_CACHE_FLUSH_ENABLE
1755 {
1756 DEPTH_CACHE_FLUSH_ENABLE_FLUSHDISABLED = 0, //!< Depth relates caches (HiZ, Stencil and Depth) are NOT flushed.
1757 DEPTH_CACHE_FLUSH_ENABLE_FLUSHENABLED = 1, //!< Depth relates caches (HiZ, Stencil and Depth) are flushed.
1758 };
1759
1760 //! \brief STALL_AT_PIXEL_SCOREBOARD
1761 //! \details
1762 //! Defines the behavior of PIPE_CONTROL command at the pixel scoreboard.
1763 enum STALL_AT_PIXEL_SCOREBOARD
1764 {
1765 STALL_AT_PIXEL_SCOREBOARD_DISABLE = 0, //!< Stall at the pixel scoreboard is disabled.
1766 STALL_AT_PIXEL_SCOREBOARD_ENABLE = 1, //!< Stall at the pixel scoreboard is enabled.
1767 };
1768
1769 //! \brief RENDER_TARGET_CACHE_FLUSH_ENABLE
1770 //! \details
1771 //! <p>Setting this bit will force Render Cache to be flushed to memory
1772 //! prior to this synchronization point completing. This bit must be set for
1773 //! all write fence sync operations to assure that results from operations
1774 //! initiated prior to this command are visible in memory once software
1775 //! observes this synchronization.</p>
1776 enum RENDER_TARGET_CACHE_FLUSH_ENABLE
1777 {
1778 RENDER_TARGET_CACHE_FLUSH_ENABLE_DISABLEFLUSH = 0, //!< Render Target Cache is NOT flushed.
1779 RENDER_TARGET_CACHE_FLUSH_ENABLE_ENABLEFLUSH = 1, //!< Render Target Cache is flushed.
1780 };
1781
1782 //! \brief DEPTH_STALL_ENABLE
1783 //! \details
1784 //! <p>This bit must be set when obtaining a "visible pixel" count to
1785 //! preclude the possible inclusion in the PS_DEPTH_COUNT value written to
1786 //! memory of some fraction of pixels from objects initiated after the
1787 //! PIPE_CONTROL command.</p>
1788 enum DEPTH_STALL_ENABLE
1789 {
1790 DEPTH_STALL_ENABLE_DISABLE = 0, //!< 3D pipeline will not stall subsequent primitives at the Depth Test stage.
1791 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.
1792 };
1793
1794 //! \brief POST_SYNC_OPERATION
1795 //! \details
1796 //! This field specifies an optional action to be taken upon completion of
1797 //! the synchronization operation.
1798 enum POST_SYNC_OPERATION
1799 {
1800 POST_SYNC_OPERATION_NOWRITE = 0, //!< No write occurs as a result of this instruction. This can be used to implement a "trap" operation, etc.
1801 POST_SYNC_OPERATION_WRITEIMMEDIATEDATA = 1, //!< Write the QWord containing Immediate Data Low, High DWs to the Destination Address
1802 POST_SYNC_OPERATION_WRITEPSDEPTHCOUNT = 2, //!< Write the 64-bit PS_DEPTH_COUNT register to the Destination Address
1803 POST_SYNC_OPERATION_WRITETIMESTAMP = 3, //!< Write the 64-bit TIMESTAMP register(i.e. "Reported Timestamp Count" 0x2358 for render pipe) to the Destination Address.
1804 };
1805
1806 //! \brief GLOBAL_SNAPSHOT_COUNT_RESET
1807 //! \details
1808 //! <p>This debug mode bit must not be exercised on any product.</p>
1809 enum GLOBAL_SNAPSHOT_COUNT_RESET
1810 {
1811 GLOBAL_SNAPSHOT_COUNT_RESET_DONTRESET = 0, //!< Do not reset the snapshot counts or Statistics Counters.
1812 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.
1813 };
1814
1815 //! \brief LRI_POST_SYNC_OPERATION
1816 //! \details
1817 //! This bit caues a post sync operation with an LRI (Load Register
1818 //! Immediate) operation. If this bit is set then the Post-Sync Operation
1819 //! field must be cleared.
1820 enum LRI_POST_SYNC_OPERATION
1821 {
1822 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.
1823 LRI_POST_SYNC_OPERATION_MMIOWRITEIMMEDIATEDATA = 1, //!< Write the DWord contained in Immediate Data Low (DW3) to the MMIO offset specifed in the Address field.
1824 };
1825
1826 //! \brief DESTINATION_ADDRESS_TYPE
1827 //! \details
1828 //! Defines address space of Destination Address
1829 enum DESTINATION_ADDRESS_TYPE
1830 {
1831 DESTINATION_ADDRESS_TYPE_PPGTT = 0, //!< Use PPGTT address space for DW write
1832 DESTINATION_ADDRESS_TYPE_GGTT = 1, //!< Use GGTT address space for DW write
1833 };
1834
1835 //! \name Initializations
1836
1837 //! \brief Explicit member initialization function
1838 PIPE_CONTROL_CMD();
1839
1840 static const size_t dwSize = 6;
1841 static const size_t byteSize = 24;
1842 };
1843
1844 //!
1845 //! \brief MFX_WAIT
1846 //! \details
1847 //! This command can be considered the same as an MI_NOOP except that the
1848 //! command parser will not parse the next command until the following
1849 //! happens AVC or VC1 BSD mode: The command will stall the parser until
1850 //! completion of the BSD object
1851 //! IT, encoder, and MPEG2 BSD mode: The command will stall the parser
1852 //! until the object package is sent down the pipelineThis command should be
1853 //! used to ensure the preemption enable window occurs during the time the
1854 //! object command is being executed down the pipeline.
1855 //!
1856 //!
1857 struct MFX_WAIT_CMD
1858 {
1859 union
1860 {
1861 //!< DWORD 0
1862 struct
1863 {
1864 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 5) ; //!< DWORD_LENGTH
1865 uint32_t Reserved6 : __CODEGEN_BITFIELD( 6, 7) ; //!< Reserved
1866 uint32_t MfxSyncControlFlag : __CODEGEN_BITFIELD( 8, 8) ; //!< MFX Sync Control Flag
1867 uint32_t Reserved9 : __CODEGEN_BITFIELD( 9, 15) ; //!< Reserved
1868 uint32_t SubOpcode : __CODEGEN_BITFIELD(16, 26) ; //!< SUB_OPCODE
1869 uint32_t CommandSubtype : __CODEGEN_BITFIELD(27, 28) ; //!< COMMAND_SUBTYPE
1870 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1871 };
1872 uint32_t Value;
1873 } DW0;
1874
1875 //! \name Local enumerations
1876
1877 enum SUB_OPCODE
1878 {
1879 SUB_OPCODE_MFXWAIT = 0, //!< No additional details
1880 };
1881
1882 enum COMMAND_SUBTYPE
1883 {
1884 COMMAND_SUBTYPE_MFXSINGLEDW = 1, //!< No additional details
1885 };
1886
1887 enum COMMAND_TYPE
1888 {
1889 COMMAND_TYPE_PARALLELVIDEOPIPE = 3, //!< No additional details
1890 };
1891
1892 //! \name Initializations
1893
1894 //! \brief Explicit member initialization function
1895 MFX_WAIT_CMD();
1896
1897 static const size_t dwSize = 1;
1898 static const size_t byteSize = 4;
1899 };
1900
1901 //!
1902 //! \brief MEDIA_STATE_FLUSH
1903 //! \details
1904 //! This command updates the Message Gateway state. In particular, it
1905 //! updates the state for a selected Interface Descriptor.
1906 //!
1907 //! This command can be considered same as a MI_Flush except that only media
1908 //! parser will get flushed instead of the entire 3D/media render pipeline.
1909 //! The command should be programmed prior to new Media state, curbe and/or
1910 //! interface descriptor commands when switching to a new context or
1911 //! programming new state for the same context. With this command, pipelined
1912 //! state change is allowed for the media pipe.
1913 //!
1914 //! Be cautious when using this command when child_present flag in the media
1915 //! state is enabled. This is because that CURBE state as well as Interface
1916 //! Descriptor state are shared between root threads and child threads.
1917 //! Changing these states while child threads are generated on the fly may
1918 //! cause unexpected behavior. Combining with MI_ARB_ON/OFF command, it is
1919 //! possible to support interruptability with the following command sequence
1920 //! where interrupt may be allowed only when MI_ARB_ON_OFF is ON:
1921 //!
1922 //! <pre>MEDIA_STATE_FLUSH
1923 //! VFE_STATE VFE will hold CS if watermark isn't met
1924 //! MI_ARB_OFF There must be at least one VFE command before this one
1925 //! MEDIA_OBJECT ... MI_ARB_ON</pre>
1926 //!
1927 //! Due to the known HW issue MEDIA_STATE_FLUSH command is not preemptable
1928 //! in GPGPU workloads. This might result in reduced frequency of preempting
1929 //! GPGPU walker in below programming sequence.
1930 //! <pre>State Commands
1931 //! GPGPU_WALKER
1932 //! MEDIA_STATE_FLUSH
1933 //! State Commands
1934 //! GPGPU_WALKER
1935 //! MEDIA_STATE_FLUSH
1936 //! State Commands</pre>
1937 //!
1938 //! MI_ARB_CHK command must be programmed following MEDIA_STATE_FLUSH
1939 //! command. PIPECONTROL ("Command Streamer Stall Enable" set and "Render
1940 //! Target Cache Flush Enable" set) must be programmed prior to
1941 //! MEDIA_STATE_FLUSH command with "Flush to GO" bit set. "Water Mark
1942 //! Required" field must not be set in "MEDIA_STATE_FLUSH" command.
1943 //!
1944 struct MEDIA_STATE_FLUSH_CMD
1945 {
1946 union
1947 {
1948 //!< DWORD 0
1949 struct
1950 {
1951 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 15) ; //!< DWORD_LENGTH
1952 uint32_t Subopcode : __CODEGEN_BITFIELD(16, 23) ; //!< SUBOPCODE
1953 uint32_t MediaCommandOpcode : __CODEGEN_BITFIELD(24, 26) ; //!< MEDIA_COMMAND_OPCODE
1954 uint32_t Pipeline : __CODEGEN_BITFIELD(27, 28) ; //!< PIPELINE
1955 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1956 };
1957 uint32_t Value;
1958 } DW0;
1959 union
1960 {
1961 //!< DWORD 1
1962 struct
1963 {
1964 uint32_t InterfaceDescriptorOffset : __CODEGEN_BITFIELD( 0, 5) ; //!< Interface Descriptor Offset
1965 uint32_t WatermarkRequired : __CODEGEN_BITFIELD( 6, 6) ; //!< Watermark Required
1966 uint32_t FlushToGo : __CODEGEN_BITFIELD( 7, 7) ; //!< Flush to GO
1967 uint32_t Reserved40 : __CODEGEN_BITFIELD( 8, 31) ; //!< Reserved
1968 };
1969 uint32_t Value;
1970 } DW1;
1971
1972 //! \name Local enumerations
1973
1974 enum SUBOPCODE
1975 {
1976 SUBOPCODE_MEDIASTATEFLUSHSUBOP = 4, //!< No additional details
1977 };
1978
1979 enum MEDIA_COMMAND_OPCODE
1980 {
1981 MEDIA_COMMAND_OPCODE_MEDIASTATEFLUSH = 0, //!< No additional details
1982 };
1983
1984 enum PIPELINE
1985 {
1986 PIPELINE_MEDIA = 2, //!< No additional details
1987 };
1988
1989 enum COMMAND_TYPE
1990 {
1991 COMMAND_TYPE_GFXPIPE = 3, //!< No additional details
1992 };
1993
1994 //! \name Initializations
1995
1996 //! \brief Explicit member initialization function
1997 MEDIA_STATE_FLUSH_CMD();
1998
1999 static const size_t dwSize = 2;
2000 static const size_t byteSize = 8;
2001 };
2002
2003 };
2004
2005 #pragma pack()
2006
2007 #endif // __MHW_MI_HWCMD_G9_X_H__