| 1 |
/* |
| 2 |
* Copyright © <2010>, 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 |
| 6 |
* "Software"), to deal in the Software without restriction, including |
| 7 |
* without limitation the rights to use, copy, modify, merge, publish, |
| 8 |
* distribute, sub license, and/or sell copies of the Software, and to |
| 9 |
* permit persons to whom the Software is furnished to do so, subject to |
| 10 |
* the following conditions: |
| 11 |
* |
| 12 |
* The above copyright notice and this permission notice (including the |
| 13 |
* next paragraph) shall be included in all copies or substantial portions |
| 14 |
* of the Software. |
| 15 |
* |
| 16 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 17 |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 18 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
| 19 |
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR |
| 20 |
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 21 |
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 22 |
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 23 |
* |
| 24 |
* This file was originally licensed under the following license |
| 25 |
* |
| 26 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 27 |
* you may not use this file except in compliance with the License. |
| 28 |
* You may obtain a copy of the License at |
| 29 |
* |
| 30 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 31 |
* |
| 32 |
* Unless required by applicable law or agreed to in writing, software |
| 33 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 34 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 35 |
* See the License for the specific language governing permissions and |
| 36 |
* limitations under the License. |
| 37 |
* |
| 38 |
*/ |
| 39 |
#if !defined(__ILDB_HEADER__) // Make sure this file is only included once |
| 40 |
#define __ILDB_HEADER__ |
| 41 |
|
| 42 |
// Module name: ILDB_header.inc |
| 43 |
// |
| 44 |
|
| 45 |
.default_execution_size (16) |
| 46 |
.default_register_type :ub |
| 47 |
|
| 48 |
#undef NULLREG |
| 49 |
#undef RETURN_REG |
| 50 |
#undef EOTMSGDSC |
| 51 |
#undef MSGSRC |
| 52 |
#undef END_THREAD |
| 53 |
#undef TSMSGDSC |
| 54 |
|
| 55 |
// ----------- Common constant definitions ------------ |
| 56 |
// |
| 57 |
// Bit position constants |
| 58 |
// |
| 59 |
#define BIT0 0x01 |
| 60 |
#define BIT1 0x02 |
| 61 |
#define BIT2 0x04 |
| 62 |
#define BIT3 0x08 |
| 63 |
#define BIT4 0x10 |
| 64 |
#define BIT5 0x20 |
| 65 |
#define BIT6 0x40 |
| 66 |
#define BIT7 0x80 |
| 67 |
#define BIT8 0x0100 |
| 68 |
#define BIT9 0x0200 |
| 69 |
#define BIT10 0x0400 |
| 70 |
#define BIT11 0x0800 |
| 71 |
#define BIT12 0x1000 |
| 72 |
#define BIT13 0x2000 |
| 73 |
#define BIT14 0x4000 |
| 74 |
#define BIT15 0x8000 |
| 75 |
#define BIT16 0x00010000 |
| 76 |
#define BIT17 0x00020000 |
| 77 |
#define BIT18 0x00040000 |
| 78 |
#define BIT19 0x00080000 |
| 79 |
#define BIT20 0x00100000 |
| 80 |
#define BIT21 0x00200000 |
| 81 |
#define BIT22 0x00400000 |
| 82 |
#define BIT23 0x00800000 |
| 83 |
#define BIT24 0x01000000 |
| 84 |
#define BIT25 0x02000000 |
| 85 |
#define BIT26 0x04000000 |
| 86 |
#define BIT27 0x08000000 |
| 87 |
#define BIT28 0x10000000 |
| 88 |
#define BIT29 0x20000000 |
| 89 |
#define BIT30 0x40000000 |
| 90 |
#define BIT31 0x80000000 |
| 91 |
|
| 92 |
// Common constants |
| 93 |
// |
| 94 |
#define INST_SIZE 16 // Instruction size in byte |
| 95 |
|
| 96 |
#define GRFWIB 32 // GRF register width in byte |
| 97 |
#define GRFWIW 16 // GRF register width in word |
| 98 |
#define GRFWID 8 // GRF register width in dword |
| 99 |
|
| 100 |
#define TOP_FIELD 0 |
| 101 |
#define BOTTOM_FIELD 1 |
| 102 |
|
| 103 |
#define PREVIOUS_FRAME 0 // Previous frame |
| 104 |
#define CURRENT_FRAME 1 // Current frame |
| 105 |
#define NEXT_FRAME 2 // Next frame |
| 106 |
|
| 107 |
#define Y_ROW_WIDTH 16 // in bytes |
| 108 |
#define UV_ROW_WIDTH 8 |
| 109 |
|
| 110 |
// Useful macros |
| 111 |
// |
| 112 |
#define REGION(Width,HStride) <Width*HStride;Width,HStride> // Region definition when ExecSize = Width |
| 113 |
|
| 114 |
#define NULLREG null<1>:d |
| 115 |
#define NULLREGW null<1>:w |
| 116 |
|
| 117 |
#define RETURN_REG r62 // Return pointer for all sub-routine calls (type DWORD) |
| 118 |
|
| 119 |
#define CALL(subFunc, skipInst) add (1) RETURN_REG<1>:ud ip:ud (1+skipInst)*INST_SIZE \n\ |
| 120 |
jmpi (1) subFunc |
| 121 |
|
| 122 |
#define RETURN mov (1) ip:ud RETURN_REG<0;1,0>:ud // Return to calling module |
| 123 |
|
| 124 |
#define PRED_CALL(flag, subFunc, skipInst) add (1) RETURN_REG<1>:ud ip:ud (1+skipInst)*INST_SIZE \n\ |
| 125 |
(flag) jmpi (1) subFunc |
| 126 |
|
| 127 |
|
| 128 |
// Definitions for surface states, GRF regions, and common data fields |
| 129 |
// |
| 130 |
// Note: Each kernel needs to define a specific symbol before including this |
| 131 |
// header file to ensure correct definitions. |
| 132 |
// |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
#if defined(AVC_ILDB) |
| 137 |
|
| 138 |
.reg_count_total 64 |
| 139 |
.reg_count_payload 4 |
| 140 |
|
| 141 |
// Binding Table Index |
| 142 |
#define BI_CNTRL_DATA 0 // Control data map |
| 143 |
#define BI_SRC_Y 1 |
| 144 |
#define BI_SRC_UV 2 |
| 145 |
#define BI_DEST_Y 3 |
| 146 |
#define BI_DEST_UV 4 |
| 147 |
|
| 148 |
|
| 149 |
//========== Left MB, 4x16 in r2 and r3 ========== |
| 150 |
#define PREV_MB_Y_BASE 64 //2*GRFWIB // Byte offset to r2 |
| 151 |
.declare PREV_MB_YD Base=r2 ElementSize=4 SrcRegion=REGION(8,1) Type=ud |
| 152 |
.declare PREV_MB_YW Base=r2 ElementSize=2 SrcRegion=REGION(8,1) Type=uw |
| 153 |
.declare PREV_MB_YB Base=r2 ElementSize=1 SrcRegion=REGION(16,1) Type=ub |
| 154 |
|
| 155 |
#define PREV_MB_U_BASE 64 //2*GRFWIB // seperate thread from Y // Byte offset to r2 |
| 156 |
.declare PREV_MB_UD Base=r2 ElementSize=4 SrcRegion=REGION(8,1) Type=ud |
| 157 |
.declare PREV_MB_UW Base=r2 ElementSize=2 SrcRegion=REGION(16,1) Type=uw |
| 158 |
.declare PREV_MB_UB Base=r2 ElementSize=1 SrcRegion=REGION(16,1) Type=ub |
| 159 |
|
| 160 |
#define PREV_MB_V_BASE 65 //2*GRFWIB+1 // NV12 // Byte offset to r2.1 |
| 161 |
.declare PREV_MB_VB Base=r2.1 ElementSize=1 SrcRegion=REGION(16,1) Type=ub |
| 162 |
|
| 163 |
//========== Top MB, 16x4 in r4 and r5 ========== |
| 164 |
#define TOP_MB_Y_BASE 128 //4*GRFWIB // Byte offset to r4 |
| 165 |
.declare TOP_MB_YD Base=r4 ElementSize=4 SrcRegion=REGION(8,1) Type=ud |
| 166 |
.declare TOP_MB_YW Base=r4 ElementSize=2 SrcRegion=REGION(8,1) Type=uw |
| 167 |
.declare TOP_MB_YB Base=r4 ElementSize=1 SrcRegion=REGION(16,1) Type=ub |
| 168 |
|
| 169 |
#define TOP_MB_U_BASE 128 //4*GRFWIB // seperate thread from Y // Byte offset to r4 |
| 170 |
.declare TOP_MB_UD Base=r4 ElementSize=4 SrcRegion=REGION(8,1) Type=ud |
| 171 |
.declare TOP_MB_UW Base=r4 ElementSize=2 SrcRegion=REGION(16,1) Type=uw |
| 172 |
.declare TOP_MB_UB Base=r4 ElementSize=1 SrcRegion=REGION(16,1) Type=ub |
| 173 |
|
| 174 |
#define TOP_MB_V_BASE 129 //4*GRFWIB+1 // NV12 // Byte offset to r4.1 |
| 175 |
.declare TOP_MB_VB Base=r4.1 ElementSize=1 SrcRegion=REGION(16,1) Type=ub |
| 176 |
|
| 177 |
|
| 178 |
//========== Current MB, 16x16 in r6-r13 ========== |
| 179 |
#define SRC_MB_Y_BASE 192 //6*GRFWIB // Byte offset to r6 |
| 180 |
.declare SRC_YD Base=r6 ElementSize=4 SrcRegion=REGION(8,1) Type=ud // For read and write, 8 GRFs |
| 181 |
.declare SRC_YW Base=r6 ElementSize=2 SrcRegion=REGION(8,1) Type=uw |
| 182 |
.declare SRC_YB Base=r6 ElementSize=1 SrcRegion=REGION(16,1) Type=ub // 8 GRFs |
| 183 |
|
| 184 |
#define SRC_MB_U_BASE 192 //6*GRFWIB // seperate thread from Y // Byte offset to r6 |
| 185 |
.declare SRC_UD Base=r6 ElementSize=4 SrcRegion=REGION(8,1) Type=ud // For read and write, 2 GRFs |
| 186 |
.declare SRC_UW Base=r6 ElementSize=2 SrcRegion=REGION(16,1) Type=uw // For read and write, 4 GRFs |
| 187 |
.declare SRC_UB Base=r6 ElementSize=1 SrcRegion=REGION(16,1) Type=ub // 2 GRFs |
| 188 |
|
| 189 |
#define SRC_MB_V_BASE 193 // 6*GRFWIB+1 // NV12 // Byte offset to r6.1 |
| 190 |
.declare SRC_VD Base=r6.1 ElementSize=4 SrcRegion=REGION(8,1) Type=ud // For read and write, 2 GRFs |
| 191 |
.declare SRC_VW Base=r6.1 ElementSize=2 SrcRegion=REGION(16,1) Type=uw // For read and write, 4 GRFs |
| 192 |
.declare SRC_VB Base=r6.1 ElementSize=1 SrcRegion=REGION(16,1) Type=ub // 2 GRFs |
| 193 |
|
| 194 |
#else // No kernel specified, define nothing. |
| 195 |
|
| 196 |
.reg_count_total 64 |
| 197 |
.reg_count_payload 2 |
| 198 |
|
| 199 |
#define SRCAOFF r1.0:ud // Offset into alpha data |
| 200 |
#define SRCOFF r1.1:ud // Offset into source YUV data |
| 201 |
#define ORIX r1.4 // :w, H. origin of the destination block in pel |
| 202 |
#define ORIY r1.5 // :w, V. origin of the destination block in pel |
| 203 |
|
| 204 |
#endif |
| 205 |
|
| 206 |
// ----------- Message Payload Header fields------------ |
| 207 |
// |
| 208 |
#define IDP r0.2:ud // Interface Descriptor Pointer |
| 209 |
#define BTP r0.4:ud // Binding Table Pointer |
| 210 |
|
| 211 |
// ----------- Common Message Descriptor ------------ |
| 212 |
// |
| 213 |
#ifdef DEV_ILK |
| 214 |
#define GW_DCN // Should be enabled only for ILK-B0 and beyond |
| 215 |
#define MSG_GW 0x03 // Message Gateway |
| 216 |
#define MSG_GW_EOT 0x23 // Message Gateway plus EOT bit set (For ILK only) |
| 217 |
#define DAPREAD 0x04 // Data Port Read Extended Message Descriptor, |
| 218 |
#define DAPWRITE 0x05 // Data Port Write Extended Message Descriptor, |
| 219 |
#define URBWRITE 0x06 // URB |
| 220 |
#define TS 0x07 // Thread Spawner Extended Message Descriptor |
| 221 |
#define TS_EOT 0x27 // End of Thread Extended Message Descriptor |
| 222 |
|
| 223 |
#define EOTMSGDSC 0x02000000 // End of Thread Message Descriptor /w URB handle dereferenced (used by root kernel) |
| 224 |
#define CHILD_EOTMSGDSC 0x02000012 // End of Child Thread Message Descriptor w/o URB handle dereferenced |
| 225 |
|
| 226 |
// Data Port Message Descriptor |
| 227 |
#define DWBRMSGDSC_RC 0x02086000 // DWORD Block Read Message Descriptor, reading from render cache = 6. |
| 228 |
#define DWBRMSGDSC_RC_TF 0x02086600 // DWORD Block Read Message Descriptor, reading from render cache = 6. |
| 229 |
#define DWBRMSGDSC_RC_BF 0x02086700 // DWORD Block Read Message Descriptor, reading from render cache = 6. |
| 230 |
#define DWBRMSGDSC_SC 0x0208A000 // DWORD Block Read Message Descriptor, reading from sampler cache = A. |
| 231 |
#define DWBRMSGDSC_SC_TF 0x0208E600 // DWORD Block Read Message Descriptor, reading top field from field mode sampler cache. |
| 232 |
#define DWBRMSGDSC_SC_BF 0x0208E700 // DWORD Block Read Message Descriptor, reading bottom field from field mode sampler cache. |
| 233 |
|
| 234 |
#define ILDBRMSGDSC 0x02085800 // AVC ILDB Control Data Read Msg Desc on Bearlake-C |
| 235 |
|
| 236 |
#define DWBWMSGDSC 0x02082000 // DWORD Block Write Message Descriptor |
| 237 |
#define DWBWMSGDSC_WC 0x0218A000 // DWORD Block Write Message Descriptor + write commit |
| 238 |
|
| 239 |
// URB Message Descriptor |
| 240 |
#define URBWMSGDSC 0x02080000 // URB Write Message Descriptor |
| 241 |
|
| 242 |
// Thread Spawner Message Descriptor |
| 243 |
#define TSMSGDSC 0x02000001 |
| 244 |
|
| 245 |
// Message Gateway Message Descriptors |
| 246 |
#define OGWMSGDSC 0x02000000 // OpenGateway Message Descriptor |
| 247 |
#define CGWMSGDSC 0x02000001 // CloseGateway Message Descriptor |
| 248 |
#define FWDMSGDSC 0x02000002 // ForwardMsg Message Descriptor |
| 249 |
#define NOTIFYMSG 0x00008000 // Send notification with ForwardMsg message |
| 250 |
|
| 251 |
#define RESP_LEN(len) 0x100000*len |
| 252 |
#define MSG_LEN(len) 0x2000000*len |
| 253 |
|
| 254 |
#else // Pre DEV_ILK |
| 255 |
|
| 256 |
#define MSG_GW |
| 257 |
#define MSG_GW_EOT |
| 258 |
#define DAPREAD |
| 259 |
#define DAPWRITE |
| 260 |
#define URBWRITE |
| 261 |
#define TS |
| 262 |
#define TS_EOT |
| 263 |
|
| 264 |
#define EOTMSGDSC 0x87100000 // End of Thread Message Descriptor /w URB handle dereferenced (used by root kernel) |
| 265 |
#define CHILD_EOTMSGDSC 0x87100012 // End of Child Thread Message Descriptor w/o URB handle dereferenced |
| 266 |
|
| 267 |
// Data Port Message Descriptor |
| 268 |
#define DWBRMSGDSC_RC 0x04106000 // DWORD Block Read Message Descriptor, reading from render cache = 6. |
| 269 |
#define DWBRMSGDSC_RC_TF 0x04106600 // DWORD Block Read Message Descriptor, reading from render cache = 6. |
| 270 |
#define DWBRMSGDSC_RC_BF 0x04106700 // DWORD Block Read Message Descriptor, reading from render cache = 6. |
| 271 |
#define DWBRMSGDSC_SC 0x0410A000 // DWORD Block Read Message Descriptor, reading from sampler cache = A. |
| 272 |
#define DWBRMSGDSC_SC_TF 0x0410A600 // DWORD Block Read Message Descriptor, reading top field from field mode sampler cache. |
| 273 |
#define DWBRMSGDSC_SC_BF 0x0410A700 // DWORD Block Read Message Descriptor, reading bottom field from field mode sampler cache. |
| 274 |
|
| 275 |
#define ILDBRMSGDSC 0x04105800 // AVC ILDB Control Data Read Msg Desc on Bearlake-C |
| 276 |
|
| 277 |
#define DWBWMSGDSC 0x05102000 // DWORD Block Write Message Descriptor |
| 278 |
#define DWBWMSGDSC_WC 0x0511A000 // DWORD Block Write Message Descriptor + write commit |
| 279 |
|
| 280 |
// URB Message Descriptor |
| 281 |
#define URBWMSGDSC 0x06100000 // URB Write Message Descriptor |
| 282 |
|
| 283 |
// Thread Spawner Message Descriptor |
| 284 |
#define TSMSGDSC 0x07100001 |
| 285 |
|
| 286 |
// Message Gateway Message Descriptors |
| 287 |
#define OGWMSGDSC 0x03100000 // OpenGateway Message Descriptor |
| 288 |
#define CGWMSGDSC 0x03100001 // CloseGateway Message Descriptor |
| 289 |
#define FWDMSGDSC 0x03100002 // ForwardMsg Message Descriptor |
| 290 |
#define NOTIFYMSG 0x00008000 // Send notification with ForwardMsg message |
| 291 |
|
| 292 |
#define RESP_LEN(len) 0x10000*len |
| 293 |
#define MSG_LEN(len) 0x100000*len |
| 294 |
|
| 295 |
// bits 15 - 0 = 01 011 000 00000000 = 0101 1000 0000 0000 = 5800 |
| 296 |
// Render cache, AVC loop rd, |
| 297 |
#endif // DEV_ILK |
| 298 |
|
| 299 |
// Enable frame/field selection in message descriptor |
| 300 |
#define ENMSGDSCFM 0x400 // Enable MSGDSC to select frame surface |
| 301 |
#define ENMSGDSCTF 0x600 // Enable MSGDSC to select top field surface |
| 302 |
#define ENMSGDSCBF 0x700 // Enable MSGDSC to select bottom field surface |
| 303 |
|
| 304 |
#define END_THREAD send (8) NULLREG MSGHDR r0:ud TS_EOT EOTMSGDSC |
| 305 |
#define END_CHILD_THREAD send (8) NULLREG MSGHDR r0:ud TS_EOT CHILD_EOTMSGDSC |
| 306 |
|
| 307 |
// ----------- Message related register ------------ |
| 308 |
// |
| 309 |
#define MSGHDR m1 // Message Payload Header |
| 310 |
#define MSGHDRY m1 // Message Payload Header register for Y data |
| 311 |
#define MSGHDRU m2 // Message Payload Header register for U data |
| 312 |
#define MSGHDRV m3 // Message Payload Header register for V data |
| 313 |
|
| 314 |
#define MSGHDRC m1 // Message Payload Header register for CUR MB |
| 315 |
#define MSGHDRL m2 // Message Payload Header register for LEFT MB |
| 316 |
#define MSGHDRT m3 // Message Payload Header register for TOP MB |
| 317 |
|
| 318 |
#define MSGHDRYA m4 // Second Message Payload Header register for Y data |
| 319 |
#define MSGSRC r63 // Message source register |
| 320 |
#define MSGDSC a0.0:ud // Message Descriptor register (type DWORD) |
| 321 |
|
| 322 |
#define MH_ORI MSGSRC.0 // DWORD block R/W message header block offset |
| 323 |
#define MH_ORIX MSGSRC.0 // DWORD block R/W message header X offset |
| 324 |
#define MH_ORIY MSGSRC.1 // DWORD block R/W message header Y offset |
| 325 |
#define MH_SIZE MSGSRC.2 // DWORD block R/W message header block width & height |
| 326 |
|
| 327 |
|
| 328 |
// M2 - M9 for message data payload |
| 329 |
.declare MSGPAYLOADB Base=m2 ElementSize=1 SrcRegion=REGION(16,1) Type=ub |
| 330 |
.declare MSGPAYLOADW Base=m2 ElementSize=2 SrcRegion=REGION(16,1) Type=uw |
| 331 |
.declare MSGPAYLOADD Base=m2 ElementSize=4 SrcRegion=REGION(8,1) Type=ud |
| 332 |
.declare MSGPAYLOADF Base=m2 ElementSize=4 SrcRegion=REGION(8,1) Type=f |
| 333 |
|
| 334 |
// End of ILDB_header.inc |
| 335 |
|
| 336 |
#endif // !defined(__ILDB_HEADER__) |