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