1 /* SPDX-License-Identifier: Apache-2.0 OR MIT */ 2 /* 3 * Copyright (c) 2024 Rockchip Electronics Co., Ltd. 4 */ 5 6 #ifndef __VDPU384A_COM_H__ 7 #define __VDPU384A_COM_H__ 8 9 #include "mpp_device.h" 10 #include "mpp_buf_slot.h" 11 12 #define OFFSET_CTRL_REGS (8 * sizeof(RK_U32)) 13 #define OFFSET_COMMON_ADDR_REGS (128 * sizeof(RK_U32)) 14 #define OFFSET_COM_NEW_REGS (320 * sizeof(RK_U32)) 15 #define OFFSET_CODEC_PARAS_REGS (64 * sizeof(RK_U32)) 16 #define OFFSET_CODEC_ADDR_REGS (168 * sizeof(RK_U32)) 17 #define OFFSET_INTERRUPT_REGS (15 * sizeof(RK_U32)) 18 19 #define RCB_ALLINE_SIZE (64) 20 21 #define MPP_RCB_BYTES(bits) MPP_ALIGN((bits + 7) / 8, RCB_ALLINE_SIZE) 22 23 // #define DUMP_VDPU384A_DATAS 24 25 typedef enum Vdpu384aRcbType_e { 26 RCB_STRMD_ROW, 27 RCB_STRMD_TILE_ROW, 28 RCB_INTER_ROW, 29 RCB_INTER_TILE_ROW, 30 RCB_INTRA_ROW, 31 RCB_INTRA_TILE_ROW, 32 RCB_FILTERD_ROW, 33 RCB_FILTERD_PROTECT_ROW, 34 RCB_FILTERD_TILE_ROW, 35 RCB_FILTERD_TILE_COL, 36 RCB_FILTERD_AV1_UP_TILE_COL, 37 38 RCB_BUF_COUNT, 39 } Vdpu384aRcbType; 40 41 typedef enum Vdpu384a_RCB_SET_MODE_E { 42 RCB_SET_BY_SIZE_SORT_MODE, 43 RCB_SET_BY_PRIORITY_MODE, 44 } Vdpu384aRcbSetMode_e; 45 46 typedef struct Vdpu384aRegVersion_t { 47 struct SWREG0_ID { 48 RK_U32 minor_ver : 8; 49 RK_U32 major_ver : 8; 50 RK_U32 prod_num : 16; 51 } reg0; 52 53 } Vdpu384aRegVersion; 54 55 typedef struct Vdpu384aCtrlReg_t { 56 /* SWREG8_DEC_MODE */ 57 RK_U32 reg8_dec_mode; 58 59 struct SWREG9_IMPORTANT_EN { 60 RK_U32 dpb_output_dis : 1; 61 /* 62 * 0: dpb data use rkfbc64x4 channel 63 * 1: dpb data user main pp channel 64 * 2: dpb data use scl down channel 65 */ 66 RK_U32 dpb_data_sel : 2; 67 RK_U32 reserve0 : 1; 68 RK_U32 low_latency_en : 1; 69 RK_U32 scale_down_en : 1; 70 RK_U32 reserve1 : 1; 71 RK_U32 pix_range_det_e : 1; 72 RK_U32 av1_fgs_en : 1; 73 RK_U32 reserve2 : 3; 74 RK_U32 scale_down_ratio : 1; 75 RK_U32 scale_down_10bitto8bit_en : 1; 76 RK_U32 line_irq_en : 3; 77 RK_U32 out_cbcr_swap : 1; 78 RK_U32 dpb_rkfbc_force_uncompress : 1; 79 RK_U32 dpb_rkfbc_sparse_mode : 1; 80 RK_U32 reserve3 : 1; 81 RK_U32 pp_m_fbc32x8_force_uncompress : 1; 82 RK_U32 pp_m_fbc32x8_sparse_mode : 1; 83 RK_U32 inter_max_mv_detect_en : 1; 84 /* 85 * 0:disable pp main channel output 86 * 1:pp main channel output raster picture to ddr. 87 * 2:pp main channel output tile4x4 picture to ddr. 88 * 3:pp main channel output afbc32x8 picture to ddr. 89 */ 90 RK_U32 pp_m_output_mode : 2; 91 RK_U32 reserve4 : 6; 92 } reg9; 93 94 struct SWREG10_BLOCK_GATING_EN { 95 RK_U32 strmd_auto_gating_e : 1; 96 RK_U32 inter_auto_gating_e : 1; 97 RK_U32 intra_auto_gating_e : 1; 98 RK_U32 transd_auto_gating_e : 1; 99 RK_U32 recon_auto_gating_e : 1; 100 RK_U32 filterd_auto_gating_e : 1; 101 RK_U32 bus_auto_gating_e : 1; 102 RK_U32 ctrl_auto_gating_e : 1; 103 RK_U32 rcb_auto_gating_e : 1; 104 RK_U32 err_prc_auto_gating_e : 1; 105 RK_U32 reserve0 : 22; 106 } reg10; 107 108 struct SWREG11_CFG_PARA { 109 RK_U32 frame_irq_dis : 1; 110 RK_U32 reserve0 : 8; 111 RK_U32 dec_timeout_dis : 1; 112 RK_U32 reserve1 : 6; 113 RK_U32 rd_outstanding : 8; 114 RK_U32 wr_outstanding : 8; 115 } reg11; 116 117 struct SWREG12_CACHE_HASH_MASK { 118 RK_U32 reserve0 : 7; 119 RK_U32 cache_hash_mask : 25; 120 } reg12; 121 122 /* SWREG13_CORE_TIMEOUT_THRESHOLD */ 123 RK_U32 reg13_core_timeout_threshold; 124 125 struct SWREG14_LINE_IRQ_CTRL { 126 RK_U32 dec_line_irq_step : 16; 127 RK_U32 dec_line_offset_y_st : 16; 128 } reg14; 129 130 /* copy from llp, media group add */ 131 struct SWREG15_IRQ_STA { 132 RK_U32 rkvdec_frame_rdy_sta : 1; 133 RK_U32 rkvdec_strm_error_sta : 1; 134 RK_U32 rkvdec_core_timeout_sta : 1; 135 RK_U32 rkvdec_ip_timeout_sta : 1; 136 RK_U32 rkvdec_bus_error_sta : 1; 137 RK_U32 rkvdec_buffer_empty_sta : 1; 138 RK_U32 rkvdec_colmv_ref_error_sta : 1; 139 RK_U32 rkvdec_error_spread_sta : 1; 140 RK_U32 create_core_timeout_sta : 1; 141 RK_U32 wlast_miss_match_sta : 1; 142 RK_U32 rkvdec_core_rst_rdy_sta : 1; 143 RK_U32 rkvdec_ip_rst_rdy_sta : 1; 144 RK_U32 force_busidle_rdy_sta : 1; 145 RK_U32 ltb_pause_rdy_sta : 1; 146 RK_U32 ltb_end_flag : 1; 147 RK_U32 unsupport_decmode_error_sta : 1; 148 RK_U32 wmask_bits : 15; 149 RK_U32 reserve0 : 1; 150 } reg15; 151 152 struct SWREG16_ERROR_CTRL_SET { 153 RK_U32 error_proc_disable : 1; 154 RK_U32 reserve0 : 3; 155 RK_U32 error_proc_mode : 1; 156 RK_U32 reserve1 : 3; 157 RK_U32 error_spread_disable : 1; 158 RK_U32 error_fill_mode : 1; 159 RK_U32 reserve2 : 14; 160 RK_U32 roi_error_ctu_cal_en : 1; 161 RK_U32 reserve3 : 7; 162 } reg16; 163 164 struct SWREG17_ERR_ROI_CTU_OFFSET_START { 165 RK_U32 roi_x_ctu_offset_st : 12; 166 RK_U32 reserve0 : 4; 167 RK_U32 roi_y_ctu_offset_st : 12; 168 RK_U32 reserve1 : 4; 169 } reg17; 170 171 struct SWREG18_ERR_ROI_CTU_OFFSET_END { 172 RK_U32 roi_x_ctu_offset_end : 12; 173 RK_U32 reserve0 : 4; 174 RK_U32 roi_y_ctu_offset_end : 12; 175 RK_U32 reserve1 : 4; 176 } reg18; 177 178 struct SWREG19_ERROR_REF_INFO { 179 RK_U32 avs2_ref_error_field : 1; 180 RK_U32 avs2_ref_error_topfield : 1; 181 RK_U32 ref_error_topfield_used : 1; 182 RK_U32 ref_error_botfield_used : 1; 183 RK_U32 reserve0 : 28; 184 } reg19; 185 186 /* SWREG20_CABAC_ERROR_EN_LOWBITS */ 187 RK_U32 reg20_cabac_error_en_lowbits; 188 189 /* SWREG21_CABAC_ERROR_EN_HIGHBITS */ 190 RK_U32 reg21_cabac_error_en_highbits; 191 192 RK_U32 reserve_reg22; 193 194 struct SWREG23_INVALID_PIXEL_FILL { 195 RK_U32 fill_y : 10; 196 RK_U32 fill_u : 10; 197 RK_U32 fill_v : 10; 198 RK_U32 reserve0 : 2; 199 } reg23; 200 201 RK_U32 reserve_reg24_27[4]; 202 203 struct SWREG28_DEBUG_PERF_LATENCY_CTRL0 { 204 RK_U32 axi_perf_work_e : 1; 205 RK_U32 reserve0 : 2; 206 RK_U32 axi_cnt_type : 1; 207 RK_U32 rd_latency_id : 8; 208 RK_U32 reserve1 : 4; 209 RK_U32 rd_latency_thr : 12; 210 RK_U32 reserve2 : 4; 211 } reg28; 212 213 struct SWREG29_DEBUG_PERF_LATENCY_CTRL1 { 214 RK_U32 addr_align_type : 2; 215 RK_U32 ar_cnt_id_type : 1; 216 RK_U32 aw_cnt_id_type : 1; 217 RK_U32 ar_count_id : 8; 218 RK_U32 reserve0 : 4; 219 RK_U32 aw_count_id : 8; 220 RK_U32 rd_band_width_mode : 1; 221 RK_U32 reserve1 : 7; 222 } reg29; 223 224 struct SWREG30_QOS_CTRL { 225 RK_U32 axi_wr_qos_level : 4; 226 RK_U32 reserve0 : 4; 227 RK_U32 axi_wr_qos : 4; 228 RK_U32 reserve1 : 4; 229 RK_U32 axi_rd_qos_level : 4; 230 RK_U32 reserve2 : 4; 231 RK_U32 axi_rd_qos : 4; 232 RK_U32 reserve3 : 4; 233 } reg30; 234 235 } Vdpu384aCtrlReg; 236 237 typedef struct Vdpu384aRegCommonAddr_t { 238 /* SWREG128_STRM_BASE */ 239 RK_U32 reg128_strm_base; 240 241 /* SWREG129_STREAM_BUF_ST_BASE */ 242 RK_U32 reg129_stream_buf_st_base; 243 244 /* SWREG130_STREAM_BUF_END_BASE */ 245 RK_U32 reg130_stream_buf_end_base; 246 247 /* SWREG131_GBL_BASE */ 248 RK_U32 reg131_gbl_base; 249 250 /* SWREG132_SCANLIST_ADDR */ 251 RK_U32 reg132_scanlist_addr; 252 253 /* SWREG133_SCL_BASE */ 254 RK_U32 reg133_scale_down_base; 255 256 /* SWREG134_FGS_BASE */ 257 RK_U32 reg134_fgs_base; 258 259 /* SWREG135_PP_M_DECOUT_BASE */ 260 RK_U32 reg135_pp_m_decout_base; 261 262 /* SWREG136_PP_M_FBC32x8_PAYLOAD_OFFSET */ 263 RK_U32 reg136_pp_m_fbc32x8_payload_offset; 264 265 RK_U32 reserve_reg137_139[3]; 266 267 /* SWREG140_RCB_STRMD_ROW_OFFSET */ 268 RK_U32 reg140_rcb_strmd_row_offset; 269 270 /* SWREG141_RCB_STRMD_ROW_LEN */ 271 RK_U32 reg141_rcb_strmd_row_len; 272 273 /* SWREG142_RCB_STRMD_TILE_ROW_OFFSET */ 274 RK_U32 reg142_rcb_strmd_tile_row_offset; 275 276 /* SWREG143_RCB_STRMD_TILE_ROW_LEN */ 277 RK_U32 reg143_rcb_strmd_tile_row_len; 278 279 /* SWREG144_RCB_INTER_ROW_OFFSET */ 280 RK_U32 reg144_rcb_inter_row_offset; 281 282 /* SWREG145_RCB_INTER_ROW_LEN */ 283 RK_U32 reg145_rcb_inter_row_len; 284 285 /* SWREG146_RCB_INTER_TILE_ROW_OFFSET */ 286 RK_U32 reg146_rcb_inter_tile_row_offset; 287 288 /* SWREG147_RCB_INTER_TILE_ROW_LEN */ 289 RK_U32 reg147_rcb_inter_tile_row_len; 290 291 /* SWREG148_RCB_INTRA_ROW_OFFSET */ 292 RK_U32 reg148_rcb_intra_row_offset; 293 294 /* SWREG149_RCB_INTRA_ROW_LEN */ 295 RK_U32 reg149_rcb_intra_row_len; 296 297 /* SWREG150_RCB_INTRA_TILE_ROW_OFFSET */ 298 RK_U32 reg150_rcb_intra_tile_row_offset; 299 300 /* SWREG151_RCB_INTRA_TILE_ROW_LEN */ 301 RK_U32 reg151_rcb_intra_tile_row_len; 302 303 /* SWREG152_RCB_FILTERD_ROW_OFFSET */ 304 RK_U32 reg152_rcb_filterd_row_offset; 305 306 /* SWREG153_RCB_FILTERD_ROW_LEN */ 307 RK_U32 reg153_rcb_filterd_row_len; 308 309 RK_U32 reserve_reg154_155[2]; 310 311 /* SWREG156_RCB_FILTERD_TILE_ROW_OFFSET */ 312 RK_U32 reg156_rcb_filterd_tile_row_offset; 313 314 /* SWREG157_RCB_FILTERD_TILE_ROW_LEN */ 315 RK_U32 reg157_rcb_filterd_tile_row_len; 316 317 /* SWREG158_RCB_FILTERD_TILE_COL_OFFSET */ 318 RK_U32 reg158_rcb_filterd_tile_col_offset; 319 320 /* SWREG159_RCB_FILTERD_TILE_COL_LEN */ 321 RK_U32 reg159_rcb_filterd_tile_col_len; 322 323 /* SWREG160_RCB_FILTERD_AV1_UPSCALE_TILE_COL_OFFSET */ 324 RK_U32 reg160_rcb_filterd_av1_upscale_tile_col_offset; 325 326 /* SWREG161_RCB_FILTERD_AV1_UPSCALE_TILE_COL_LEN */ 327 RK_U32 reg161_rcb_filterd_av1_upscale_tile_col_len; 328 329 } Vdpu384aRegCommonAddr; 330 331 typedef struct Vdpu384aRegCommParas_t { 332 /* SWREG64_H26X_PARA */ 333 RK_U32 reg64_unused_bits; 334 335 /* SWREG65_STREAM_PARAM_SET */ 336 RK_U32 reg65_strm_start_bit; 337 338 /* SWREG66_STREAM_LEN */ 339 RK_U32 reg66_stream_len; 340 341 /* SWREG67_GLOBAL_LEN */ 342 RK_U32 reg67_global_len; 343 344 /* SWREG68_DPB_HOR_STRIDE */ 345 RK_U32 reg68_dpb_hor_virstride; 346 347 RK_U32 reserve_reg69_70[2]; 348 349 /* SWREG71_SCL_Y_HOR_VIRSTRIDE */ 350 RK_U32 reg71_scl_ref_hor_virstride; 351 352 /* SWREG72_SCL_UV_HOR_VIRSTRIDE */ 353 RK_U32 reg72_scl_ref_raster_uv_hor_virstride; 354 355 /* SWREG73_SCL_Y_VIRSTRIDE */ 356 RK_U32 reg73_scl_ref_virstride; 357 358 /* SWREG74_FGS_Y_HOR_VIRSTRIDE */ 359 RK_U32 reg74_fgs_ref_hor_virstride; 360 361 RK_U32 reserve_reg75_76[2]; 362 363 /* SWREG77_HEAD_HOR_STRIDE */ 364 RK_U32 reg77_pp_m_hor_stride; 365 366 /* SWREG78_PP_M_RASTER_UV_HOR_STRIDE */ 367 RK_U32 reg78_pp_m_uv_hor_stride; 368 369 /* SWREG79_PP_M_Y_STRIDE */ 370 RK_U32 reg79_pp_m_y_virstride; 371 372 /* SWREG80_ERROR_REF_Y_HOR_VIRSTRIDE */ 373 RK_U32 reg80_error_ref_hor_virstride; 374 375 /* SWREG81_ERROR_REF_UV_HOR_VIRSTRIDE */ 376 RK_U32 reg81_error_ref_raster_uv_hor_virstride; 377 378 /* SWREG82_ERROR_REF_Y_VIRSTRIDE */ 379 RK_U32 reg82_error_ref_virstride; 380 381 /* SWREG83_REF0_Y_HOR_VIRSTRIDE */ 382 RK_U32 reg83_ref0_hor_virstride; 383 384 /* SWREG84_REF0_UV_HOR_VIRSTRIDE */ 385 RK_U32 reg84_ref0_raster_uv_hor_virstride; 386 387 /* SWREG85_REF0_Y_VIRSTRIDE */ 388 RK_U32 reg85_ref0_virstride; 389 390 /* SWREG86_REF1_Y_HOR_VIRSTRIDE */ 391 RK_U32 reg86_ref1_hor_virstride; 392 393 /* SWREG87_REF1_UV_HOR_VIRSTRIDE */ 394 RK_U32 reg87_ref1_raster_uv_hor_virstride; 395 396 /* SWREG88_REF1_Y_VIRSTRIDE */ 397 RK_U32 reg88_ref1_virstride; 398 399 /* SWREG89_REF2_Y_HOR_VIRSTRIDE */ 400 RK_U32 reg89_ref2_hor_virstride; 401 402 /* SWREG90_REF2_UV_HOR_VIRSTRIDE */ 403 RK_U32 reg90_ref2_raster_uv_hor_virstride; 404 405 /* SWREG91_REF2_Y_VIRSTRIDE */ 406 RK_U32 reg91_ref2_virstride; 407 408 /* SWREG92_REF3_Y_HOR_VIRSTRIDE */ 409 RK_U32 reg92_ref3_hor_virstride; 410 411 /* SWREG93_REF3_UV_HOR_VIRSTRIDE */ 412 RK_U32 reg93_ref3_raster_uv_hor_virstride; 413 414 /* SWREG94_REF3_Y_VIRSTRIDE */ 415 RK_U32 reg94_ref3_virstride; 416 417 /* SWREG95_REF4_Y_HOR_VIRSTRIDE */ 418 RK_U32 reg95_ref4_hor_virstride; 419 420 /* SWREG96_REF4_UV_HOR_VIRSTRIDE */ 421 RK_U32 reg96_ref4_raster_uv_hor_virstride; 422 423 /* SWREG97_REF4_Y_VIRSTRIDE */ 424 RK_U32 reg97_ref4_virstride; 425 426 /* SWREG98_REF5_Y_HOR_VIRSTRIDE */ 427 RK_U32 reg98_ref5_hor_virstride; 428 429 /* SWREG99_REF5_UV_HOR_VIRSTRIDE */ 430 RK_U32 reg99_ref5_raster_uv_hor_virstride; 431 432 /* SWREG100_REF5_Y_VIRSTRIDE */ 433 RK_U32 reg100_ref5_virstride; 434 435 /* SWREG101_REF6_Y_HOR_VIRSTRIDE */ 436 RK_U32 reg101_ref6_hor_virstride; 437 438 /* SWREG102_REF6_UV_HOR_VIRSTRIDE */ 439 RK_U32 reg102_ref6_raster_uv_hor_virstride; 440 441 /* SWREG103_REF6_Y_VIRSTRIDE */ 442 RK_U32 reg103_ref6_virstride; 443 444 /* SWREG104_REF7_Y_HOR_VIRSTRIDE */ 445 RK_U32 reg104_ref7_hor_virstride; 446 447 /* SWREG105_REF7_UV_HOR_VIRSTRIDE */ 448 RK_U32 reg105_ref7_raster_uv_hor_virstride; 449 450 /* SWREG106_REF7_Y_VIRSTRIDE */ 451 RK_U32 reg106_ref7_virstride; 452 453 } Vdpu384aRegCommParas; 454 455 typedef struct Vdpu384aRegStatistic_t { 456 struct SWREG256_IDLE_FLAG { 457 RK_U32 reserve0 : 24; 458 RK_U32 rkvdec_bus_idle_flag : 1; 459 RK_U32 reserve1 : 7; 460 } reg256; 461 462 RK_U32 reserve_reg257; 463 464 /* SWREG258_PERF_MONITOR */ 465 RK_U32 reg258_perf_rd_max_latency_num; 466 467 /* SWREG259_PERF_MONITOR */ 468 RK_U32 reg259_perf_rd_latency_samp_num; 469 470 /* SWREG260_PERF_MONITOR */ 471 RK_U32 reg260_perf_rd_latency_acc_sum; 472 473 /* SWREG261_PERF_MONITOR */ 474 RK_U32 reg261_perf_rd_axi_total_byte; 475 476 /* SWREG262_PERF_MONITOR */ 477 RK_U32 reg262_perf_wr_axi_total_bytes; 478 479 /* SWREG263_PERF_MONITOR */ 480 RK_U32 reg263_perf_working_cnt; 481 482 RK_U32 reserve_reg264_272[9]; 483 484 /* SWREG273_REFLIST_IDX_USED */ 485 RK_U32 reg273_inter_sw_reflst_idx_use; 486 487 RK_U32 reserve_reg274_284[11]; 488 489 /* SWREG285_PAYLOAD_CNT */ 490 RK_U32 reg285_filterd_payload_total_cnt; 491 492 struct SWREG286_WR_OFFSET { 493 RK_U32 filterd_report_offsety : 16; 494 RK_U32 filterd_report_offsetx : 16; 495 } reg286; 496 497 struct SWREG287_MAX_PIX { 498 RK_U32 filterd_max_y : 10; 499 RK_U32 filterd_max_u : 10; 500 RK_U32 filterd_max_v : 10; 501 RK_U32 reserve0 : 2; 502 } reg287; 503 504 struct SWREG288_MIN_PIX { 505 RK_U32 filterd_min_y : 10; 506 RK_U32 filterd_min_u : 10; 507 RK_U32 filterd_min_v : 10; 508 RK_U32 reserve0 : 2; 509 } reg288; 510 511 /* SWREG289_WR_LINE_NUM */ 512 RK_U32 reg289_filterd_line_irq_offsety; 513 514 RK_U32 reserve_reg290_291[2]; 515 516 struct SWREG292_RCB_RW_SUM { 517 RK_U32 rcb_rd_sum_chk : 8; 518 RK_U32 rcb_wr_sum_chk : 8; 519 RK_U32 reserve0 : 16; 520 } reg292; 521 522 RK_U32 reserve_reg293; 523 524 struct SWREG294_ERR_CTU_NUM0 { 525 RK_U32 error_ctu_num : 24; 526 RK_U32 roi_error_ctu_num_lowbit : 8; 527 } reg294; 528 529 /* SWREG295_ERR_CTU_NUM1 */ 530 RK_U32 reg295_roi_error_ctu_num_highbit; 531 532 } Vdpu384aRegStatistic; 533 534 typedef struct Vdpu384aRegLlp_t { 535 struct SWREG0_LINK_MODE { 536 RK_U32 llp_mmu_zap_cache_dis : 1; 537 RK_U32 reserve0 : 15; 538 RK_U32 core_work_mode : 1; 539 RK_U32 ccu_core_work_mode : 1; 540 RK_U32 reserve1 : 3; 541 RK_U32 ltb_pause_flag : 1; 542 RK_U32 reserve2 : 10; 543 } reg0; 544 545 struct SWREG1_CFG_START_ADDR { 546 RK_U32 reserve0 : 4; 547 RK_U32 reg_cfg_addr : 28; 548 } reg1; 549 550 struct SWREG2_LINK_MODE { 551 RK_U32 pre_frame_num : 30; 552 RK_U32 reserve0 : 1; 553 RK_U32 link_mode : 1; 554 } reg2; 555 556 /* SWREG3_CONFIG_DONE */ 557 RK_U32 reg3_done; 558 559 /* SWREG4_DECODERED_NUM */ 560 RK_U32 reg4_num; 561 562 /* SWREG5_DEC_TOTAL_NUM */ 563 RK_U32 reg5_total_num; 564 565 /* SWREG6_LINK_MODE_EN */ 566 RK_U32 reg6_mode_en; 567 568 /* SWREG7_SKIP_NUM */ 569 RK_U32 reg7_num; 570 571 /* SWREG8_CUR_LTB_IDX */ 572 RK_U32 reg8_ltb_idx; 573 574 RK_U32 reserve_reg9_15[7]; 575 576 /* SWREG16_DEC_E */ 577 RK_U32 reg16_dec_e; 578 579 /* SWREG17_SOFT_RST */ 580 RK_U32 reg17_rkvdec_ip_rst_p; 581 582 struct SWREG18_IRQ { 583 RK_U32 rkvdec_irq : 1; 584 RK_U32 rkvdec_line_irq : 1; 585 RK_U32 reserve0 : 14; 586 RK_U32 wmask : 2; 587 RK_U32 reserve1 : 14; 588 } reg18; 589 590 struct SWREG19_STA { 591 RK_U32 rkvdec_frame_rdy_sta : 1; 592 RK_U32 rkvdec_strm_error_sta : 1; 593 RK_U32 rkvdec_core_timeout_sta : 1; 594 RK_U32 rkvdec_ip_timeout_sta : 1; 595 RK_U32 rkvdec_bus_error_sta : 1; 596 RK_U32 rkvdec_buffer_empty_sta : 1; 597 RK_U32 rkvdec_colmv_ref_error_sta : 1; 598 RK_U32 rkvdec_error_spread_sta : 1; 599 RK_U32 create_core_timeout_sta : 1; 600 RK_U32 wlast_miss_match_sta : 1; 601 RK_U32 rkvdec_core_rst_rdy_sta : 1; 602 RK_U32 rkvdec_ip_rst_rdy_sta : 1; 603 RK_U32 force_busidle_rdy_sta : 1; 604 RK_U32 ltb_pause_rdy_sta : 1; 605 RK_U32 ltb_end_flag : 1; 606 RK_U32 unsupport_decmode_error_sta : 1; 607 RK_U32 wmask_bits : 15; 608 RK_U32 reserve0 : 1; 609 } reg19; 610 611 RK_U32 reserve_reg20; 612 613 /* SWREG21_IP_TIMEOUT_THRESHOD */ 614 RK_U32 reg21_ip_timeout_threshold; 615 616 struct SWREG22_IP_EN { 617 RK_U32 ip_timeout_pause_flag : 1; 618 RK_U32 reserve0 : 3; 619 RK_U32 abnormal_auto_reset_dis : 1; 620 RK_U32 reserve1 : 3; 621 RK_U32 force_busidle_req_flag : 1; 622 RK_U32 reserve2 : 3; 623 RK_U32 bus_clkgate_dis : 1; 624 RK_U32 ctrl_clkgate_dis : 1; 625 RK_U32 reserve3 : 1; 626 RK_U32 irq_dis : 1; 627 RK_U32 wid_reorder_dis : 1; 628 RK_U32 reserve4 : 7; 629 RK_U32 clk_cru_mode : 2; 630 RK_U32 reserve5 : 5; 631 RK_U32 mmu_sel : 1; 632 } reg22; 633 634 struct SWREG23_IN_OUT { 635 RK_U32 endian : 1; 636 RK_U32 swap32_e : 1; 637 RK_U32 swap64_e : 1; 638 RK_U32 str_endian : 1; 639 RK_U32 str_swap32_e : 1; 640 RK_U32 str_swap64_e : 1; 641 RK_U32 reserve0 : 26; 642 } reg23; 643 644 /* SWREG24_EXTRA_STRM_BASE */ 645 RK_U32 reg24_extra_stream_base; 646 647 /* SWREG25_EXTRA_STRM_LEN */ 648 RK_U32 reg25_extra_stream_len; 649 650 /* SWREG26_EXTRA_STRM_PARA_SET */ 651 RK_U32 reg26_extra_strm_start_bit; 652 653 /* SWREG27_BUF_EMPTY_RESTART */ 654 RK_U32 reg27_buf_emtpy_restart_p; 655 656 /* SWREG28_RCB_BASE */ 657 RK_U32 reg28_rcb_base; 658 659 } Vdpu384aRegLlp; 660 661 typedef struct Vdpu384aRcbInfo_t { 662 RK_U32 reg_idx; 663 RK_S32 size; 664 RK_S32 offset; 665 } Vdpu384aRcbInfo; 666 667 #ifdef __cplusplus 668 extern "C" { 669 #endif 670 671 RK_S32 vdpu384a_get_rcb_buf_size(Vdpu384aRcbInfo *info, RK_S32 width, RK_S32 height); 672 RK_RET vdpu384a_check_rcb_buf_size(Vdpu384aRcbInfo *info, RK_S32 width, RK_S32 height); 673 void vdpu384a_setup_rcb(Vdpu384aRegCommonAddr *reg, MppDev dev, MppBuffer buf, Vdpu384aRcbInfo *info); 674 RK_S32 vdpu384a_compare_rcb_size(const void *a, const void *b); 675 void vdpu384a_setup_statistic(Vdpu384aCtrlReg *com); 676 void vdpu384a_afbc_align_calc(MppBufSlots slots, MppFrame frame, RK_U32 expand); 677 RK_S32 vdpu384a_set_rcbinfo(MppDev dev, Vdpu384aRcbInfo *rcb_info); 678 void vdpu384a_setup_down_scale(MppFrame frame, MppDev dev, Vdpu384aCtrlReg *com, void* comParas); 679 void vdpu384a_update_thumbnail_frame_info(MppFrame frame); 680 681 #ifdef DUMP_VDPU384A_DATAS 682 extern RK_U32 dump_cur_frame; 683 extern char dump_cur_dir[128]; 684 extern char dump_cur_fname_path[512]; 685 686 MPP_RET flip_string(char *str); 687 MPP_RET dump_data_to_file(char *fname_path, void *data, RK_U32 data_bit_size, 688 RK_U32 line_bits, RK_U32 big_end); 689 #endif 690 691 #ifdef __cplusplus 692 } 693 #endif 694 695 #endif /* __VDPU384A_COM_H__ */ 696