hw_sequencer.h 5.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
/*
 * Copyright 2015 Advanced Micro Devices, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Authors: AMD
 *
 */

#ifndef __DC_HW_SEQUENCER_H__
#define __DC_HW_SEQUENCER_H__
28 29 30
#include "dc_types.h"
#include "clock_source.h"
#include "inc/hw/timing_generator.h"
31
#include "inc/hw/opp.h"
32
#include "inc/hw/link_encoder.h"
33
#include "core_status.h"
34 35 36 37 38 39 40

enum pipe_gating_control {
	PIPE_GATING_CONTROL_DISABLE = 0,
	PIPE_GATING_CONTROL_ENABLE,
	PIPE_GATING_CONTROL_INIT
};

41 42
struct dce_hwseq_wa {
	bool blnd_crtc_trigger;
43
	bool DEGVIDCN10_253;
44
	bool false_optc_underflow;
45 46 47 48
};

struct hwseq_wa_state {
	bool DEGVIDCN10_253_applied;
49 50 51 52 53 54 55 56
};

struct dce_hwseq {
	struct dc_context *ctx;
	const struct dce_hwseq_registers *regs;
	const struct dce_hwseq_shift *shifts;
	const struct dce_hwseq_mask *masks;
	struct dce_hwseq_wa wa;
57
	struct hwseq_wa_state wa_state;
58 59
};

60
struct pipe_ctx;
61
struct dc_state;
62 63 64 65
struct dchub_init_data;
struct dc_static_screen_events;
struct resource_pool;
struct resource_context;
66 67 68

struct hw_sequencer_funcs {

69
	void (*init_hw)(struct dc *dc);
70 71

	enum dc_status (*apply_ctx_to_hw)(
72
			struct dc *dc, struct dc_state *context);
73 74

	void (*reset_hw_ctx_wrap)(
75
			struct dc *dc, struct dc_state *context);
76 77

	void (*apply_ctx_for_surface)(
78
			struct dc *dc,
79 80
			const struct dc_stream_state *stream,
			int num_planes,
81
			struct dc_state *context);
82 83

	void (*set_plane_config)(
84
			const struct dc *dc,
85 86 87
			struct pipe_ctx *pipe_ctx,
			struct resource_context *res_ctx);

88 89 90
	void (*program_gamut_remap)(
			struct pipe_ctx *pipe_ctx);

91 92 93 94 95
	void (*program_csc_matrix)(
			struct pipe_ctx *pipe_ctx,
			enum dc_color_space colorspace,
			uint16_t *matrix);

96
	void (*update_plane_addr)(
97
		const struct dc *dc,
98 99
		struct pipe_ctx *pipe_ctx);

100 101 102 103
	void (*update_dchub)(
		struct dce_hwseq *hws,
		struct dchub_init_data *dh_data);

104 105 106
	void (*update_pending_status)(
			struct pipe_ctx *pipe_ctx);

107
	bool (*set_input_transfer_func)(
108
				struct pipe_ctx *pipe_ctx,
109
				const struct dc_plane_state *plane_state);
110

111 112
	bool (*set_output_transfer_func)(
				struct pipe_ctx *pipe_ctx,
113
				const struct dc_stream_state *stream);
114

115
	void (*power_down)(struct dc *dc);
116

117
	void (*enable_accelerated_mode)(struct dc *dc, struct dc_state *context);
118 119

	void (*enable_timing_synchronization)(
120
			struct dc *dc,
121 122 123 124
			int group_index,
			int group_size,
			struct pipe_ctx *grouped_pipes[]);

125 126 127 128 129
	void (*enable_per_frame_crtc_position_reset)(
			struct dc *dc,
			int group_size,
			struct pipe_ctx *grouped_pipes[]);

130 131 132 133 134
	void (*enable_display_pipe_clock_gating)(
					struct dc_context *ctx,
					bool clock_gating);

	bool (*enable_display_power_gating)(
135
					struct dc *dc,
136 137 138 139
					uint8_t controller_id,
					struct dc_bios *dcb,
					enum pipe_gating_control power_gating);

140
	void (*disable_plane)(struct dc *dc, struct pipe_ctx *pipe_ctx);
141

142 143 144 145
	void (*update_info_frame)(struct pipe_ctx *pipe_ctx);

	void (*enable_stream)(struct pipe_ctx *pipe_ctx);

146 147
	void (*disable_stream)(struct pipe_ctx *pipe_ctx,
			int option);
148 149 150 151

	void (*unblank_stream)(struct pipe_ctx *pipe_ctx,
			struct dc_link_settings *link_settings);

152
	void (*blank_stream)(struct pipe_ctx *pipe_ctx);
153
	void (*pipe_control_lock)(
154
				struct dc *dc,
155
				struct pipe_ctx *pipe,
156 157
				bool lock);

158
	void (*set_bandwidth)(
159
			struct dc *dc,
160
			struct dc_state *context,
161
			bool decrease_allowed);
162 163 164 165

	void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes,
			int vmin, int vmax);

166 167 168
	void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes,
			struct crtc_position *position);

169
	void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx,
S
Sylvia Tsai 已提交
170
			int num_pipes, const struct dc_static_screen_events *events);
171 172 173

	enum dc_status (*prog_pixclk_crtc_otg)(
			struct pipe_ctx *pipe_ctx,
174
			struct dc_state *context,
175
			struct dc *dc);
176 177 178

	void (*setup_stereo)(
			struct pipe_ctx *pipe_ctx,
179
			struct dc *dc);
180 181

	void (*set_avmute)(struct pipe_ctx *pipe_ctx, bool enable);
182

183
	void (*log_hw_state)(struct dc *dc);
184

185
	void (*wait_for_mpcc_disconnect)(struct dc *dc,
186 187
			struct resource_pool *res_pool,
			struct pipe_ctx *pipe_ctx);
188

189
	void (*ready_shared_resources)(struct dc *dc, struct dc_state *context);
190
	void (*optimize_shared_resources)(struct dc *dc);
191 192 193
	void (*pplib_apply_display_requirements)(
			struct dc *dc,
			struct dc_state *context);
194
	void (*edp_power_control)(
195
			struct dc_link *link,
196 197
			bool enable);
	void (*edp_backlight_control)(
198 199
			struct dc_link *link,
			bool enable);
200
	void (*edp_wait_for_hpd_ready)(struct dc_link *link, bool power_up);
201

202 203 204
	void (*set_cursor_position)(struct pipe_ctx *pipe);
	void (*set_cursor_attribute)(struct pipe_ctx *pipe);

205 206 207
};

void color_space_to_black_color(
208
	const struct dc *dc,
209 210 211
	enum dc_color_space colorspace,
	struct tg_color *black_color);

212 213 214
bool hwss_wait_for_blank_complete(
		struct timing_generator *tg);

215 216 217 218
const uint16_t *find_color_matrix(
		enum dc_color_space color_space,
		uint32_t *array_size);

219
#endif /* __DC_HW_SEQUENCER_H__ */