| 1 |
/* |
| 2 |
* Copyright © 2010-2013 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 (including the next |
| 12 |
* paragraph) shall be included in all copies or substantial portions of the |
| 13 |
* Software. |
| 14 |
* |
| 15 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 21 |
* IN THE SOFTWARE. |
| 22 |
* |
| 23 |
* Authors: |
| 24 |
* Zhao Yakui <[email protected]> |
| 25 |
*/ |
| 26 |
|
| 27 |
/* GRF registers |
| 28 |
* r0 header |
| 29 |
* r1~r4 constant buffer (reserved) |
| 30 |
* r5 inline data |
| 31 |
* r6~r7 reserved |
| 32 |
* r8~r15 temporary registers |
| 33 |
* r16 write back of Oword Block Write |
| 34 |
*/ |
| 35 |
|
| 36 |
/* |
| 37 |
* GRF 0 -- header |
| 38 |
*/ |
| 39 |
define(`thread_id_ub', `r0.20<0,1,0>:UB') /* thread id in payload */ |
| 40 |
|
| 41 |
define(`inline_reg0', `r5') |
| 42 |
define(`buffer_offset', `inline_reg0.0') /* :ud, in units of Owords */ |
| 43 |
/* :ub, |
| 44 |
* bit0 indicates the frame type. 1 is the I-frame. 0 is P-B frame |
| 45 |
*/ |
| 46 |
define(`mb_flag', `inline_reg0.4') |
| 47 |
define(`qp_flag', `inline_reg0.6') /* :ub */ |
| 48 |
|
| 49 |
define(`mb_x', `inline_reg0.8') /* :ub, */ |
| 50 |
define(`mb_y', `inline_reg0.9') /* :ub, */ |
| 51 |
define(`mb_xy', `inline_reg0.8') /* :uw, */ |
| 52 |
/* :uw, the picture width in macroblocks */ |
| 53 |
define(`width_in_mbs', `inline_reg0.10') |
| 54 |
/* :w, the number of macroblock commands being processed by the kernel */ |
| 55 |
define(`total_mbs', `inline_reg0.12') |
| 56 |
/* ub, the mb x/y of the last mb in slice */ |
| 57 |
define(`slice_end_x', `inline_reg0.16') |
| 58 |
define(`slice_end_y', `inline_reg0.17') |
| 59 |
|
| 60 |
/* :ud the forward reference picture list */ |
| 61 |
define(`fwd_ref', `inline_reg0.20') |
| 62 |
/* :ud the backward reference picture list */ |
| 63 |
define(`bwd_ref', `inline_reg0.24') |
| 64 |
|
| 65 |
/* |
| 66 |
* GRF 8~15 -- temporary registers |
| 67 |
*/ |
| 68 |
define(`tmp_reg0', `r8') |
| 69 |
define(`tmp_reg1', `r9') |
| 70 |
define(`tmp_reg2', `r10') |
| 71 |
define(`tmp_reg3', `r11') |
| 72 |
define(`tmp_reg4', `r12') |
| 73 |
define(`tmp_reg5', `r13') |
| 74 |
define(`tmp_reg6', `r14') |
| 75 |
define(`tmp_reg7', `r15') |
| 76 |
|
| 77 |
define(`obw_m0', `tmp_reg7') |
| 78 |
|
| 79 |
define(`obw_wb', `null<1>:W') |
| 80 |
define(`obw_wb_length', `0') |
| 81 |
|
| 82 |
/* |
| 83 |
* GRF 26~27 |
| 84 |
*/ |
| 85 |
define(`pak_object_reg0', `r26') |
| 86 |
define(`pak_object0_ud', `r26.0') |
| 87 |
define(`pak_object1_ud', `r26.4') |
| 88 |
define(`pak_object2_ud', `r26.8') |
| 89 |
define(`pak_object3_ud', `r26.12') |
| 90 |
define(`pak_object4_ud', `r26.16') |
| 91 |
define(`pak_object5_ud', `r26.20') |
| 92 |
define(`pak_object6_ud', `r26.24') |
| 93 |
define(`pak_object7_ud', `r26.28') |
| 94 |
|
| 95 |
define(`pak_object_reg1', `r27') |
| 96 |
define(`pak_object8_ud', `r27.0') |
| 97 |
define(`pak_object9_ud', `r27.4') |
| 98 |
define(`pak_object10_ud', `r27.8') |
| 99 |
define(`pak_object11_ud', `r27.12') |
| 100 |
|
| 101 |
/* |
| 102 |
* Message Payload registers |
| 103 |
*/ |
| 104 |
define(`msg_ind', `64') |
| 105 |
define(`msg_reg0', `g64') |
| 106 |
define(`msg_reg1', `g65') |
| 107 |
define(`msg_reg2', `g66') |
| 108 |
define(`msg_reg3', `g67') |
| 109 |
define(`msg_reg4', `g68') |
| 110 |
define(`msg_reg5', `g69') |
| 111 |
define(`msg_reg6', `g70') |
| 112 |
define(`msg_reg7', `g71') |
| 113 |
define(`msg_reg8', `g72') |
| 114 |
|
| 115 |
define(`MV_BIND_IDX', `0') |
| 116 |
define(`MFC_BIND_IDX', `2') |
| 117 |
|
| 118 |
define(`ts_msg_ind', `112') |
| 119 |
define(`ts_msg_reg0', `r112') |
| 120 |
|
| 121 |
|
| 122 |
define(`MFC_AVC_PAK_OBJECT_DW0', `0x7149000a') |
| 123 |
define(`MFC_AVC_PAK_OBJECT_DW4', `0xFFFF0000') /* CBP for Y */ |
| 124 |
define(`MFC_AVC_PAK_OBJECT_DW5', `0x000F000F') |
| 125 |
define(`MFC_AVC_PAK_OBJECT_DW10', `0x0000000') |
| 126 |
|
| 127 |
define(`OBR_MESSAGE_TYPE', `0') |
| 128 |
define(`OBR_CACHE_TYPE', `10') |
| 129 |
|
| 130 |
define(`OBR_MESSAGE_FENCE', `7') |
| 131 |
define(`OBR_MF_NOCOMMIT', `0') |
| 132 |
define(`OBR_MF_COMMIT', `0x20') |
| 133 |
|
| 134 |
define(`OBR_CONTROL_0', `0') /* 1 OWord, low 128 bits */ |
| 135 |
define(`OBR_CONTROL_1', `1') /* 1 OWord, high 128 bits */ |
| 136 |
define(`OBR_CONTROL_2', `2') /* 2 OWords */ |
| 137 |
define(`OBR_CONTROL_4', `3') /* 4 OWords */ |
| 138 |
define(`OBR_CONTROL_8', `4') /* 8 OWords */ |
| 139 |
|
| 140 |
define(`OBR_HEADER_PRESENT', `1') |
| 141 |
define(`OBR_WRITE_COMMIT_CATEGORY', `0') /* category on Ivybridge */ |
| 142 |
|
| 143 |
define(`OBW_WRITE_COMMIT_CATEGORY', `0') /* category on Ivybridge */ |
| 144 |
|
| 145 |
define(`OBW_CACHE_TYPE', `10') |
| 146 |
|
| 147 |
|
| 148 |
define(`OBW_MESSAGE_TYPE', `8') |
| 149 |
|
| 150 |
define(`OBW_CONTROL_0', `0') /* 1 OWord, low 128 bits */ |
| 151 |
define(`OBW_CONTROL_1', `1') /* 1 OWord, high 128 bits */ |
| 152 |
define(`OBW_CONTROL_2', `2') /* 2 OWords */ |
| 153 |
define(`OBW_CONTROL_4', `3') /* 4 OWords */ |
| 154 |
define(`OBW_CONTROL_8', `4') /* 8 OWords */ |
| 155 |
define(`OBW_HEADER_PRESENT', `1') |
| 156 |
|
| 157 |
define(`INTER_MASK', `0x03') |
| 158 |
define(`INTER_16X16MODE', `0x0') |
| 159 |
define(`INTER_16X8MODE', `0x01') |
| 160 |
define(`INTER_8X16MODE', `0x02') |
| 161 |
define(`INTER_8X8MODE', `0x03') |
| 162 |
define(`SUBSHAPE_MASK', `0xFF00') |
| 163 |
|
| 164 |
define(`mb_ind', `90') |
| 165 |
define(`mb_msg0', `r90') |
| 166 |
define(`mb_wb', `r91') |
| 167 |
define(`mb_intra_wb', `r91') |
| 168 |
define(`mb_inter_wb', `r92') |
| 169 |
define(`mb_mv0', `r93') |
| 170 |
define(`mb_mv1', `r94') |
| 171 |
define(`mb_mv2', `r95') |
| 172 |
define(`mb_mv3', `r96') |
| 173 |
|
| 174 |
define(`mb_temp', `r86') |
| 175 |
define(`cur_mb_x', `mb_temp.0') /* :uw, */ |
| 176 |
define(`cur_mb_y', `mb_temp.2') /* :uw, */ |
| 177 |
define(`cur_loop_count', `mb_temp.4') /* :uw, */ |
| 178 |
define(`mb_end', `r87') |
| 179 |
define(`end_mb_x', `mb_end.0') /* :uw, */ |
| 180 |
define(`end_mb_y', `mb_end.2') /* :uw, */ |
| 181 |
define(`end_loop_count', `mb_end.4') /* :uw, */ |
| 182 |
/* :ud the length of VME predict result for every mb. Units in owords */ |
| 183 |
define(`vme_len', `mb_end.8') |
| 184 |
define(`mb_cur_msg', `r88') |
| 185 |
|
| 186 |
define(`INTRA_SLICE', `0x0001') |
| 187 |
define(`MFC_AVC_PAK_LAST_MB', `0x0400') |
| 188 |
|
| 189 |
define(`MFC_AVC_INTER_MASK_DW3', `0x1F00FFFF') |
| 190 |
define(`MFC_AVC_INTRA_MASK_DW3', `0x0000C0FF') |
| 191 |
define(`INTER_MV8', `0x00400000') |
| 192 |
define(`INTER_MV32', `0x00600000') |
| 193 |
define(`MFC_AVC_PAK_CBP', `0x000E0000') |
| 194 |
define(`MFC_AVC_INTRA_FLAG', `0x00002000') |
| 195 |
define(`AVC_INTRA_MASK', `0x1F00') |