14562236bSHarry Wentland /* 24562236bSHarry Wentland * Copyright 2012-15 Advanced Micro Devices, Inc. 34562236bSHarry Wentland * 44562236bSHarry Wentland * Permission is hereby granted, free of charge, to any person obtaining a 54562236bSHarry Wentland * copy of this software and associated documentation files (the "Software"), 64562236bSHarry Wentland * to deal in the Software without restriction, including without limitation 74562236bSHarry Wentland * the rights to use, copy, modify, merge, publish, distribute, sublicense, 84562236bSHarry Wentland * and/or sell copies of the Software, and to permit persons to whom the 94562236bSHarry Wentland * Software is furnished to do so, subject to the following conditions: 104562236bSHarry Wentland * 114562236bSHarry Wentland * The above copyright notice and this permission notice shall be included in 124562236bSHarry Wentland * all copies or substantial portions of the Software. 134562236bSHarry Wentland * 144562236bSHarry Wentland * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 154562236bSHarry Wentland * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 164562236bSHarry Wentland * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 174562236bSHarry Wentland * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 184562236bSHarry Wentland * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 194562236bSHarry Wentland * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 204562236bSHarry Wentland * OTHER DEALINGS IN THE SOFTWARE. 214562236bSHarry Wentland * 224562236bSHarry Wentland * Authors: AMD 234562236bSHarry Wentland * 244562236bSHarry Wentland */ 254562236bSHarry Wentland 264562236bSHarry Wentland #include "dm_services.h" 274562236bSHarry Wentland #include "virtual_stream_encoder.h" 284562236bSHarry Wentland 294562236bSHarry Wentland static void virtual_stream_encoder_dp_set_stream_attribute( 304562236bSHarry Wentland struct stream_encoder *enc, 314562236bSHarry Wentland struct dc_crtc_timing *crtc_timing, 324562236bSHarry Wentland enum dc_color_space output_color_space) {} 334562236bSHarry Wentland 344562236bSHarry Wentland static void virtual_stream_encoder_hdmi_set_stream_attribute( 354562236bSHarry Wentland struct stream_encoder *enc, 364562236bSHarry Wentland struct dc_crtc_timing *crtc_timing, 374562236bSHarry Wentland int actual_pix_clk_khz, 384562236bSHarry Wentland bool enable_audio) {} 394562236bSHarry Wentland 404562236bSHarry Wentland static void virtual_stream_encoder_dvi_set_stream_attribute( 414562236bSHarry Wentland struct stream_encoder *enc, 424562236bSHarry Wentland struct dc_crtc_timing *crtc_timing, 434562236bSHarry Wentland bool is_dual_link) {} 444562236bSHarry Wentland 454562236bSHarry Wentland static void virtual_stream_encoder_set_mst_bandwidth( 464562236bSHarry Wentland struct stream_encoder *enc, 474562236bSHarry Wentland struct fixed31_32 avg_time_slots_per_mtp) {} 484562236bSHarry Wentland 494562236bSHarry Wentland static void virtual_stream_encoder_update_hdmi_info_packets( 504562236bSHarry Wentland struct stream_encoder *enc, 514562236bSHarry Wentland const struct encoder_info_frame *info_frame) {} 524562236bSHarry Wentland 534562236bSHarry Wentland static void virtual_stream_encoder_stop_hdmi_info_packets( 544562236bSHarry Wentland struct stream_encoder *enc) {} 554562236bSHarry Wentland 564562236bSHarry Wentland static void virtual_stream_encoder_update_dp_info_packets( 574562236bSHarry Wentland struct stream_encoder *enc, 584562236bSHarry Wentland const struct encoder_info_frame *info_frame) {} 594562236bSHarry Wentland 604562236bSHarry Wentland static void virtual_stream_encoder_stop_dp_info_packets( 614562236bSHarry Wentland struct stream_encoder *enc) {} 624562236bSHarry Wentland 634562236bSHarry Wentland static void virtual_stream_encoder_dp_blank( 644562236bSHarry Wentland struct stream_encoder *enc) {} 654562236bSHarry Wentland 664562236bSHarry Wentland static void virtual_stream_encoder_dp_unblank( 674562236bSHarry Wentland struct stream_encoder *enc, 684562236bSHarry Wentland const struct encoder_unblank_param *param) {} 694562236bSHarry Wentland 704562236bSHarry Wentland static void virtual_audio_mute_control( 714562236bSHarry Wentland struct stream_encoder *enc, 724562236bSHarry Wentland bool mute) {} 734562236bSHarry Wentland 744562236bSHarry Wentland static const struct stream_encoder_funcs virtual_str_enc_funcs = { 754562236bSHarry Wentland .dp_set_stream_attribute = 764562236bSHarry Wentland virtual_stream_encoder_dp_set_stream_attribute, 774562236bSHarry Wentland .hdmi_set_stream_attribute = 784562236bSHarry Wentland virtual_stream_encoder_hdmi_set_stream_attribute, 794562236bSHarry Wentland .dvi_set_stream_attribute = 804562236bSHarry Wentland virtual_stream_encoder_dvi_set_stream_attribute, 814562236bSHarry Wentland .set_mst_bandwidth = 824562236bSHarry Wentland virtual_stream_encoder_set_mst_bandwidth, 834562236bSHarry Wentland .update_hdmi_info_packets = 844562236bSHarry Wentland virtual_stream_encoder_update_hdmi_info_packets, 854562236bSHarry Wentland .stop_hdmi_info_packets = 864562236bSHarry Wentland virtual_stream_encoder_stop_hdmi_info_packets, 874562236bSHarry Wentland .update_dp_info_packets = 884562236bSHarry Wentland virtual_stream_encoder_update_dp_info_packets, 894562236bSHarry Wentland .stop_dp_info_packets = 904562236bSHarry Wentland virtual_stream_encoder_stop_dp_info_packets, 914562236bSHarry Wentland .dp_blank = 924562236bSHarry Wentland virtual_stream_encoder_dp_blank, 934562236bSHarry Wentland .dp_unblank = 944562236bSHarry Wentland virtual_stream_encoder_dp_unblank, 954562236bSHarry Wentland 964562236bSHarry Wentland .audio_mute_control = virtual_audio_mute_control, 974562236bSHarry Wentland }; 984562236bSHarry Wentland 994562236bSHarry Wentland bool virtual_stream_encoder_construct( 1004562236bSHarry Wentland struct stream_encoder *enc, 1014562236bSHarry Wentland struct dc_context *ctx, 1024562236bSHarry Wentland struct dc_bios *bp) 1034562236bSHarry Wentland { 1044562236bSHarry Wentland if (!enc) 1054562236bSHarry Wentland return false; 1064562236bSHarry Wentland if (!bp) 1074562236bSHarry Wentland return false; 1084562236bSHarry Wentland 1094562236bSHarry Wentland enc->funcs = &virtual_str_enc_funcs; 1104562236bSHarry Wentland enc->ctx = ctx; 1114562236bSHarry Wentland enc->id = ENGINE_ID_VIRTUAL; 1124562236bSHarry Wentland enc->bp = bp; 1134562236bSHarry Wentland 1144562236bSHarry Wentland return true; 1154562236bSHarry Wentland } 1164562236bSHarry Wentland 1174562236bSHarry Wentland struct stream_encoder *virtual_stream_encoder_create( 1184562236bSHarry Wentland struct dc_context *ctx, struct dc_bios *bp) 1194562236bSHarry Wentland { 1204562236bSHarry Wentland struct stream_encoder *enc = dm_alloc(sizeof(*enc)); 1214562236bSHarry Wentland 1224562236bSHarry Wentland if (!enc) 1234562236bSHarry Wentland return NULL; 1244562236bSHarry Wentland 1254562236bSHarry Wentland if (virtual_stream_encoder_construct(enc, ctx, bp)) 1264562236bSHarry Wentland return enc; 1274562236bSHarry Wentland 1284562236bSHarry Wentland BREAK_TO_DEBUGGER(); 1294562236bSHarry Wentland dm_free(enc); 1304562236bSHarry Wentland return NULL; 1314562236bSHarry Wentland } 1324562236bSHarry Wentland 133