1b8e80941Smrg/************************************************************************** 2b8e80941Smrg * 3b8e80941Smrg * Copyright 2013 Advanced Micro Devices, Inc. 4b8e80941Smrg * All Rights Reserved. 5b8e80941Smrg * 6b8e80941Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7b8e80941Smrg * copy of this software and associated documentation files (the 8b8e80941Smrg * "Software"), to deal in the Software without restriction, including 9b8e80941Smrg * without limitation the rights to use, copy, modify, merge, publish, 10b8e80941Smrg * distribute, sub license, and/or sell copies of the Software, and to 11b8e80941Smrg * permit persons to whom the Software is furnished to do so, subject to 12b8e80941Smrg * the following conditions: 13b8e80941Smrg * 14b8e80941Smrg * The above copyright notice and this permission notice (including the 15b8e80941Smrg * next paragraph) shall be included in all copies or substantial portions 16b8e80941Smrg * of the Software. 17b8e80941Smrg * 18b8e80941Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19b8e80941Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20b8e80941Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21b8e80941Smrg * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR 22b8e80941Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23b8e80941Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24b8e80941Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25b8e80941Smrg * 26b8e80941Smrg **************************************************************************/ 27b8e80941Smrg 28b8e80941Smrg/* 29b8e80941Smrg * Authors: 30b8e80941Smrg * Christian König <christian.koenig@amd.com> 31b8e80941Smrg * 32b8e80941Smrg */ 33b8e80941Smrg 34b8e80941Smrg#ifndef RADEON_VCE_H 35b8e80941Smrg#define RADEON_VCE_H 36b8e80941Smrg 37b8e80941Smrg#include "util/list.h" 38b8e80941Smrg 39b8e80941Smrg#define RVCE_CS(value) (enc->cs->current.buf[enc->cs->current.cdw++] = (value)) 40b8e80941Smrg#define RVCE_BEGIN(cmd) { \ 41b8e80941Smrg uint32_t *begin = &enc->cs->current.buf[enc->cs->current.cdw++]; \ 42b8e80941Smrg RVCE_CS(cmd) 43b8e80941Smrg#define RVCE_READ(buf, domain, off) rvce_add_buffer(enc, (buf), RADEON_USAGE_READ, (domain), (off)) 44b8e80941Smrg#define RVCE_WRITE(buf, domain, off) rvce_add_buffer(enc, (buf), RADEON_USAGE_WRITE, (domain), (off)) 45b8e80941Smrg#define RVCE_READWRITE(buf, domain, off) rvce_add_buffer(enc, (buf), RADEON_USAGE_READWRITE, (domain), (off)) 46b8e80941Smrg#define RVCE_END() *begin = (&enc->cs->current.buf[enc->cs->current.cdw] - begin) * 4; } 47b8e80941Smrg 48b8e80941Smrg#define RVCE_MAX_BITSTREAM_OUTPUT_ROW_SIZE (4096 * 16 * 2.5) 49b8e80941Smrg#define RVCE_MAX_AUX_BUFFER_NUM 4 50b8e80941Smrg 51b8e80941Smrgstruct r600_common_screen; 52b8e80941Smrg 53b8e80941Smrg/* driver dependent callback */ 54b8e80941Smrgtypedef void (*rvce_get_buffer)(struct pipe_resource *resource, 55b8e80941Smrg struct pb_buffer **handle, 56b8e80941Smrg struct radeon_surf **surface); 57b8e80941Smrg 58b8e80941Smrg/* Coded picture buffer slot */ 59b8e80941Smrgstruct rvce_cpb_slot { 60b8e80941Smrg struct list_head list; 61b8e80941Smrg 62b8e80941Smrg unsigned index; 63b8e80941Smrg enum pipe_h264_enc_picture_type picture_type; 64b8e80941Smrg unsigned frame_num; 65b8e80941Smrg unsigned pic_order_cnt; 66b8e80941Smrg}; 67b8e80941Smrg 68b8e80941Smrgstruct rvce_rate_control { 69b8e80941Smrg uint32_t rc_method; 70b8e80941Smrg uint32_t target_bitrate; 71b8e80941Smrg uint32_t peak_bitrate; 72b8e80941Smrg uint32_t frame_rate_num; 73b8e80941Smrg uint32_t gop_size; 74b8e80941Smrg uint32_t quant_i_frames; 75b8e80941Smrg uint32_t quant_p_frames; 76b8e80941Smrg uint32_t quant_b_frames; 77b8e80941Smrg uint32_t vbv_buffer_size; 78b8e80941Smrg uint32_t frame_rate_den; 79b8e80941Smrg uint32_t vbv_buf_lv; 80b8e80941Smrg uint32_t max_au_size; 81b8e80941Smrg uint32_t qp_initial_mode; 82b8e80941Smrg uint32_t target_bits_picture; 83b8e80941Smrg uint32_t peak_bits_picture_integer; 84b8e80941Smrg uint32_t peak_bits_picture_fraction; 85b8e80941Smrg uint32_t min_qp; 86b8e80941Smrg uint32_t max_qp; 87b8e80941Smrg uint32_t skip_frame_enable; 88b8e80941Smrg uint32_t fill_data_enable; 89b8e80941Smrg uint32_t enforce_hrd; 90b8e80941Smrg uint32_t b_pics_delta_qp; 91b8e80941Smrg uint32_t ref_b_pics_delta_qp; 92b8e80941Smrg uint32_t rc_reinit_disable; 93b8e80941Smrg uint32_t enc_lcvbr_init_qp_flag; 94b8e80941Smrg uint32_t lcvbrsatd_based_nonlinear_bit_budget_flag; 95b8e80941Smrg}; 96b8e80941Smrg 97b8e80941Smrgstruct rvce_motion_estimation { 98b8e80941Smrg uint32_t enc_ime_decimation_search; 99b8e80941Smrg uint32_t motion_est_half_pixel; 100b8e80941Smrg uint32_t motion_est_quarter_pixel; 101b8e80941Smrg uint32_t disable_favor_pmv_point; 102b8e80941Smrg uint32_t force_zero_point_center; 103b8e80941Smrg uint32_t lsmvert; 104b8e80941Smrg uint32_t enc_search_range_x; 105b8e80941Smrg uint32_t enc_search_range_y; 106b8e80941Smrg uint32_t enc_search1_range_x; 107b8e80941Smrg uint32_t enc_search1_range_y; 108b8e80941Smrg uint32_t disable_16x16_frame1; 109b8e80941Smrg uint32_t disable_satd; 110b8e80941Smrg uint32_t enable_amd; 111b8e80941Smrg uint32_t enc_disable_sub_mode; 112b8e80941Smrg uint32_t enc_ime_skip_x; 113b8e80941Smrg uint32_t enc_ime_skip_y; 114b8e80941Smrg uint32_t enc_en_ime_overw_dis_subm; 115b8e80941Smrg uint32_t enc_ime_overw_dis_subm_no; 116b8e80941Smrg uint32_t enc_ime2_search_range_x; 117b8e80941Smrg uint32_t enc_ime2_search_range_y; 118b8e80941Smrg uint32_t parallel_mode_speedup_enable; 119b8e80941Smrg uint32_t fme0_enc_disable_sub_mode; 120b8e80941Smrg uint32_t fme1_enc_disable_sub_mode; 121b8e80941Smrg uint32_t ime_sw_speedup_enable; 122b8e80941Smrg}; 123b8e80941Smrg 124b8e80941Smrgstruct rvce_pic_control { 125b8e80941Smrg uint32_t enc_use_constrained_intra_pred; 126b8e80941Smrg uint32_t enc_cabac_enable; 127b8e80941Smrg uint32_t enc_cabac_idc; 128b8e80941Smrg uint32_t enc_loop_filter_disable; 129b8e80941Smrg int32_t enc_lf_beta_offset; 130b8e80941Smrg int32_t enc_lf_alpha_c0_offset; 131b8e80941Smrg uint32_t enc_crop_left_offset; 132b8e80941Smrg uint32_t enc_crop_right_offset; 133b8e80941Smrg uint32_t enc_crop_top_offset; 134b8e80941Smrg uint32_t enc_crop_bottom_offset; 135b8e80941Smrg uint32_t enc_num_mbs_per_slice; 136b8e80941Smrg uint32_t enc_intra_refresh_num_mbs_per_slot; 137b8e80941Smrg uint32_t enc_force_intra_refresh; 138b8e80941Smrg uint32_t enc_force_imb_period; 139b8e80941Smrg uint32_t enc_pic_order_cnt_type; 140b8e80941Smrg uint32_t log2_max_pic_order_cnt_lsb_minus4; 141b8e80941Smrg uint32_t enc_sps_id; 142b8e80941Smrg uint32_t enc_pps_id; 143b8e80941Smrg uint32_t enc_constraint_set_flags; 144b8e80941Smrg uint32_t enc_b_pic_pattern; 145b8e80941Smrg uint32_t weight_pred_mode_b_picture; 146b8e80941Smrg uint32_t enc_number_of_reference_frames; 147b8e80941Smrg uint32_t enc_max_num_ref_frames; 148b8e80941Smrg uint32_t enc_num_default_active_ref_l0; 149b8e80941Smrg uint32_t enc_num_default_active_ref_l1; 150b8e80941Smrg uint32_t enc_slice_mode; 151b8e80941Smrg uint32_t enc_max_slice_size; 152b8e80941Smrg}; 153b8e80941Smrg 154b8e80941Smrgstruct rvce_task_info { 155b8e80941Smrg uint32_t offset_of_next_task_info; 156b8e80941Smrg uint32_t task_operation; 157b8e80941Smrg uint32_t reference_picture_dependency; 158b8e80941Smrg uint32_t collocate_flag_dependency; 159b8e80941Smrg uint32_t feedback_index; 160b8e80941Smrg uint32_t video_bitstream_ring_index; 161b8e80941Smrg}; 162b8e80941Smrg 163b8e80941Smrgstruct rvce_feedback_buf_pkg { 164b8e80941Smrg uint32_t feedback_ring_address_hi; 165b8e80941Smrg uint32_t feedback_ring_address_lo; 166b8e80941Smrg uint32_t feedback_ring_size; 167b8e80941Smrg}; 168b8e80941Smrg 169b8e80941Smrgstruct rvce_rdo { 170b8e80941Smrg uint32_t enc_disable_tbe_pred_i_frame; 171b8e80941Smrg uint32_t enc_disable_tbe_pred_p_frame; 172b8e80941Smrg uint32_t use_fme_interpol_y; 173b8e80941Smrg uint32_t use_fme_interpol_uv; 174b8e80941Smrg uint32_t use_fme_intrapol_y; 175b8e80941Smrg uint32_t use_fme_intrapol_uv; 176b8e80941Smrg uint32_t use_fme_interpol_y_1; 177b8e80941Smrg uint32_t use_fme_interpol_uv_1; 178b8e80941Smrg uint32_t use_fme_intrapol_y_1; 179b8e80941Smrg uint32_t use_fme_intrapol_uv_1; 180b8e80941Smrg uint32_t enc_16x16_cost_adj; 181b8e80941Smrg uint32_t enc_skip_cost_adj; 182b8e80941Smrg uint32_t enc_force_16x16_skip; 183b8e80941Smrg uint32_t enc_disable_threshold_calc_a; 184b8e80941Smrg uint32_t enc_luma_coeff_cost; 185b8e80941Smrg uint32_t enc_luma_mb_coeff_cost; 186b8e80941Smrg uint32_t enc_chroma_coeff_cost; 187b8e80941Smrg}; 188b8e80941Smrg 189b8e80941Smrgstruct rvce_vui { 190b8e80941Smrg uint32_t aspect_ratio_info_present_flag; 191b8e80941Smrg uint32_t aspect_ratio_idc; 192b8e80941Smrg uint32_t sar_width; 193b8e80941Smrg uint32_t sar_height; 194b8e80941Smrg uint32_t overscan_info_present_flag; 195b8e80941Smrg uint32_t overscan_Approp_flag; 196b8e80941Smrg uint32_t video_signal_type_present_flag; 197b8e80941Smrg uint32_t video_format; 198b8e80941Smrg uint32_t video_full_range_flag; 199b8e80941Smrg uint32_t color_description_present_flag; 200b8e80941Smrg uint32_t color_prim; 201b8e80941Smrg uint32_t transfer_char; 202b8e80941Smrg uint32_t matrix_coef; 203b8e80941Smrg uint32_t chroma_loc_info_present_flag; 204b8e80941Smrg uint32_t chroma_loc_top; 205b8e80941Smrg uint32_t chroma_loc_bottom; 206b8e80941Smrg uint32_t timing_info_present_flag; 207b8e80941Smrg uint32_t num_units_in_tick; 208b8e80941Smrg uint32_t time_scale; 209b8e80941Smrg uint32_t fixed_frame_rate_flag; 210b8e80941Smrg uint32_t nal_hrd_parameters_present_flag; 211b8e80941Smrg uint32_t cpb_cnt_minus1; 212b8e80941Smrg uint32_t bit_rate_scale; 213b8e80941Smrg uint32_t cpb_size_scale; 214b8e80941Smrg uint32_t bit_rate_value_minus; 215b8e80941Smrg uint32_t cpb_size_value_minus; 216b8e80941Smrg uint32_t cbr_flag; 217b8e80941Smrg uint32_t initial_cpb_removal_delay_length_minus1; 218b8e80941Smrg uint32_t cpb_removal_delay_length_minus1; 219b8e80941Smrg uint32_t dpb_output_delay_length_minus1; 220b8e80941Smrg uint32_t time_offset_length; 221b8e80941Smrg uint32_t low_delay_hrd_flag; 222b8e80941Smrg uint32_t pic_struct_present_flag; 223b8e80941Smrg uint32_t bitstream_restriction_present_flag; 224b8e80941Smrg uint32_t motion_vectors_over_pic_boundaries_flag; 225b8e80941Smrg uint32_t max_bytes_per_pic_denom; 226b8e80941Smrg uint32_t max_bits_per_mb_denom; 227b8e80941Smrg uint32_t log2_max_mv_length_hori; 228b8e80941Smrg uint32_t log2_max_mv_length_vert; 229b8e80941Smrg uint32_t num_reorder_frames; 230b8e80941Smrg uint32_t max_dec_frame_buffering; 231b8e80941Smrg}; 232b8e80941Smrg 233b8e80941Smrgstruct rvce_enc_operation { 234b8e80941Smrg uint32_t insert_headers; 235b8e80941Smrg uint32_t picture_structure; 236b8e80941Smrg uint32_t allowed_max_bitstream_size; 237b8e80941Smrg uint32_t force_refresh_map; 238b8e80941Smrg uint32_t insert_aud; 239b8e80941Smrg uint32_t end_of_sequence; 240b8e80941Smrg uint32_t end_of_stream; 241b8e80941Smrg uint32_t input_picture_luma_address_hi; 242b8e80941Smrg uint32_t input_picture_luma_address_lo; 243b8e80941Smrg uint32_t input_picture_chroma_address_hi; 244b8e80941Smrg uint32_t input_picture_chroma_address_lo; 245b8e80941Smrg uint32_t enc_input_frame_y_pitch; 246b8e80941Smrg uint32_t enc_input_pic_luma_pitch; 247b8e80941Smrg uint32_t enc_input_pic_chroma_pitch;; 248b8e80941Smrg uint32_t enc_input_pic_addr_array; 249b8e80941Smrg uint32_t enc_input_pic_addr_array_disable2pipe_disablemboffload; 250b8e80941Smrg uint32_t enc_input_pic_tile_config; 251b8e80941Smrg uint32_t enc_pic_type; 252b8e80941Smrg uint32_t enc_idr_flag; 253b8e80941Smrg uint32_t enc_idr_pic_id; 254b8e80941Smrg uint32_t enc_mgs_key_pic; 255b8e80941Smrg uint32_t enc_reference_flag; 256b8e80941Smrg uint32_t enc_temporal_layer_index; 257b8e80941Smrg uint32_t num_ref_idx_active_override_flag; 258b8e80941Smrg uint32_t num_ref_idx_l0_active_minus1; 259b8e80941Smrg uint32_t num_ref_idx_l1_active_minus1; 260b8e80941Smrg uint32_t enc_ref_list_modification_op; 261b8e80941Smrg uint32_t enc_ref_list_modification_num; 262b8e80941Smrg uint32_t enc_decoded_picture_marking_op; 263b8e80941Smrg uint32_t enc_decoded_picture_marking_num; 264b8e80941Smrg uint32_t enc_decoded_picture_marking_idx; 265b8e80941Smrg uint32_t enc_decoded_ref_base_picture_marking_op; 266b8e80941Smrg uint32_t enc_decoded_ref_base_picture_marking_num; 267b8e80941Smrg uint32_t l0_picture_structure; 268b8e80941Smrg uint32_t l0_enc_pic_type; 269b8e80941Smrg uint32_t l0_frame_number; 270b8e80941Smrg uint32_t l0_picture_order_count; 271b8e80941Smrg uint32_t l0_luma_offset; 272b8e80941Smrg uint32_t l0_chroma_offset; 273b8e80941Smrg uint32_t l1_picture_structure; 274b8e80941Smrg uint32_t l1_enc_pic_type; 275b8e80941Smrg uint32_t l1_frame_number; 276b8e80941Smrg uint32_t l1_picture_order_count; 277b8e80941Smrg uint32_t l1_luma_offset; 278b8e80941Smrg uint32_t l1_chroma_offset; 279b8e80941Smrg uint32_t enc_reconstructed_luma_offset; 280b8e80941Smrg uint32_t enc_reconstructed_chroma_offset;; 281b8e80941Smrg uint32_t enc_coloc_buffer_offset; 282b8e80941Smrg uint32_t enc_reconstructed_ref_base_picture_luma_offset; 283b8e80941Smrg uint32_t enc_reconstructed_ref_base_picture_chroma_offset; 284b8e80941Smrg uint32_t enc_reference_ref_base_picture_luma_offset; 285b8e80941Smrg uint32_t enc_reference_ref_base_picture_chroma_offset; 286b8e80941Smrg uint32_t picture_count; 287b8e80941Smrg uint32_t frame_number; 288b8e80941Smrg uint32_t picture_order_count; 289b8e80941Smrg uint32_t num_i_pic_remain_in_rcgop; 290b8e80941Smrg uint32_t num_p_pic_remain_in_rcgop; 291b8e80941Smrg uint32_t num_b_pic_remain_in_rcgop; 292b8e80941Smrg uint32_t num_ir_pic_remain_in_rcgop; 293b8e80941Smrg uint32_t enable_intra_refresh; 294b8e80941Smrg uint32_t aq_variance_en; 295b8e80941Smrg uint32_t aq_block_size; 296b8e80941Smrg uint32_t aq_mb_variance_sel; 297b8e80941Smrg uint32_t aq_frame_variance_sel; 298b8e80941Smrg uint32_t aq_param_a; 299b8e80941Smrg uint32_t aq_param_b; 300b8e80941Smrg uint32_t aq_param_c; 301b8e80941Smrg uint32_t aq_param_d; 302b8e80941Smrg uint32_t aq_param_e; 303b8e80941Smrg uint32_t context_in_sfb; 304b8e80941Smrg}; 305b8e80941Smrg 306b8e80941Smrgstruct rvce_enc_create { 307b8e80941Smrg uint32_t enc_use_circular_buffer; 308b8e80941Smrg uint32_t enc_profile; 309b8e80941Smrg uint32_t enc_level; 310b8e80941Smrg uint32_t enc_pic_struct_restriction; 311b8e80941Smrg uint32_t enc_image_width; 312b8e80941Smrg uint32_t enc_image_height; 313b8e80941Smrg uint32_t enc_ref_pic_luma_pitch; 314b8e80941Smrg uint32_t enc_ref_pic_chroma_pitch; 315b8e80941Smrg uint32_t enc_ref_y_height_in_qw; 316b8e80941Smrg uint32_t enc_ref_pic_addr_array_enc_pic_struct_restriction_disable_rdo; 317b8e80941Smrg uint32_t enc_pre_encode_context_buffer_offset; 318b8e80941Smrg uint32_t enc_pre_encode_input_luma_buffer_offset; 319b8e80941Smrg uint32_t enc_pre_encode_input_chroma_buffer_offset; 320b8e80941Smrg uint32_t enc_pre_encode_mode_chromaflag_vbaqmode_scenechangesensitivity; 321b8e80941Smrg}; 322b8e80941Smrg 323b8e80941Smrgstruct rvce_config_ext { 324b8e80941Smrg uint32_t enc_enable_perf_logging; 325b8e80941Smrg}; 326b8e80941Smrg 327b8e80941Smrgstruct rvce_h264_enc_pic { 328b8e80941Smrg struct rvce_rate_control rc; 329b8e80941Smrg struct rvce_motion_estimation me; 330b8e80941Smrg struct rvce_pic_control pc; 331b8e80941Smrg struct rvce_task_info ti; 332b8e80941Smrg struct rvce_feedback_buf_pkg fb; 333b8e80941Smrg struct rvce_rdo rdo; 334b8e80941Smrg struct rvce_vui vui; 335b8e80941Smrg struct rvce_enc_operation eo; 336b8e80941Smrg struct rvce_enc_create ec; 337b8e80941Smrg struct rvce_config_ext ce; 338b8e80941Smrg 339b8e80941Smrg unsigned quant_i_frames; 340b8e80941Smrg unsigned quant_p_frames; 341b8e80941Smrg unsigned quant_b_frames; 342b8e80941Smrg 343b8e80941Smrg enum pipe_h264_enc_picture_type picture_type; 344b8e80941Smrg unsigned frame_num; 345b8e80941Smrg unsigned frame_num_cnt; 346b8e80941Smrg unsigned p_remain; 347b8e80941Smrg unsigned i_remain; 348b8e80941Smrg unsigned idr_pic_id; 349b8e80941Smrg unsigned gop_cnt; 350b8e80941Smrg unsigned gop_size; 351b8e80941Smrg unsigned pic_order_cnt; 352b8e80941Smrg unsigned ref_idx_l0; 353b8e80941Smrg unsigned ref_idx_l1; 354b8e80941Smrg unsigned addrmode_arraymode_disrdo_distwoinstants; 355b8e80941Smrg 356b8e80941Smrg bool not_referenced; 357b8e80941Smrg bool is_idr; 358b8e80941Smrg bool has_ref_pic_list; 359b8e80941Smrg bool enable_vui; 360b8e80941Smrg unsigned int ref_pic_list_0[32]; 361b8e80941Smrg unsigned int ref_pic_list_1[32]; 362b8e80941Smrg unsigned int frame_idx[32]; 363b8e80941Smrg}; 364b8e80941Smrg 365b8e80941Smrg/* VCE encoder representation */ 366b8e80941Smrgstruct rvce_encoder { 367b8e80941Smrg struct pipe_video_codec base; 368b8e80941Smrg 369b8e80941Smrg /* version specific packets */ 370b8e80941Smrg void (*session)(struct rvce_encoder *enc); 371b8e80941Smrg void (*create)(struct rvce_encoder *enc); 372b8e80941Smrg void (*feedback)(struct rvce_encoder *enc); 373b8e80941Smrg void (*rate_control)(struct rvce_encoder *enc); 374b8e80941Smrg void (*config_extension)(struct rvce_encoder *enc); 375b8e80941Smrg void (*pic_control)(struct rvce_encoder *enc); 376b8e80941Smrg void (*motion_estimation)(struct rvce_encoder *enc); 377b8e80941Smrg void (*rdo)(struct rvce_encoder *enc); 378b8e80941Smrg void (*vui)(struct rvce_encoder *enc); 379b8e80941Smrg void (*config)(struct rvce_encoder *enc); 380b8e80941Smrg void (*encode)(struct rvce_encoder *enc); 381b8e80941Smrg void (*destroy)(struct rvce_encoder *enc); 382b8e80941Smrg void (*task_info)(struct rvce_encoder *enc, uint32_t op, 383b8e80941Smrg uint32_t dep, uint32_t fb_idx, 384b8e80941Smrg uint32_t ring_idx); 385b8e80941Smrg 386b8e80941Smrg unsigned stream_handle; 387b8e80941Smrg 388b8e80941Smrg struct pipe_screen *screen; 389b8e80941Smrg struct radeon_winsys* ws; 390b8e80941Smrg struct radeon_cmdbuf* cs; 391b8e80941Smrg 392b8e80941Smrg rvce_get_buffer get_buffer; 393b8e80941Smrg 394b8e80941Smrg struct pb_buffer* handle; 395b8e80941Smrg struct radeon_surf* luma; 396b8e80941Smrg struct radeon_surf* chroma; 397b8e80941Smrg 398b8e80941Smrg struct pb_buffer* bs_handle; 399b8e80941Smrg unsigned bs_size; 400b8e80941Smrg 401b8e80941Smrg struct rvce_cpb_slot *cpb_array; 402b8e80941Smrg struct list_head cpb_slots; 403b8e80941Smrg unsigned cpb_num; 404b8e80941Smrg 405b8e80941Smrg struct rvid_buffer *fb; 406b8e80941Smrg struct rvid_buffer cpb; 407b8e80941Smrg struct pipe_h264_enc_picture_desc pic; 408b8e80941Smrg struct rvce_h264_enc_pic enc_pic; 409b8e80941Smrg 410b8e80941Smrg unsigned task_info_idx; 411b8e80941Smrg unsigned bs_idx; 412b8e80941Smrg 413b8e80941Smrg bool use_vm; 414b8e80941Smrg bool use_vui; 415b8e80941Smrg bool dual_pipe; 416b8e80941Smrg bool dual_inst; 417b8e80941Smrg}; 418b8e80941Smrg 419b8e80941Smrg/* CPB handling functions */ 420b8e80941Smrgstruct rvce_cpb_slot *current_slot(struct rvce_encoder *enc); 421b8e80941Smrgstruct rvce_cpb_slot *l0_slot(struct rvce_encoder *enc); 422b8e80941Smrgstruct rvce_cpb_slot *l1_slot(struct rvce_encoder *enc); 423b8e80941Smrgvoid rvce_frame_offset(struct rvce_encoder *enc, struct rvce_cpb_slot *slot, 424b8e80941Smrg signed *luma_offset, signed *chroma_offset); 425b8e80941Smrg 426b8e80941Smrgstruct pipe_video_codec *rvce_create_encoder(struct pipe_context *context, 427b8e80941Smrg const struct pipe_video_codec *templat, 428b8e80941Smrg struct radeon_winsys* ws, 429b8e80941Smrg rvce_get_buffer get_buffer); 430b8e80941Smrg 431b8e80941Smrgbool rvce_is_fw_version_supported(struct r600_common_screen *rscreen); 432b8e80941Smrg 433b8e80941Smrgvoid rvce_add_buffer(struct rvce_encoder *enc, struct pb_buffer *buf, 434b8e80941Smrg enum radeon_bo_usage usage, enum radeon_bo_domain domain, 435b8e80941Smrg signed offset); 436b8e80941Smrg 437b8e80941Smrg/* init vce fw 40.2.2 specific callbacks */ 438b8e80941Smrgvoid radeon_vce_40_2_2_init(struct rvce_encoder *enc); 439b8e80941Smrg 440b8e80941Smrg/* init vce fw 50 specific callbacks */ 441b8e80941Smrgvoid radeon_vce_50_init(struct rvce_encoder *enc); 442b8e80941Smrg 443b8e80941Smrg/* init vce fw 52 specific callbacks */ 444b8e80941Smrgvoid radeon_vce_52_init(struct rvce_encoder *enc); 445b8e80941Smrg 446b8e80941Smrg/* version specific function for getting parameters */ 447b8e80941Smrgvoid (*get_pic_param)(struct rvce_encoder *enc, 448b8e80941Smrg struct pipe_h264_enc_picture_desc *pic); 449b8e80941Smrg 450b8e80941Smrg/* get parameters for vce 40.2.2 */ 451b8e80941Smrgvoid radeon_vce_40_2_2_get_param(struct rvce_encoder *enc, 452b8e80941Smrg struct pipe_h264_enc_picture_desc *pic); 453b8e80941Smrg 454b8e80941Smrg/* get parameters for vce 50 */ 455b8e80941Smrgvoid radeon_vce_50_get_param(struct rvce_encoder *enc, 456b8e80941Smrg struct pipe_h264_enc_picture_desc *pic); 457b8e80941Smrg 458b8e80941Smrg/* get parameters for vce 52 */ 459b8e80941Smrgvoid radeon_vce_52_get_param(struct rvce_encoder *enc, 460b8e80941Smrg struct pipe_h264_enc_picture_desc *pic); 461b8e80941Smrg 462b8e80941Smrg#endif 463