1 /* 2 * Copyright 2017 Advanced Micro Devices, Inc. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 * 22 */ 23 /* 24 * stream_encoder.h 25 * 26 */ 27 28 #ifndef STREAM_ENCODER_H_ 29 #define STREAM_ENCODER_H_ 30 31 #include "audio_types.h" 32 #include "hw_shared.h" 33 34 struct dc_bios; 35 struct dc_context; 36 struct dc_crtc_timing; 37 38 enum dp_pixel_encoding_type { 39 DP_PIXEL_ENCODING_TYPE_RGB444 = 0x00000000, 40 DP_PIXEL_ENCODING_TYPE_YCBCR422 = 0x00000001, 41 DP_PIXEL_ENCODING_TYPE_YCBCR444 = 0x00000002, 42 DP_PIXEL_ENCODING_TYPE_RGB_WIDE_GAMUT = 0x00000003, 43 DP_PIXEL_ENCODING_TYPE_Y_ONLY = 0x00000004, 44 DP_PIXEL_ENCODING_TYPE_YCBCR420 = 0x00000005 45 }; 46 47 enum dp_component_depth { 48 DP_COMPONENT_PIXEL_DEPTH_6BPC = 0x00000000, 49 DP_COMPONENT_PIXEL_DEPTH_8BPC = 0x00000001, 50 DP_COMPONENT_PIXEL_DEPTH_10BPC = 0x00000002, 51 DP_COMPONENT_PIXEL_DEPTH_12BPC = 0x00000003, 52 DP_COMPONENT_PIXEL_DEPTH_16BPC = 0x00000004 53 }; 54 55 struct encoder_info_frame { 56 /* auxiliary video information */ 57 struct dc_info_packet avi; 58 struct dc_info_packet gamut; 59 struct dc_info_packet vendor; 60 /* source product description */ 61 struct dc_info_packet spd; 62 /* video stream configuration */ 63 struct dc_info_packet vsc; 64 /* HDR Static MetaData */ 65 struct dc_info_packet hdrsmd; 66 /* custom sdp message */ 67 struct dc_info_packet dpsdp; 68 }; 69 70 struct encoder_unblank_param { 71 struct dc_link_settings link_settings; 72 struct dc_crtc_timing timing; 73 }; 74 75 struct encoder_set_dp_phy_pattern_param { 76 enum dp_test_pattern dp_phy_pattern; 77 const uint8_t *custom_pattern; 78 uint32_t custom_pattern_size; 79 enum dp_panel_mode dp_panel_mode; 80 }; 81 82 struct stream_encoder { 83 const struct stream_encoder_funcs *funcs; 84 struct dc_context *ctx; 85 struct dc_bios *bp; 86 enum engine_id id; 87 }; 88 89 struct stream_encoder_funcs { 90 void (*dp_set_stream_attribute)( 91 struct stream_encoder *enc, 92 struct dc_crtc_timing *crtc_timing, 93 enum dc_color_space output_color_space, 94 uint32_t enable_sdp_splitting); 95 96 void (*hdmi_set_stream_attribute)( 97 struct stream_encoder *enc, 98 struct dc_crtc_timing *crtc_timing, 99 int actual_pix_clk_khz, 100 bool enable_audio); 101 102 void (*dvi_set_stream_attribute)( 103 struct stream_encoder *enc, 104 struct dc_crtc_timing *crtc_timing, 105 bool is_dual_link); 106 107 void (*lvds_set_stream_attribute)( 108 struct stream_encoder *enc, 109 struct dc_crtc_timing *crtc_timing); 110 111 void (*set_mst_bandwidth)( 112 struct stream_encoder *enc, 113 struct fixed31_32 avg_time_slots_per_mtp); 114 115 void (*update_hdmi_info_packets)( 116 struct stream_encoder *enc, 117 const struct encoder_info_frame *info_frame); 118 119 void (*stop_hdmi_info_packets)( 120 struct stream_encoder *enc); 121 122 void (*update_dp_info_packets)( 123 struct stream_encoder *enc, 124 const struct encoder_info_frame *info_frame); 125 126 void (*stop_dp_info_packets)( 127 struct stream_encoder *enc); 128 129 void (*dp_blank)( 130 struct stream_encoder *enc); 131 132 void (*dp_unblank)( 133 struct stream_encoder *enc, 134 const struct encoder_unblank_param *param); 135 136 void (*audio_mute_control)( 137 struct stream_encoder *enc, bool mute); 138 139 void (*dp_audio_setup)( 140 struct stream_encoder *enc, 141 unsigned int az_inst, 142 struct audio_info *info); 143 144 void (*dp_audio_enable) ( 145 struct stream_encoder *enc); 146 147 void (*dp_audio_disable) ( 148 struct stream_encoder *enc); 149 150 void (*hdmi_audio_setup)( 151 struct stream_encoder *enc, 152 unsigned int az_inst, 153 struct audio_info *info, 154 struct audio_crtc_info *audio_crtc_info); 155 156 void (*hdmi_audio_disable) ( 157 struct stream_encoder *enc); 158 159 void (*setup_stereo_sync) ( 160 struct stream_encoder *enc, 161 int tg_inst, 162 bool enable); 163 164 void (*set_avmute)( 165 struct stream_encoder *enc, bool enable); 166 167 void (*dig_connect_to_otg)( 168 struct stream_encoder *enc, 169 int tg_inst); 170 171 }; 172 173 #endif /* STREAM_ENCODER_H_ */ 174