Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2012-15 Advanced Micro Devices, Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  * Authors: AMD
0023  *
0024  */
0025 
0026 #include "dm_services.h"
0027 #include "virtual_stream_encoder.h"
0028 
0029 static void virtual_stream_encoder_dp_set_stream_attribute(
0030     struct stream_encoder *enc,
0031     struct dc_crtc_timing *crtc_timing,
0032     enum dc_color_space output_color_space,
0033     bool use_vsc_sdp_for_colorimetry,
0034     uint32_t enable_sdp_splitting) {}
0035 
0036 static void virtual_stream_encoder_hdmi_set_stream_attribute(
0037     struct stream_encoder *enc,
0038     struct dc_crtc_timing *crtc_timing,
0039     int actual_pix_clk_khz,
0040     bool enable_audio) {}
0041 
0042 static void virtual_stream_encoder_dvi_set_stream_attribute(
0043     struct stream_encoder *enc,
0044     struct dc_crtc_timing *crtc_timing,
0045     bool is_dual_link) {}
0046 
0047 static void virtual_stream_encoder_set_throttled_vcp_size(
0048     struct stream_encoder *enc,
0049     struct fixed31_32 avg_time_slots_per_mtp)
0050 {}
0051 
0052 static void virtual_stream_encoder_update_hdmi_info_packets(
0053     struct stream_encoder *enc,
0054     const struct encoder_info_frame *info_frame) {}
0055 
0056 static void virtual_stream_encoder_stop_hdmi_info_packets(
0057     struct stream_encoder *enc) {}
0058 
0059 static void virtual_stream_encoder_set_avmute(
0060     struct stream_encoder *enc,
0061     bool enable) {}
0062 static void virtual_stream_encoder_update_dp_info_packets(
0063     struct stream_encoder *enc,
0064     const struct encoder_info_frame *info_frame) {}
0065 
0066 static void virtual_stream_encoder_stop_dp_info_packets(
0067     struct stream_encoder *enc) {}
0068 
0069 static void virtual_stream_encoder_dp_blank(
0070     struct dc_link *link,
0071     struct stream_encoder *enc) {}
0072 
0073 static void virtual_stream_encoder_dp_unblank(
0074     struct dc_link *link,
0075     struct stream_encoder *enc,
0076     const struct encoder_unblank_param *param) {}
0077 
0078 static void virtual_audio_mute_control(
0079     struct stream_encoder *enc,
0080     bool mute) {}
0081 
0082 static void virtual_stream_encoder_reset_hdmi_stream_attribute(
0083         struct stream_encoder *enc)
0084 {}
0085 
0086 static void virtual_enc_dp_set_odm_combine(
0087     struct stream_encoder *enc,
0088     bool odm_combine)
0089 {}
0090 
0091 static void virtual_dig_connect_to_otg(
0092         struct stream_encoder *enc,
0093         int tg_inst)
0094 {}
0095 
0096 static void virtual_setup_stereo_sync(
0097             struct stream_encoder *enc,
0098             int tg_inst,
0099             bool enable)
0100 {}
0101 
0102 static void virtual_stream_encoder_set_dsc_pps_info_packet(
0103         struct stream_encoder *enc,
0104         bool enable,
0105         uint8_t *dsc_packed_pps,
0106         bool immediate_update)
0107 {}
0108 
0109 static const struct stream_encoder_funcs virtual_str_enc_funcs = {
0110     .dp_set_odm_combine =
0111         virtual_enc_dp_set_odm_combine,
0112     .dp_set_stream_attribute =
0113         virtual_stream_encoder_dp_set_stream_attribute,
0114     .hdmi_set_stream_attribute =
0115         virtual_stream_encoder_hdmi_set_stream_attribute,
0116     .dvi_set_stream_attribute =
0117         virtual_stream_encoder_dvi_set_stream_attribute,
0118     .set_throttled_vcp_size =
0119         virtual_stream_encoder_set_throttled_vcp_size,
0120     .update_hdmi_info_packets =
0121         virtual_stream_encoder_update_hdmi_info_packets,
0122     .stop_hdmi_info_packets =
0123         virtual_stream_encoder_stop_hdmi_info_packets,
0124     .update_dp_info_packets =
0125         virtual_stream_encoder_update_dp_info_packets,
0126     .stop_dp_info_packets =
0127         virtual_stream_encoder_stop_dp_info_packets,
0128     .dp_blank =
0129         virtual_stream_encoder_dp_blank,
0130     .dp_unblank =
0131         virtual_stream_encoder_dp_unblank,
0132 
0133     .audio_mute_control = virtual_audio_mute_control,
0134     .set_avmute = virtual_stream_encoder_set_avmute,
0135     .hdmi_reset_stream_attribute = virtual_stream_encoder_reset_hdmi_stream_attribute,
0136     .dig_connect_to_otg = virtual_dig_connect_to_otg,
0137     .setup_stereo_sync = virtual_setup_stereo_sync,
0138     .dp_set_dsc_pps_info_packet = virtual_stream_encoder_set_dsc_pps_info_packet,
0139 };
0140 
0141 bool virtual_stream_encoder_construct(
0142     struct stream_encoder *enc,
0143     struct dc_context *ctx,
0144     struct dc_bios *bp)
0145 {
0146     if (!enc)
0147         return false;
0148     if (!bp)
0149         return false;
0150 
0151     enc->funcs = &virtual_str_enc_funcs;
0152     enc->ctx = ctx;
0153     enc->id = ENGINE_ID_VIRTUAL;
0154     enc->bp = bp;
0155 
0156     return true;
0157 }
0158 
0159 struct stream_encoder *virtual_stream_encoder_create(
0160     struct dc_context *ctx, struct dc_bios *bp)
0161 {
0162     struct stream_encoder *enc = kzalloc(sizeof(*enc), GFP_KERNEL);
0163 
0164     if (!enc)
0165         return NULL;
0166 
0167     if (virtual_stream_encoder_construct(enc, ctx, bp))
0168         return enc;
0169 
0170     BREAK_TO_DEBUGGER();
0171     kfree(enc);
0172     return NULL;
0173 }
0174