1 /* 2 * Copyright 2016 Rockchip Electronics Co. LTD 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #ifndef __HAL_VP8D_VDPU1_REG_H__ 17 #define __HAL_VP8D_VDPU1_REG_H__ 18 19 #include "rk_type.h" 20 21 #define VP8HWD_VP7 1 22 #define VP8HWD_VP8 2 23 #define VP8HWD_WEBP 3 24 25 #define DEC_MODE_VP7 9 26 #define DEC_MODE_VP8 10 27 28 #define VP8D_PROB_TABLE_SIZE (1<<16) 29 #define VP8D_MAX_SEGMAP_SIZE (2048 + 1024) 30 31 #define VP8D_REG_NUM 101 32 33 typedef struct { 34 struct { 35 RK_U32 build_version : 3; 36 RK_U32 product_IDen : 1; 37 RK_U32 minor_version : 8; 38 RK_U32 major_version : 4; 39 RK_U32 product_numer : 16; 40 } reg0_id; 41 42 struct { 43 RK_U32 sw_dec_e : 1; 44 RK_U32 reserve4 : 3; 45 RK_U32 sw_dec_irq_dis : 1; 46 RK_U32 reserve3 : 3; 47 RK_U32 sw_dec_irq : 1; 48 RK_U32 reserve2 : 3; 49 RK_U32 sw_dec_rdy_int : 1; 50 RK_U32 sw_dec_bus_int : 1; 51 RK_U32 sw_dec_buffer_int : 1; 52 RK_U32 sw_dec_aso_int : 1; 53 RK_U32 sw_dec_error_int : 1; 54 RK_U32 sw_dec_slice_int : 1; 55 RK_U32 sw_dec_timeout : 1; 56 RK_U32 reseved1 : 5; 57 RK_U32 sw_dec_pic_inf : 1; 58 RK_U32 reserved0 : 7; 59 } reg1_interrupt; 60 61 struct { 62 RK_U32 sw_dec_max_burst : 5; 63 RK_U32 sw_dec_scmd_dis : 1; 64 RK_U32 sw_dec_adv_pre_dis : 1; 65 RK_U32 sw_priority_mode : 1; /* Not used */ 66 RK_U32 sw_dec_out_endian : 1; 67 RK_U32 sw_dec_in_endian : 1; 68 RK_U32 sw_dec_clk_gate_e : 1; 69 RK_U32 sw_dec_latency : 6; 70 RK_U32 sw_dec_out_tiled_e : 1; /* Not used */ 71 RK_U32 sw_dec_data_disc_e : 1; 72 RK_U32 sw_dec_outswap32_e : 1; 73 RK_U32 sw_dec_inswap32_e : 1; 74 RK_U32 sw_dec_strendian_e : 1; 75 RK_U32 sw_dec_strswap32_e : 1; 76 RK_U32 sw_dec_timeout_e : 1; 77 RK_U32 sw_dec_axi_rn_id : 8; 78 } reg2_dec_ctrl; 79 80 struct { 81 RK_U32 sw_dec_axi_wr_id : 8; 82 RK_U32 sw_dec_ahb_hlock_e : 1; /* Not used */ 83 RK_U32 sw_picord_count_e : 1; 84 RK_U32 sw_seq_mbaff_e : 1; 85 RK_U32 sw_reftopfirst_e : 1; 86 RK_U32 sw_write_mvs_e : 1; 87 RK_U32 sw_pic_fixed_quant : 1; 88 RK_U32 sw_filtering_dis : 1; 89 RK_U32 sw_dec_out_dis : 1; 90 RK_U32 sw_ref_topfield_e : 1; 91 RK_U32 sw_sorenson_e : 1; 92 RK_U32 sw_fwd_interlace_e : 1; 93 RK_U32 sw_pic_topfield_e : 1; 94 RK_U32 sw_pic_inter_e : 1; 95 RK_U32 sw_pic_b_e : 1; 96 RK_U32 sw_pic_fieldmode_e : 1; 97 RK_U32 sw_pic_interlace_e : 1; 98 RK_U32 sw_pjpeg_e : 1; 99 RK_U32 sw_divx3_e : 1; /* Not used */ 100 RK_U32 sw_skip_mode : 1; 101 RK_U32 sw_rlc_mode_e : 1; 102 RK_U32 sw_dec_mode : 4; 103 } reg3; 104 105 struct { 106 RK_U32 sw_pic_mb_h_ext : 3; 107 RK_U32 sw_pic_mb_w_ext : 3; 108 RK_U32 sw_alt_scan_e : 1; 109 RK_U32 sw_mb_height_off : 4; 110 RK_U32 sw_pic_mb_hight_p : 8; 111 RK_U32 sw_mb_width_off : 4; 112 RK_U32 sw_pic_mb_width : 9; 113 } reg4; 114 115 struct { 116 RK_U32 sw_boolean_range : 8; 117 RK_U32 sw_boolean_value : 8; 118 RK_U32 reserved1 : 2; 119 RK_U32 sw_strm1_start_bit : 6; 120 RK_U32 reserved0 : 2; 121 RK_U32 sw_strm0_start_bit : 6; 122 } reg5; 123 124 struct { 125 RK_U32 sw_stream_len : 24; 126 RK_U32 sw_ch_8pix_ileav_e : 1; 127 RK_U32 sw_init_qp : 6; 128 RK_U32 sw_start_code_e : 1; 129 } reg6; 130 131 struct { 132 RK_U32 reserved1 : 5; 133 RK_U32 sw_vp7_version : 1; 134 RK_U32 sw_dc_match1 : 3; 135 RK_U32 sw_dc_match0 : 3; 136 RK_U32 sw_bilin_mc_e : 1; 137 RK_U32 sw_ch_mv_res : 1; 138 RK_U32 reserved0 : 6; 139 RK_U32 sw_dct2_start_bit : 6; 140 RK_U32 sw_dct1_start_bit : 6; 141 } reg7; 142 143 struct { 144 RK_U32 sw_dc_comp1 : 16; 145 RK_U32 sw_dc_comp0 : 16; 146 } reg8; 147 148 struct { 149 RK_U32 sw_stream1_len : 24; 150 RK_U32 sw_coeffs_part_am : 4; 151 RK_U32 reserved0 : 4; 152 } reg9; 153 154 RK_U32 reg10_segment_map_base; 155 156 struct { 157 RK_U32 sw_dct_start_bit_7 : 6; 158 RK_U32 sw_dct_start_bit_6 : 6; 159 RK_U32 sw_dct_start_bit_5 : 6; 160 RK_U32 sw_dct_start_bit_4 : 6; 161 RK_U32 sw_dct_start_bit_3 : 6; 162 RK_U32 reserved0 : 2; 163 } reg11; 164 165 RK_U32 reg12_input_stream_base; 166 RK_U32 reg13_cur_pic_base; /* Decoder output base */ 167 RK_U32 reg14_ref0_base; /* sw_ch_out_base */ 168 RK_U32 reg15_17[3]; /* Not used */ 169 170 RK_U32 reg18_golden_ref_base; 171 172 union { 173 RK_U32 alternate_ref_base; /* sw_refer5_base */ 174 struct { 175 RK_U32 sw_scan_map_5 : 6; 176 RK_U32 sw_scan_map_4 : 6; 177 RK_U32 sw_scan_map_3 : 6; 178 RK_U32 sw_scan_map_2 : 6; 179 RK_U32 sw_scan_map_1 : 6; 180 RK_U32 reserved0 : 2; 181 }; 182 } reg19; 183 184 struct { 185 RK_U32 sw_scan_map_10 : 6; 186 RK_U32 sw_scan_map_9 : 6; 187 RK_U32 sw_scan_map_8 : 6; 188 RK_U32 sw_scan_map_7 : 6; 189 RK_U32 sw_scan_map_6 : 6; 190 RK_U32 reserved0 : 2; 191 } reg20; 192 193 struct { 194 RK_U32 sw_scan_map_15 : 6; 195 RK_U32 sw_scan_map_14 : 6; 196 RK_U32 sw_scan_map_13 : 6; 197 RK_U32 sw_scan_map_12 : 6; 198 RK_U32 sw_scan_map_11 : 6; 199 RK_U32 reserved0 : 2; 200 } reg21; 201 202 RK_U32 reg_dct_strm0_base[5]; /* From reg22 to reg26 */ 203 RK_U32 reg27_bitpl_ctrl_base; 204 RK_U32 reg_dct_strm1_base[2]; /* From reg28 to reg29 */ 205 206 struct { 207 RK_U32 sw_filt_mb_adj_3 : 7; 208 RK_U32 sw_filt_mb_adj_2 : 7; 209 RK_U32 sw_filt_mb_adj_1 : 7; 210 RK_U32 sw_filt_mb_adj_0 : 7; 211 RK_U32 sw_filt_sharpness : 3; 212 RK_U32 sw_filt_type : 1; 213 } reg30; 214 215 struct { 216 RK_U32 sw_filt_ref_adj_3 : 7; 217 RK_U32 sw_filt_ref_adj_2 : 7; 218 RK_U32 sw_filt_ref_adj_1 : 7; 219 RK_U32 sw_filt_ref_adj_0 : 7; 220 RK_U32 reserved0 : 4; 221 } reg31; 222 223 struct { 224 RK_U32 sw_filt_level_3 : 6; 225 RK_U32 sw_filt_level_2 : 6; 226 RK_U32 sw_filt_level_1 : 6; 227 RK_U32 sw_filt_level_0 : 6; 228 RK_U32 reserved0 : 8; 229 } reg32; 230 231 struct { 232 RK_U32 sw_quant_1 : 11; 233 RK_U32 sw_quant_0 : 11; 234 RK_U32 sw_quant_delta_1 : 5; 235 RK_U32 sw_quant_delta_0 : 5; 236 } reg33; 237 238 struct { 239 RK_U32 reserved0 : 2; 240 RK_U32 sw_pred_bc_tap_1_1 : 10; 241 RK_U32 sw_pred_bc_tap_1_0 : 10; 242 RK_U32 sw_pred_bc_tap_0_3 : 10; 243 } reg34; 244 245 struct { 246 RK_U32 reserved0 : 2; 247 RK_U32 sw_pred_bc_tap_2_0 : 10; 248 RK_U32 sw_pred_bc_tap_1_3 : 10; 249 RK_U32 sw_pred_bc_tap_1_2 : 10; 250 } reg35; 251 252 struct { 253 RK_U32 reserved0 : 2; 254 RK_U32 sw_pred_bc_tap_2_3 : 10; 255 RK_U32 sw_pred_bc_tap_2_2 : 10; 256 RK_U32 sw_pred_bc_tap_2_1 : 10; 257 } reg36; 258 259 struct { 260 RK_U32 reserved0 : 2; 261 RK_U32 sw_pred_bc_tap_3_2 : 10; 262 RK_U32 sw_pred_bc_tap_3_1 : 10; 263 RK_U32 sw_pred_bc_tap_3_0 : 10; 264 } reg37; 265 266 struct { 267 RK_U32 reserved0 : 2; 268 RK_U32 sw_pred_bc_tap_4_1 : 10; 269 RK_U32 sw_pred_bc_tap_4_0 : 10; 270 RK_U32 sw_pred_bc_tap_3_3 : 10; 271 } reg38; 272 273 struct { 274 RK_U32 reserved0 : 2; 275 RK_U32 sw_pred_bc_tap_5_0 : 10; 276 RK_U32 sw_pred_bc_tap_4_3 : 10; 277 RK_U32 sw_pred_bc_tap_4_2 : 10; 278 } reg39; 279 280 RK_U32 reg40_qtable_base; 281 RK_U32 reg41_directmv_base; 282 283 struct { 284 RK_U32 reserved0 : 2; 285 RK_U32 sw_pred_bc_tap_5_3 : 10; 286 RK_U32 sw_pred_bc_tap_5_2 : 10; 287 RK_U32 sw_pred_bc_tap_5_1 : 10; 288 } reg42; 289 290 struct { 291 RK_U32 reserved0 : 2; 292 RK_U32 sw_pred_bc_tap_6_2 : 10; 293 RK_U32 sw_pred_bc_tap_6_1 : 10; 294 RK_U32 sw_pred_bc_tap_6_0 : 10; 295 } reg43; 296 297 struct { 298 RK_U32 reserved0 : 2; 299 RK_U32 sw_pred_bc_tap_7_1 : 10; 300 RK_U32 sw_pred_bc_tap_7_0 : 10; 301 RK_U32 sw_pred_bc_tap_6_3 : 10; 302 } reg44; 303 304 struct { 305 RK_U32 sw_pred_tap_6_4 : 2; 306 RK_U32 sw_pred_tap_6_M1 : 2; 307 RK_U32 sw_pred_tap_4_4 : 2; 308 RK_U32 sw_pred_tap_4_M1 : 2; 309 RK_U32 sw_pred_tap_2_4 : 2; 310 RK_U32 sw_pred_tap_2_M1 : 2; 311 RK_U32 sw_pred_bc_tap_7_3 : 10; 312 RK_U32 sw_pred_bc_tap_7_2 : 10; 313 } reg45; 314 315 struct { 316 RK_U32 sw_quant_3 : 11; 317 RK_U32 sw_quant_2 : 11; 318 RK_U32 sw_quant_delta_3 : 5; 319 RK_U32 sw_quant_delta_2 : 5; 320 } reg46; 321 322 struct { 323 RK_U32 sw_quant_5 : 11; 324 RK_U32 sw_quant_4 : 11; 325 RK_U32 reserved : 5; 326 RK_U32 sw_quant_delta_4 : 5; 327 } reg47; 328 329 struct { 330 RK_U32 reserved0 : 15; 331 RK_U32 sw_startmb_y : 8; 332 RK_U32 sw_startmb_x : 9; 333 } reg48; 334 335 struct { 336 RK_U32 reserved0 : 2; 337 RK_U32 sw_pred_bc_tap_0_2 : 10; 338 RK_U32 sw_pred_bc_tap_0_1 : 10; 339 RK_U32 sw_pred_bc_tap_0_0 : 10; 340 } reg49; 341 342 RK_U32 reg50; 343 344 struct { 345 RK_U32 sw_refbu_y_offset : 9; 346 RK_U32 reserve0 : 3; 347 RK_U32 sw_refbu_fparmod_e : 1; 348 RK_U32 sw_refbu_eval_e : 1; 349 RK_U32 sw_refbu_picid : 5; 350 RK_U32 sw_refbu_thr : 12; 351 RK_U32 sw_refbu_e : 1; 352 } reg51_refpicbuf_ctrl; 353 354 struct { 355 RK_U32 sw_refbu_intra_sum : 16; 356 RK_U32 sw_refbu_hit_sum : 16; 357 } reg52_sum_inf; 358 359 struct { 360 RK_U32 sw_refbu_mv_sum : 22; 361 RK_U32 reserve0 : 10; 362 } reg53_sum_mv; 363 364 struct { 365 RK_U32 reserve0 : 17; 366 /* sw_priority_mode */ 367 RK_U32 sw_dec_tiled_l : 2; 368 RK_U32 sw_dec_vp8snap_e : 1; 369 RK_U32 sw_dec_mvc_prof : 2; 370 RK_U32 sw_dec_avs_prof : 1; 371 RK_U32 sw_dec_vp8_prof : 1; 372 RK_U32 sw_dec_vp7_prof : 1; 373 RK_U32 sw_dec_rtl_rom : 1; 374 RK_U32 sw_dec_rv_prof : 2; 375 RK_U32 sw_ref_buff2_exist : 1; 376 RK_U32 reserve1 : 1; 377 RK_U32 sw_dec_refbu_ilace : 1; 378 RK_U32 sw_dec_jpeg_exten : 1; 379 } reg54_synthesis_cfg; 380 381 struct { 382 RK_U32 sw_apf_threshold : 14; 383 RK_U32 sw_refbu2_picid : 5; 384 RK_U32 sw_refbu2_thr : 12; 385 RK_U32 sw_refbu2_buf_e : 1; 386 } reg55; 387 388 struct { 389 RK_U32 sw_refbu_bot_sum : 16; 390 RK_U32 sw_refbu_top_sum : 16; 391 } reg56_sum_of_partitions; 392 393 /* Not used */ 394 RK_U32 reg57_decoder_fuse; 395 RK_U32 reg58_debug; 396 397 RK_U32 reg59_addit_ch_st_base; 398 RK_U32 reg60_100_post_processor[41]; 399 } VP8DRegSet_t; 400 401 #endif 402