2 * Copyright 2017 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
28 #ifndef STREAM_ENCODER_H_
29 #define STREAM_ENCODER_H_
31 #include "audio_types.h"
32 #include "hw_shared.h"
36 struct dc_crtc_timing;
38 enum dp_pixel_encoding_type {
39 DP_PIXEL_ENCODING_TYPE_RGB444 = 0x00000000,
40 DP_PIXEL_ENCODING_TYPE_YCBCR422 = 0x00000001,
41 DP_PIXEL_ENCODING_TYPE_YCBCR444 = 0x00000002,
42 DP_PIXEL_ENCODING_TYPE_RGB_WIDE_GAMUT = 0x00000003,
43 DP_PIXEL_ENCODING_TYPE_Y_ONLY = 0x00000004,
44 DP_PIXEL_ENCODING_TYPE_YCBCR420 = 0x00000005
47 enum dp_component_depth {
48 DP_COMPONENT_PIXEL_DEPTH_6BPC = 0x00000000,
49 DP_COMPONENT_PIXEL_DEPTH_8BPC = 0x00000001,
50 DP_COMPONENT_PIXEL_DEPTH_10BPC = 0x00000002,
51 DP_COMPONENT_PIXEL_DEPTH_12BPC = 0x00000003,
52 DP_COMPONENT_PIXEL_DEPTH_16BPC = 0x00000004
55 struct audio_clock_info {
56 /* pixel clock frequency*/
57 uint32_t pixel_clock_in_10khz;
60 /* CTS - 32KHz audio*/
68 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
69 enum dynamic_metadata_mode {
76 struct encoder_info_frame {
77 /* auxiliary video information */
78 struct dc_info_packet avi;
79 struct dc_info_packet gamut;
80 struct dc_info_packet vendor;
81 struct dc_info_packet hfvsif;
82 /* source product description */
83 struct dc_info_packet spd;
84 /* video stream configuration */
85 struct dc_info_packet vsc;
86 /* HDR Static MetaData */
87 struct dc_info_packet hdrsmd;
90 struct encoder_unblank_param {
91 struct dc_link_settings link_settings;
92 struct dc_crtc_timing timing;
93 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
98 struct encoder_set_dp_phy_pattern_param {
99 enum dp_test_pattern dp_phy_pattern;
100 const uint8_t *custom_pattern;
101 uint32_t custom_pattern_size;
102 enum dp_panel_mode dp_panel_mode;
105 struct stream_encoder {
106 const struct stream_encoder_funcs *funcs;
107 struct dc_context *ctx;
112 #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
114 uint32_t dsc_mode; // DISABLED 0; 1 or 2 indicate enabled state.
115 uint32_t dsc_slice_width;
116 uint32_t sec_gsp_pps_line_num;
117 uint32_t vbid6_line_reference;
118 uint32_t vbid6_line_num;
119 uint32_t sec_gsp_pps_enable;
120 uint32_t sec_stream_enable;
124 struct stream_encoder_funcs {
125 void (*dp_set_stream_attribute)(
126 struct stream_encoder *enc,
127 struct dc_crtc_timing *crtc_timing,
128 enum dc_color_space output_color_space,
129 uint32_t enable_sdp_splitting);
131 void (*hdmi_set_stream_attribute)(
132 struct stream_encoder *enc,
133 struct dc_crtc_timing *crtc_timing,
134 int actual_pix_clk_khz,
137 void (*dvi_set_stream_attribute)(
138 struct stream_encoder *enc,
139 struct dc_crtc_timing *crtc_timing,
142 void (*lvds_set_stream_attribute)(
143 struct stream_encoder *enc,
144 struct dc_crtc_timing *crtc_timing);
146 void (*set_mst_bandwidth)(
147 struct stream_encoder *enc,
148 struct fixed31_32 avg_time_slots_per_mtp);
150 void (*update_hdmi_info_packets)(
151 struct stream_encoder *enc,
152 const struct encoder_info_frame *info_frame);
154 void (*stop_hdmi_info_packets)(
155 struct stream_encoder *enc);
157 void (*update_dp_info_packets)(
158 struct stream_encoder *enc,
159 const struct encoder_info_frame *info_frame);
161 void (*send_immediate_sdp_message)(
162 struct stream_encoder *enc,
163 const uint8_t *custom_sdp_message,
164 unsigned int sdp_message_size);
166 void (*stop_dp_info_packets)(
167 struct stream_encoder *enc);
170 struct stream_encoder *enc);
173 struct stream_encoder *enc,
174 const struct encoder_unblank_param *param);
176 void (*audio_mute_control)(
177 struct stream_encoder *enc, bool mute);
179 void (*dp_audio_setup)(
180 struct stream_encoder *enc,
181 unsigned int az_inst,
182 struct audio_info *info);
184 void (*dp_audio_enable) (
185 struct stream_encoder *enc);
187 void (*dp_audio_disable) (
188 struct stream_encoder *enc);
190 void (*hdmi_audio_setup)(
191 struct stream_encoder *enc,
192 unsigned int az_inst,
193 struct audio_info *info,
194 struct audio_crtc_info *audio_crtc_info);
196 void (*hdmi_audio_disable) (
197 struct stream_encoder *enc);
199 void (*setup_stereo_sync) (
200 struct stream_encoder *enc,
205 struct stream_encoder *enc, bool enable);
207 void (*dig_connect_to_otg)(
208 struct stream_encoder *enc,
211 void (*hdmi_reset_stream_attribute)(
212 struct stream_encoder *enc);
214 unsigned int (*dig_source_otg)(
215 struct stream_encoder *enc);
217 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
218 #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
219 void (*enc_read_state)(struct stream_encoder *enc, struct enc_state *s);
221 void (*dp_set_dsc_config)(
222 struct stream_encoder *enc,
223 enum optc_dsc_mode dsc_mode,
224 uint32_t dsc_bytes_per_pixel,
225 uint32_t dsc_slice_width);
227 void (*dp_set_dsc_pps_info_packet)(struct stream_encoder *enc,
229 uint8_t *dsc_packed_pps);
232 void (*set_dynamic_metadata)(struct stream_encoder *enc,
234 uint32_t hubp_requestor_id,
235 enum dynamic_metadata_mode dmdata_mode);
237 void (*dp_set_odm_combine)(
238 struct stream_encoder *enc,
243 #endif /* STREAM_ENCODER_H_ */