blob: e9c6021a5372733f592d78d9f703dd730d2d7b18 [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
Yongqiang Sund6001ae2019-01-25 14:40:14 -050035enum vline_select {
36 VLINE0,
37 VLINE1
38};
39
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -040040struct pipe_ctx;
Jerry Zuo608ac7b2017-08-25 16:16:10 -040041struct dc_state;
Harry Wentland7ed4e632019-02-22 16:52:08 -050042struct dc_stream_status;
43struct dc_writeback_info;
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -040044struct dchub_init_data;
45struct dc_static_screen_events;
46struct resource_pool;
Dmytro Laktyushkinbda9afd2019-05-22 18:05:41 -040047struct dc_phy_addr_space_config;
48struct dc_virtual_addr_space_config;
Martin Leung8a318202019-07-09 15:15:17 -040049struct dpp;
Anthony Koof42ea552019-11-05 13:17:30 -050050struct dce_hwseq;
Harry Wentland45622362017-09-12 15:58:20 -040051
52struct hw_sequencer_funcs {
Anthony Koof42ea552019-11-05 13:17:30 -050053 /* 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 Wentland45622362017-09-12 15:58:20 -040056
Anthony Koof42ea552019-11-05 13:17:30 -050057 /* Pipe Programming Related */
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -040058 void (*init_hw)(struct dc *dc);
Anthony Koof42ea552019-11-05 13:17:30 -050059 void (*enable_accelerated_mode)(struct dc *dc,
Jerry Zuo608ac7b2017-08-25 16:16:10 -040060 struct dc_state *context);
Anthony Koof42ea552019-11-05 13:17:30 -050061 enum dc_status (*apply_ctx_to_hw)(struct dc *dc,
Dmytro Laktyushkinb6e881c2019-09-13 18:00:28 -050062 struct dc_state *context);
Yongqiang Sun7f914a62017-11-06 14:40:31 -050063 void (*disable_plane)(struct dc *dc, struct pipe_ctx *pipe_ctx);
Anthony Koof42ea552019-11-05 13:17:30 -050064 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 Laktyushkin9566b672018-09-18 15:00:49 -040068 struct dc_state *context);
Anthony Koof42ea552019-11-05 13:17:30 -050069 void (*update_plane_addr)(const struct dc *dc,
70 struct pipe_ctx *pipe_ctx);
71 void (*update_dchub)(struct dce_hwseq *hws,
72 struct dchub_init_data *dh_data);
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -040073 void (*wait_for_mpcc_disconnect)(struct dc *dc,
Eric Yang6be425f2017-07-24 10:47:02 -040074 struct resource_pool *res_pool,
75 struct pipe_ctx *pipe_ctx);
Anthony Koof42ea552019-11-05 13:17:30 -050076 void (*program_triplebuffer)(const struct dc *dc,
77 struct pipe_ctx *pipe_ctx, bool enableTripleBuffer);
78 void (*update_pending_status)(struct pipe_ctx *pipe_ctx);
Hersen Wu41f97c02017-08-24 17:40:00 -040079
Anthony Koof42ea552019-11-05 13:17:30 -050080 /* Pipe Lock Related */
81 void (*pipe_control_lock_global)(struct dc *dc,
82 struct pipe_ctx *pipe, bool lock);
83 void (*pipe_control_lock)(struct dc *dc,
84 struct pipe_ctx *pipe, bool lock);
85 void (*set_flip_control_gsl)(struct pipe_ctx *pipe_ctx,
86 bool flip_immediate);
Hersen Wu631aaa02017-10-31 15:55:15 -040087
Anthony Koof42ea552019-11-05 13:17:30 -050088 /* Timing Related */
89 void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes,
90 struct crtc_position *position);
91 int (*get_vupdate_offset_from_vsync)(struct pipe_ctx *pipe_ctx);
92 void (*enable_per_frame_crtc_position_reset)(struct dc *dc,
93 int group_size, struct pipe_ctx *grouped_pipes[]);
94 void (*enable_timing_synchronization)(struct dc *dc,
95 int group_index, int group_size,
96 struct pipe_ctx *grouped_pipes[]);
97 void (*setup_periodic_interrupt)(struct dc *dc,
98 struct pipe_ctx *pipe_ctx,
99 enum vline_select vline);
100 void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes,
101 unsigned int vmin, unsigned int vmax,
102 unsigned int vmid, unsigned int vmid_frame_number);
103 void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx,
104 int num_pipes,
105 const struct dc_static_screen_events *events);
106
107 /* Stream Related */
108 void (*enable_stream)(struct pipe_ctx *pipe_ctx);
109 void (*disable_stream)(struct pipe_ctx *pipe_ctx);
110 void (*blank_stream)(struct pipe_ctx *pipe_ctx);
111 void (*unblank_stream)(struct pipe_ctx *pipe_ctx,
112 struct dc_link_settings *link_settings);
113
114 /* Bandwidth Related */
115 void (*prepare_bandwidth)(struct dc *dc, struct dc_state *context);
116 bool (*update_bandwidth)(struct dc *dc, struct dc_state *context);
117 void (*optimize_bandwidth)(struct dc *dc, struct dc_state *context);
118
119 /* Infopacket Related */
120 void (*set_avmute)(struct pipe_ctx *pipe_ctx, bool enable);
121 void (*send_immediate_sdp_message)(
122 struct pipe_ctx *pipe_ctx,
123 const uint8_t *custom_sdp_message,
124 unsigned int sdp_message_size);
125 void (*update_info_frame)(struct pipe_ctx *pipe_ctx);
126 void (*set_dmdata_attributes)(struct pipe_ctx *pipe);
127 void (*program_dmdata_engine)(struct pipe_ctx *pipe_ctx);
128 bool (*dmdata_status_done)(struct pipe_ctx *pipe_ctx);
129
130 /* Cursor Related */
Eric Yang33fd17d92018-01-18 19:07:54 -0500131 void (*set_cursor_position)(struct pipe_ctx *pipe);
132 void (*set_cursor_attribute)(struct pipe_ctx *pipe);
Krunoslav Kovac6d92b5c2018-06-27 18:23:37 -0400133 void (*set_cursor_sdr_white_level)(struct pipe_ctx *pipe);
Eric Bernstein8e357612018-04-09 15:47:42 -0400134
Anthony Koof42ea552019-11-05 13:17:30 -0500135 /* Colour Related */
136 void (*program_gamut_remap)(struct pipe_ctx *pipe_ctx);
137 void (*program_output_csc)(struct dc *dc, struct pipe_ctx *pipe_ctx,
138 enum dc_color_space colorspace,
139 uint16_t *matrix, int opp_id);
Yongqiang Sund6001ae2019-01-25 14:40:14 -0500140
Anthony Koof42ea552019-11-05 13:17:30 -0500141 /* VM Related */
142 int (*init_sys_ctx)(struct dce_hwseq *hws,
Harry Wentland7ed4e632019-02-22 16:52:08 -0500143 struct dc *dc,
Anthony Koof42ea552019-11-05 13:17:30 -0500144 struct dc_phy_addr_space_config *pa_config);
145 void (*init_vm_ctx)(struct dce_hwseq *hws,
146 struct dc *dc,
147 struct dc_virtual_addr_space_config *va_config,
148 int vmid);
149
150 /* Writeback Related */
Harry Wentland7ed4e632019-02-22 16:52:08 -0500151 void (*update_writeback)(struct dc *dc,
152 const struct dc_stream_status *stream_status,
Julian Parkinedb922b02019-08-29 17:06:05 -0400153 struct dc_writeback_info *wb_info,
154 struct dc_state *context);
Harry Wentland7ed4e632019-02-22 16:52:08 -0500155 void (*enable_writeback)(struct dc *dc,
156 const struct dc_stream_status *stream_status,
Julian Parkinedb922b02019-08-29 17:06:05 -0400157 struct dc_writeback_info *wb_info,
158 struct dc_state *context);
Harry Wentland7ed4e632019-02-22 16:52:08 -0500159 void (*disable_writeback)(struct dc *dc,
160 unsigned int dwb_pipe_inst);
Anthony Koof42ea552019-11-05 13:17:30 -0500161
162 /* Clock Related */
Charlene Liu925f5662019-06-27 18:16:21 -0400163 enum dc_status (*set_clock)(struct dc *dc,
164 enum dc_clock_type clock_type,
Anthony Koof42ea552019-11-05 13:17:30 -0500165 uint32_t clk_khz, uint32_t stepping);
166 void (*get_clock)(struct dc *dc, enum dc_clock_type clock_type,
Charlene Liu925f5662019-06-27 18:16:21 -0400167 struct dc_clock_config *clock_cfg);
Anthony Koof42ea552019-11-05 13:17:30 -0500168 void (*optimize_pwr_state)(const struct dc *dc,
169 struct dc_state *context);
170 void (*exit_optimized_pwr_state)(const struct dc *dc,
Anthony Koo78c77382019-10-29 15:05:56 -0400171 struct dc_state *context);
172
Anthony Koof42ea552019-11-05 13:17:30 -0500173 /* Audio Related */
174 void (*enable_audio_stream)(struct pipe_ctx *pipe_ctx);
175 void (*disable_audio_stream)(struct pipe_ctx *pipe_ctx);
Anthony Koo78c77382019-10-29 15:05:56 -0400176
Anthony Koof42ea552019-11-05 13:17:30 -0500177 /* Stereo 3D Related */
178 void (*setup_stereo)(struct pipe_ctx *pipe_ctx, struct dc *dc);
Anthony Koo78c77382019-10-29 15:05:56 -0400179
Anthony Koof42ea552019-11-05 13:17:30 -0500180 /* HW State Logging Related */
181 void (*log_hw_state)(struct dc *dc, struct dc_log_buffer_ctx *log_ctx);
182 void (*get_hw_state)(struct dc *dc, char *pBuf,
183 unsigned int bufSize, unsigned int mask);
184 void (*clear_status_bits)(struct dc *dc, unsigned int mask);
Anthony Koo78c77382019-10-29 15:05:56 -0400185
Anthony Koo78c77382019-10-29 15:05:56 -0400186
Harry Wentland45622362017-09-12 15:58:20 -0400187};
188
189void color_space_to_black_color(
Bhawanpreet Lakhafb3466a2017-08-01 15:00:25 -0400190 const struct dc *dc,
Harry Wentland45622362017-09-12 15:58:20 -0400191 enum dc_color_space colorspace,
192 struct tg_color *black_color);
193
Hersen Wu4b5e7d62017-01-06 16:23:18 -0500194bool hwss_wait_for_blank_complete(
195 struct timing_generator *tg);
196
Vitaly Prosyak38cb3e92017-12-01 11:42:18 -0600197const uint16_t *find_color_matrix(
198 enum dc_color_space color_space,
199 uint32_t *array_size);
200
Harry Wentland45622362017-09-12 15:58:20 -0400201#endif /* __DC_HW_SEQUENCER_H__ */