.. | .. |
---|
32 | 32 | #include "inc/hw/link_encoder.h" |
---|
33 | 33 | #include "core_status.h" |
---|
34 | 34 | |
---|
35 | | -#define EDP_BACKLIGHT_RAMP_DISABLE_LEVEL 0xFFFFFFFF |
---|
36 | | - |
---|
37 | | -enum pipe_gating_control { |
---|
38 | | - PIPE_GATING_CONTROL_DISABLE = 0, |
---|
39 | | - PIPE_GATING_CONTROL_ENABLE, |
---|
40 | | - PIPE_GATING_CONTROL_INIT |
---|
41 | | -}; |
---|
42 | | - |
---|
43 | | -struct dce_hwseq_wa { |
---|
44 | | - bool blnd_crtc_trigger; |
---|
45 | | - bool DEGVIDCN10_253; |
---|
46 | | - bool false_optc_underflow; |
---|
47 | | - bool DEGVIDCN10_254; |
---|
48 | | -}; |
---|
49 | | - |
---|
50 | | -struct hwseq_wa_state { |
---|
51 | | - bool DEGVIDCN10_253_applied; |
---|
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; |
---|
60 | | - struct hwseq_wa_state wa_state; |
---|
61 | | -}; |
---|
62 | | - |
---|
63 | 35 | struct pipe_ctx; |
---|
64 | 36 | struct dc_state; |
---|
| 37 | +struct dc_stream_status; |
---|
| 38 | +struct dc_writeback_info; |
---|
65 | 39 | struct dchub_init_data; |
---|
66 | | -struct dc_static_screen_events; |
---|
| 40 | +struct dc_static_screen_params; |
---|
67 | 41 | struct resource_pool; |
---|
68 | | -struct resource_context; |
---|
69 | | -struct stream_resource; |
---|
| 42 | +struct dc_phy_addr_space_config; |
---|
| 43 | +struct dc_virtual_addr_space_config; |
---|
| 44 | +struct dpp; |
---|
| 45 | +struct dce_hwseq; |
---|
70 | 46 | |
---|
71 | 47 | struct hw_sequencer_funcs { |
---|
| 48 | + /* Embedded Display Related */ |
---|
| 49 | + void (*edp_power_control)(struct dc_link *link, bool enable); |
---|
| 50 | + void (*edp_wait_for_hpd_ready)(struct dc_link *link, bool power_up); |
---|
72 | 51 | |
---|
| 52 | + /* Pipe Programming Related */ |
---|
73 | 53 | void (*init_hw)(struct dc *dc); |
---|
74 | | - |
---|
75 | | - enum dc_status (*apply_ctx_to_hw)( |
---|
76 | | - struct dc *dc, struct dc_state *context); |
---|
77 | | - |
---|
78 | | - void (*reset_hw_ctx_wrap)( |
---|
79 | | - struct dc *dc, struct dc_state *context); |
---|
80 | | - |
---|
81 | | - void (*apply_ctx_for_surface)( |
---|
82 | | - struct dc *dc, |
---|
83 | | - const struct dc_stream_state *stream, |
---|
84 | | - int num_planes, |
---|
| 54 | + void (*power_down_on_boot)(struct dc *dc); |
---|
| 55 | + void (*enable_accelerated_mode)(struct dc *dc, |
---|
85 | 56 | struct dc_state *context); |
---|
86 | | - |
---|
87 | | - void (*program_gamut_remap)( |
---|
88 | | - struct pipe_ctx *pipe_ctx); |
---|
89 | | - |
---|
90 | | - void (*program_csc_matrix)( |
---|
91 | | - struct pipe_ctx *pipe_ctx, |
---|
92 | | - enum dc_color_space colorspace, |
---|
93 | | - uint16_t *matrix); |
---|
94 | | - |
---|
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 | | - |
---|
101 | | - void (*update_plane_addr)( |
---|
102 | | - const struct dc *dc, |
---|
103 | | - struct pipe_ctx *pipe_ctx); |
---|
104 | | - |
---|
105 | | - void (*plane_atomic_disconnect)( |
---|
106 | | - struct dc *dc, |
---|
107 | | - struct pipe_ctx *pipe_ctx); |
---|
108 | | - |
---|
109 | | - void (*update_dchub)( |
---|
110 | | - struct dce_hwseq *hws, |
---|
111 | | - struct dchub_init_data *dh_data); |
---|
112 | | - |
---|
113 | | - void (*update_mpcc)( |
---|
114 | | - struct dc *dc, |
---|
115 | | - struct pipe_ctx *pipe_ctx); |
---|
116 | | - |
---|
117 | | - void (*update_pending_status)( |
---|
118 | | - struct pipe_ctx *pipe_ctx); |
---|
119 | | - |
---|
120 | | - bool (*set_input_transfer_func)( |
---|
121 | | - struct pipe_ctx *pipe_ctx, |
---|
122 | | - const struct dc_plane_state *plane_state); |
---|
123 | | - |
---|
124 | | - bool (*set_output_transfer_func)( |
---|
125 | | - struct pipe_ctx *pipe_ctx, |
---|
126 | | - const struct dc_stream_state *stream); |
---|
127 | | - |
---|
128 | | - void (*power_down)(struct dc *dc); |
---|
129 | | - |
---|
130 | | - void (*enable_accelerated_mode)(struct dc *dc, struct dc_state *context); |
---|
131 | | - |
---|
132 | | - void (*enable_timing_synchronization)( |
---|
133 | | - struct dc *dc, |
---|
134 | | - int group_index, |
---|
135 | | - int group_size, |
---|
136 | | - struct pipe_ctx *grouped_pipes[]); |
---|
137 | | - |
---|
138 | | - void (*enable_per_frame_crtc_position_reset)( |
---|
139 | | - struct dc *dc, |
---|
140 | | - int group_size, |
---|
141 | | - struct pipe_ctx *grouped_pipes[]); |
---|
142 | | - |
---|
143 | | - void (*enable_display_pipe_clock_gating)( |
---|
144 | | - struct dc_context *ctx, |
---|
145 | | - bool clock_gating); |
---|
146 | | - |
---|
147 | | - bool (*enable_display_power_gating)( |
---|
148 | | - struct dc *dc, |
---|
149 | | - uint8_t controller_id, |
---|
150 | | - struct dc_bios *dcb, |
---|
151 | | - enum pipe_gating_control power_gating); |
---|
152 | | - |
---|
| 57 | + enum dc_status (*apply_ctx_to_hw)(struct dc *dc, |
---|
| 58 | + struct dc_state *context); |
---|
153 | 59 | void (*disable_plane)(struct dc *dc, struct pipe_ctx *pipe_ctx); |
---|
154 | | - |
---|
155 | | - void (*update_info_frame)(struct pipe_ctx *pipe_ctx); |
---|
156 | | - |
---|
157 | | - void (*enable_stream)(struct pipe_ctx *pipe_ctx); |
---|
158 | | - |
---|
159 | | - void (*disable_stream)(struct pipe_ctx *pipe_ctx, |
---|
160 | | - int option); |
---|
161 | | - |
---|
162 | | - void (*unblank_stream)(struct pipe_ctx *pipe_ctx, |
---|
163 | | - struct dc_link_settings *link_settings); |
---|
164 | | - |
---|
165 | | - void (*blank_stream)(struct pipe_ctx *pipe_ctx); |
---|
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 | | - |
---|
171 | | - void (*pipe_control_lock)( |
---|
172 | | - struct dc *dc, |
---|
173 | | - struct pipe_ctx *pipe, |
---|
174 | | - bool lock); |
---|
175 | | - void (*blank_pixel_data)( |
---|
176 | | - struct dc *dc, |
---|
177 | | - struct pipe_ctx *pipe_ctx, |
---|
178 | | - bool blank); |
---|
179 | | - |
---|
180 | | - void (*set_bandwidth)( |
---|
181 | | - struct dc *dc, |
---|
182 | | - struct dc_state *context, |
---|
183 | | - bool safe_to_lower); |
---|
184 | | - |
---|
185 | | - void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes, |
---|
186 | | - int vmin, int vmax); |
---|
187 | | - |
---|
188 | | - void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes, |
---|
189 | | - struct crtc_position *position); |
---|
190 | | - |
---|
191 | | - void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx, |
---|
192 | | - int num_pipes, const struct dc_static_screen_events *events); |
---|
193 | | - |
---|
194 | | - enum dc_status (*enable_stream_timing)( |
---|
195 | | - struct pipe_ctx *pipe_ctx, |
---|
196 | | - struct dc_state *context, |
---|
197 | | - struct dc *dc); |
---|
198 | | - |
---|
199 | | - void (*setup_stereo)( |
---|
200 | | - struct pipe_ctx *pipe_ctx, |
---|
201 | | - struct dc *dc); |
---|
202 | | - |
---|
203 | | - void (*set_avmute)(struct pipe_ctx *pipe_ctx, bool enable); |
---|
204 | | - |
---|
205 | | - void (*log_hw_state)(struct dc *dc); |
---|
206 | | - |
---|
| 60 | + void (*apply_ctx_for_surface)(struct dc *dc, |
---|
| 61 | + const struct dc_stream_state *stream, |
---|
| 62 | + int num_planes, struct dc_state *context); |
---|
| 63 | + void (*program_front_end_for_ctx)(struct dc *dc, |
---|
| 64 | + struct dc_state *context); |
---|
| 65 | + bool (*disconnect_pipes)(struct dc *dc, |
---|
| 66 | + struct dc_state *context); |
---|
| 67 | + void (*wait_for_pending_cleared)(struct dc *dc, |
---|
| 68 | + struct dc_state *context); |
---|
| 69 | + void (*post_unlock_program_front_end)(struct dc *dc, |
---|
| 70 | + struct dc_state *context); |
---|
| 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); |
---|
207 | 75 | void (*wait_for_mpcc_disconnect)(struct dc *dc, |
---|
208 | 76 | struct resource_pool *res_pool, |
---|
209 | 77 | struct pipe_ctx *pipe_ctx); |
---|
210 | | - |
---|
211 | | - void (*ready_shared_resources)(struct dc *dc, struct dc_state *context); |
---|
212 | | - void (*optimize_shared_resources)(struct dc *dc); |
---|
213 | | - void (*pplib_apply_display_requirements)( |
---|
214 | | - struct dc *dc, |
---|
215 | | - struct dc_state *context); |
---|
216 | | - void (*edp_power_control)( |
---|
217 | | - struct dc_link *link, |
---|
218 | | - bool enable); |
---|
219 | 78 | void (*edp_backlight_control)( |
---|
220 | 79 | struct dc_link *link, |
---|
221 | 80 | bool enable); |
---|
222 | | - void (*edp_wait_for_hpd_ready)(struct dc_link *link, bool power_up); |
---|
| 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); |
---|
| 84 | + void (*power_down)(struct dc *dc); |
---|
223 | 85 | |
---|
| 86 | + /* Pipe Lock Related */ |
---|
| 87 | + void (*pipe_control_lock)(struct dc *dc, |
---|
| 88 | + struct pipe_ctx *pipe, bool lock); |
---|
| 89 | + void (*interdependent_update_lock)(struct dc *dc, |
---|
| 90 | + struct dc_state *context, bool lock); |
---|
| 91 | + void (*set_flip_control_gsl)(struct pipe_ctx *pipe_ctx, |
---|
| 92 | + bool flip_immediate); |
---|
| 93 | + void (*cursor_lock)(struct dc *dc, struct pipe_ctx *pipe, bool lock); |
---|
| 94 | + |
---|
| 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); |
---|
| 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); |
---|
| 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 | + void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes, |
---|
| 112 | + unsigned int vmin, unsigned int vmax, |
---|
| 113 | + unsigned int vmid, unsigned int vmid_frame_number); |
---|
| 114 | + void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx, |
---|
| 115 | + int num_pipes, |
---|
| 116 | + const struct dc_static_screen_params *events); |
---|
| 117 | +#ifndef TRIM_FSFT |
---|
| 118 | + bool (*optimize_timing_for_fsft)(struct dc *dc, |
---|
| 119 | + struct dc_crtc_timing *timing, |
---|
| 120 | + unsigned int max_input_rate_in_khz); |
---|
| 121 | +#endif |
---|
| 122 | + |
---|
| 123 | + /* Stream Related */ |
---|
| 124 | + void (*enable_stream)(struct pipe_ctx *pipe_ctx); |
---|
| 125 | + void (*disable_stream)(struct pipe_ctx *pipe_ctx); |
---|
| 126 | + void (*blank_stream)(struct pipe_ctx *pipe_ctx); |
---|
| 127 | + void (*unblank_stream)(struct pipe_ctx *pipe_ctx, |
---|
| 128 | + struct dc_link_settings *link_settings); |
---|
| 129 | + |
---|
| 130 | + /* Bandwidth Related */ |
---|
| 131 | + void (*prepare_bandwidth)(struct dc *dc, struct dc_state *context); |
---|
| 132 | + bool (*update_bandwidth)(struct dc *dc, struct dc_state *context); |
---|
| 133 | + void (*optimize_bandwidth)(struct dc *dc, struct dc_state *context); |
---|
| 134 | + |
---|
| 135 | + /* Infopacket Related */ |
---|
| 136 | + void (*set_avmute)(struct pipe_ctx *pipe_ctx, bool enable); |
---|
| 137 | + void (*send_immediate_sdp_message)( |
---|
| 138 | + struct pipe_ctx *pipe_ctx, |
---|
| 139 | + const uint8_t *custom_sdp_message, |
---|
| 140 | + unsigned int sdp_message_size); |
---|
| 141 | + void (*update_info_frame)(struct pipe_ctx *pipe_ctx); |
---|
| 142 | + void (*set_dmdata_attributes)(struct pipe_ctx *pipe); |
---|
| 143 | + void (*program_dmdata_engine)(struct pipe_ctx *pipe_ctx); |
---|
| 144 | + bool (*dmdata_status_done)(struct pipe_ctx *pipe_ctx); |
---|
| 145 | + |
---|
| 146 | + /* Cursor Related */ |
---|
224 | 147 | void (*set_cursor_position)(struct pipe_ctx *pipe); |
---|
225 | 148 | void (*set_cursor_attribute)(struct pipe_ctx *pipe); |
---|
226 | 149 | void (*set_cursor_sdr_white_level)(struct pipe_ctx *pipe); |
---|
227 | 150 | |
---|
| 151 | + /* Colour Related */ |
---|
| 152 | + void (*program_gamut_remap)(struct pipe_ctx *pipe_ctx); |
---|
| 153 | + void (*program_output_csc)(struct dc *dc, struct pipe_ctx *pipe_ctx, |
---|
| 154 | + enum dc_color_space colorspace, |
---|
| 155 | + uint16_t *matrix, int opp_id); |
---|
| 156 | + |
---|
| 157 | + /* VM Related */ |
---|
| 158 | + int (*init_sys_ctx)(struct dce_hwseq *hws, |
---|
| 159 | + struct dc *dc, |
---|
| 160 | + struct dc_phy_addr_space_config *pa_config); |
---|
| 161 | + void (*init_vm_ctx)(struct dce_hwseq *hws, |
---|
| 162 | + struct dc *dc, |
---|
| 163 | + struct dc_virtual_addr_space_config *va_config, |
---|
| 164 | + int vmid); |
---|
| 165 | + |
---|
| 166 | + /* Writeback Related */ |
---|
| 167 | + void (*update_writeback)(struct dc *dc, |
---|
| 168 | + struct dc_writeback_info *wb_info, |
---|
| 169 | + struct dc_state *context); |
---|
| 170 | + void (*enable_writeback)(struct dc *dc, |
---|
| 171 | + struct dc_writeback_info *wb_info, |
---|
| 172 | + struct dc_state *context); |
---|
| 173 | + void (*disable_writeback)(struct dc *dc, |
---|
| 174 | + unsigned int dwb_pipe_inst); |
---|
| 175 | + |
---|
| 176 | + bool (*mmhubbub_warmup)(struct dc *dc, |
---|
| 177 | + unsigned int num_dwb, |
---|
| 178 | + struct dc_writeback_info *wb_info); |
---|
| 179 | + |
---|
| 180 | + /* Clock Related */ |
---|
| 181 | + enum dc_status (*set_clock)(struct dc *dc, |
---|
| 182 | + enum dc_clock_type clock_type, |
---|
| 183 | + uint32_t clk_khz, uint32_t stepping); |
---|
| 184 | + void (*get_clock)(struct dc *dc, enum dc_clock_type clock_type, |
---|
| 185 | + struct dc_clock_config *clock_cfg); |
---|
| 186 | + void (*optimize_pwr_state)(const struct dc *dc, |
---|
| 187 | + struct dc_state *context); |
---|
| 188 | + void (*exit_optimized_pwr_state)(const struct dc *dc, |
---|
| 189 | + struct dc_state *context); |
---|
| 190 | + |
---|
| 191 | + /* Audio Related */ |
---|
| 192 | + void (*enable_audio_stream)(struct pipe_ctx *pipe_ctx); |
---|
| 193 | + void (*disable_audio_stream)(struct pipe_ctx *pipe_ctx); |
---|
| 194 | + |
---|
| 195 | + /* Stereo 3D Related */ |
---|
| 196 | + void (*setup_stereo)(struct pipe_ctx *pipe_ctx, struct dc *dc); |
---|
| 197 | + |
---|
| 198 | + /* HW State Logging Related */ |
---|
| 199 | + void (*log_hw_state)(struct dc *dc, struct dc_log_buffer_ctx *log_ctx); |
---|
| 200 | + void (*get_hw_state)(struct dc *dc, char *pBuf, |
---|
| 201 | + unsigned int bufSize, unsigned int mask); |
---|
| 202 | + void (*clear_status_bits)(struct dc *dc, unsigned int mask); |
---|
| 203 | + |
---|
| 204 | + bool (*set_backlight_level)(struct pipe_ctx *pipe_ctx, |
---|
| 205 | + uint32_t backlight_pwm_u16_16, |
---|
| 206 | + uint32_t frame_ramp); |
---|
| 207 | + |
---|
| 208 | + void (*set_abm_immediate_disable)(struct pipe_ctx *pipe_ctx); |
---|
| 209 | + |
---|
| 210 | + void (*set_pipe)(struct pipe_ctx *pipe_ctx); |
---|
| 211 | + |
---|
| 212 | +#if defined(CONFIG_DRM_AMD_DC_DCN3_0) |
---|
| 213 | + /* Idle Optimization Related */ |
---|
| 214 | + bool (*apply_idle_power_optimizations)(struct dc *dc, bool enable); |
---|
| 215 | +#endif |
---|
| 216 | + |
---|
228 | 217 | }; |
---|
229 | 218 | |
---|
230 | 219 | void color_space_to_black_color( |
---|