at v6.18-rc6 181 lines 5.4 kB view raw
1/* 2 * Copyright 2012-15 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 * Authors: AMD 23 * 24 */ 25 26#include "dm_services.h" 27#include "virtual_stream_encoder.h" 28 29static void virtual_stream_encoder_dp_set_stream_attribute( 30 struct stream_encoder *enc, 31 struct dc_crtc_timing *crtc_timing, 32 enum dc_color_space output_color_space, 33 bool use_vsc_sdp_for_colorimetry, 34 uint32_t enable_sdp_splitting) {} 35 36static void virtual_stream_encoder_hdmi_set_stream_attribute( 37 struct stream_encoder *enc, 38 struct dc_crtc_timing *crtc_timing, 39 int actual_pix_clk_khz, 40 bool enable_audio) {} 41 42static void virtual_stream_encoder_dvi_set_stream_attribute( 43 struct stream_encoder *enc, 44 struct dc_crtc_timing *crtc_timing, 45 bool is_dual_link) {} 46 47static void virtual_stream_encoder_lvds_set_stream_attribute( 48 struct stream_encoder *enc, 49 struct dc_crtc_timing *crtc_timing) 50{} 51 52static void virtual_stream_encoder_set_throttled_vcp_size( 53 struct stream_encoder *enc, 54 struct fixed31_32 avg_time_slots_per_mtp) 55{} 56 57static void virtual_stream_encoder_update_hdmi_info_packets( 58 struct stream_encoder *enc, 59 const struct encoder_info_frame *info_frame) {} 60 61static void virtual_stream_encoder_stop_hdmi_info_packets( 62 struct stream_encoder *enc) {} 63 64static void virtual_stream_encoder_set_avmute( 65 struct stream_encoder *enc, 66 bool enable) {} 67static void virtual_stream_encoder_update_dp_info_packets( 68 struct stream_encoder *enc, 69 const struct encoder_info_frame *info_frame) {} 70 71static void virtual_stream_encoder_stop_dp_info_packets( 72 struct stream_encoder *enc) {} 73 74static void virtual_stream_encoder_dp_blank( 75 struct dc_link *link, 76 struct stream_encoder *enc) {} 77 78static void virtual_stream_encoder_dp_unblank( 79 struct dc_link *link, 80 struct stream_encoder *enc, 81 const struct encoder_unblank_param *param) {} 82 83static void virtual_audio_mute_control( 84 struct stream_encoder *enc, 85 bool mute) {} 86 87static void virtual_stream_encoder_reset_hdmi_stream_attribute( 88 struct stream_encoder *enc) 89{} 90 91static void virtual_enc_dp_set_odm_combine( 92 struct stream_encoder *enc, 93 bool odm_combine) 94{} 95 96static void virtual_dig_connect_to_otg( 97 struct stream_encoder *enc, 98 int tg_inst) 99{} 100 101static void virtual_setup_stereo_sync( 102 struct stream_encoder *enc, 103 int tg_inst, 104 bool enable) 105{} 106 107static void virtual_stream_encoder_set_dsc_pps_info_packet( 108 struct stream_encoder *enc, 109 bool enable, 110 uint8_t *dsc_packed_pps, 111 bool immediate_update) 112{} 113 114static const struct stream_encoder_funcs virtual_str_enc_funcs = { 115 .dp_set_odm_combine = 116 virtual_enc_dp_set_odm_combine, 117 .dp_set_stream_attribute = 118 virtual_stream_encoder_dp_set_stream_attribute, 119 .hdmi_set_stream_attribute = 120 virtual_stream_encoder_hdmi_set_stream_attribute, 121 .dvi_set_stream_attribute = 122 virtual_stream_encoder_dvi_set_stream_attribute, 123 .lvds_set_stream_attribute = 124 virtual_stream_encoder_lvds_set_stream_attribute, 125 .set_throttled_vcp_size = 126 virtual_stream_encoder_set_throttled_vcp_size, 127 .update_hdmi_info_packets = 128 virtual_stream_encoder_update_hdmi_info_packets, 129 .stop_hdmi_info_packets = 130 virtual_stream_encoder_stop_hdmi_info_packets, 131 .update_dp_info_packets = 132 virtual_stream_encoder_update_dp_info_packets, 133 .stop_dp_info_packets = 134 virtual_stream_encoder_stop_dp_info_packets, 135 .dp_blank = 136 virtual_stream_encoder_dp_blank, 137 .dp_unblank = 138 virtual_stream_encoder_dp_unblank, 139 140 .audio_mute_control = virtual_audio_mute_control, 141 .set_avmute = virtual_stream_encoder_set_avmute, 142 .hdmi_reset_stream_attribute = virtual_stream_encoder_reset_hdmi_stream_attribute, 143 .dig_connect_to_otg = virtual_dig_connect_to_otg, 144 .setup_stereo_sync = virtual_setup_stereo_sync, 145 .dp_set_dsc_pps_info_packet = virtual_stream_encoder_set_dsc_pps_info_packet, 146}; 147 148bool virtual_stream_encoder_construct( 149 struct stream_encoder *enc, 150 struct dc_context *ctx, 151 struct dc_bios *bp) 152{ 153 if (!enc) 154 return false; 155 if (!bp) 156 return false; 157 158 enc->funcs = &virtual_str_enc_funcs; 159 enc->ctx = ctx; 160 enc->id = ENGINE_ID_VIRTUAL; 161 enc->bp = bp; 162 163 return true; 164} 165 166struct stream_encoder *virtual_stream_encoder_create( 167 struct dc_context *ctx, struct dc_bios *bp) 168{ 169 struct stream_encoder *enc = kzalloc(sizeof(*enc), GFP_KERNEL); 170 171 if (!enc) 172 return NULL; 173 174 if (virtual_stream_encoder_construct(enc, ctx, bp)) 175 return enc; 176 177 BREAK_TO_DEBUGGER(); 178 kfree(enc); 179 return NULL; 180} 181