1af69d88dSmrg/**************************************************************************
2af69d88dSmrg *
3af69d88dSmrg * Copyright 2011 Advanced Micro Devices, Inc.
4af69d88dSmrg * All Rights Reserved.
5af69d88dSmrg *
6af69d88dSmrg * Permission is hereby granted, free of charge, to any person obtaining a
7af69d88dSmrg * copy of this software and associated documentation files (the
8af69d88dSmrg * "Software"), to deal in the Software without restriction, including
9af69d88dSmrg * without limitation the rights to use, copy, modify, merge, publish,
10af69d88dSmrg * distribute, sub license, and/or sell copies of the Software, and to
11af69d88dSmrg * permit persons to whom the Software is furnished to do so, subject to
12af69d88dSmrg * the following conditions:
13af69d88dSmrg *
14af69d88dSmrg * The above copyright notice and this permission notice (including the
15af69d88dSmrg * next paragraph) shall be included in all copies or substantial portions
16af69d88dSmrg * of the Software.
17af69d88dSmrg *
18af69d88dSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19af69d88dSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20af69d88dSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21af69d88dSmrg * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR
22af69d88dSmrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23af69d88dSmrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24af69d88dSmrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25af69d88dSmrg *
26af69d88dSmrg **************************************************************************/
27af69d88dSmrg
28af69d88dSmrg#ifndef RADEON_UVD_H
29af69d88dSmrg#define RADEON_UVD_H
30af69d88dSmrg
3101e04c3fSmrg#include "radeon/radeon_winsys.h"
32af69d88dSmrg#include "vl/vl_video_buffer.h"
33af69d88dSmrg
34af69d88dSmrg/* UVD uses PM4 packet type 0 and 2 */
357ec681f3Smrg#define RUVD_PKT_TYPE_S(x)        (((unsigned)(x)&0x3) << 30)
367ec681f3Smrg#define RUVD_PKT_TYPE_G(x)        (((x) >> 30) & 0x3)
377ec681f3Smrg#define RUVD_PKT_TYPE_C           0x3FFFFFFF
387ec681f3Smrg#define RUVD_PKT_COUNT_S(x)       (((unsigned)(x)&0x3FFF) << 16)
397ec681f3Smrg#define RUVD_PKT_COUNT_G(x)       (((x) >> 16) & 0x3FFF)
407ec681f3Smrg#define RUVD_PKT_COUNT_C          0xC000FFFF
417ec681f3Smrg#define RUVD_PKT0_BASE_INDEX_S(x) (((unsigned)(x)&0xFFFF) << 0)
427ec681f3Smrg#define RUVD_PKT0_BASE_INDEX_G(x) (((x) >> 0) & 0xFFFF)
437ec681f3Smrg#define RUVD_PKT0_BASE_INDEX_C    0xFFFF0000
447ec681f3Smrg#define RUVD_PKT0(index, count)                                                                    \
457ec681f3Smrg   (RUVD_PKT_TYPE_S(0) | RUVD_PKT0_BASE_INDEX_S(index) | RUVD_PKT_COUNT_S(count))
467ec681f3Smrg#define RUVD_PKT2() (RUVD_PKT_TYPE_S(2))
47af69d88dSmrg
48af69d88dSmrg/* registers involved with UVD */
497ec681f3Smrg#define RUVD_GPCOM_VCPU_CMD   0xEF0C
507ec681f3Smrg#define RUVD_GPCOM_VCPU_DATA0 0xEF10
517ec681f3Smrg#define RUVD_GPCOM_VCPU_DATA1 0xEF14
527ec681f3Smrg#define RUVD_ENGINE_CNTL      0xEF18
53af69d88dSmrg
547ec681f3Smrg#define RUVD_GPCOM_VCPU_CMD_SOC15   0x2070c
557ec681f3Smrg#define RUVD_GPCOM_VCPU_DATA0_SOC15 0x20710
567ec681f3Smrg#define RUVD_GPCOM_VCPU_DATA1_SOC15 0x20714
577ec681f3Smrg#define RUVD_ENGINE_CNTL_SOC15      0x20718
5801e04c3fSmrg
59af69d88dSmrg/* UVD commands to VCPU */
607ec681f3Smrg#define RUVD_CMD_MSG_BUFFER             0x00000000
617ec681f3Smrg#define RUVD_CMD_DPB_BUFFER             0x00000001
627ec681f3Smrg#define RUVD_CMD_DECODING_TARGET_BUFFER 0x00000002
637ec681f3Smrg#define RUVD_CMD_FEEDBACK_BUFFER        0x00000003
647ec681f3Smrg#define RUVD_CMD_SESSION_CONTEXT_BUFFER 0x00000005
657ec681f3Smrg#define RUVD_CMD_BITSTREAM_BUFFER       0x00000100
667ec681f3Smrg#define RUVD_CMD_ITSCALING_TABLE_BUFFER 0x00000204
677ec681f3Smrg#define RUVD_CMD_CONTEXT_BUFFER         0x00000206
68af69d88dSmrg
69af69d88dSmrg/* UVD message types */
707ec681f3Smrg#define RUVD_MSG_CREATE  0
717ec681f3Smrg#define RUVD_MSG_DECODE  1
727ec681f3Smrg#define RUVD_MSG_DESTROY 2
73af69d88dSmrg
74af69d88dSmrg/* UVD stream types */
757ec681f3Smrg#define RUVD_CODEC_H264      0x00000000
767ec681f3Smrg#define RUVD_CODEC_VC1       0x00000001
777ec681f3Smrg#define RUVD_CODEC_MPEG2     0x00000003
787ec681f3Smrg#define RUVD_CODEC_MPEG4     0x00000004
797ec681f3Smrg#define RUVD_CODEC_H264_PERF 0x00000007
807ec681f3Smrg#define RUVD_CODEC_MJPEG     0x00000008
817ec681f3Smrg#define RUVD_CODEC_H265      0x00000010
82af69d88dSmrg
83af69d88dSmrg/* UVD decode target buffer tiling mode */
847ec681f3Smrg#define RUVD_TILE_LINEAR 0x00000000
857ec681f3Smrg#define RUVD_TILE_8X4    0x00000001
867ec681f3Smrg#define RUVD_TILE_8X8    0x00000002
877ec681f3Smrg#define RUVD_TILE_32AS8  0x00000003
88af69d88dSmrg
89af69d88dSmrg/* UVD decode target buffer array mode */
907ec681f3Smrg#define RUVD_ARRAY_MODE_LINEAR                   0x00000000
917ec681f3Smrg#define RUVD_ARRAY_MODE_MACRO_LINEAR_MICRO_TILED 0x00000001
927ec681f3Smrg#define RUVD_ARRAY_MODE_1D_THIN                  0x00000002
937ec681f3Smrg#define RUVD_ARRAY_MODE_2D_THIN                  0x00000004
947ec681f3Smrg#define RUVD_ARRAY_MODE_MACRO_TILED_MICRO_LINEAR 0x00000004
957ec681f3Smrg#define RUVD_ARRAY_MODE_MACRO_TILED_MICRO_TILED  0x00000005
96af69d88dSmrg
97af69d88dSmrg/* UVD tile config */
987ec681f3Smrg#define RUVD_BANK_WIDTH(x)              ((x) << 0)
997ec681f3Smrg#define RUVD_BANK_HEIGHT(x)             ((x) << 3)
1007ec681f3Smrg#define RUVD_MACRO_TILE_ASPECT_RATIO(x) ((x) << 6)
1017ec681f3Smrg#define RUVD_NUM_BANKS(x)               ((x) << 9)
102af69d88dSmrg
103af69d88dSmrg/* H.264 profile definitions */
1047ec681f3Smrg#define RUVD_H264_PROFILE_BASELINE    0x00000000
1057ec681f3Smrg#define RUVD_H264_PROFILE_MAIN        0x00000001
1067ec681f3Smrg#define RUVD_H264_PROFILE_HIGH        0x00000002
1077ec681f3Smrg#define RUVD_H264_PROFILE_STEREO_HIGH 0x00000003
1087ec681f3Smrg#define RUVD_H264_PROFILE_MVC         0x00000004
109af69d88dSmrg
110af69d88dSmrg/* VC-1 profile definitions */
1117ec681f3Smrg#define RUVD_VC1_PROFILE_SIMPLE   0x00000000
1127ec681f3Smrg#define RUVD_VC1_PROFILE_MAIN     0x00000001
1137ec681f3Smrg#define RUVD_VC1_PROFILE_ADVANCED 0x00000002
114af69d88dSmrg
1157ec681f3Smrgenum ruvd_surface_type
1167ec681f3Smrg{
1177ec681f3Smrg   RUVD_SURFACE_TYPE_LEGACY = 0,
1187ec681f3Smrg   RUVD_SURFACE_TYPE_GFX9
11901e04c3fSmrg};
12001e04c3fSmrg
121af69d88dSmrgstruct ruvd_mvc_element {
1227ec681f3Smrg   uint16_t viewOrderIndex;
1237ec681f3Smrg   uint16_t viewId;
1247ec681f3Smrg   uint16_t numOfAnchorRefsInL0;
1257ec681f3Smrg   uint16_t viewIdOfAnchorRefsInL0[15];
1267ec681f3Smrg   uint16_t numOfAnchorRefsInL1;
1277ec681f3Smrg   uint16_t viewIdOfAnchorRefsInL1[15];
1287ec681f3Smrg   uint16_t numOfNonAnchorRefsInL0;
1297ec681f3Smrg   uint16_t viewIdOfNonAnchorRefsInL0[15];
1307ec681f3Smrg   uint16_t numOfNonAnchorRefsInL1;
1317ec681f3Smrg   uint16_t viewIdOfNonAnchorRefsInL1[15];
132af69d88dSmrg};
133af69d88dSmrg
134af69d88dSmrgstruct ruvd_h264 {
1357ec681f3Smrg   uint32_t profile;
1367ec681f3Smrg   uint32_t level;
137af69d88dSmrg
1387ec681f3Smrg   uint32_t sps_info_flags;
1397ec681f3Smrg   uint32_t pps_info_flags;
1407ec681f3Smrg   uint8_t chroma_format;
1417ec681f3Smrg   uint8_t bit_depth_luma_minus8;
1427ec681f3Smrg   uint8_t bit_depth_chroma_minus8;
1437ec681f3Smrg   uint8_t log2_max_frame_num_minus4;
144af69d88dSmrg
1457ec681f3Smrg   uint8_t pic_order_cnt_type;
1467ec681f3Smrg   uint8_t log2_max_pic_order_cnt_lsb_minus4;
1477ec681f3Smrg   uint8_t num_ref_frames;
1487ec681f3Smrg   uint8_t reserved_8bit;
149af69d88dSmrg
1507ec681f3Smrg   int8_t pic_init_qp_minus26;
1517ec681f3Smrg   int8_t pic_init_qs_minus26;
1527ec681f3Smrg   int8_t chroma_qp_index_offset;
1537ec681f3Smrg   int8_t second_chroma_qp_index_offset;
154af69d88dSmrg
1557ec681f3Smrg   uint8_t num_slice_groups_minus1;
1567ec681f3Smrg   uint8_t slice_group_map_type;
1577ec681f3Smrg   uint8_t num_ref_idx_l0_active_minus1;
1587ec681f3Smrg   uint8_t num_ref_idx_l1_active_minus1;
159af69d88dSmrg
1607ec681f3Smrg   uint16_t slice_group_change_rate_minus1;
1617ec681f3Smrg   uint16_t reserved_16bit_1;
162af69d88dSmrg
1637ec681f3Smrg   uint8_t scaling_list_4x4[6][16];
1647ec681f3Smrg   uint8_t scaling_list_8x8[2][64];
165af69d88dSmrg
1667ec681f3Smrg   uint32_t frame_num;
1677ec681f3Smrg   uint32_t frame_num_list[16];
1687ec681f3Smrg   int32_t curr_field_order_cnt_list[2];
1697ec681f3Smrg   int32_t field_order_cnt_list[16][2];
170af69d88dSmrg
1717ec681f3Smrg   uint32_t decoded_pic_idx;
172af69d88dSmrg
1737ec681f3Smrg   uint32_t curr_pic_ref_frame_num;
174af69d88dSmrg
1757ec681f3Smrg   uint8_t ref_frame_list[16];
176af69d88dSmrg
1777ec681f3Smrg   uint32_t reserved[122];
178af69d88dSmrg
1797ec681f3Smrg   struct {
1807ec681f3Smrg      uint32_t numViews;
1817ec681f3Smrg      uint32_t viewId0;
1827ec681f3Smrg      struct ruvd_mvc_element mvcElements[1];
1837ec681f3Smrg   } mvc;
184af69d88dSmrg};
185af69d88dSmrg
18601e04c3fSmrgstruct ruvd_h265 {
1877ec681f3Smrg   uint32_t sps_info_flags;
1887ec681f3Smrg   uint32_t pps_info_flags;
1897ec681f3Smrg
1907ec681f3Smrg   uint8_t chroma_format;
1917ec681f3Smrg   uint8_t bit_depth_luma_minus8;
1927ec681f3Smrg   uint8_t bit_depth_chroma_minus8;
1937ec681f3Smrg   uint8_t log2_max_pic_order_cnt_lsb_minus4;
1947ec681f3Smrg
1957ec681f3Smrg   uint8_t sps_max_dec_pic_buffering_minus1;
1967ec681f3Smrg   uint8_t log2_min_luma_coding_block_size_minus3;
1977ec681f3Smrg   uint8_t log2_diff_max_min_luma_coding_block_size;
1987ec681f3Smrg   uint8_t log2_min_transform_block_size_minus2;
1997ec681f3Smrg
2007ec681f3Smrg   uint8_t log2_diff_max_min_transform_block_size;
2017ec681f3Smrg   uint8_t max_transform_hierarchy_depth_inter;
2027ec681f3Smrg   uint8_t max_transform_hierarchy_depth_intra;
2037ec681f3Smrg   uint8_t pcm_sample_bit_depth_luma_minus1;
2047ec681f3Smrg
2057ec681f3Smrg   uint8_t pcm_sample_bit_depth_chroma_minus1;
2067ec681f3Smrg   uint8_t log2_min_pcm_luma_coding_block_size_minus3;
2077ec681f3Smrg   uint8_t log2_diff_max_min_pcm_luma_coding_block_size;
2087ec681f3Smrg   uint8_t num_extra_slice_header_bits;
2097ec681f3Smrg
2107ec681f3Smrg   uint8_t num_short_term_ref_pic_sets;
2117ec681f3Smrg   uint8_t num_long_term_ref_pic_sps;
2127ec681f3Smrg   uint8_t num_ref_idx_l0_default_active_minus1;
2137ec681f3Smrg   uint8_t num_ref_idx_l1_default_active_minus1;
2147ec681f3Smrg
2157ec681f3Smrg   int8_t pps_cb_qp_offset;
2167ec681f3Smrg   int8_t pps_cr_qp_offset;
2177ec681f3Smrg   int8_t pps_beta_offset_div2;
2187ec681f3Smrg   int8_t pps_tc_offset_div2;
2197ec681f3Smrg
2207ec681f3Smrg   uint8_t diff_cu_qp_delta_depth;
2217ec681f3Smrg   uint8_t num_tile_columns_minus1;
2227ec681f3Smrg   uint8_t num_tile_rows_minus1;
2237ec681f3Smrg   uint8_t log2_parallel_merge_level_minus2;
2247ec681f3Smrg
2257ec681f3Smrg   uint16_t column_width_minus1[19];
2267ec681f3Smrg   uint16_t row_height_minus1[21];
2277ec681f3Smrg
2287ec681f3Smrg   int8_t init_qp_minus26;
2297ec681f3Smrg   uint8_t num_delta_pocs_ref_rps_idx;
2307ec681f3Smrg   uint8_t curr_idx;
2317ec681f3Smrg   uint8_t reserved1;
2327ec681f3Smrg   int32_t curr_poc;
2337ec681f3Smrg   uint8_t ref_pic_list[16];
2347ec681f3Smrg   int32_t poc_list[16];
2357ec681f3Smrg   uint8_t ref_pic_set_st_curr_before[8];
2367ec681f3Smrg   uint8_t ref_pic_set_st_curr_after[8];
2377ec681f3Smrg   uint8_t ref_pic_set_lt_curr[8];
2387ec681f3Smrg
2397ec681f3Smrg   uint8_t ucScalingListDCCoefSizeID2[6];
2407ec681f3Smrg   uint8_t ucScalingListDCCoefSizeID3[2];
2417ec681f3Smrg
2427ec681f3Smrg   uint8_t highestTid;
2437ec681f3Smrg   uint8_t isNonRef;
2447ec681f3Smrg
2457ec681f3Smrg   uint8_t p010_mode;
2467ec681f3Smrg   uint8_t msb_mode;
2477ec681f3Smrg   uint8_t luma_10to8;
2487ec681f3Smrg   uint8_t chroma_10to8;
2497ec681f3Smrg   uint8_t sclr_luma10to8;
2507ec681f3Smrg   uint8_t sclr_chroma10to8;
2517ec681f3Smrg
2527ec681f3Smrg   uint8_t direct_reflist[2][15];
25301e04c3fSmrg};
25401e04c3fSmrg
255af69d88dSmrgstruct ruvd_vc1 {
2567ec681f3Smrg   uint32_t profile;
2577ec681f3Smrg   uint32_t level;
2587ec681f3Smrg   uint32_t sps_info_flags;
2597ec681f3Smrg   uint32_t pps_info_flags;
2607ec681f3Smrg   uint32_t pic_structure;
2617ec681f3Smrg   uint32_t chroma_format;
262af69d88dSmrg};
263af69d88dSmrg
264af69d88dSmrgstruct ruvd_mpeg2 {
2657ec681f3Smrg   uint32_t decoded_pic_idx;
2667ec681f3Smrg   uint32_t ref_pic_idx[2];
2677ec681f3Smrg
2687ec681f3Smrg   uint8_t load_intra_quantiser_matrix;
2697ec681f3Smrg   uint8_t load_nonintra_quantiser_matrix;
2707ec681f3Smrg   uint8_t reserved_quantiser_alignement[2];
2717ec681f3Smrg   uint8_t intra_quantiser_matrix[64];
2727ec681f3Smrg   uint8_t nonintra_quantiser_matrix[64];
2737ec681f3Smrg
2747ec681f3Smrg   uint8_t profile_and_level_indication;
2757ec681f3Smrg   uint8_t chroma_format;
2767ec681f3Smrg
2777ec681f3Smrg   uint8_t picture_coding_type;
2787ec681f3Smrg
2797ec681f3Smrg   uint8_t reserved_1;
2807ec681f3Smrg
2817ec681f3Smrg   uint8_t f_code[2][2];
2827ec681f3Smrg   uint8_t intra_dc_precision;
2837ec681f3Smrg   uint8_t pic_structure;
2847ec681f3Smrg   uint8_t top_field_first;
2857ec681f3Smrg   uint8_t frame_pred_frame_dct;
2867ec681f3Smrg   uint8_t concealment_motion_vectors;
2877ec681f3Smrg   uint8_t q_scale_type;
2887ec681f3Smrg   uint8_t intra_vlc_format;
2897ec681f3Smrg   uint8_t alternate_scan;
290af69d88dSmrg};
291af69d88dSmrg
2927ec681f3Smrgstruct ruvd_mpeg4 {
2937ec681f3Smrg   uint32_t decoded_pic_idx;
2947ec681f3Smrg   uint32_t ref_pic_idx[2];
295af69d88dSmrg
2967ec681f3Smrg   uint32_t variant_type;
2977ec681f3Smrg   uint8_t profile_and_level_indication;
298af69d88dSmrg
2997ec681f3Smrg   uint8_t video_object_layer_verid;
3007ec681f3Smrg   uint8_t video_object_layer_shape;
301af69d88dSmrg
3027ec681f3Smrg   uint8_t reserved_1;
303af69d88dSmrg
3047ec681f3Smrg   uint16_t video_object_layer_width;
3057ec681f3Smrg   uint16_t video_object_layer_height;
306af69d88dSmrg
3077ec681f3Smrg   uint16_t vop_time_increment_resolution;
308af69d88dSmrg
3097ec681f3Smrg   uint16_t reserved_2;
310af69d88dSmrg
3117ec681f3Smrg   uint32_t flags;
312af69d88dSmrg
3137ec681f3Smrg   uint8_t quant_type;
314af69d88dSmrg
3157ec681f3Smrg   uint8_t reserved_3[3];
316af69d88dSmrg
3177ec681f3Smrg   uint8_t intra_quant_mat[64];
3187ec681f3Smrg   uint8_t nonintra_quant_mat[64];
319af69d88dSmrg
3207ec681f3Smrg   struct {
3217ec681f3Smrg      uint8_t sprite_enable;
322af69d88dSmrg
3237ec681f3Smrg      uint8_t reserved_4[3];
324af69d88dSmrg
3257ec681f3Smrg      uint16_t sprite_width;
3267ec681f3Smrg      uint16_t sprite_height;
3277ec681f3Smrg      int16_t sprite_left_coordinate;
3287ec681f3Smrg      int16_t sprite_top_coordinate;
329af69d88dSmrg
3307ec681f3Smrg      uint8_t no_of_sprite_warping_points;
3317ec681f3Smrg      uint8_t sprite_warping_accuracy;
3327ec681f3Smrg      uint8_t sprite_brightness_change;
3337ec681f3Smrg      uint8_t low_latency_sprite_enable;
3347ec681f3Smrg   } sprite_config;
335af69d88dSmrg
3367ec681f3Smrg   struct {
3377ec681f3Smrg      uint32_t flags;
3387ec681f3Smrg      uint8_t vol_mode;
3397ec681f3Smrg      uint8_t reserved_5[3];
3407ec681f3Smrg   } divx_311_config;
341af69d88dSmrg};
342af69d88dSmrg
343af69d88dSmrg/* message between driver and hardware */
344af69d88dSmrgstruct ruvd_msg {
345af69d88dSmrg
3467ec681f3Smrg   uint32_t size;
3477ec681f3Smrg   uint32_t msg_type;
3487ec681f3Smrg   uint32_t stream_handle;
3497ec681f3Smrg   uint32_t status_report_feedback_number;
3507ec681f3Smrg
3517ec681f3Smrg   union {
3527ec681f3Smrg      struct {
3537ec681f3Smrg         uint32_t stream_type;
3547ec681f3Smrg         uint32_t session_flags;
3557ec681f3Smrg         uint32_t asic_id;
3567ec681f3Smrg         uint32_t width_in_samples;
3577ec681f3Smrg         uint32_t height_in_samples;
3587ec681f3Smrg         uint32_t dpb_buffer;
3597ec681f3Smrg         uint32_t dpb_size;
3607ec681f3Smrg         uint32_t dpb_model;
3617ec681f3Smrg         uint32_t version_info;
3627ec681f3Smrg      } create;
3637ec681f3Smrg
3647ec681f3Smrg      struct {
3657ec681f3Smrg         uint32_t stream_type;
3667ec681f3Smrg         uint32_t decode_flags;
3677ec681f3Smrg         uint32_t width_in_samples;
3687ec681f3Smrg         uint32_t height_in_samples;
3697ec681f3Smrg
3707ec681f3Smrg         uint32_t dpb_buffer;
3717ec681f3Smrg         uint32_t dpb_size;
3727ec681f3Smrg         uint32_t dpb_model;
3737ec681f3Smrg         uint32_t dpb_reserved;
3747ec681f3Smrg
3757ec681f3Smrg         uint32_t db_offset_alignment;
3767ec681f3Smrg         uint32_t db_pitch;
3777ec681f3Smrg         uint32_t db_tiling_mode;
3787ec681f3Smrg         uint32_t db_array_mode;
3797ec681f3Smrg         uint32_t db_field_mode;
3807ec681f3Smrg         uint32_t db_surf_tile_config;
3817ec681f3Smrg         uint32_t db_aligned_height;
3827ec681f3Smrg         uint32_t db_reserved;
3837ec681f3Smrg
3847ec681f3Smrg         uint32_t use_addr_macro;
3857ec681f3Smrg
3867ec681f3Smrg         uint32_t bsd_buffer;
3877ec681f3Smrg         uint32_t bsd_size;
3887ec681f3Smrg
3897ec681f3Smrg         uint32_t pic_param_buffer;
3907ec681f3Smrg         uint32_t pic_param_size;
3917ec681f3Smrg         uint32_t mb_cntl_buffer;
3927ec681f3Smrg         uint32_t mb_cntl_size;
3937ec681f3Smrg
3947ec681f3Smrg         uint32_t dt_buffer;
3957ec681f3Smrg         uint32_t dt_pitch;
3967ec681f3Smrg         uint32_t dt_tiling_mode;
3977ec681f3Smrg         uint32_t dt_array_mode;
3987ec681f3Smrg         uint32_t dt_field_mode;
3997ec681f3Smrg         uint32_t dt_luma_top_offset;
4007ec681f3Smrg         uint32_t dt_luma_bottom_offset;
4017ec681f3Smrg         uint32_t dt_chroma_top_offset;
4027ec681f3Smrg         uint32_t dt_chroma_bottom_offset;
4037ec681f3Smrg         uint32_t dt_surf_tile_config;
4047ec681f3Smrg         uint32_t dt_uv_surf_tile_config;
4057ec681f3Smrg         // re-use dt_wa_chroma_top_offset as dt_ext_info for UV pitch in stoney
4067ec681f3Smrg         uint32_t dt_wa_chroma_top_offset;
4077ec681f3Smrg         uint32_t dt_wa_chroma_bottom_offset;
4087ec681f3Smrg
4097ec681f3Smrg         uint32_t reserved[16];
4107ec681f3Smrg
4117ec681f3Smrg         union {
4127ec681f3Smrg            struct ruvd_h264 h264;
4137ec681f3Smrg            struct ruvd_h265 h265;
4147ec681f3Smrg            struct ruvd_vc1 vc1;
4157ec681f3Smrg            struct ruvd_mpeg2 mpeg2;
4167ec681f3Smrg            struct ruvd_mpeg4 mpeg4;
4177ec681f3Smrg
4187ec681f3Smrg            uint32_t info[768];
4197ec681f3Smrg         } codec;
4207ec681f3Smrg
4217ec681f3Smrg         uint8_t extension_support;
4227ec681f3Smrg         uint8_t reserved_8bit_1;
4237ec681f3Smrg         uint8_t reserved_8bit_2;
4247ec681f3Smrg         uint8_t reserved_8bit_3;
4257ec681f3Smrg         uint32_t extension_reserved[64];
4267ec681f3Smrg      } decode;
4277ec681f3Smrg   } body;
428af69d88dSmrg};
429af69d88dSmrg
430af69d88dSmrg/* driver dependent callback */
4317ec681f3Smrgtypedef struct pb_buffer *(*ruvd_set_dtb)(struct ruvd_msg *msg, struct vl_video_buffer *vb);
432af69d88dSmrg
433af69d88dSmrg/* create an UVD decode */
43401e04c3fSmrgstruct pipe_video_codec *si_common_uvd_create_decoder(struct pipe_context *context,
4357ec681f3Smrg                                                      const struct pipe_video_codec *templat,
4367ec681f3Smrg                                                      ruvd_set_dtb set_dtb);
437af69d88dSmrg
438af69d88dSmrg/* fill decoding target field from the luma and chroma surfaces */
43901e04c3fSmrgvoid si_uvd_set_dt_surfaces(struct ruvd_msg *msg, struct radeon_surf *luma,
4407ec681f3Smrg                            struct radeon_surf *chroma, enum ruvd_surface_type type);
441af69d88dSmrg#endif
442