Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

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