~gma500/+junk/gma500-natty

« back to all changes in this revision

Viewing changes to libva-0.31.1/i965_drv_video/shaders/h264/mc/header.inc

  • Committer: Luca Forina
  • Date: 2011-02-14 10:01:54 UTC
  • Revision ID: luca.forina@gmail.com-20110214100154-ai9gynuqb1dna2ea
new commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Common header file for all AVC MC kernels
 
3
 * Copyright © <2010>, Intel Corporation.
 
4
 *
 
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.
 
8
 *
 
9
 */
 
10
#if !defined(__HEADER__)        // Make sure this file is only included once
 
11
#define __HEADER__
 
12
 
 
13
// Module name: header.inc
 
14
//
 
15
// Common header file for all AVC MC kernels
 
16
//
 
17
 
 
18
#ifndef COMBINED_KERNEL
 
19
#ifdef DEV_CTG
 
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
 
22
#else
 
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
 
25
#endif  // DEV_CTG
 
26
#endif  // COMBINED_KERNEL
 
27
 
 
28
//#define MONO                          // Build Monochrome kernels
 
29
 
 
30
//  Surface state definition
 
31
//
 
32
#define DESTY           0
 
33
#define DESTUV          1
 
34
#define REFYFM0         2
 
35
#define REFYFM1         3
 
36
#define REFYFM2         4
 
37
#define REFYFM3         5
 
38
#define REFYFM4         6
 
39
#define REFYFM5         7
 
40
#define REFYFM6         8
 
41
#define REFYFM7         9
 
42
#define REFYFM8         10
 
43
#define REFYFM9         11
 
44
#define REFYFM10        12
 
45
#define REFYFM11        13
 
46
#define REFYFM12        14
 
47
#define REFYFM13        15
 
48
#define REFYFM14        16
 
49
#define REFYFM15        17
 
50
#define REFUVFM0        18
 
51
#define REFUVFM1        19
 
52
#define REFUVFM2        20
 
53
#define REFUVFM3        21
 
54
#define REFUVFM4        22
 
55
#define REFUVFM5        23
 
56
#define REFUVFM6        24
 
57
#define REFUVFM7        25
 
58
#define REFUVFM8        26
 
59
#define REFUVFM9        27
 
60
#define REFUVFM10       28
 
61
#define REFUVFM11       29
 
62
#define REFUVFM12       30
 
63
#define REFUVFM13       31
 
64
#define REFUVFM14       32
 
65
#define REFUVFM15       33
 
66
 
 
67
.default_execution_size (16)
 
68
.default_register_type  :ub
 
69
 
 
70
//  ----------- Common constant definitions ------------
 
71
//
 
72
//  Bit position constants
 
73
//
 
74
#define BIT0    0x01
 
75
#define BIT1    0x02
 
76
#define BIT2    0x04
 
77
#define BIT3    0x08
 
78
#define BIT4    0x10
 
79
#define BIT5    0x20
 
80
#define BIT6    0x40
 
81
#define BIT7    0x80
 
82
#define BIT8    0x0100
 
83
#define BIT9    0x0200
 
84
#define BIT10   0x0400
 
85
#define BIT11   0x0800
 
86
#define BIT12   0x1000
 
87
#define BIT13   0x2000
 
88
#define BIT14   0x4000
 
89
#define BIT15   0x8000
 
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
 
106
 
 
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
 
110
 
 
111
#define INST_SIZE   16          // Instruction size = 128b = 16 Bytes
 
112
 
 
113
#define REGION(Width,HStride) <Width*HStride;Width,HStride>
 
114
 
 
115
#define NULLREG         null<1>:ud
 
116
#define NULLREGW        null<1>:w
 
117
 
 
118
#define TOP_FIELD               0
 
119
#define BOTTOM_FIELD    1
 
120
 
 
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
 
126
 
 
127
//  ----------- Common Message Descriptor ------------
 
128
//
 
129
#ifdef DEV_ILK
 
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
 
135
 
 
136
#define EOTMSGDSC       0x02000010      // End of Thread Message Descriptor, don't deference URB handle
 
137
 
 
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.
 
145
 
 
146
#define DWBWMSGDSC               0x02082000     // DWORD Block Write Message Descriptor
 
147
#define DWBWMSGDSC_WC    0x0218A000     // DWORD Block Write Message Descriptor + write commit
 
148
 
 
149
// Enable Write Commit writeback mesage
 
150
#define ENWRCOM         0x00108000      // Enable "write commit" and set response length = 1
 
151
 
 
152
// Thread Spawner Message Descriptor
 
153
#define TSMSGDSC        0x02000011
 
154
 
 
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
 
