#include "dm_services.h"
#include "dc.h"
#include "mod_freesync.h"
#include "core_types.h"
#define MOD_FREESYNC_MAX_CONCURRENT_STREAMS …
#define MIN_REFRESH_RANGE …
#define STATIC_SCREEN_RAMP_DELTA_REFRESH_RATE_PER_FRAME …
#define RENDER_TIMES_MAX_COUNT …
#define BTR_MAX_MARGIN …
#define BTR_DRIFT_MARGIN …
#define FIXED_REFRESH_EXIT_MARGIN_IN_HZ …
#define FIXED_REFRESH_ENTER_FRAME_COUNT …
#define FIXED_REFRESH_EXIT_FRAME_COUNT …
#define VSYNCS_BETWEEN_FLIP_THRESHOLD …
#define FREESYNC_CONSEC_FLIP_AFTER_VSYNC …
#define FREESYNC_VSYNC_TO_FLIP_DELTA_IN_US …
struct core_freesync { … };
#define MOD_FREESYNC_TO_CORE(mod_freesync) …
struct mod_freesync *mod_freesync_create(struct dc *dc)
{ … }
void mod_freesync_destroy(struct mod_freesync *mod_freesync)
{ … }
#if 0
static unsigned int calc_refresh_in_uhz_from_duration(
unsigned int duration_in_ns)
{
unsigned int refresh_in_uhz =
((unsigned int)(div64_u64((1000000000ULL * 1000000),
duration_in_ns)));
return refresh_in_uhz;
}
#endif
static unsigned int calc_duration_in_us_from_refresh_in_uhz(
unsigned int refresh_in_uhz)
{ … }
static unsigned int calc_duration_in_us_from_v_total(
const struct dc_stream_state *stream,
const struct mod_vrr_params *in_vrr,
unsigned int v_total)
{ … }
unsigned int mod_freesync_calc_v_total_from_refresh(
const struct dc_stream_state *stream,
unsigned int refresh_in_uhz)
{ … }
static unsigned int calc_v_total_from_duration(
const struct dc_stream_state *stream,
const struct mod_vrr_params *vrr,
unsigned int duration_in_us)
{ … }
static void update_v_total_for_static_ramp(
struct core_freesync *core_freesync,
const struct dc_stream_state *stream,
struct mod_vrr_params *in_out_vrr)
{ … }
static void apply_below_the_range(struct core_freesync *core_freesync,
const struct dc_stream_state *stream,
unsigned int last_render_time_in_us,
struct mod_vrr_params *in_out_vrr)
{ … }
static void apply_fixed_refresh(struct core_freesync *core_freesync,
const struct dc_stream_state *stream,
unsigned int last_render_time_in_us,
struct mod_vrr_params *in_out_vrr)
{ … }
static void determine_flip_interval_workaround_req(struct mod_vrr_params *in_vrr,
unsigned int curr_time_stamp_in_us)
{ … }
static bool vrr_settings_require_update(struct core_freesync *core_freesync,
struct mod_freesync_config *in_config,
unsigned int min_refresh_in_uhz,
unsigned int max_refresh_in_uhz,
struct mod_vrr_params *in_vrr)
{ … }
bool mod_freesync_get_vmin_vmax(struct mod_freesync *mod_freesync,
const struct dc_stream_state *stream,
unsigned int *vmin,
unsigned int *vmax)
{ … }
bool mod_freesync_get_v_position(struct mod_freesync *mod_freesync,
struct dc_stream_state *stream,
unsigned int *nom_v_pos,
unsigned int *v_pos)
{ … }
static void build_vrr_infopacket_data_v1(const struct mod_vrr_params *vrr,
struct dc_info_packet *infopacket,
bool freesync_on_desktop)
{ … }
static void build_vrr_infopacket_data_v3(const struct mod_vrr_params *vrr,
struct dc_info_packet *infopacket,
bool freesync_on_desktop)
{ … }
static void build_vrr_infopacket_fs2_data(enum color_transfer_func app_tf,
struct dc_info_packet *infopacket)
{ … }
static void build_vrr_infopacket_header_v1(enum signal_type signal,
struct dc_info_packet *infopacket,
unsigned int *payload_size)
{ … }
static void build_vrr_infopacket_header_v2(enum signal_type signal,
struct dc_info_packet *infopacket,
unsigned int *payload_size)
{ … }
static void build_vrr_infopacket_header_v3(enum signal_type signal,
struct dc_info_packet *infopacket,
unsigned int *payload_size)
{ … }
static void build_vrr_infopacket_checksum(unsigned int *payload_size,
struct dc_info_packet *infopacket)
{ … }
static void build_vrr_infopacket_v1(enum signal_type signal,
const struct mod_vrr_params *vrr,
struct dc_info_packet *infopacket,
bool freesync_on_desktop)
{ … }
static void build_vrr_infopacket_v2(enum signal_type signal,
const struct mod_vrr_params *vrr,
enum color_transfer_func app_tf,
struct dc_info_packet *infopacket,
bool freesync_on_desktop)
{ … }
static void build_vrr_infopacket_v3(enum signal_type signal,
const struct mod_vrr_params *vrr,
enum color_transfer_func app_tf,
struct dc_info_packet *infopacket,
bool freesync_on_desktop)
{ … }
static void build_vrr_infopacket_sdp_v1_3(enum vrr_packet_type packet_type,
struct dc_info_packet *infopacket)
{ … }
void mod_freesync_build_vrr_infopacket(struct mod_freesync *mod_freesync,
const struct dc_stream_state *stream,
const struct mod_vrr_params *vrr,
enum vrr_packet_type packet_type,
enum color_transfer_func app_tf,
struct dc_info_packet *infopacket,
bool pack_sdp_v1_3)
{ … }
void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync,
const struct dc_stream_state *stream,
struct mod_freesync_config *in_config,
struct mod_vrr_params *in_out_vrr)
{ … }
void mod_freesync_handle_preflip(struct mod_freesync *mod_freesync,
const struct dc_plane_state *plane,
const struct dc_stream_state *stream,
unsigned int curr_time_stamp_in_us,
struct mod_vrr_params *in_out_vrr)
{ … }
void mod_freesync_handle_v_update(struct mod_freesync *mod_freesync,
const struct dc_stream_state *stream,
struct mod_vrr_params *in_out_vrr)
{ … }
void mod_freesync_get_settings(struct mod_freesync *mod_freesync,
const struct mod_vrr_params *vrr,
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)
{ … }
unsigned long long mod_freesync_calc_nominal_field_rate(
const struct dc_stream_state *stream)
{ … }
unsigned long long mod_freesync_calc_field_rate_from_timing(
unsigned int vtotal, unsigned int htotal, unsigned int pix_clk)
{ … }
bool mod_freesync_get_freesync_enabled(struct mod_vrr_params *pVrr)
{ … }
bool mod_freesync_is_valid_range(uint32_t min_refresh_cap_in_uhz,
uint32_t max_refresh_cap_in_uhz,
uint32_t nominal_field_rate_in_uhz)
{ … }