2
* Common header file for all AVC MC kernels
3
* Copyright © <2010>, Intel Corporation.
5
* This program is licensed under the terms and conditions of the
6
* Eclipse Public License (EPL), version 1.0. The full text of the EPL is at
7
* http://www.opensource.org/licenses/eclipse-1.0.php.
10
#if !defined(__HEADER__) // Make sure this file is only included once
13
// Module name: header.inc
15
// Common header file for all AVC MC kernels
18
#ifndef COMBINED_KERNEL
20
#define SW_SCOREBOARD // SW Scoreboard should be enabled for CTG and earlier
21
#undef HW_SCOREBOARD // HW Scoreboard should be disabled for CTG and earlier
23
#define HW_SCOREBOARD // HW Scoreboard should be enabled for ILK and beyond
24
#undef SW_SCOREBOARD // SW Scoreboard should be disabled for ILK and beyond
26
#endif // COMBINED_KERNEL
28
//#define MONO // Build Monochrome kernels
30
// Surface state definition
67
.default_execution_size (16)
68
.default_register_type :ub
70
// ----------- Common constant definitions ------------
72
// Bit position constants
90
#define BIT16 0x00010000
91
#define BIT17 0x00020000
92
#define BIT18 0x00040000
93
#define BIT19 0x00080000
94
#define BIT20 0x00100000
95
#define BIT21 0x00200000
96
#define BIT22 0x00400000
97
#define BIT23 0x00800000
98
#define BIT24 0x01000000
99
#define BIT25 0x02000000
100
#define BIT26 0x04000000
101
#define BIT27 0x08000000
102
#define BIT28 0x10000000
103
#define BIT29 0x20000000
104
#define BIT30 0x40000000
105
#define BIT31 0x80000000
107
#define GRFWIB 32 // GRF register width in byte
108
#define GRFWIW 16 // GRF register width in word
109
#define GRFWID 8 // GRF register width in dword
111
#define INST_SIZE 16 // Instruction size = 128b = 16 Bytes
113
#define REGION(Width,HStride) <Width*HStride;Width,HStride>
115
#define NULLREG null<1>:ud
116
#define NULLREGW null<1>:w
119
#define BOTTOM_FIELD 1
121
// M2 - M9 for date writing message payload
122
.declare MSGPAYLOAD Base=m2 ElementSize=1 SrcRegion=REGION(16,1) Type=ub
123
.declare MSGPAYLOADB Base=m2 ElementSize=1 SrcRegion=REGION(16,1) Type=ub
124
.declare MSGPAYLOADW Base=m2 ElementSize=2 SrcRegion=REGION(16,1) Type=uw
125
.declare MSGPAYLOADD Base=m2 ElementSize=4 SrcRegion=REGION(8,1) Type=ud
127
// ----------- Common Message Descriptor ------------
130
#define MSG_GW 0x03 // Message Gateway Extended Message Descriptor,
131
#define DAPREAD 0x04 // Data Port Read Extended Message Descriptor,
132
#define DAPWRITE 0x05 // Data Port Write Extended Message Descriptor,
133
#define TS 0x07 // Thread Spawner Extended Message Descriptor
134
#define TS_EOT 0x27 // End of Thread Extended Message Descriptor
136
#define EOTMSGDSC 0x02000010 // End of Thread Message Descriptor, don't deference URB handle
138
// Data Port Message Descriptor
139
#define DWBRMSGDSC_RC 0x02086000 // DWORD Block Read Message Descriptor, reading from render cache = 6.
140
#define DWBRMSGDSC_RC_TF 0x02086600 // DWORD Block Read Message Descriptor, reading from render cache = 6.
141
#define DWBRMSGDSC_RC_BF 0x02086700 // DWORD Block Read Message Descriptor, reading from render cache = 6.
142
#define DWBRMSGDSC_SC 0x0208A000 // DWORD Block Read Message Descriptor, reading from sampler cache = A.
143
#define DWBRMSGDSC_SC_TF 0x0208E600 // DWORD Block Read Message Descriptor, reading top field from field mode sampler cache.
144
#define DWBRMSGDSC_SC_BF 0x0208E700 // DWORD Block Read Message Descriptor, reading bottom field from field mode sampler cache.
146
#define DWBWMSGDSC 0x02082000 // DWORD Block Write Message Descriptor
147
#define DWBWMSGDSC_WC 0x0218A000 // DWORD Block Write Message Descriptor + write commit
149
// Enable Write Commit writeback mesage
150
#define ENWRCOM 0x00108000 // Enable "write commit" and set response length = 1
152
// Thread Spawner Message Descriptor
153
#define TSMSGDSC 0x02000011
155
// Message Gateway Message Descriptors
156
#define OGWMSGDSC 0x02000000 // OpenGateway Message Descriptor
157
#define CGWMSGDSC 0x02000001 // CloseGateway Message Descriptor
158
#define FWDMSGDSC 0x02000002 // ForwardMsg Message Descriptor
160
#define NOTIFYMSG 0x00008000 // Send notification with ForwardMsg message
162
#define RESP_LEN(len) 0x100000*len
163
#define MSG_LEN(len) 0x2000000*len
173
#define EOTMSGDSC 0x87100010 // End of Thread Message Descriptor, don't deference URB handle
175
// Data Port Message Descriptor
176
#define DWBRMSGDSC_RC 0x04106000 // DWORD Block Read Message Descriptor, reading from render cache = 6.
177
#define DWBRMSGDSC_RC_TF 0x04106600 // DWORD Block Read Message Descriptor, reading from render cache = 6.
178
#define DWBRMSGDSC_RC_BF 0x04106700 // DWORD Block Read Message Descriptor, reading from render cache = 6.
179
#define DWBRMSGDSC_SC 0x0410A000 // DWORD Block Read Message Descriptor, reading from sampler cache = A.
180
#define DWBRMSGDSC_SC_TF 0x0410A600 // DWORD Block Read Message Descriptor, reading top field from field mode sampler cache.
181
#define DWBRMSGDSC_SC_BF 0x0410A700 // DWORD Block Read Message Descriptor, reading bottom field from field mode sampler cache.
183
#define DWBWMSGDSC 0x05102000 // DWORD Block Write Message Descriptor
184
#define DWBWMSGDSC_WC 0x0511A000 // DWORD Block Write Message Descriptor + write commit
186
// Enable Write Commit writeback mesage
187
#define ENWRCOM 0x00018000 // Enable "write commit" and set response length = 1
189
// Thread Spawner Message Descriptor
190
#define TSMSGDSC 0x07100011
192
// Message Gateway Message Descriptors
193
#define OGWMSGDSC 0x03100000 // OpenGateway Message Descriptor
194
#define CGWMSGDSC 0x03100001 // CloseGateway Message Descriptor
195
#define FWDMSGDSC 0x03100002 // ForwardMsg Message Descriptor
197
#define NOTIFYMSG 0x00008000 // Send notification with ForwardMsg message
198
#define ACKREQMSG 0x00014000 // Acknowledgement required so response length should be 1
200
#define RESP_LEN(len) 0x10000*len
201
#define MSG_LEN(len) 0x100000*len
205
// Enable frame/field selection in message descriptor
206
#define ENMSGDSCFM 0x400 // Enable MSGDSC to select frame surface
207
#define ENMSGDSCTF 0x600 // Enable MSGDSC to select top field surface
208
#define ENMSGDSCBF 0x700 // Enable MSGDSC to select bottom field surface
210
// ----------- Message related register ------------
212
#define MSGHDR m1 // Message Payload Header
213
#define MSGHDRY m1 // Message Payload Header register for Y data
214
#define MSGHDRY0 m1 // Message Payload Header register for Y data
215
#define MSGHDRY1 m2 // Message Payload Header register for Y data
216
#define MSGHDRY2 m3 // Message Payload Header register for Y data
217
#define MSGHDRY3 m4 // Message Payload Header register for Y data
218
#define MSGHDRUV m5 // Message Payload Header register for U/V data
219
#define MSGSRC r62 // Message source register, should never be used for other purposes
220
#define MSGDSC a0.0:ud // Message Descriptor register (type DWORD)
222
#define MH_ORI MSGSRC.0 // DWORD block R/W message header block offset
223
#define MH_ORIX MSGSRC.0 // DWORD block R/W message header X offset
224
#define MH_ORIY MSGSRC.1 // DWORD block R/W message header Y offset
225
#define MH_SIZE MSGSRC.2 // DWORD block R/W message header block width & height
227
// Data necessary for kernel operations
229
// Address registers used as pointers
231
// Note: Please keep the register order as is since they are used in compressed instructions
233
#define PPREDBUF_Y a0.4 // Pointer to predicted Y picture
234
#define PPREDBUF_Y1 a0.5 // Pointer to predicted Y picture for extended instruction
236
#define PPREDBUF_UV a0.4 // Pointer to predicted U/V picture
237
#define PPREDBUF_UV1 a0.5 // Pointer to predicted U/V picture for extended instruction
239
#define PDECBUF a0.4 // Pointer to decoded picture data
240
#define PDECBUF_UD a0.2 // Pointer to decoded picture data in DWORD unit
242
// ----------- R63 is reserved for global variables ------------
244
// Note: Don't program it with values other than what are defined here.
248
#define RETURN_REG G_REG.0 // Return pointer for all sub-routine calls (type DWORD)
249
#define RETURN_REG1 G_REG.1 // Return pointer for second-level calls
251
#define I_ORIX G_REG.13 // :uw, H. origin of the macroblock in pixel unit, don't overwrite in-line data
252
#define I_ORIY G_REG.14 // :uw, V. origin of the macroblock in pixel unit, don't overwrite in-line data
256
// Note: For macros that require multiple line expansion, insert "\n" at the end of each line.
258
#define GRF(reg) r##reg
260
#define END_THREAD send (8) NULLREG MSGHDR r0:ud TS_EOT EOTMSGDSC
262
#define END_THREAD send (8) NULLREG MSGHDR r0:ud EOTMSGDSC
265
#define CALL(subFunc, skipInst) add (1) RETURN_REG<1>:ud ip:ud (1+skipInst)*INST_SIZE \n\
268
#define CALL_1(subFunc, skipInst) add (1) RETURN_REG1<1>:ud ip:ud (1+skipInst)*INST_SIZE \n\
271
#define RETURN mov (1) ip:ud RETURN_REG<0;1,0>:ud // Return to calling module
272
#define RETURN_1 mov (1) ip:ud RETURN_REG1<0;1,0>:ud // Return to second-level calling module
273
// To support iterative calling
277
#define LEADING_THREAD 1 // For CTG A, no SRT is needed. Only PRT is necessary
279
#define LEADING_THREAD 0 // For CTG B0 and beyond, PRT doesn't take into debug count
280
#define DOUBLE_SB // Scoreboard size needs to be doubled
283
#ifdef DOUBLE_SB // Scoreboard size needs to be doubled
284
#define SB_MASK 0x1ff // Scoreboard wrap-around mask (for 512 entries)
286
#define SB_MASK 0xff // Scoreboard wrap-around mask (for 256 entries)
287
#endif // defined(DOUBLE_SB)
289
// Scoreboard related definitions
295
#define M05_STORE r0.13 // :uw, reuse r0.6:ud upper-word to store M0.5 header information for scoreboard
298
#endif // SW_SCOREBOARD
302
#endif // !defined(__HEADER__)