159
 
 
160
#define NOTIFYMSG       0x00008000      // Send notification with ForwardMsg message
 
161
 
 
162
#define RESP_LEN(len)   0x100000*len
 
163
#define MSG_LEN(len)    0x2000000*len
 
164
 
 
165
#else   // Pre DEV_ILK
 
166
 
 
167
#define MSG_GW
 
168
#define DAPREAD
 
169
#define DAPWRITE
 
170
#define TS
 
171
#define TS_EOT
 
172
 
 
173
#define EOTMSGDSC       0x87100010      // End of Thread Message Descriptor, don't deference URB handle
 
174
 
 
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.
 
182
 
 
183
#define DWBWMSGDSC               0x05102000     // DWORD Block Write Message Descriptor
 
184
#define DWBWMSGDSC_WC    0x0511A000     // DWORD Block Write Message Descriptor + write commit
 
185
 
 
186
// Enable Write Commit writeback mesage
 
187
#define ENWRCOM         0x00018000      // Enable "write commit" and set response length = 1
 
188
 
 
189
// Thread Spawner Message Descriptor
 
190
#define TSMSGDSC        0x07100011
 
191
 
 
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
 
196
 
 
197
#define NOTIFYMSG       0x00008000      // Send notification with ForwardMsg message
 
198
#define ACKREQMSG       0x00014000      // Acknowledgement required so response length should be 1
 
199
 
 
200
#define RESP_LEN(len)   0x10000*len
 
201
#define MSG_LEN(len)    0x100000*len
 
202
 
 
203
#endif  // DEV_ILK
 
204
 
 
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
 
209
 
 
210
//  ----------- Message related register ------------
 
211
//
 
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)
 
221
 
 
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
 
226
 
 
227
// Data necessary for kernel operations
 
228
//
 
229
//  Address registers used as pointers
 
230
//
 
231
//  Note: Please keep the register order as is since they are used in compressed instructions
 
232
//
 
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
 
235
 
 
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
 
238
 
 
239
#define     PDECBUF             a0.4    // Pointer to decoded picture data
 
240
#define     PDECBUF_UD  a0.2    // Pointer to decoded picture data in DWORD unit
 
241
 
 
242
//  ----------- R63 is reserved for global variables ------------
 
243
//
 
244
//  Note: Don't program it with values other than what are defined here. 
 
245
 
 
246
#define G_REG           r63
 
247
 
 
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
 
250
 
 
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
 
253
 
 
254
//  Macros
 
255
//
 
256
//  Note: For macros that require multiple line expansion, insert "\n" at the end of each line.
 
257
//
 
258
#define GRF(reg)        r##reg
 
259
#ifdef DEV_ILK
 
260
#define END_THREAD                      send (8) NULLREG MSGHDR r0:ud TS_EOT    EOTMSGDSC
 
261
#else
 
262
#define END_THREAD                      send (8) NULLREG MSGHDR r0:ud EOTMSGDSC
 
263
#endif  // DEV_ILK
 
264
 
 
265
#define CALL(subFunc, skipInst) add (1) RETURN_REG<1>:ud   ip:ud        (1+skipInst)*INST_SIZE \n\
 
266
                                jmpi (1) subFunc
 
267
 
 
268
#define CALL_1(subFunc, skipInst)       add (1) RETURN_REG1<1>:ud   ip:ud       (1+skipInst)*INST_SIZE \n\
 
269
                                jmpi (1) subFunc
 
270
 
 
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
 
274
#ifdef SW_SCOREBOARD    
 
275
 
 
276
#ifdef DEV_CTG_A
 
277
  #define LEADING_THREAD        1               // For CTG A, no SRT is needed. Only PRT is necessary
 
278
#else
 
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
 
281
#endif
 
282
 
 
283
#ifdef  DOUBLE_SB                                       // Scoreboard size needs to be doubled
 
284
  #define SB_MASK               0x1ff           // Scoreboard wrap-around mask (for 512 entries)
 
285
#else
 
286
  #define SB_MASK               0xff            // Scoreboard wrap-around mask (for 256 entries)
 
287
#endif  // defined(DOUBLE_SB)
 
288
 
 
289
// Scoreboard related definitions
 
290
 
 
291
#define TEMPX           r50
 
292
#define TEMPY           r51
 
293
#define DELTA           r52
 
294
 
 
295
#define M05_STORE       r0.13           // :uw, reuse r0.6:ud upper-word to store M0.5 header information for scoreboard
 
296
 
 
297
 
 
298
#endif  // SW_SCOREBOARD
 
299
 
 
300
// End of header.inc
 
301
 
 
302
#endif  // !defined(__HEADER__)
 
303