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#ifndef DC_STREAM_H_
27#define DC_STREAM_H_
28
29#include "dc_types.h"
30#include "grph_object_defs.h"
31
32
33
34
35
36struct dc_stream_status {
37 int primary_otg_inst;
38 int stream_enc_inst;
39 int plane_count;
40 struct dc_plane_state *plane_states[MAX_SURFACE_NUM];
41
42
43
44
45 struct dc_link *link;
46};
47
48struct dc_stream_state {
49 struct dc_sink *sink;
50 struct dc_crtc_timing timing;
51 struct dc_crtc_timing_adjust timing_adjust;
52 struct vrr_params vrr_params;
53
54 struct rect src;
55 struct rect dst;
56
57 struct audio_info audio_info;
58
59 struct freesync_context freesync_ctx;
60
61 struct dc_info_packet hdr_static_metadata;
62 PHYSICAL_ADDRESS_LOC dmdata_address;
63 bool use_dynamic_meta;
64
65 struct dc_transfer_func *out_transfer_func;
66 struct colorspace_transform gamut_remap_matrix;
67 struct dc_csc_transform csc_color_matrix;
68
69 enum dc_color_space output_color_space;
70 enum dc_dither_option dither_option;
71
72 enum view_3d_format view_format;
73
74 bool ignore_msa_timing_param;
75
76 unsigned long long periodic_fn_vsync_delta;
77
78
79
80
81 unsigned char psr_version;
82
83
84
85 unsigned int abm_level;
86 unsigned int bl_pwm_level;
87
88
89 struct dc_context *ctx;
90
91
92 struct bit_depth_reduction_params bit_depth_params;
93 struct clamping_and_pixel_encoding_params clamping;
94
95 int phy_pix_clk;
96 enum signal_type signal;
97 bool dpms_off;
98
99 struct dc_stream_status status;
100
101 struct dc_cursor_attributes cursor_attributes;
102 struct dc_cursor_position cursor_position;
103 uint32_t sdr_white_level;
104
105
106 struct kref refcount;
107
108 struct crtc_trigger_info triggered_crtc_reset;
109
110
111 bool mode_changed : 1;
112
113};
114
115struct dc_stream_update {
116 struct rect src;
117 struct rect dst;
118 struct dc_transfer_func *out_transfer_func;
119 struct dc_info_packet *hdr_static_metadata;
120 unsigned int *abm_level;
121
122 unsigned long long *periodic_fn_vsync_delta;
123};
124
125bool dc_is_stream_unchanged(
126 struct dc_stream_state *old_stream, struct dc_stream_state *stream);
127bool dc_is_stream_scaling_unchanged(
128 struct dc_stream_state *old_stream, struct dc_stream_state *stream);
129
130
131
132
133
134
135
136
137
138
139
140
141void dc_commit_updates_for_stream(struct dc *dc,
142 struct dc_surface_update *srf_updates,
143 int surface_count,
144 struct dc_stream_state *stream,
145 struct dc_stream_update *stream_update,
146 struct dc_plane_state **plane_states,
147 struct dc_state *state);
148
149
150
151void dc_stream_log(const struct dc *dc, const struct dc_stream_state *stream);
152
153uint8_t dc_get_current_stream_count(struct dc *dc);
154struct dc_stream_state *dc_get_stream_at_index(struct dc *dc, uint8_t i);
155
156
157
158
159uint32_t dc_stream_get_vblank_counter(const struct dc_stream_state *stream);
160
161
162
163
164
165bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream,
166 uint32_t *v_blank_start,
167 uint32_t *v_blank_end,
168 uint32_t *h_position,
169 uint32_t *v_position);
170
171enum dc_status dc_add_stream_to_ctx(
172 struct dc *dc,
173 struct dc_state *new_ctx,
174 struct dc_stream_state *stream);
175
176enum dc_status dc_remove_stream_from_ctx(
177 struct dc *dc,
178 struct dc_state *new_ctx,
179 struct dc_stream_state *stream);
180
181
182bool dc_add_plane_to_context(
183 const struct dc *dc,
184 struct dc_stream_state *stream,
185 struct dc_plane_state *plane_state,
186 struct dc_state *context);
187
188bool dc_remove_plane_from_context(
189 const struct dc *dc,
190 struct dc_stream_state *stream,
191 struct dc_plane_state *plane_state,
192 struct dc_state *context);
193
194bool dc_rem_all_planes_for_stream(
195 const struct dc *dc,
196 struct dc_stream_state *stream,
197 struct dc_state *context);
198
199bool dc_add_all_planes_for_stream(
200 const struct dc *dc,
201 struct dc_stream_state *stream,
202 struct dc_plane_state * const *plane_states,
203 int plane_count,
204 struct dc_state *context);
205
206enum dc_status dc_validate_stream(struct dc *dc, struct dc_stream_state *stream);
207
208
209
210
211
212
213
214
215
216
217
218
219
220bool dc_enable_stereo(
221 struct dc *dc,
222 struct dc_state *context,
223 struct dc_stream_state *streams[],
224 uint8_t stream_count);
225
226
227enum surface_update_type dc_check_update_surfaces_for_stream(
228 struct dc *dc,
229 struct dc_surface_update *updates,
230 int surface_count,
231 struct dc_stream_update *stream_update,
232 const struct dc_stream_status *stream_status);
233
234
235
236
237struct dc_stream_state *dc_create_stream_for_sink(struct dc_sink *dc_sink);
238
239void update_stream_signal(struct dc_stream_state *stream);
240
241void dc_stream_retain(struct dc_stream_state *dc_stream);
242void dc_stream_release(struct dc_stream_state *dc_stream);
243
244struct dc_stream_status *dc_stream_get_status(
245 struct dc_stream_state *dc_stream);
246
247
248
249
250
251bool dc_stream_set_cursor_attributes(
252 struct dc_stream_state *stream,
253 const struct dc_cursor_attributes *attributes);
254
255bool dc_stream_set_cursor_position(
256 struct dc_stream_state *stream,
257 const struct dc_cursor_position *position);
258
259
260bool dc_stream_adjust_vmin_vmax(struct dc *dc,
261 struct dc_stream_state **stream,
262 int num_streams,
263 int vmin,
264 int vmax);
265
266bool dc_stream_get_crtc_position(struct dc *dc,
267 struct dc_stream_state **stream,
268 int num_streams,
269 unsigned int *v_pos,
270 unsigned int *nom_v_pos);
271
272bool dc_stream_configure_crc(struct dc *dc,
273 struct dc_stream_state *stream,
274 bool enable,
275 bool continuous);
276
277bool dc_stream_get_crc(struct dc *dc,
278 struct dc_stream_state *stream,
279 uint32_t *r_cr,
280 uint32_t *g_y,
281 uint32_t *b_cb);
282
283void dc_stream_set_static_screen_events(struct dc *dc,
284 struct dc_stream_state **stream,
285 int num_streams,
286 const struct dc_static_screen_events *events);
287
288void dc_stream_set_dither_option(struct dc_stream_state *stream,
289 enum dc_dither_option option);
290
291
292bool dc_stream_adjust_vmin_vmax(struct dc *dc,
293 struct dc_stream_state **stream,
294 int num_streams,
295 int vmin,
296 int vmax);
297
298bool dc_stream_get_crtc_position(struct dc *dc,
299 struct dc_stream_state **stream,
300 int num_streams,
301 unsigned int *v_pos,
302 unsigned int *nom_v_pos);
303
304#endif
305