hw_sequencer.h 6.14 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
	bool DEGVIDCN10_254;
46 47 48 49
};

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

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;
58
	struct hwseq_wa_state wa_state;
59 60
};

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

struct hw_sequencer_funcs {

71
	void (*init_hw)(struct dc *dc);
72 73

	enum dc_status (*apply_ctx_to_hw)(
74
			struct dc *dc, struct dc_state *context);
75 76

	void (*reset_hw_ctx_wrap)(
77
			struct dc *dc, struct dc_state *context);
78 79

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

85 86 87
	void (*program_gamut_remap)(
			struct pipe_ctx *pipe_ctx);

88 89 90 91 92 93
	void (*program_output_csc)(struct dc *dc,
			struct pipe_ctx *pipe_ctx,
			enum dc_color_space colorspace,
			uint16_t *matrix,
			int opp_id);

94
	void (*update_plane_addr)(
95
		const struct dc *dc,
96 97
		struct pipe_ctx *pipe_ctx);

98 99 100 101
	void (*plane_atomic_disconnect)(
		struct dc *dc,
		struct pipe_ctx *pipe_ctx);

102 103 104 105
	void (*update_dchub)(
		struct dce_hwseq *hws,
		struct dchub_init_data *dh_data);

106 107 108 109
	void (*update_mpcc)(
		struct dc *dc,
		struct pipe_ctx *pipe_ctx);

110 111 112
	void (*update_pending_status)(
			struct pipe_ctx *pipe_ctx);

113
	bool (*set_input_transfer_func)(
114
				struct pipe_ctx *pipe_ctx,
115
				const struct dc_plane_state *plane_state);
116

117 118
	bool (*set_output_transfer_func)(
				struct pipe_ctx *pipe_ctx,
119
				const struct dc_stream_state *stream);
120

121
	void (*power_down)(struct dc *dc);
122

123
	void (*enable_accelerated_mode)(struct dc *dc, struct dc_state *context);
124 125

	void (*enable_timing_synchronization)(
126
			struct dc *dc,
127 128 129 130
			int group_index,
			int group_size,
			struct pipe_ctx *grouped_pipes[]);

131 132 133 134 135
	void (*enable_per_frame_crtc_position_reset)(
			struct dc *dc,
			int group_size,
			struct pipe_ctx *grouped_pipes[]);

136 137 138 139 140
	void (*enable_display_pipe_clock_gating)(
					struct dc_context *ctx,
					bool clock_gating);

	bool (*enable_display_power_gating)(
141
					struct dc *dc,
142 143 144 145
					uint8_t controller_id,
					struct dc_bios *dcb,
					enum pipe_gating_control power_gating);

146
	void (*disable_plane)(struct dc *dc, struct pipe_ctx *pipe_ctx);
147

148 149 150 151
	void (*update_info_frame)(struct pipe_ctx *pipe_ctx);

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

152 153
	void (*disable_stream)(struct pipe_ctx *pipe_ctx,
			int option);
154 155 156 157

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

158
	void (*blank_stream)(struct pipe_ctx *pipe_ctx);
159 160 161 162 163

	void (*enable_audio_stream)(struct pipe_ctx *pipe_ctx);

	void (*disable_audio_stream)(struct pipe_ctx *pipe_ctx, int option);

164
	void (*pipe_control_lock)(
165
				struct dc *dc,
166
				struct pipe_ctx *pipe,
167
				bool lock);
168 169
	void (*blank_pixel_data)(
			struct dc *dc,
170
			struct pipe_ctx *pipe_ctx,
171
			bool blank);
172

173
	void (*prepare_bandwidth)(
174
			struct dc *dc,
175 176 177 178
			struct dc_state *context);
	void (*optimize_bandwidth)(
			struct dc *dc,
			struct dc_state *context);
179 180 181 182

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

183 184 185
	void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes,
			struct crtc_position *position);

186
	void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx,
187
			int num_pipes, const struct dc_static_screen_events *events);
188

189
	enum dc_status (*enable_stream_timing)(
190
			struct pipe_ctx *pipe_ctx,
191
			struct dc_state *context,
192
			struct dc *dc);
193 194 195

	void (*setup_stereo)(
			struct pipe_ctx *pipe_ctx,
196
			struct dc *dc);
197 198

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

200 201
	void (*log_hw_state)(struct dc *dc,
		struct dc_log_buffer_ctx *log_ctx);
202
	void (*get_hw_state)(struct dc *dc, char *pBuf, unsigned int bufSize, unsigned int mask);
203

204
	void (*wait_for_mpcc_disconnect)(struct dc *dc,
205 206
			struct resource_pool *res_pool,
			struct pipe_ctx *pipe_ctx);
207

208
	void (*edp_power_control)(
209
			struct dc_link *link,
210 211
			bool enable);
	void (*edp_backlight_control)(
212 213
			struct dc_link *link,
			bool enable);
214
	void (*edp_wait_for_hpd_ready)(struct dc_link *link, bool power_up);
215

216 217
	void (*set_cursor_position)(struct pipe_ctx *pipe);
	void (*set_cursor_attribute)(struct pipe_ctx *pipe);
218
	void (*set_cursor_sdr_white_level)(struct pipe_ctx *pipe);
219

220 221 222
};

void color_space_to_black_color(
223
	const struct dc *dc,
224 225 226
	enum dc_color_space colorspace,
	struct tg_color *black_color);

227 228 229
bool hwss_wait_for_blank_complete(
		struct timing_generator *tg);

230 231 232 233
const uint16_t *find_color_matrix(
		enum dc_color_space color_space,
		uint32_t *array_size);

234
#endif /* __DC_HW_SEQUENCER_H__ */