]>
Commit | Line | Data |
---|---|---|
7c0c9672 HW |
1 | /* |
2 | * Copyright 2012-14 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 | #ifndef DC_STREAM_H_ | |
27 | #define DC_STREAM_H_ | |
28 | ||
29 | #include "dc_types.h" | |
30 | #include "grph_object_defs.h" | |
31 | ||
32 | /******************************************************************************* | |
33 | * Stream Interfaces | |
34 | ******************************************************************************/ | |
35 | ||
36 | struct 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 | * link this stream passes through | |
44 | */ | |
45 | struct dc_link *link; | |
46 | }; | |
47 | ||
48 | struct dc_stream_state { | |
49 | struct dc_sink *sink; | |
50 | struct dc_crtc_timing timing; | |
51 | ||
52 | struct rect src; /* composition area */ | |
53 | struct rect dst; /* stream addressable area */ | |
54 | ||
55 | struct audio_info audio_info; | |
56 | ||
57 | struct freesync_context freesync_ctx; | |
58 | ||
59 | struct dc_hdr_static_metadata hdr_static_metadata; | |
60 | struct dc_transfer_func *out_transfer_func; | |
61 | struct colorspace_transform gamut_remap_matrix; | |
62 | struct csc_transform csc_color_matrix; | |
63 | ||
64 | enum dc_color_space output_color_space; | |
65 | enum dc_dither_option dither_option; | |
66 | ||
67 | enum view_3d_format view_format; | |
68 | ||
69 | bool ignore_msa_timing_param; | |
70 | /* TODO: custom INFO packets */ | |
71 | /* TODO: ABM info (DMCU) */ | |
72 | /* TODO: PSR info */ | |
73 | /* TODO: CEA VIC */ | |
74 | ||
75 | /* from core_stream struct */ | |
76 | struct dc_context *ctx; | |
77 | ||
78 | /* used by DCP and FMT */ | |
79 | struct bit_depth_reduction_params bit_depth_params; | |
80 | struct clamping_and_pixel_encoding_params clamping; | |
81 | ||
82 | int phy_pix_clk; | |
83 | enum signal_type signal; | |
84 | bool dpms_off; | |
85 | ||
86 | struct dc_stream_status status; | |
87 | ||
88 | struct dc_cursor_attributes cursor_attributes; | |
ea783c31 | 89 | struct dc_cursor_position cursor_position; |
7c0c9672 HW |
90 | |
91 | /* from stream struct */ | |
92 | struct kref refcount; | |
93 | ||
94 | struct crtc_trigger_info triggered_crtc_reset; | |
95 | ||
27b3f4fc LSL |
96 | /* Computed state bits */ |
97 | bool mode_changed : 1; | |
98 | ||
7c0c9672 HW |
99 | }; |
100 | ||
101 | struct dc_stream_update { | |
102 | struct rect src; | |
103 | struct rect dst; | |
104 | struct dc_transfer_func *out_transfer_func; | |
105 | struct dc_hdr_static_metadata *hdr_static_metadata; | |
106 | }; | |
107 | ||
108 | bool dc_is_stream_unchanged( | |
109 | struct dc_stream_state *old_stream, struct dc_stream_state *stream); | |
110 | bool dc_is_stream_scaling_unchanged( | |
111 | struct dc_stream_state *old_stream, struct dc_stream_state *stream); | |
112 | ||
113 | /* | |
114 | * Set up surface attributes and associate to a stream | |
115 | * The surfaces parameter is an absolute set of all surface active for the stream. | |
116 | * If no surfaces are provided, the stream will be blanked; no memory read. | |
117 | * Any flip related attribute changes must be done through this interface. | |
118 | * | |
119 | * After this call: | |
120 | * Surfaces attributes are programmed and configured to be composed into stream. | |
121 | * This does not trigger a flip. No surface address is programmed. | |
122 | */ | |
123 | ||
124 | bool dc_commit_planes_to_stream( | |
125 | struct dc *dc, | |
126 | struct dc_plane_state **plane_states, | |
127 | uint8_t new_plane_count, | |
128 | struct dc_stream_state *dc_stream, | |
129 | struct dc_state *state); | |
130 | ||
131 | void dc_commit_updates_for_stream(struct dc *dc, | |
132 | struct dc_surface_update *srf_updates, | |
133 | int surface_count, | |
134 | struct dc_stream_state *stream, | |
135 | struct dc_stream_update *stream_update, | |
136 | struct dc_plane_state **plane_states, | |
137 | struct dc_state *state); | |
138 | /* | |
139 | * Log the current stream state. | |
140 | */ | |
141 | void dc_stream_log( | |
142 | const struct dc_stream_state *stream, | |
143 | struct dal_logger *dc_logger, | |
144 | enum dc_log_type log_type); | |
145 | ||
146 | uint8_t dc_get_current_stream_count(struct dc *dc); | |
147 | struct dc_stream_state *dc_get_stream_at_index(struct dc *dc, uint8_t i); | |
148 | ||
149 | /* | |
150 | * Return the current frame counter. | |
151 | */ | |
152 | uint32_t dc_stream_get_vblank_counter(const struct dc_stream_state *stream); | |
153 | ||
154 | /* TODO: Return parsed values rather than direct register read | |
155 | * This has a dependency on the caller (amdgpu_get_crtc_scanoutpos) | |
156 | * being refactored properly to be dce-specific | |
157 | */ | |
158 | bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream, | |
159 | uint32_t *v_blank_start, | |
160 | uint32_t *v_blank_end, | |
161 | uint32_t *h_position, | |
162 | uint32_t *v_position); | |
163 | ||
164 | enum dc_status dc_add_stream_to_ctx( | |
165 | struct dc *dc, | |
166 | struct dc_state *new_ctx, | |
167 | struct dc_stream_state *stream); | |
168 | ||
169 | enum dc_status dc_remove_stream_from_ctx( | |
170 | struct dc *dc, | |
171 | struct dc_state *new_ctx, | |
172 | struct dc_stream_state *stream); | |
173 | ||
174 | ||
175 | bool dc_add_plane_to_context( | |
176 | const struct dc *dc, | |
177 | struct dc_stream_state *stream, | |
178 | struct dc_plane_state *plane_state, | |
179 | struct dc_state *context); | |
180 | ||
181 | bool dc_remove_plane_from_context( | |
182 | const struct dc *dc, | |
183 | struct dc_stream_state *stream, | |
184 | struct dc_plane_state *plane_state, | |
185 | struct dc_state *context); | |
186 | ||
187 | bool dc_rem_all_planes_for_stream( | |
188 | const struct dc *dc, | |
189 | struct dc_stream_state *stream, | |
190 | struct dc_state *context); | |
191 | ||
192 | bool dc_add_all_planes_for_stream( | |
193 | const struct dc *dc, | |
194 | struct dc_stream_state *stream, | |
195 | struct dc_plane_state * const *plane_states, | |
196 | int plane_count, | |
197 | struct dc_state *context); | |
198 | ||
199 | enum dc_status dc_validate_stream(struct dc *dc, struct dc_stream_state *stream); | |
200 | ||
201 | /* | |
202 | * This function takes a stream and checks if it is guaranteed to be supported. | |
203 | * Guaranteed means that MAX_COFUNC similar streams are supported. | |
204 | * | |
205 | * After this call: | |
206 | * No hardware is programmed for call. Only validation is done. | |
207 | */ | |
208 | ||
209 | /* | |
210 | * Set up streams and links associated to drive sinks | |
211 | * The streams parameter is an absolute set of all active streams. | |
212 | * | |
213 | * After this call: | |
214 | * Phy, Encoder, Timing Generator are programmed and enabled. | |
215 | * New streams are enabled with blank stream; no memory read. | |
216 | */ | |
217 | /* | |
218 | * Enable stereo when commit_streams is not required, | |
219 | * for example, frame alternate. | |
220 | */ | |
221 | bool dc_enable_stereo( | |
222 | struct dc *dc, | |
223 | struct dc_state *context, | |
224 | struct dc_stream_state *streams[], | |
225 | uint8_t stream_count); | |
226 | ||
227 | ||
228 | enum surface_update_type dc_check_update_surfaces_for_stream( | |
229 | struct dc *dc, | |
230 | struct dc_surface_update *updates, | |
231 | int surface_count, | |
232 | struct dc_stream_update *stream_update, | |
233 | const struct dc_stream_status *stream_status); | |
234 | ||
235 | /** | |
236 | * Create a new default stream for the requested sink | |
237 | */ | |
238 | struct dc_stream_state *dc_create_stream_for_sink(struct dc_sink *dc_sink); | |
239 | ||
3549130e HW |
240 | void update_stream_signal(struct dc_stream_state *stream); |
241 | ||
7c0c9672 HW |
242 | void dc_stream_retain(struct dc_stream_state *dc_stream); |
243 | void dc_stream_release(struct dc_stream_state *dc_stream); | |
244 | ||
245 | struct dc_stream_status *dc_stream_get_status( | |
246 | struct dc_stream_state *dc_stream); | |
247 | ||
248 | /******************************************************************************* | |
249 | * Cursor interfaces - To manages the cursor within a stream | |
250 | ******************************************************************************/ | |
251 | /* TODO: Deprecated once we switch to dc_set_cursor_position */ | |
252 | bool dc_stream_set_cursor_attributes( | |
253 | struct dc_stream_state *stream, | |
254 | const struct dc_cursor_attributes *attributes); | |
255 | ||
256 | bool dc_stream_set_cursor_position( | |
257 | struct dc_stream_state *stream, | |
258 | const struct dc_cursor_position *position); | |
259 | ||
2a06e0a5 HW |
260 | bool 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 | ||
266 | bool 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 | ||
272 | void dc_stream_set_static_screen_events(struct dc *dc, | |
273 | struct dc_stream_state **stream, | |
274 | int num_streams, | |
275 | const struct dc_static_screen_events *events); | |
276 | ||
277 | ||
7c0c9672 HW |
278 | bool dc_stream_adjust_vmin_vmax(struct dc *dc, |
279 | struct dc_stream_state **stream, | |
280 | int num_streams, | |
281 | int vmin, | |
282 | int vmax); | |
283 | ||
284 | bool dc_stream_get_crtc_position(struct dc *dc, | |
285 | struct dc_stream_state **stream, | |
286 | int num_streams, | |
287 | unsigned int *v_pos, | |
288 | unsigned int *nom_v_pos); | |
289 | ||
290 | void dc_stream_set_static_screen_events(struct dc *dc, | |
291 | struct dc_stream_state **stream, | |
292 | int num_streams, | |
293 | const struct dc_static_screen_events *events); | |
294 | ||
295 | #endif /* DC_STREAM_H_ */ |