2 * Copyright 2015 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.
26 #ifndef __DC_HW_SEQUENCER_H__
27 #define __DC_HW_SEQUENCER_H__
29 #include "clock_source.h"
30 #include "inc/hw/timing_generator.h"
31 #include "inc/hw/opp.h"
32 #include "inc/hw/link_encoder.h"
33 #include "core_status.h"
35 enum pipe_gating_control {
36 PIPE_GATING_CONTROL_DISABLE = 0,
37 PIPE_GATING_CONTROL_ENABLE,
38 PIPE_GATING_CONTROL_INIT
47 bool blnd_crtc_trigger;
49 bool false_optc_underflow;
53 struct hwseq_wa_state {
54 bool DEGVIDCN10_253_applied;
58 struct dc_context *ctx;
59 const struct dce_hwseq_registers *regs;
60 const struct dce_hwseq_shift *shifts;
61 const struct dce_hwseq_mask *masks;
62 struct dce_hwseq_wa wa;
63 struct hwseq_wa_state wa_state;
68 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
69 struct dc_stream_status;
70 struct dc_writeback_info;
72 struct dchub_init_data;
73 struct dc_static_screen_events;
75 struct resource_context;
76 struct stream_resource;
77 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
78 struct dc_phy_addr_space_config;
79 struct dc_virtual_addr_space_config;
84 struct hw_sequencer_funcs {
86 void (*disable_stream_gating)(struct dc *dc, struct pipe_ctx *pipe_ctx);
88 void (*enable_stream_gating)(struct dc *dc, struct pipe_ctx *pipe_ctx);
90 void (*init_hw)(struct dc *dc);
92 void (*init_pipes)(struct dc *dc, struct dc_state *context);
94 enum dc_status (*apply_ctx_to_hw)(
95 struct dc *dc, struct dc_state *context);
97 void (*reset_hw_ctx_wrap)(
98 struct dc *dc, struct dc_state *context);
100 void (*apply_ctx_for_surface)(
102 const struct dc_stream_state *stream,
104 struct dc_state *context);
106 void (*program_gamut_remap)(
107 struct pipe_ctx *pipe_ctx);
109 void (*program_output_csc)(struct dc *dc,
110 struct pipe_ctx *pipe_ctx,
111 enum dc_color_space colorspace,
115 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
116 void (*program_triplebuffer)(
118 struct pipe_ctx *pipe_ctx,
119 bool enableTripleBuffer);
120 void (*set_flip_control_gsl)(
121 struct pipe_ctx *pipe_ctx,
122 bool flip_immediate);
125 void (*update_plane_addr)(
127 struct pipe_ctx *pipe_ctx);
129 void (*plane_atomic_disconnect)(
131 struct pipe_ctx *pipe_ctx);
133 void (*update_dchub)(
134 struct dce_hwseq *hws,
135 struct dchub_init_data *dh_data);
137 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
139 struct dce_hwseq *hws,
141 struct dc_phy_addr_space_config *pa_config);
143 struct dce_hwseq *hws,
145 struct dc_virtual_addr_space_config *va_config,
150 struct pipe_ctx *pipe_ctx);
152 void (*update_pending_status)(
153 struct pipe_ctx *pipe_ctx);
155 bool (*set_input_transfer_func)(
156 struct pipe_ctx *pipe_ctx,
157 const struct dc_plane_state *plane_state);
159 bool (*set_output_transfer_func)(
160 struct pipe_ctx *pipe_ctx,
161 const struct dc_stream_state *stream);
163 void (*power_down)(struct dc *dc);
165 void (*enable_accelerated_mode)(struct dc *dc, struct dc_state *context);
167 void (*enable_timing_synchronization)(
171 struct pipe_ctx *grouped_pipes[]);
173 void (*enable_per_frame_crtc_position_reset)(
176 struct pipe_ctx *grouped_pipes[]);
178 void (*enable_display_pipe_clock_gating)(
179 struct dc_context *ctx,
182 bool (*enable_display_power_gating)(
184 uint8_t controller_id,
186 enum pipe_gating_control power_gating);
188 void (*disable_plane)(struct dc *dc, struct pipe_ctx *pipe_ctx);
190 void (*update_info_frame)(struct pipe_ctx *pipe_ctx);
192 void (*send_immediate_sdp_message)(
193 struct pipe_ctx *pipe_ctx,
194 const uint8_t *custom_sdp_message,
195 unsigned int sdp_message_size);
197 void (*enable_stream)(struct pipe_ctx *pipe_ctx);
199 void (*disable_stream)(struct pipe_ctx *pipe_ctx,
202 void (*unblank_stream)(struct pipe_ctx *pipe_ctx,
203 struct dc_link_settings *link_settings);
205 void (*blank_stream)(struct pipe_ctx *pipe_ctx);
207 void (*enable_audio_stream)(struct pipe_ctx *pipe_ctx);
209 void (*disable_audio_stream)(struct pipe_ctx *pipe_ctx, int option);
211 void (*pipe_control_lock)(
213 struct pipe_ctx *pipe,
216 void (*pipe_control_lock_global)(
218 struct pipe_ctx *pipe,
220 void (*blank_pixel_data)(
222 struct pipe_ctx *pipe_ctx,
225 void (*prepare_bandwidth)(
227 struct dc_state *context);
228 void (*optimize_bandwidth)(
230 struct dc_state *context);
232 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
233 bool (*update_bandwidth)(
235 struct dc_state *context);
236 void (*program_dmdata_engine)(struct pipe_ctx *pipe_ctx);
237 bool (*dmdata_status_done)(struct pipe_ctx *pipe_ctx);
240 void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes,
243 void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes,
244 struct crtc_position *position);
246 void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx,
247 int num_pipes, const struct dc_static_screen_events *events);
249 enum dc_status (*enable_stream_timing)(
250 struct pipe_ctx *pipe_ctx,
251 struct dc_state *context,
254 void (*setup_stereo)(
255 struct pipe_ctx *pipe_ctx,
258 void (*set_avmute)(struct pipe_ctx *pipe_ctx, bool enable);
260 void (*log_hw_state)(struct dc *dc,
261 struct dc_log_buffer_ctx *log_ctx);
262 void (*get_hw_state)(struct dc *dc, char *pBuf, unsigned int bufSize, unsigned int mask);
263 void (*clear_status_bits)(struct dc *dc, unsigned int mask);
265 void (*wait_for_mpcc_disconnect)(struct dc *dc,
266 struct resource_pool *res_pool,
267 struct pipe_ctx *pipe_ctx);
269 void (*edp_power_control)(
270 struct dc_link *link,
272 void (*edp_backlight_control)(
273 struct dc_link *link,
275 void (*edp_wait_for_hpd_ready)(struct dc_link *link, bool power_up);
277 void (*set_cursor_position)(struct pipe_ctx *pipe);
278 void (*set_cursor_attribute)(struct pipe_ctx *pipe);
279 void (*set_cursor_sdr_white_level)(struct pipe_ctx *pipe);
281 void (*setup_periodic_interrupt)(struct pipe_ctx *pipe_ctx, enum vline_select vline);
282 void (*setup_vupdate_interrupt)(struct pipe_ctx *pipe_ctx);
283 bool (*did_underflow_occur)(struct dc *dc, struct pipe_ctx *pipe_ctx);
285 void (*init_blank)(struct dc *dc, struct timing_generator *tg);
286 void (*disable_vga)(struct dce_hwseq *hws);
287 void (*bios_golden_init)(struct dc *dc);
288 void (*plane_atomic_power_down)(struct dc *dc,
292 void (*plane_atomic_disable)(
293 struct dc *dc, struct pipe_ctx *pipe_ctx);
295 void (*enable_power_gating_plane)(
296 struct dce_hwseq *hws,
299 void (*dpp_pg_control)(
300 struct dce_hwseq *hws,
301 unsigned int dpp_inst,
304 void (*hubp_pg_control)(
305 struct dce_hwseq *hws,
306 unsigned int hubp_inst,
309 void (*dsc_pg_control)(
310 struct dce_hwseq *hws,
311 unsigned int dsc_inst,
315 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
316 void (*update_odm)(struct dc *dc, struct dc_state *context, struct pipe_ctx *pipe_ctx);
317 void (*program_all_writeback_pipes_in_tree)(
319 const struct dc_stream_state *stream,
320 struct dc_state *context);
321 void (*update_writeback)(struct dc *dc,
322 const struct dc_stream_status *stream_status,
323 struct dc_writeback_info *wb_info);
324 void (*enable_writeback)(struct dc *dc,
325 const struct dc_stream_status *stream_status,
326 struct dc_writeback_info *wb_info);
327 void (*disable_writeback)(struct dc *dc,
328 unsigned int dwb_pipe_inst);
330 enum dc_status (*set_clock)(struct dc *dc,
331 enum dc_clock_type clock_type,
335 void (*get_clock)(struct dc *dc,
336 enum dc_clock_type clock_type,
337 struct dc_clock_config *clock_cfg);
341 void color_space_to_black_color(
343 enum dc_color_space colorspace,
344 struct tg_color *black_color);
346 bool hwss_wait_for_blank_complete(
347 struct timing_generator *tg);
349 const uint16_t *find_color_matrix(
350 enum dc_color_space color_space,
351 uint32_t *array_size);
353 #endif /* __DC_HW_SEQUENCER_H__ */