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 29 static 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 34 static void virtual_stream_encoder_hdmi_set_stream_attribute( 35 struct stream_encoder *enc, 36 struct dc_crtc_timing *crtc_timing, 37 int actual_pix_clk_khz, 38 bool enable_audio) {} 39 40 static void virtual_stream_encoder_dvi_set_stream_attribute( 41 struct stream_encoder *enc, 42 struct dc_crtc_timing *crtc_timing, 43 bool is_dual_link) {} 44 45 static void virtual_stream_encoder_set_mst_bandwidth( 46 struct stream_encoder *enc, 47 struct fixed31_32 avg_time_slots_per_mtp) {} 48 49 static void virtual_stream_encoder_update_hdmi_info_packets( 50 struct stream_encoder *enc, 51 const struct encoder_info_frame *info_frame) {} 52 53 static void virtual_stream_encoder_stop_hdmi_info_packets( 54 struct stream_encoder *enc) {} 55 56 static void virtual_stream_encoder_set_avmute( 57 struct stream_encoder *enc, 58 bool enable) {} 59 static void virtual_stream_encoder_update_dp_info_packets( 60 struct stream_encoder *enc, 61 const struct encoder_info_frame *info_frame) {} 62 63 static void virtual_stream_encoder_stop_dp_info_packets( 64 struct stream_encoder *enc) {} 65 66 static void virtual_stream_encoder_dp_blank( 67 struct stream_encoder *enc) {} 68 69 static void virtual_stream_encoder_dp_unblank( 70 struct stream_encoder *enc, 71 const struct encoder_unblank_param *param) {} 72 73 static void virtual_audio_mute_control( 74 struct stream_encoder *enc, 75 bool mute) {} 76 77 static const struct stream_encoder_funcs virtual_str_enc_funcs = { 78 .dp_set_stream_attribute = 79 virtual_stream_encoder_dp_set_stream_attribute, 80 .hdmi_set_stream_attribute = 81 virtual_stream_encoder_hdmi_set_stream_attribute, 82 .dvi_set_stream_attribute = 83 virtual_stream_encoder_dvi_set_stream_attribute, 84 .set_mst_bandwidth = 85 virtual_stream_encoder_set_mst_bandwidth, 86 .update_hdmi_info_packets = 87 virtual_stream_encoder_update_hdmi_info_packets, 88 .stop_hdmi_info_packets = 89 virtual_stream_encoder_stop_hdmi_info_packets, 90 .update_dp_info_packets = 91 virtual_stream_encoder_update_dp_info_packets, 92 .stop_dp_info_packets = 93 virtual_stream_encoder_stop_dp_info_packets, 94 .dp_blank = 95 virtual_stream_encoder_dp_blank, 96 .dp_unblank = 97 virtual_stream_encoder_dp_unblank, 98 99 .audio_mute_control = virtual_audio_mute_control, 100 .set_avmute = virtual_stream_encoder_set_avmute, 101 }; 102 103 bool virtual_stream_encoder_construct( 104 struct stream_encoder *enc, 105 struct dc_context *ctx, 106 struct dc_bios *bp) 107 { 108 if (!enc) 109 return false; 110 if (!bp) 111 return false; 112 113 enc->funcs = &virtual_str_enc_funcs; 114 enc->ctx = ctx; 115 enc->id = ENGINE_ID_VIRTUAL; 116 enc->bp = bp; 117 118 return true; 119 } 120 121 struct stream_encoder *virtual_stream_encoder_create( 122 struct dc_context *ctx, struct dc_bios *bp) 123 { 124 struct stream_encoder *enc = kzalloc(sizeof(*enc), GFP_KERNEL); 125 126 if (!enc) 127 return NULL; 128 129 if (virtual_stream_encoder_construct(enc, ctx, bp)) 130 return enc; 131 132 BREAK_TO_DEBUGGER(); 133 kfree(enc); 134 return NULL; 135 } 136 137