blob: e764cbad881b757f16c35a41e4218dad5a52bc7c [file] [log] [blame]
Harry Wentland45622362017-09-12 15:58:20 -04001/*
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 Lakhafb3466a2017-08-01 15:00:25 -040028#include "dc_types.h"
29#include "clock_source.h"
30#include "inc/hw/timing_generator.h"
Yue Hin Laub51adc77e2017-12-04 16:58:11 -050031#include "inc/hw/opp.h"
Andrew Jiang87401962017-09-25 18:03:14 -040032#include "inc/hw/link_encoder.h"
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -040033#include "core_status.h"
Harry Wentland45622362017-09-12 15:58:20 -040034
Harry Wentland45622362017-09-12 15:58:20 -040035enum pipe_gating_control {
36 PIPE_GATING_CONTROL_DISABLE = 0,
37 PIPE_GATING_CONTROL_ENABLE,
38 PIPE_GATING_CONTROL_INIT
39};
40
Charlene Liuf0828112017-02-28 15:23:38 -050041struct dce_hwseq_wa {
42 bool blnd_crtc_trigger;
Yongqiang Sun7f914a62017-11-06 14:40:31 -050043 bool DEGVIDCN10_253;
Yongqiang Sun5cc26872017-11-15 16:21:34 -050044 bool false_optc_underflow;
Yongqiang Sun7f914a62017-11-06 14:40:31 -050045};
46
47struct hwseq_wa_state {
48 bool DEGVIDCN10_253_applied;
Charlene Liuf0828112017-02-28 15:23:38 -050049};
50
51struct dce_hwseq {
52 struct dc_context *ctx;
53 const struct dce_hwseq_registers *regs;
54 const struct dce_hwseq_shift *shifts;
55 const struct dce_hwseq_mask *masks;
56 struct dce_hwseq_wa wa;
Yongqiang Sun7f914a62017-11-06 14:40:31 -050057 struct hwseq_wa_state wa_state;
Charlene Liuf0828112017-02-28 15:23:38 -050058};
59
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -040060struct pipe_ctx;
Jerry Zuo608ac7b2017-08-25 16:16:10 -040061struct dc_state;
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -040062struct dchub_init_data;
63struct dc_static_screen_events;
64struct resource_pool;
65struct resource_context;
Harry Wentland45622362017-09-12 15:58:20 -040066
67struct hw_sequencer_funcs {
68
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -040069 void (*init_hw)(struct dc *dc);
Harry Wentland45622362017-09-12 15:58:20 -040070
71 enum dc_status (*apply_ctx_to_hw)(
Jerry Zuo608ac7b2017-08-25 16:16:10 -040072 struct dc *dc, struct dc_state *context);
Harry Wentland45622362017-09-12 15:58:20 -040073
74 void (*reset_hw_ctx_wrap)(
Jerry Zuo608ac7b2017-08-25 16:16:10 -040075 struct dc *dc, struct dc_state *context);
Harry Wentland45622362017-09-12 15:58:20 -040076
Harry Wentland45622362017-09-12 15:58:20 -040077 void (*apply_ctx_for_surface)(
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -040078 struct dc *dc,
Eric Yang3e9ad6162017-08-03 00:22:25 -040079 const struct dc_stream_state *stream,
80 int num_planes,
Jerry Zuo608ac7b2017-08-25 16:16:10 -040081 struct dc_state *context);
Harry Wentland45622362017-09-12 15:58:20 -040082
83 void (*set_plane_config)(
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -040084 const struct dc *dc,
Harry Wentland45622362017-09-12 15:58:20 -040085 struct pipe_ctx *pipe_ctx,
86 struct resource_context *res_ctx);
87
Zeyu Fan1bf56e62017-06-02 17:25:49 -040088 void (*program_gamut_remap)(
89 struct pipe_ctx *pipe_ctx);
90
Yue Hin Lauabe07e82017-06-28 17:21:42 -040091 void (*program_csc_matrix)(
92 struct pipe_ctx *pipe_ctx,
93 enum dc_color_space colorspace,
94 uint16_t *matrix);
95
Harry Wentland45622362017-09-12 15:58:20 -040096 void (*update_plane_addr)(
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -040097 const struct dc *dc,
Harry Wentland45622362017-09-12 15:58:20 -040098 struct pipe_ctx *pipe_ctx);
99
Zeyu Fan08b16882017-07-23 18:30:15 -0400100 void (*update_dchub)(
101 struct dce_hwseq *hws,
102 struct dchub_init_data *dh_data);
103
Harry Wentland45622362017-09-12 15:58:20 -0400104 void (*update_pending_status)(
105 struct pipe_ctx *pipe_ctx);
106
Anthony Koo90e508b2016-12-15 12:09:46 -0500107 bool (*set_input_transfer_func)(
Anthony Koofb735a92016-12-13 13:59:41 -0500108 struct pipe_ctx *pipe_ctx,
Harry Wentland3be5262e2017-07-27 09:55:38 -0400109 const struct dc_plane_state *plane_state);
Harry Wentland45622362017-09-12 15:58:20 -0400110
Anthony Koo90e508b2016-12-15 12:09:46 -0500111 bool (*set_output_transfer_func)(
112 struct pipe_ctx *pipe_ctx,
Harry Wentland0971c402017-07-27 09:33:33 -0400113 const struct dc_stream_state *stream);
Anthony Koo90e508b2016-12-15 12:09:46 -0500114
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -0400115 void (*power_down)(struct dc *dc);
Harry Wentland45622362017-09-12 15:58:20 -0400116
Yongqiang Sun25292022017-12-19 11:51:40 -0500117 void (*enable_accelerated_mode)(struct dc *dc, struct dc_state *context);
Harry Wentland45622362017-09-12 15:58:20 -0400118
119 void (*enable_timing_synchronization)(
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -0400120 struct dc *dc,
Harry Wentland45622362017-09-12 15:58:20 -0400121 int group_index,
122 int group_size,
123 struct pipe_ctx *grouped_pipes[]);
124
Mikita Lipskifa2123d2017-10-17 15:29:22 -0400125 void (*enable_per_frame_crtc_position_reset)(
126 struct dc *dc,
127 int group_size,
128 struct pipe_ctx *grouped_pipes[]);
129
Harry Wentland45622362017-09-12 15:58:20 -0400130 void (*enable_display_pipe_clock_gating)(
131 struct dc_context *ctx,
132 bool clock_gating);
133
134 bool (*enable_display_power_gating)(
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -0400135 struct dc *dc,
Harry Wentland45622362017-09-12 15:58:20 -0400136 uint8_t controller_id,
137 struct dc_bios *dcb,
138 enum pipe_gating_control power_gating);
139
Yongqiang Sun7f914a62017-11-06 14:40:31 -0500140 void (*disable_plane)(struct dc *dc, struct pipe_ctx *pipe_ctx);
Yongqiang Sun18f7a1e2017-03-23 10:34:06 -0400141
Harry Wentland45622362017-09-12 15:58:20 -0400142 void (*update_info_frame)(struct pipe_ctx *pipe_ctx);
143
144 void (*enable_stream)(struct pipe_ctx *pipe_ctx);
145
Charlene Liu41766642017-09-27 23:23:16 -0400146 void (*disable_stream)(struct pipe_ctx *pipe_ctx,
147 int option);
Harry Wentland45622362017-09-12 15:58:20 -0400148
149 void (*unblank_stream)(struct pipe_ctx *pipe_ctx,
150 struct dc_link_settings *link_settings);
151
Charlene Liu41b49742018-01-11 15:31:26 -0500152 void (*blank_stream)(struct pipe_ctx *pipe_ctx);
Harry Wentland45622362017-09-12 15:58:20 -0400153 void (*pipe_control_lock)(
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -0400154 struct dc *dc,
Charlene Liuf0828112017-02-28 15:23:38 -0500155 struct pipe_ctx *pipe,
Harry Wentland45622362017-09-12 15:58:20 -0400156 bool lock);
157
Dmytro Laktyushkincf437592017-02-22 17:52:22 -0500158 void (*set_bandwidth)(
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -0400159 struct dc *dc,
Jerry Zuo608ac7b2017-08-25 16:16:10 -0400160 struct dc_state *context,
Dmytro Laktyushkincf437592017-02-22 17:52:22 -0500161 bool decrease_allowed);
Harry Wentland45622362017-09-12 15:58:20 -0400162
163 void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes,
164 int vmin, int vmax);
165
Eric Cook72ada5f2017-04-18 15:24:50 -0400166 void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes,
167 struct crtc_position *position);
168
Harry Wentland45622362017-09-12 15:58:20 -0400169 void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx,
Sylvia Tsai94267b32017-04-21 15:29:55 -0400170 int num_pipes, const struct dc_static_screen_events *events);
Harry Wentland45622362017-09-12 15:58:20 -0400171
172 enum dc_status (*prog_pixclk_crtc_otg)(
173 struct pipe_ctx *pipe_ctx,
Jerry Zuo608ac7b2017-08-25 16:16:10 -0400174 struct dc_state *context,
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -0400175 struct dc *dc);
Vitaly Prosyak9edba552017-06-07 12:23:59 -0500176
177 void (*setup_stereo)(
178 struct pipe_ctx *pipe_ctx,
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -0400179 struct dc *dc);
Charlene Liu15e17332017-07-17 16:04:02 -0400180
181 void (*set_avmute)(struct pipe_ctx *pipe_ctx, bool enable);
Tony Cheng6d244be2017-07-20 00:12:20 -0400182
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -0400183 void (*log_hw_state)(struct dc *dc);
Eric Yang87480682017-07-23 15:18:57 -0400184
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -0400185 void (*wait_for_mpcc_disconnect)(struct dc *dc,
Eric Yang6be425f2017-07-24 10:47:02 -0400186 struct resource_pool *res_pool,
187 struct pipe_ctx *pipe_ctx);
Hersen Wu41f97c02017-08-24 17:40:00 -0400188
Hersen Wu6bf52022017-09-05 12:20:39 -0400189 void (*ready_shared_resources)(struct dc *dc, struct dc_state *context);
Hersen Wu41f97c02017-08-24 17:40:00 -0400190 void (*optimize_shared_resources)(struct dc *dc);
Hersen Wu631aaa02017-10-31 15:55:15 -0400191 void (*pplib_apply_display_requirements)(
192 struct dc *dc,
193 struct dc_state *context);
Andrew Jiang87401962017-09-25 18:03:14 -0400194 void (*edp_power_control)(
Andrew Jiang069d4182017-09-26 19:45:43 -0400195 struct dc_link *link,
Andrew Jiang87401962017-09-25 18:03:14 -0400196 bool enable);
197 void (*edp_backlight_control)(
Yue Hin Lau5eefbc42017-09-15 17:42:20 -0400198 struct dc_link *link,
199 bool enable);
Yongqiang Sun904623e2017-11-24 16:31:03 -0500200 void (*edp_wait_for_hpd_ready)(struct dc_link *link, bool power_up);
Hersen Wu631aaa02017-10-31 15:55:15 -0400201
Eric Yang33fd17d92018-01-18 19:07:54 -0500202 void (*set_cursor_position)(struct pipe_ctx *pipe);
203 void (*set_cursor_attribute)(struct pipe_ctx *pipe);
Harry Wentland45622362017-09-12 15:58:20 -0400204};
205
206void color_space_to_black_color(
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -0400207 const struct dc *dc,
Harry Wentland45622362017-09-12 15:58:20 -0400208 enum dc_color_space colorspace,
209 struct tg_color *black_color);
210
Hersen Wu4b5e7d62017-01-06 16:23:18 -0500211bool hwss_wait_for_blank_complete(
212 struct timing_generator *tg);
213
Vitaly Prosyak38cb3e92017-12-01 11:42:18 -0600214const uint16_t *find_color_matrix(
215 enum dc_color_space color_space,
216 uint32_t *array_size);
217
Harry Wentland45622362017-09-12 15:58:20 -0400218#endif /* __DC_HW_SEQUENCER_H__ */