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