hw_sequencer.h 5.1 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 31
#include "dc_types.h"
#include "clock_source.h"
#include "inc/hw/timing_generator.h"
#include "core_status.h"
32 33 34 35 36 37 38

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

39 40 41 42 43 44 45 46 47 48
struct dce_hwseq_wa {
	bool blnd_crtc_trigger;
};

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;
49 50
};

51
struct pipe_ctx;
52
struct dc_state;
53 54 55 56
struct dchub_init_data;
struct dc_static_screen_events;
struct resource_pool;
struct resource_context;
57 58 59

struct hw_sequencer_funcs {

60
	void (*init_hw)(struct dc *dc);
61 62

	enum dc_status (*apply_ctx_to_hw)(
63
			struct dc *dc, struct dc_state *context);
64 65

	void (*reset_hw_ctx_wrap)(
66
			struct dc *dc, struct dc_state *context);
67 68

	void (*apply_ctx_for_surface)(
69
			struct dc *dc,
70 71
			const struct dc_stream_state *stream,
			int num_planes,
72
			struct dc_state *context);
73 74

	void (*set_plane_config)(
75
			const struct dc *dc,
76 77 78
			struct pipe_ctx *pipe_ctx,
			struct resource_context *res_ctx);

79 80 81
	void (*program_gamut_remap)(
			struct pipe_ctx *pipe_ctx);

82 83 84 85 86
	void (*program_csc_matrix)(
			struct pipe_ctx *pipe_ctx,
			enum dc_color_space colorspace,
			uint16_t *matrix);

87
	void (*update_plane_addr)(
88
		const struct dc *dc,
89 90
		struct pipe_ctx *pipe_ctx);

91 92 93 94
	void (*update_dchub)(
		struct dce_hwseq *hws,
		struct dchub_init_data *dh_data);

95 96 97
	void (*update_pending_status)(
			struct pipe_ctx *pipe_ctx);

98
	bool (*set_input_transfer_func)(
99
				struct pipe_ctx *pipe_ctx,
100
				const struct dc_plane_state *plane_state);
101

102 103
	bool (*set_output_transfer_func)(
				struct pipe_ctx *pipe_ctx,
104
				const struct dc_stream_state *stream);
105

106
	void (*power_down)(struct dc *dc);
107

108
	void (*enable_accelerated_mode)(struct dc *dc);
109 110

	void (*enable_timing_synchronization)(
111
			struct dc *dc,
112 113 114 115 116 117 118 119 120
			int group_index,
			int group_size,
			struct pipe_ctx *grouped_pipes[]);

	void (*enable_display_pipe_clock_gating)(
					struct dc_context *ctx,
					bool clock_gating);

	bool (*enable_display_power_gating)(
121
					struct dc *dc,
122 123 124 125
					uint8_t controller_id,
					struct dc_bios *dcb,
					enum pipe_gating_control power_gating);

126
	void (*power_down_front_end)(struct dc *dc, int fe_idx);
127

128
	void (*power_on_front_end)(struct dc *dc,
129
			struct pipe_ctx *pipe,
130
			struct dc_state *context);
131

132 133 134 135 136 137 138 139 140 141
	void (*update_info_frame)(struct pipe_ctx *pipe_ctx);

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

	void (*disable_stream)(struct pipe_ctx *pipe_ctx);

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

	void (*pipe_control_lock)(
142
				struct dc *dc,
143
				struct pipe_ctx *pipe,
144 145
				bool lock);

146
	void (*set_bandwidth)(
147
			struct dc *dc,
148
			struct dc_state *context,
149
			bool decrease_allowed);
150 151 152 153

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

154 155 156
	void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes,
			struct crtc_position *position);

157
	void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx,
S
Sylvia Tsai 已提交
158
			int num_pipes, const struct dc_static_screen_events *events);
159 160 161

	enum dc_status (*prog_pixclk_crtc_otg)(
			struct pipe_ctx *pipe_ctx,
162
			struct dc_state *context,
163
			struct dc *dc);
164 165 166

	void (*setup_stereo)(
			struct pipe_ctx *pipe_ctx,
167
			struct dc *dc);
168 169

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

171
	void (*log_hw_state)(struct dc *dc);
172

173
	void (*wait_for_mpcc_disconnect)(struct dc *dc,
174 175
			struct resource_pool *res_pool,
			struct pipe_ctx *pipe_ctx);
176

177
	void (*ready_shared_resources)(struct dc *dc, struct dc_state *context);
178
	void (*optimize_shared_resources)(struct dc *dc);
179 180 181 182

	void (*backlight_control)(
			struct dc_link *link,
			bool enable);
183 184 185
};

void color_space_to_black_color(
186
	const struct dc *dc,
187 188 189
	enum dc_color_space colorspace,
	struct tg_color *black_color);

190 191 192
bool hwss_wait_for_blank_complete(
		struct timing_generator *tg);

193
#endif /* __DC_HW_SEQUENCER_H__ */