Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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_HW_SEQUENCER_H__ |
| 27 | #define __DC_HW_SEQUENCER_H__ |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 28 | #include "dc_types.h" |
| 29 | #include "clock_source.h" |
| 30 | #include "inc/hw/timing_generator.h" |
Yue Hin Lau | b51adc77e | 2017-12-04 16:58:11 -0500 | [diff] [blame] | 31 | #include "inc/hw/opp.h" |
Andrew Jiang | 8740196 | 2017-09-25 18:03:14 -0400 | [diff] [blame] | 32 | #include "inc/hw/link_encoder.h" |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 33 | #include "core_status.h" |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 34 | |
Yongqiang Sun | d6001ae | 2019-01-25 14:40:14 -0500 | [diff] [blame] | 35 | enum vline_select { |
| 36 | VLINE0, |
| 37 | VLINE1 |
| 38 | }; |
| 39 | |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 40 | struct pipe_ctx; |
Jerry Zuo | 608ac7b | 2017-08-25 16:16:10 -0400 | [diff] [blame] | 41 | struct dc_state; |
Harry Wentland | 7ed4e63 | 2019-02-22 16:52:08 -0500 | [diff] [blame] | 42 | struct dc_stream_status; |
| 43 | struct dc_writeback_info; |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 44 | struct dchub_init_data; |
Anthony Koo | 5b5abe9 | 2019-12-09 17:26:34 -0500 | [diff] [blame] | 45 | struct dc_static_screen_params; |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 46 | struct resource_pool; |
Dmytro Laktyushkin | bda9afd | 2019-05-22 18:05:41 -0400 | [diff] [blame] | 47 | struct dc_phy_addr_space_config; |
| 48 | struct dc_virtual_addr_space_config; |
Martin Leung | 8a31820 | 2019-07-09 15:15:17 -0400 | [diff] [blame] | 49 | struct dpp; |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 50 | struct dce_hwseq; |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 51 | |
| 52 | struct hw_sequencer_funcs { |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 53 | /* Embedded Display Related */ |
| 54 | void (*edp_power_control)(struct dc_link *link, bool enable); |
| 55 | void (*edp_wait_for_hpd_ready)(struct dc_link *link, bool power_up); |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 56 | |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 57 | /* Pipe Programming Related */ |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 58 | void (*init_hw)(struct dc *dc); |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 59 | void (*enable_accelerated_mode)(struct dc *dc, |
Jerry Zuo | 608ac7b | 2017-08-25 16:16:10 -0400 | [diff] [blame] | 60 | struct dc_state *context); |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 61 | enum dc_status (*apply_ctx_to_hw)(struct dc *dc, |
Dmytro Laktyushkin | b6e881c | 2019-09-13 18:00:28 -0500 | [diff] [blame] | 62 | struct dc_state *context); |
Yongqiang Sun | 7f914a6 | 2017-11-06 14:40:31 -0500 | [diff] [blame] | 63 | void (*disable_plane)(struct dc *dc, struct pipe_ctx *pipe_ctx); |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 64 | void (*apply_ctx_for_surface)(struct dc *dc, |
| 65 | const struct dc_stream_state *stream, |
| 66 | int num_planes, struct dc_state *context); |
| 67 | void (*program_front_end_for_ctx)(struct dc *dc, |
Dmytro Laktyushkin | 9566b67 | 2018-09-18 15:00:49 -0400 | [diff] [blame] | 68 | struct dc_state *context); |
Anthony Koo | bbf5f6c | 2020-01-14 16:23:31 -0500 | [diff] [blame] | 69 | void (*post_unlock_program_front_end)(struct dc *dc, |
| 70 | struct dc_state *context); |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 71 | void (*update_plane_addr)(const struct dc *dc, |
| 72 | struct pipe_ctx *pipe_ctx); |
| 73 | void (*update_dchub)(struct dce_hwseq *hws, |
| 74 | struct dchub_init_data *dh_data); |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 75 | void (*wait_for_mpcc_disconnect)(struct dc *dc, |
Eric Yang | 6be425f | 2017-07-24 10:47:02 -0400 | [diff] [blame] | 76 | struct resource_pool *res_pool, |
| 77 | struct pipe_ctx *pipe_ctx); |
Sung Lee | b3a941d | 2020-04-05 16:40:45 -0400 | [diff] [blame] | 78 | void (*edp_backlight_control)( |
| 79 | struct dc_link *link, |
| 80 | bool enable); |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 81 | void (*program_triplebuffer)(const struct dc *dc, |
| 82 | struct pipe_ctx *pipe_ctx, bool enableTripleBuffer); |
| 83 | void (*update_pending_status)(struct pipe_ctx *pipe_ctx); |
Sung Lee | b3a941d | 2020-04-05 16:40:45 -0400 | [diff] [blame] | 84 | void (*power_down)(struct dc *dc); |
Hersen Wu | 41f97c0 | 2017-08-24 17:40:00 -0400 | [diff] [blame] | 85 | |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 86 | /* Pipe Lock Related */ |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 87 | void (*pipe_control_lock)(struct dc *dc, |
| 88 | struct pipe_ctx *pipe, bool lock); |
Anthony Koo | 009114f | 2020-01-14 17:04:24 -0500 | [diff] [blame] | 89 | void (*interdependent_update_lock)(struct dc *dc, |
| 90 | struct dc_state *context, bool lock); |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 91 | void (*set_flip_control_gsl)(struct pipe_ctx *pipe_ctx, |
| 92 | bool flip_immediate); |
Aric Cyr | 1e461c3 | 2020-04-22 18:08:03 -0400 | [diff] [blame] | 93 | void (*cursor_lock)(struct dc *dc, struct pipe_ctx *pipe, bool lock); |
Hersen Wu | 631aaa0 | 2017-10-31 15:55:15 -0400 | [diff] [blame] | 94 | |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 95 | /* Timing Related */ |
| 96 | void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes, |
| 97 | struct crtc_position *position); |
| 98 | int (*get_vupdate_offset_from_vsync)(struct pipe_ctx *pipe_ctx); |
Nicholas Kazlauskas | 63731e7 | 2020-05-04 16:49:28 -0400 | [diff] [blame] | 99 | void (*calc_vupdate_position)( |
| 100 | struct dc *dc, |
| 101 | struct pipe_ctx *pipe_ctx, |
| 102 | uint32_t *start_line, |
| 103 | uint32_t *end_line); |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 104 | void (*enable_per_frame_crtc_position_reset)(struct dc *dc, |
| 105 | int group_size, struct pipe_ctx *grouped_pipes[]); |
| 106 | void (*enable_timing_synchronization)(struct dc *dc, |
| 107 | int group_index, int group_size, |
| 108 | struct pipe_ctx *grouped_pipes[]); |
| 109 | void (*setup_periodic_interrupt)(struct dc *dc, |
| 110 | struct pipe_ctx *pipe_ctx, |
| 111 | enum vline_select vline); |
| 112 | void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes, |
| 113 | unsigned int vmin, unsigned int vmax, |
| 114 | unsigned int vmid, unsigned int vmid_frame_number); |
| 115 | void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx, |
| 116 | int num_pipes, |
Anthony Koo | 5b5abe9 | 2019-12-09 17:26:34 -0500 | [diff] [blame] | 117 | const struct dc_static_screen_params *events); |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 118 | |
| 119 | /* Stream Related */ |
| 120 | void (*enable_stream)(struct pipe_ctx *pipe_ctx); |
| 121 | void (*disable_stream)(struct pipe_ctx *pipe_ctx); |
| 122 | void (*blank_stream)(struct pipe_ctx *pipe_ctx); |
| 123 | void (*unblank_stream)(struct pipe_ctx *pipe_ctx, |
| 124 | struct dc_link_settings *link_settings); |
| 125 | |
| 126 | /* Bandwidth Related */ |
| 127 | void (*prepare_bandwidth)(struct dc *dc, struct dc_state *context); |
| 128 | bool (*update_bandwidth)(struct dc *dc, struct dc_state *context); |
| 129 | void (*optimize_bandwidth)(struct dc *dc, struct dc_state *context); |
| 130 | |
| 131 | /* Infopacket Related */ |
| 132 | void (*set_avmute)(struct pipe_ctx *pipe_ctx, bool enable); |
| 133 | void (*send_immediate_sdp_message)( |
| 134 | struct pipe_ctx *pipe_ctx, |
| 135 | const uint8_t *custom_sdp_message, |
| 136 | unsigned int sdp_message_size); |
| 137 | void (*update_info_frame)(struct pipe_ctx *pipe_ctx); |
| 138 | void (*set_dmdata_attributes)(struct pipe_ctx *pipe); |
| 139 | void (*program_dmdata_engine)(struct pipe_ctx *pipe_ctx); |
| 140 | bool (*dmdata_status_done)(struct pipe_ctx *pipe_ctx); |
| 141 | |
| 142 | /* Cursor Related */ |
Eric Yang | 33fd17d9 | 2018-01-18 19:07:54 -0500 | [diff] [blame] | 143 | void (*set_cursor_position)(struct pipe_ctx *pipe); |
| 144 | void (*set_cursor_attribute)(struct pipe_ctx *pipe); |
Krunoslav Kovac | 6d92b5c | 2018-06-27 18:23:37 -0400 | [diff] [blame] | 145 | void (*set_cursor_sdr_white_level)(struct pipe_ctx *pipe); |
Eric Bernstein | 8e35761 | 2018-04-09 15:47:42 -0400 | [diff] [blame] | 146 | |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 147 | /* Colour Related */ |
| 148 | void (*program_gamut_remap)(struct pipe_ctx *pipe_ctx); |
| 149 | void (*program_output_csc)(struct dc *dc, struct pipe_ctx *pipe_ctx, |
| 150 | enum dc_color_space colorspace, |
| 151 | uint16_t *matrix, int opp_id); |
Yongqiang Sun | d6001ae | 2019-01-25 14:40:14 -0500 | [diff] [blame] | 152 | |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 153 | /* VM Related */ |
| 154 | int (*init_sys_ctx)(struct dce_hwseq *hws, |
Harry Wentland | 7ed4e63 | 2019-02-22 16:52:08 -0500 | [diff] [blame] | 155 | struct dc *dc, |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 156 | struct dc_phy_addr_space_config *pa_config); |
| 157 | void (*init_vm_ctx)(struct dce_hwseq *hws, |
| 158 | struct dc *dc, |
| 159 | struct dc_virtual_addr_space_config *va_config, |
| 160 | int vmid); |
| 161 | |
| 162 | /* Writeback Related */ |
Harry Wentland | 7ed4e63 | 2019-02-22 16:52:08 -0500 | [diff] [blame] | 163 | void (*update_writeback)(struct dc *dc, |
Julian Parkin | edb922b0 | 2019-08-29 17:06:05 -0400 | [diff] [blame] | 164 | struct dc_writeback_info *wb_info, |
| 165 | struct dc_state *context); |
Harry Wentland | 7ed4e63 | 2019-02-22 16:52:08 -0500 | [diff] [blame] | 166 | void (*enable_writeback)(struct dc *dc, |
Julian Parkin | edb922b0 | 2019-08-29 17:06:05 -0400 | [diff] [blame] | 167 | struct dc_writeback_info *wb_info, |
| 168 | struct dc_state *context); |
Harry Wentland | 7ed4e63 | 2019-02-22 16:52:08 -0500 | [diff] [blame] | 169 | void (*disable_writeback)(struct dc *dc, |
| 170 | unsigned int dwb_pipe_inst); |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 171 | |
Charlene Liu | 6a652f6 | 2019-11-20 21:23:47 -0500 | [diff] [blame] | 172 | bool (*mmhubbub_warmup)(struct dc *dc, |
| 173 | unsigned int num_dwb, |
| 174 | struct dc_writeback_info *wb_info); |
| 175 | |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 176 | /* Clock Related */ |
Charlene Liu | 925f566 | 2019-06-27 18:16:21 -0400 | [diff] [blame] | 177 | enum dc_status (*set_clock)(struct dc *dc, |
| 178 | enum dc_clock_type clock_type, |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 179 | uint32_t clk_khz, uint32_t stepping); |
| 180 | void (*get_clock)(struct dc *dc, enum dc_clock_type clock_type, |
Charlene Liu | 925f566 | 2019-06-27 18:16:21 -0400 | [diff] [blame] | 181 | struct dc_clock_config *clock_cfg); |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 182 | void (*optimize_pwr_state)(const struct dc *dc, |
| 183 | struct dc_state *context); |
| 184 | void (*exit_optimized_pwr_state)(const struct dc *dc, |
Anthony Koo | 78c7738 | 2019-10-29 15:05:56 -0400 | [diff] [blame] | 185 | struct dc_state *context); |
| 186 | |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 187 | /* Audio Related */ |
| 188 | void (*enable_audio_stream)(struct pipe_ctx *pipe_ctx); |
| 189 | void (*disable_audio_stream)(struct pipe_ctx *pipe_ctx); |
Anthony Koo | 78c7738 | 2019-10-29 15:05:56 -0400 | [diff] [blame] | 190 | |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 191 | /* Stereo 3D Related */ |
| 192 | void (*setup_stereo)(struct pipe_ctx *pipe_ctx, struct dc *dc); |
Anthony Koo | 78c7738 | 2019-10-29 15:05:56 -0400 | [diff] [blame] | 193 | |
Anthony Koo | f42ea55 | 2019-11-05 13:17:30 -0500 | [diff] [blame] | 194 | /* HW State Logging Related */ |
| 195 | void (*log_hw_state)(struct dc *dc, struct dc_log_buffer_ctx *log_ctx); |
| 196 | void (*get_hw_state)(struct dc *dc, char *pBuf, |
| 197 | unsigned int bufSize, unsigned int mask); |
| 198 | void (*clear_status_bits)(struct dc *dc, unsigned int mask); |
Anthony Koo | 78c7738 | 2019-10-29 15:05:56 -0400 | [diff] [blame] | 199 | |
Yongqiang Sun | 4b0e95d | 2020-04-22 18:08:01 -0400 | [diff] [blame] | 200 | bool (*set_backlight_level)(struct pipe_ctx *pipe_ctx, |
| 201 | uint32_t backlight_pwm_u16_16, |
| 202 | uint32_t frame_ramp); |
| 203 | |
Yongqiang Sun | 3ba0181 | 2020-04-18 19:22:55 -0400 | [diff] [blame] | 204 | void (*set_abm_immediate_disable)(struct pipe_ctx *pipe_ctx); |
| 205 | |
Anthony Koo | 78c7738 | 2019-10-29 15:05:56 -0400 | [diff] [blame] | 206 | |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 207 | }; |
| 208 | |
| 209 | void color_space_to_black_color( |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 210 | const struct dc *dc, |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 211 | enum dc_color_space colorspace, |
| 212 | struct tg_color *black_color); |
| 213 | |
Hersen Wu | 4b5e7d6 | 2017-01-06 16:23:18 -0500 | [diff] [blame] | 214 | bool hwss_wait_for_blank_complete( |
| 215 | struct timing_generator *tg); |
| 216 | |
Vitaly Prosyak | 38cb3e9 | 2017-12-01 11:42:18 -0600 | [diff] [blame] | 217 | const uint16_t *find_color_matrix( |
| 218 | enum dc_color_space color_space, |
| 219 | uint32_t *array_size); |
| 220 | |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 221 | #endif /* __DC_HW_SEQUENCER_H__ */ |