Commit 9e594f4c authored by Eric Cook's avatar Eric Cook Committed by Alex Deucher

drm/amd/display: Add support for FreeSync on eDP to module

Signed-off-by: default avatarEric <eric.cook@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Reviewed-by: default avatarAnthony Koo <Anthony.Koo@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 529cad0f
...@@ -109,11 +109,16 @@ struct freesync_entity { ...@@ -109,11 +109,16 @@ struct freesync_entity {
struct mod_freesync_user_enable user_enable; struct mod_freesync_user_enable user_enable;
}; };
struct freesync_registry_options {
unsigned int min_refresh_from_edid;
};
struct core_freesync { struct core_freesync {
struct mod_freesync public; struct mod_freesync public;
struct dc *dc; struct dc *dc;
struct freesync_entity *map; struct freesync_entity *map;
int num_entities; int num_entities;
struct freesync_registry_options opts;
}; };
#define MOD_FREESYNC_TO_CORE(mod_freesync)\ #define MOD_FREESYNC_TO_CORE(mod_freesync)\
...@@ -136,7 +141,7 @@ struct mod_freesync *mod_freesync_create(struct dc *dc) ...@@ -136,7 +141,7 @@ struct mod_freesync *mod_freesync_create(struct dc *dc)
struct persistent_data_flag flag; struct persistent_data_flag flag;
int i = 0; int i, data = 0;
if (core_freesync == NULL) if (core_freesync == NULL)
goto fail_alloc_context; goto fail_alloc_context;
...@@ -165,6 +170,12 @@ struct mod_freesync *mod_freesync_create(struct dc *dc) ...@@ -165,6 +170,12 @@ struct mod_freesync *mod_freesync_create(struct dc *dc)
flag.save_per_link = false; flag.save_per_link = false;
dm_write_persistent_data(core_dc->ctx, NULL, FREESYNC_REGISTRY_NAME, NULL, NULL, dm_write_persistent_data(core_dc->ctx, NULL, FREESYNC_REGISTRY_NAME, NULL, NULL,
0, &flag); 0, &flag);
flag.save_per_edid = false;
flag.save_per_link = false;
if (dm_read_persistent_data(core_dc->ctx, NULL, NULL,
"DalDrrSupport", &data, sizeof(data), &flag)) {
core_freesync->opts.min_refresh_from_edid = data;
}
return &core_freesync->public; return &core_freesync->public;
...@@ -219,7 +230,7 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync, ...@@ -219,7 +230,7 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
struct core_stream *core_stream = NULL; struct core_stream *core_stream = NULL;
struct core_dc *core_dc = NULL; struct core_dc *core_dc = NULL;
struct core_freesync *core_freesync = NULL; struct core_freesync *core_freesync = NULL;
int persistent_freesync_enable = 0; int persistent_freesync_enable, stream_index = 0;
struct persistent_data_flag flag; struct persistent_data_flag flag;
unsigned int nom_refresh_rate_micro_hz; unsigned int nom_refresh_rate_micro_hz;
unsigned long long temp; unsigned long long temp;
...@@ -238,6 +249,26 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync, ...@@ -238,6 +249,26 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
dc_stream_retain(stream); dc_stream_retain(stream);
stream_index = map_index_from_stream(core_freesync, stream);
temp = stream->timing.pix_clk_khz;
temp *= 1000ULL * 1000ULL * 1000ULL;
temp = div_u64(temp, stream->timing.h_total);
temp = div_u64(temp, stream->timing.v_total);
nom_refresh_rate_micro_hz = (unsigned int) temp;
if (core_freesync->opts.min_refresh_from_edid != 0 &&
dc_is_embedded_signal(
stream[stream_index].sink->sink_signal)) {
caps->supported = true;
caps->min_refresh_in_micro_hz =
core_freesync->opts.min_refresh_from_edid *
1000000;
caps->max_refresh_in_micro_hz =
nom_refresh_rate_micro_hz;
}
core_freesync->map[core_freesync->num_entities].stream = stream; core_freesync->map[core_freesync->num_entities].stream = stream;
core_freesync->map[core_freesync->num_entities].caps = caps; core_freesync->map[core_freesync->num_entities].caps = caps;
...@@ -275,13 +306,6 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync, ...@@ -275,13 +306,6 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
enable_for_video = false; enable_for_video = false;
} }
temp = stream->timing.pix_clk_khz;
temp *= 1000ULL * 1000ULL * 1000ULL;
temp = div_u64(temp, stream->timing.h_total);
temp = div_u64(temp, stream->timing.v_total);
nom_refresh_rate_micro_hz = (unsigned int) temp;
if (caps->supported && if (caps->supported &&
nom_refresh_rate_micro_hz >= caps->min_refresh_in_micro_hz && nom_refresh_rate_micro_hz >= caps->min_refresh_in_micro_hz &&
nom_refresh_rate_micro_hz <= caps->max_refresh_in_micro_hz) nom_refresh_rate_micro_hz <= caps->max_refresh_in_micro_hz)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment