mod_freesync.h 5.7 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
/*
 * Copyright 2016 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
 *
 */




/*
 * Copyright 2016 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 MOD_FREESYNC_H_
#define MOD_FREESYNC_H_

#include "dm_services.h"

struct mod_freesync *mod_freesync_create(struct dc *dc);
void mod_freesync_destroy(struct mod_freesync *mod_freesync);

struct mod_freesync {
	int dummy;
};

enum mod_freesync_state {
	FREESYNC_STATE_NONE,
	FREESYNC_STATE_FULLSCREEN,
	FREESYNC_STATE_STATIC_SCREEN,
	FREESYNC_STATE_VIDEO
};

enum mod_freesync_user_enable_mask {
	FREESYNC_USER_ENABLE_STATIC = 0x1,
	FREESYNC_USER_ENABLE_VIDEO = 0x2,
	FREESYNC_USER_ENABLE_GAMING = 0x4
};

struct mod_freesync_user_enable {
	bool enable_for_static;
	bool enable_for_video;
	bool enable_for_gaming;
};

struct mod_freesync_caps {
	bool supported;
	unsigned int min_refresh_in_micro_hz;
	unsigned int max_refresh_in_micro_hz;

	bool btr_supported;
};

struct mod_freesync_params {
	enum mod_freesync_state state;
	bool enable;
	unsigned int update_duration_in_ns;
	bool windowed_fullscreen;
};

/*
 * Add stream to be tracked by module
 */
bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
104
		struct dc_stream_state *stream, struct mod_freesync_caps *caps);
105 106 107 108 109

/*
 * Remove stream to be tracked by module
 */
bool mod_freesync_remove_stream(struct mod_freesync *mod_freesync,
110
		struct dc_stream_state *stream);
111 112 113 114 115 116

/*
 * Update the freesync state flags for each display and program
 * freesync accordingly
 */
void mod_freesync_update_state(struct mod_freesync *mod_freesync,
117
		struct dc_stream_state **streams, int num_streams,
118 119 120
		struct mod_freesync_params *freesync_params);

bool mod_freesync_get_state(struct mod_freesync *mod_freesync,
121
		struct dc_stream_state *stream,
122 123 124
		struct mod_freesync_params *freesync_params);

bool mod_freesync_set_user_enable(struct mod_freesync *mod_freesync,
125
		struct dc_stream_state **streams, int num_streams,
126 127 128
		struct mod_freesync_user_enable *user_enable);

bool mod_freesync_get_user_enable(struct mod_freesync *mod_freesync,
129
		struct dc_stream_state *stream,
130 131
		struct mod_freesync_user_enable *user_enable);

132
bool mod_freesync_get_static_ramp_active(struct mod_freesync *mod_freesync,
133
		struct dc_stream_state *stream,
134 135
		bool *is_ramp_active);

136
bool mod_freesync_override_min_max(struct mod_freesync *mod_freesync,
137
		struct dc_stream_state *streams,
138
		unsigned int min_refresh,
139 140
		unsigned int max_refresh,
		struct mod_freesync_caps *caps);
141 142

bool mod_freesync_get_min_max(struct mod_freesync *mod_freesync,
143
		struct dc_stream_state *stream,
144 145 146 147
		unsigned int *min_refresh,
		unsigned int *max_refresh);

bool mod_freesync_get_vmin_vmax(struct mod_freesync *mod_freesync,
148
		struct dc_stream_state *stream,
149 150 151 152
		unsigned int *vmin,
		unsigned int *vmax);

bool mod_freesync_get_v_position(struct mod_freesync *mod_freesync,
153
		struct dc_stream_state *stream,
154 155 156
		unsigned int *nom_v_pos,
		unsigned int *v_pos);

157
void mod_freesync_handle_v_update(struct mod_freesync *mod_freesync,
158
		struct dc_stream_state **streams, int num_streams);
159 160

void mod_freesync_notify_mode_change(struct mod_freesync *mod_freesync,
161
		struct dc_stream_state **streams, int num_streams);
162 163

void mod_freesync_pre_update_plane_addresses(struct mod_freesync *mod_freesync,
164
		struct dc_stream_state **streams, int num_streams,
165 166
		unsigned int curr_time_stamp);

167 168 169 170 171 172 173 174 175
void mod_freesync_get_settings(struct mod_freesync *mod_freesync,
		struct dc_stream_state **streams, int num_streams,
		unsigned int *v_total_min, unsigned int *v_total_max,
		unsigned int *event_triggers,
		unsigned int *window_min, unsigned int *window_max,
		unsigned int *lfc_mid_point_in_us,
		unsigned int *inserted_frames,
		unsigned int *inserted_duration_in_us);

176
#endif