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 | 5282cbe | 2018-03-27 10:05:10 -0400 | [diff] [blame] | 35 | #define EDP_BACKLIGHT_RAMP_DISABLE_LEVEL 0xFFFFFFFF |
| 36 | |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 37 | enum pipe_gating_control { |
| 38 | PIPE_GATING_CONTROL_DISABLE = 0, |
| 39 | PIPE_GATING_CONTROL_ENABLE, |
| 40 | PIPE_GATING_CONTROL_INIT |
| 41 | }; |
| 42 | |
Charlene Liu | f082811 | 2017-02-28 15:23:38 -0500 | [diff] [blame] | 43 | struct dce_hwseq_wa { |
| 44 | bool blnd_crtc_trigger; |
Yongqiang Sun | 7f914a6 | 2017-11-06 14:40:31 -0500 | [diff] [blame] | 45 | bool DEGVIDCN10_253; |
Yongqiang Sun | 5cc2687 | 2017-11-15 16:21:34 -0500 | [diff] [blame] | 46 | bool false_optc_underflow; |
Dmytro Laktyushkin | 7144d3c | 2018-06-05 13:14:13 -0400 | [diff] [blame] | 47 | bool DEGVIDCN10_254; |
Yongqiang Sun | 7f914a6 | 2017-11-06 14:40:31 -0500 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | struct hwseq_wa_state { |
| 51 | bool DEGVIDCN10_253_applied; |
Charlene Liu | f082811 | 2017-02-28 15:23:38 -0500 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | struct dce_hwseq { |
| 55 | struct dc_context *ctx; |
| 56 | const struct dce_hwseq_registers *regs; |
| 57 | const struct dce_hwseq_shift *shifts; |
| 58 | const struct dce_hwseq_mask *masks; |
| 59 | struct dce_hwseq_wa wa; |
Yongqiang Sun | 7f914a6 | 2017-11-06 14:40:31 -0500 | [diff] [blame] | 60 | struct hwseq_wa_state wa_state; |
Charlene Liu | f082811 | 2017-02-28 15:23:38 -0500 | [diff] [blame] | 61 | }; |
| 62 | |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 63 | struct pipe_ctx; |
Jerry Zuo | 608ac7b | 2017-08-25 16:16:10 -0400 | [diff] [blame] | 64 | struct dc_state; |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 65 | struct dchub_init_data; |
| 66 | struct dc_static_screen_events; |
| 67 | struct resource_pool; |
| 68 | struct resource_context; |
Eric Bernstein | 3158223 | 2018-04-09 17:19:27 -0400 | [diff] [blame] | 69 | struct stream_resource; |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 70 | |
| 71 | struct hw_sequencer_funcs { |
| 72 | |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 73 | void (*init_hw)(struct dc *dc); |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 74 | |
| 75 | enum dc_status (*apply_ctx_to_hw)( |
Jerry Zuo | 608ac7b | 2017-08-25 16:16:10 -0400 | [diff] [blame] | 76 | struct dc *dc, struct dc_state *context); |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 77 | |
| 78 | void (*reset_hw_ctx_wrap)( |
Jerry Zuo | 608ac7b | 2017-08-25 16:16:10 -0400 | [diff] [blame] | 79 | struct dc *dc, struct dc_state *context); |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 80 | |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 81 | void (*apply_ctx_for_surface)( |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 82 | struct dc *dc, |
Eric Yang | 3e9ad616 | 2017-08-03 00:22:25 -0400 | [diff] [blame] | 83 | const struct dc_stream_state *stream, |
| 84 | int num_planes, |
Jerry Zuo | 608ac7b | 2017-08-25 16:16:10 -0400 | [diff] [blame] | 85 | struct dc_state *context); |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 86 | |
Zeyu Fan | 1bf56e6 | 2017-06-02 17:25:49 -0400 | [diff] [blame] | 87 | void (*program_gamut_remap)( |
| 88 | struct pipe_ctx *pipe_ctx); |
| 89 | |
Yue Hin Lau | abe07e8 | 2017-06-28 17:21:42 -0400 | [diff] [blame] | 90 | void (*program_csc_matrix)( |
| 91 | struct pipe_ctx *pipe_ctx, |
| 92 | enum dc_color_space colorspace, |
| 93 | uint16_t *matrix); |
| 94 | |
Eric Bernstein | 8e35761 | 2018-04-09 15:47:42 -0400 | [diff] [blame] | 95 | void (*program_output_csc)(struct dc *dc, |
| 96 | struct pipe_ctx *pipe_ctx, |
| 97 | enum dc_color_space colorspace, |
| 98 | uint16_t *matrix, |
| 99 | int opp_id); |
| 100 | |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 101 | void (*update_plane_addr)( |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 102 | const struct dc *dc, |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 103 | struct pipe_ctx *pipe_ctx); |
| 104 | |
Eric Bernstein | c2437b1 | 2018-05-16 16:19:50 -0400 | [diff] [blame^] | 105 | void (*plane_atomic_disconnect)( |
| 106 | struct dc *dc, |
| 107 | struct pipe_ctx *pipe_ctx); |
| 108 | |
Zeyu Fan | 08b1688 | 2017-07-23 18:30:15 -0400 | [diff] [blame] | 109 | void (*update_dchub)( |
| 110 | struct dce_hwseq *hws, |
| 111 | struct dchub_init_data *dh_data); |
| 112 | |
Eric Bernstein | c2437b1 | 2018-05-16 16:19:50 -0400 | [diff] [blame^] | 113 | void (*update_mpcc)( |
| 114 | struct dc *dc, |
| 115 | struct pipe_ctx *pipe_ctx); |
| 116 | |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 117 | void (*update_pending_status)( |
| 118 | struct pipe_ctx *pipe_ctx); |
| 119 | |
Anthony Koo | 90e508b | 2016-12-15 12:09:46 -0500 | [diff] [blame] | 120 | bool (*set_input_transfer_func)( |
Anthony Koo | fb735a9 | 2016-12-13 13:59:41 -0500 | [diff] [blame] | 121 | struct pipe_ctx *pipe_ctx, |
Harry Wentland | 3be5262e | 2017-07-27 09:55:38 -0400 | [diff] [blame] | 122 | const struct dc_plane_state *plane_state); |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 123 | |
Anthony Koo | 90e508b | 2016-12-15 12:09:46 -0500 | [diff] [blame] | 124 | bool (*set_output_transfer_func)( |
| 125 | struct pipe_ctx *pipe_ctx, |
Harry Wentland | 0971c40 | 2017-07-27 09:33:33 -0400 | [diff] [blame] | 126 | const struct dc_stream_state *stream); |
Anthony Koo | 90e508b | 2016-12-15 12:09:46 -0500 | [diff] [blame] | 127 | |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 128 | void (*power_down)(struct dc *dc); |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 129 | |
Yongqiang Sun | 2529202 | 2017-12-19 11:51:40 -0500 | [diff] [blame] | 130 | void (*enable_accelerated_mode)(struct dc *dc, struct dc_state *context); |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 131 | |
| 132 | void (*enable_timing_synchronization)( |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 133 | struct dc *dc, |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 134 | int group_index, |
| 135 | int group_size, |
| 136 | struct pipe_ctx *grouped_pipes[]); |
| 137 | |
Mikita Lipski | fa2123d | 2017-10-17 15:29:22 -0400 | [diff] [blame] | 138 | void (*enable_per_frame_crtc_position_reset)( |
| 139 | struct dc *dc, |
| 140 | int group_size, |
| 141 | struct pipe_ctx *grouped_pipes[]); |
| 142 | |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 143 | void (*enable_display_pipe_clock_gating)( |
| 144 | struct dc_context *ctx, |
| 145 | bool clock_gating); |
| 146 | |
| 147 | bool (*enable_display_power_gating)( |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 148 | struct dc *dc, |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 149 | uint8_t controller_id, |
| 150 | struct dc_bios *dcb, |
| 151 | enum pipe_gating_control power_gating); |
| 152 | |
Yongqiang Sun | 7f914a6 | 2017-11-06 14:40:31 -0500 | [diff] [blame] | 153 | void (*disable_plane)(struct dc *dc, struct pipe_ctx *pipe_ctx); |
Yongqiang Sun | 18f7a1e | 2017-03-23 10:34:06 -0400 | [diff] [blame] | 154 | |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 155 | void (*update_info_frame)(struct pipe_ctx *pipe_ctx); |
| 156 | |
| 157 | void (*enable_stream)(struct pipe_ctx *pipe_ctx); |
| 158 | |
Charlene Liu | 4176664 | 2017-09-27 23:23:16 -0400 | [diff] [blame] | 159 | void (*disable_stream)(struct pipe_ctx *pipe_ctx, |
| 160 | int option); |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 161 | |
| 162 | void (*unblank_stream)(struct pipe_ctx *pipe_ctx, |
| 163 | struct dc_link_settings *link_settings); |
| 164 | |
Charlene Liu | 41b4974 | 2018-01-11 15:31:26 -0500 | [diff] [blame] | 165 | void (*blank_stream)(struct pipe_ctx *pipe_ctx); |
Anthony Koo | 1a05873 | 2018-05-10 14:21:47 -0400 | [diff] [blame] | 166 | |
| 167 | void (*enable_audio_stream)(struct pipe_ctx *pipe_ctx); |
| 168 | |
| 169 | void (*disable_audio_stream)(struct pipe_ctx *pipe_ctx, int option); |
| 170 | |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 171 | void (*pipe_control_lock)( |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 172 | struct dc *dc, |
Charlene Liu | f082811 | 2017-02-28 15:23:38 -0500 | [diff] [blame] | 173 | struct pipe_ctx *pipe, |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 174 | bool lock); |
Eric Bernstein | 3158223 | 2018-04-09 17:19:27 -0400 | [diff] [blame] | 175 | void (*blank_pixel_data)( |
| 176 | struct dc *dc, |
Eric Bernstein | ea4a202 | 2018-05-01 15:21:42 -0400 | [diff] [blame] | 177 | struct pipe_ctx *pipe_ctx, |
Eric Bernstein | 3158223 | 2018-04-09 17:19:27 -0400 | [diff] [blame] | 178 | bool blank); |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 179 | |
Dmytro Laktyushkin | cf43759 | 2017-02-22 17:52:22 -0500 | [diff] [blame] | 180 | void (*set_bandwidth)( |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 181 | struct dc *dc, |
Jerry Zuo | 608ac7b | 2017-08-25 16:16:10 -0400 | [diff] [blame] | 182 | struct dc_state *context, |
Dmytro Laktyushkin | e21db6d | 2018-05-24 14:39:01 -0400 | [diff] [blame] | 183 | bool safe_to_lower); |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 184 | |
| 185 | void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes, |
| 186 | int vmin, int vmax); |
| 187 | |
Eric Cook | 72ada5f | 2017-04-18 15:24:50 -0400 | [diff] [blame] | 188 | void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes, |
| 189 | struct crtc_position *position); |
| 190 | |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 191 | void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx, |
Sylvia Tsai | 94267b3 | 2017-04-21 15:29:55 -0400 | [diff] [blame] | 192 | int num_pipes, const struct dc_static_screen_events *events); |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 193 | |
Eric Bernstein | 3158223 | 2018-04-09 17:19:27 -0400 | [diff] [blame] | 194 | enum dc_status (*enable_stream_timing)( |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 195 | struct pipe_ctx *pipe_ctx, |
Jerry Zuo | 608ac7b | 2017-08-25 16:16:10 -0400 | [diff] [blame] | 196 | struct dc_state *context, |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 197 | struct dc *dc); |
Vitaly Prosyak | 9edba55 | 2017-06-07 12:23:59 -0500 | [diff] [blame] | 198 | |
| 199 | void (*setup_stereo)( |
| 200 | struct pipe_ctx *pipe_ctx, |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 201 | struct dc *dc); |
Charlene Liu | 15e1733 | 2017-07-17 16:04:02 -0400 | [diff] [blame] | 202 | |
| 203 | void (*set_avmute)(struct pipe_ctx *pipe_ctx, bool enable); |
Tony Cheng | 6d244be | 2017-07-20 00:12:20 -0400 | [diff] [blame] | 204 | |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 205 | void (*log_hw_state)(struct dc *dc); |
Eric Yang | 8748068 | 2017-07-23 15:18:57 -0400 | [diff] [blame] | 206 | |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 207 | void (*wait_for_mpcc_disconnect)(struct dc *dc, |
Eric Yang | 6be425f | 2017-07-24 10:47:02 -0400 | [diff] [blame] | 208 | struct resource_pool *res_pool, |
| 209 | struct pipe_ctx *pipe_ctx); |
Hersen Wu | 41f97c0 | 2017-08-24 17:40:00 -0400 | [diff] [blame] | 210 | |
Hersen Wu | 6bf5202 | 2017-09-05 12:20:39 -0400 | [diff] [blame] | 211 | void (*ready_shared_resources)(struct dc *dc, struct dc_state *context); |
Hersen Wu | 41f97c0 | 2017-08-24 17:40:00 -0400 | [diff] [blame] | 212 | void (*optimize_shared_resources)(struct dc *dc); |
Hersen Wu | 631aaa0 | 2017-10-31 15:55:15 -0400 | [diff] [blame] | 213 | void (*pplib_apply_display_requirements)( |
| 214 | struct dc *dc, |
| 215 | struct dc_state *context); |
Andrew Jiang | 8740196 | 2017-09-25 18:03:14 -0400 | [diff] [blame] | 216 | void (*edp_power_control)( |
Andrew Jiang | 069d418 | 2017-09-26 19:45:43 -0400 | [diff] [blame] | 217 | struct dc_link *link, |
Andrew Jiang | 8740196 | 2017-09-25 18:03:14 -0400 | [diff] [blame] | 218 | bool enable); |
| 219 | void (*edp_backlight_control)( |
Yue Hin Lau | 5eefbc4 | 2017-09-15 17:42:20 -0400 | [diff] [blame] | 220 | struct dc_link *link, |
| 221 | bool enable); |
Yongqiang Sun | 904623e | 2017-11-24 16:31:03 -0500 | [diff] [blame] | 222 | void (*edp_wait_for_hpd_ready)(struct dc_link *link, bool power_up); |
Hersen Wu | 631aaa0 | 2017-10-31 15:55:15 -0400 | [diff] [blame] | 223 | |
Eric Yang | 33fd17d9 | 2018-01-18 19:07:54 -0500 | [diff] [blame] | 224 | void (*set_cursor_position)(struct pipe_ctx *pipe); |
| 225 | void (*set_cursor_attribute)(struct pipe_ctx *pipe); |
Eric Bernstein | 8e35761 | 2018-04-09 15:47:42 -0400 | [diff] [blame] | 226 | |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 227 | }; |
| 228 | |
| 229 | void color_space_to_black_color( |
Bhawanpreet Lakha | fb3466a | 2017-08-01 15:00:25 -0400 | [diff] [blame] | 230 | const struct dc *dc, |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 231 | enum dc_color_space colorspace, |
| 232 | struct tg_color *black_color); |
| 233 | |
Hersen Wu | 4b5e7d6 | 2017-01-06 16:23:18 -0500 | [diff] [blame] | 234 | bool hwss_wait_for_blank_complete( |
| 235 | struct timing_generator *tg); |
| 236 | |
Vitaly Prosyak | 38cb3e9 | 2017-12-01 11:42:18 -0600 | [diff] [blame] | 237 | const uint16_t *find_color_matrix( |
| 238 | enum dc_color_space color_space, |
| 239 | uint32_t *array_size); |
| 240 | |
Harry Wentland | 4562236 | 2017-09-12 15:58:20 -0400 | [diff] [blame] | 241 | #endif /* __DC_HW_SEQUENCER_H__ */ |