0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 #ifndef STREAM_ENCODER_H_
0029 #define STREAM_ENCODER_H_
0030
0031 #include "audio_types.h"
0032 #include "hw_shared.h"
0033 #include "dc_link.h"
0034
0035 struct dc_bios;
0036 struct dc_context;
0037 struct dc_crtc_timing;
0038
0039 enum dp_pixel_encoding_type {
0040 DP_PIXEL_ENCODING_TYPE_RGB444 = 0x00000000,
0041 DP_PIXEL_ENCODING_TYPE_YCBCR422 = 0x00000001,
0042 DP_PIXEL_ENCODING_TYPE_YCBCR444 = 0x00000002,
0043 DP_PIXEL_ENCODING_TYPE_RGB_WIDE_GAMUT = 0x00000003,
0044 DP_PIXEL_ENCODING_TYPE_Y_ONLY = 0x00000004,
0045 DP_PIXEL_ENCODING_TYPE_YCBCR420 = 0x00000005
0046 };
0047
0048 enum dp_component_depth {
0049 DP_COMPONENT_PIXEL_DEPTH_6BPC = 0x00000000,
0050 DP_COMPONENT_PIXEL_DEPTH_8BPC = 0x00000001,
0051 DP_COMPONENT_PIXEL_DEPTH_10BPC = 0x00000002,
0052 DP_COMPONENT_PIXEL_DEPTH_12BPC = 0x00000003,
0053 DP_COMPONENT_PIXEL_DEPTH_16BPC = 0x00000004
0054 };
0055
0056 struct audio_clock_info {
0057
0058 uint32_t pixel_clock_in_10khz;
0059
0060 uint32_t n_32khz;
0061
0062 uint32_t cts_32khz;
0063 uint32_t n_44khz;
0064 uint32_t cts_44khz;
0065 uint32_t n_48khz;
0066 uint32_t cts_48khz;
0067 };
0068
0069 enum dynamic_metadata_mode {
0070 dmdata_dp,
0071 dmdata_hdmi,
0072 dmdata_dolby_vision
0073 };
0074
0075 struct encoder_info_frame {
0076
0077 struct dc_info_packet avi;
0078 struct dc_info_packet gamut;
0079 struct dc_info_packet vendor;
0080 struct dc_info_packet hfvsif;
0081 struct dc_info_packet vtem;
0082
0083 struct dc_info_packet spd;
0084
0085 struct dc_info_packet vsc;
0086
0087 struct dc_info_packet hdrsmd;
0088 };
0089
0090 struct encoder_unblank_param {
0091 struct dc_link_settings link_settings;
0092 struct dc_crtc_timing timing;
0093 int opp_cnt;
0094 };
0095
0096 struct encoder_set_dp_phy_pattern_param {
0097 enum dp_test_pattern dp_phy_pattern;
0098 const uint8_t *custom_pattern;
0099 uint32_t custom_pattern_size;
0100 enum dp_panel_mode dp_panel_mode;
0101 };
0102
0103 struct stream_encoder {
0104 const struct stream_encoder_funcs *funcs;
0105 struct dc_context *ctx;
0106 struct dc_bios *bp;
0107 enum engine_id id;
0108 uint32_t stream_enc_inst;
0109 struct vpg *vpg;
0110 struct afmt *afmt;
0111 };
0112
0113 struct enc_state {
0114 uint32_t dsc_mode;
0115 uint32_t dsc_slice_width;
0116 uint32_t sec_gsp_pps_line_num;
0117 uint32_t vbid6_line_reference;
0118 uint32_t vbid6_line_num;
0119 uint32_t sec_gsp_pps_enable;
0120 uint32_t sec_stream_enable;
0121 };
0122
0123 struct stream_encoder_funcs {
0124 void (*dp_set_stream_attribute)(
0125 struct stream_encoder *enc,
0126 struct dc_crtc_timing *crtc_timing,
0127 enum dc_color_space output_color_space,
0128 bool use_vsc_sdp_for_colorimetry,
0129 uint32_t enable_sdp_splitting);
0130
0131 void (*hdmi_set_stream_attribute)(
0132 struct stream_encoder *enc,
0133 struct dc_crtc_timing *crtc_timing,
0134 int actual_pix_clk_khz,
0135 bool enable_audio);
0136
0137 void (*dvi_set_stream_attribute)(
0138 struct stream_encoder *enc,
0139 struct dc_crtc_timing *crtc_timing,
0140 bool is_dual_link);
0141
0142 void (*lvds_set_stream_attribute)(
0143 struct stream_encoder *enc,
0144 struct dc_crtc_timing *crtc_timing);
0145
0146 void (*set_throttled_vcp_size)(
0147 struct stream_encoder *enc,
0148 struct fixed31_32 avg_time_slots_per_mtp);
0149
0150 void (*update_hdmi_info_packets)(
0151 struct stream_encoder *enc,
0152 const struct encoder_info_frame *info_frame);
0153
0154 void (*stop_hdmi_info_packets)(
0155 struct stream_encoder *enc);
0156
0157 void (*update_dp_info_packets)(
0158 struct stream_encoder *enc,
0159 const struct encoder_info_frame *info_frame);
0160
0161 void (*send_immediate_sdp_message)(
0162 struct stream_encoder *enc,
0163 const uint8_t *custom_sdp_message,
0164 unsigned int sdp_message_size);
0165
0166 void (*stop_dp_info_packets)(
0167 struct stream_encoder *enc);
0168
0169 void (*reset_fifo)(
0170 struct stream_encoder *enc
0171 );
0172
0173 void (*dp_blank)(
0174 struct dc_link *link,
0175 struct stream_encoder *enc);
0176
0177 void (*dp_unblank)(
0178 struct dc_link *link,
0179 struct stream_encoder *enc,
0180 const struct encoder_unblank_param *param);
0181
0182 void (*audio_mute_control)(
0183 struct stream_encoder *enc, bool mute);
0184
0185 void (*dp_audio_setup)(
0186 struct stream_encoder *enc,
0187 unsigned int az_inst,
0188 struct audio_info *info);
0189
0190 void (*dp_audio_enable) (
0191 struct stream_encoder *enc);
0192
0193 void (*dp_audio_disable) (
0194 struct stream_encoder *enc);
0195
0196 void (*hdmi_audio_setup)(
0197 struct stream_encoder *enc,
0198 unsigned int az_inst,
0199 struct audio_info *info,
0200 struct audio_crtc_info *audio_crtc_info);
0201
0202 void (*hdmi_audio_disable) (
0203 struct stream_encoder *enc);
0204
0205 void (*setup_stereo_sync) (
0206 struct stream_encoder *enc,
0207 int tg_inst,
0208 bool enable);
0209
0210 void (*set_avmute)(
0211 struct stream_encoder *enc, bool enable);
0212
0213 void (*dig_connect_to_otg)(
0214 struct stream_encoder *enc,
0215 int tg_inst);
0216
0217 void (*hdmi_reset_stream_attribute)(
0218 struct stream_encoder *enc);
0219
0220 unsigned int (*dig_source_otg)(
0221 struct stream_encoder *enc);
0222
0223 bool (*dp_get_pixel_format)(
0224 struct stream_encoder *enc,
0225 enum dc_pixel_encoding *encoding,
0226 enum dc_color_depth *depth);
0227
0228 void (*enc_read_state)(struct stream_encoder *enc, struct enc_state *s);
0229
0230 void (*dp_set_dsc_config)(
0231 struct stream_encoder *enc,
0232 enum optc_dsc_mode dsc_mode,
0233 uint32_t dsc_bytes_per_pixel,
0234 uint32_t dsc_slice_width);
0235
0236 void (*dp_set_dsc_pps_info_packet)(struct stream_encoder *enc,
0237 bool enable,
0238 uint8_t *dsc_packed_pps,
0239 bool immediate_update);
0240
0241 void (*set_dynamic_metadata)(struct stream_encoder *enc,
0242 bool enable,
0243 uint32_t hubp_requestor_id,
0244 enum dynamic_metadata_mode dmdata_mode);
0245
0246 void (*dp_set_odm_combine)(
0247 struct stream_encoder *enc,
0248 bool odm_combine);
0249
0250 uint32_t (*get_fifo_cal_average_level)(
0251 struct stream_encoder *enc);
0252
0253 void (*set_input_mode)(
0254 struct stream_encoder *enc, unsigned int pix_per_container);
0255 void (*enable_fifo)(struct stream_encoder *enc);
0256 void (*disable_fifo)(struct stream_encoder *enc);
0257 };
0258
0259 struct hpo_dp_stream_encoder_state {
0260 uint32_t stream_enc_enabled;
0261 uint32_t vid_stream_enabled;
0262 uint32_t otg_inst;
0263 uint32_t pixel_encoding;
0264 uint32_t component_depth;
0265 uint32_t compressed_format;
0266 uint32_t sdp_enabled;
0267 uint32_t mapped_to_link_enc;
0268 };
0269
0270 struct hpo_dp_stream_encoder {
0271 const struct hpo_dp_stream_encoder_funcs *funcs;
0272 struct dc_context *ctx;
0273 struct dc_bios *bp;
0274 uint32_t inst;
0275 enum engine_id id;
0276 struct vpg *vpg;
0277 struct apg *apg;
0278 };
0279
0280 struct hpo_dp_stream_encoder_funcs {
0281 void (*enable_stream)(
0282 struct hpo_dp_stream_encoder *enc);
0283
0284 void (*dp_unblank)(
0285 struct hpo_dp_stream_encoder *enc,
0286 uint32_t stream_source);
0287
0288 void (*dp_blank)(
0289 struct hpo_dp_stream_encoder *enc);
0290
0291 void (*disable)(
0292 struct hpo_dp_stream_encoder *enc);
0293
0294 void (*set_stream_attribute)(
0295 struct hpo_dp_stream_encoder *enc,
0296 struct dc_crtc_timing *crtc_timing,
0297 enum dc_color_space output_color_space,
0298 bool use_vsc_sdp_for_colorimetry,
0299 bool compressed_format,
0300 bool double_buffer_en);
0301
0302 void (*update_dp_info_packets)(
0303 struct hpo_dp_stream_encoder *enc,
0304 const struct encoder_info_frame *info_frame);
0305
0306 void (*stop_dp_info_packets)(
0307 struct hpo_dp_stream_encoder *enc);
0308
0309 void (*dp_set_dsc_pps_info_packet)(
0310 struct hpo_dp_stream_encoder *enc,
0311 bool enable,
0312 uint8_t *dsc_packed_pps,
0313 bool immediate_update);
0314
0315 void (*map_stream_to_link)(
0316 struct hpo_dp_stream_encoder *enc,
0317 uint32_t stream_enc_inst,
0318 uint32_t link_enc_inst);
0319
0320 void (*audio_mute_control)(
0321 struct hpo_dp_stream_encoder *enc, bool mute);
0322
0323 void (*dp_audio_setup)(
0324 struct hpo_dp_stream_encoder *enc,
0325 unsigned int az_inst,
0326 struct audio_info *info);
0327
0328 void (*dp_audio_enable)(
0329 struct hpo_dp_stream_encoder *enc);
0330
0331 void (*dp_audio_disable)(
0332 struct hpo_dp_stream_encoder *enc);
0333
0334 void (*read_state)(
0335 struct hpo_dp_stream_encoder *enc,
0336 struct hpo_dp_stream_encoder_state *state);
0337
0338 void (*set_hblank_min_symbol_width)(
0339 struct hpo_dp_stream_encoder *enc,
0340 uint16_t width);
0341 };
0342
0343 #endif