1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28#ifndef STREAM_ENCODER_H_
29#define STREAM_ENCODER_H_
30
31#include "audio_types.h"
32#include "hw_shared.h"
33
34struct dc_bios;
35struct dc_context;
36struct dc_crtc_timing;
37
38enum 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
45};
46
47enum 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
53};
54
55struct audio_clock_info {
56
57 uint32_t pixel_clock_in_10khz;
58
59 uint32_t n_32khz;
60
61 uint32_t cts_32khz;
62 uint32_t n_44khz;
63 uint32_t cts_44khz;
64 uint32_t n_48khz;
65 uint32_t cts_48khz;
66};
67
68#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
69enum dynamic_metadata_mode {
70 dmdata_dp,
71 dmdata_hdmi,
72 dmdata_dolby_vision
73};
74#endif
75
76struct encoder_info_frame {
77
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
83 struct dc_info_packet spd;
84
85 struct dc_info_packet vsc;
86
87 struct dc_info_packet hdrsmd;
88};
89
90struct encoder_unblank_param {
91 struct dc_link_settings link_settings;
92 struct dc_crtc_timing timing;
93#ifdef CONFIG_DRM_AMD_DC_DCN2_0
94 bool odm;
95#endif
96};
97
98struct 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;
103};
104
105struct stream_encoder {
106 const struct stream_encoder_funcs *funcs;
107 struct dc_context *ctx;
108 struct dc_bios *bp;
109 enum engine_id id;
110};
111
112#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
113struct enc_state {
114 uint32_t dsc_mode;
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;
121};
122#endif
123
124struct stream_encoder_funcs {
125 #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
126 void (*enc_read_state)(struct stream_encoder *enc, struct enc_state *s);
127 #endif
128 void (*dp_set_stream_attribute)(
129 struct stream_encoder *enc,
130 struct dc_crtc_timing *crtc_timing,
131 enum dc_color_space output_color_space,
132 uint32_t enable_sdp_splitting);
133
134 void (*hdmi_set_stream_attribute)(
135 struct stream_encoder *enc,
136 struct dc_crtc_timing *crtc_timing,
137 int actual_pix_clk_khz,
138 bool enable_audio);
139
140 void (*dvi_set_stream_attribute)(
141 struct stream_encoder *enc,
142 struct dc_crtc_timing *crtc_timing,
143 bool is_dual_link);
144
145 void (*lvds_set_stream_attribute)(
146 struct stream_encoder *enc,
147 struct dc_crtc_timing *crtc_timing);
148
149 void (*set_mst_bandwidth)(
150 struct stream_encoder *enc,
151 struct fixed31_32 avg_time_slots_per_mtp);
152
153 void (*update_hdmi_info_packets)(
154 struct stream_encoder *enc,
155 const struct encoder_info_frame *info_frame);
156
157 void (*stop_hdmi_info_packets)(
158 struct stream_encoder *enc);
159
160 void (*update_dp_info_packets)(
161 struct stream_encoder *enc,
162 const struct encoder_info_frame *info_frame);
163
164 void (*send_immediate_sdp_message)(
165 struct stream_encoder *enc,
166 const uint8_t *custom_sdp_message,
167 unsigned int sdp_message_size);
168
169 void (*stop_dp_info_packets)(
170 struct stream_encoder *enc);
171
172 void (*dp_blank)(
173 struct stream_encoder *enc);
174
175 void (*dp_unblank)(
176 struct stream_encoder *enc,
177 const struct encoder_unblank_param *param);
178
179 void (*audio_mute_control)(
180 struct stream_encoder *enc, bool mute);
181
182 void (*dp_audio_setup)(
183 struct stream_encoder *enc,
184 unsigned int az_inst,
185 struct audio_info *info);
186
187 void (*dp_audio_enable) (
188 struct stream_encoder *enc);
189
190 void (*dp_audio_disable) (
191 struct stream_encoder *enc);
192
193 void (*hdmi_audio_setup)(
194 struct stream_encoder *enc,
195 unsigned int az_inst,
196 struct audio_info *info,
197 struct audio_crtc_info *audio_crtc_info);
198
199 void (*hdmi_audio_disable) (
200 struct stream_encoder *enc);
201
202 void (*setup_stereo_sync) (
203 struct stream_encoder *enc,
204 int tg_inst,
205 bool enable);
206
207 void (*set_avmute)(
208 struct stream_encoder *enc, bool enable);
209
210 void (*dig_connect_to_otg)(
211 struct stream_encoder *enc,
212 int tg_inst);
213
214#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
215#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
216 void (*dp_set_dsc_config)(
217 struct stream_encoder *enc,
218 enum optc_dsc_mode dsc_mode,
219 uint32_t dsc_bytes_per_pixel,
220 uint32_t dsc_slice_width,
221 uint8_t *dsc_packed_pps);
222#endif
223
224 void (*set_dynamic_metadata)(struct stream_encoder *enc,
225 bool enable,
226 uint32_t hubp_requestor_id,
227 enum dynamic_metadata_mode dmdata_mode);
228
229 void (*dp_set_odm_combine)(
230 struct stream_encoder *enc,
231 bool odm_combine);
232#endif
233};
234
235#endif
236