Commit 2233ec72 authored by Anthony Koo's avatar Anthony Koo Committed by Alex Deucher

drm/amd/display: Add regkey for DRR control for internal panel

Also need to change default to off
Signed-off-by: default avatarAnthony Koo <anthony.koo@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d65359d5
...@@ -188,7 +188,6 @@ struct dc_debug { ...@@ -188,7 +188,6 @@ struct dc_debug {
bool disable_dmcu; bool disable_dmcu;
bool disable_psr; bool disable_psr;
bool force_abm_enable; bool force_abm_enable;
bool no_static_for_external_dp;
}; };
struct dc { struct dc {
......
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
#define FREESYNC_REGISTRY_NAME "freesync_v1" #define FREESYNC_REGISTRY_NAME "freesync_v1"
#define FREESYNC_NO_STATIC_FOR_EXTERNAL_DP_REGKEY "DalFreeSyncNoStaticForExternalDp"
#define FREESYNC_NO_STATIC_FOR_INTERNAL_REGKEY "DalFreeSyncNoStaticForInternal"
struct gradual_static_ramp { struct gradual_static_ramp {
bool ramp_is_active; bool ramp_is_active;
bool ramp_direction_is_up; bool ramp_direction_is_up;
...@@ -114,7 +118,8 @@ struct freesync_entity { ...@@ -114,7 +118,8 @@ struct freesync_entity {
}; };
struct freesync_registry_options { struct freesync_registry_options {
unsigned int min_refresh_from_edid; bool drr_external_supported;
bool drr_internal_supported;
}; };
struct core_freesync { struct core_freesync {
...@@ -176,9 +181,19 @@ struct mod_freesync *mod_freesync_create(struct dc *dc) ...@@ -176,9 +181,19 @@ struct mod_freesync *mod_freesync_create(struct dc *dc)
NULL, NULL, 0, &flag); NULL, NULL, 0, &flag);
flag.save_per_edid = false; flag.save_per_edid = false;
flag.save_per_link = false; flag.save_per_link = false;
if (dm_read_persistent_data(core_dc->ctx, NULL, NULL, if (dm_read_persistent_data(core_dc->ctx, NULL, NULL,
"DalDrrSupport", &data, sizeof(data), &flag)) { FREESYNC_NO_STATIC_FOR_INTERNAL_REGKEY,
core_freesync->opts.min_refresh_from_edid = data; &data, sizeof(data), &flag)) {
core_freesync->opts.drr_internal_supported =
(data & 1) ? false : true;
}
if (dm_read_persistent_data(core_dc->ctx, NULL, NULL,
FREESYNC_NO_STATIC_FOR_EXTERNAL_DP_REGKEY,
&data, sizeof(data), &flag)) {
core_freesync->opts.drr_external_supported =
(data & 1) ? false : true;
} }
return &core_freesync->public; return &core_freesync->public;
...@@ -236,7 +251,7 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync, ...@@ -236,7 +251,7 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
struct core_freesync *core_freesync = NULL; struct core_freesync *core_freesync = NULL;
int persistent_freesync_enable = 0; int persistent_freesync_enable = 0;
struct persistent_data_flag flag; struct persistent_data_flag flag;
unsigned int nom_refresh_rate_micro_hz; unsigned int nom_refresh_rate_uhz;
unsigned long long temp; unsigned long long temp;
if (mod_freesync == NULL) if (mod_freesync == NULL)
...@@ -258,20 +273,7 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync, ...@@ -258,20 +273,7 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
temp = div_u64(temp, stream->timing.h_total); temp = div_u64(temp, stream->timing.h_total);
temp = div_u64(temp, stream->timing.v_total); temp = div_u64(temp, stream->timing.v_total);
nom_refresh_rate_micro_hz = (unsigned int) temp; nom_refresh_rate_uhz = (unsigned int) temp;
if (core_freesync->opts.min_refresh_from_edid != 0 &&
dc_is_embedded_signal(stream->sink->sink_signal)
&& (nom_refresh_rate_micro_hz -
core_freesync->opts.min_refresh_from_edid *
1000000) >= 10000000) {
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;
...@@ -311,8 +313,8 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync, ...@@ -311,8 +313,8 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
} }
if (caps->supported && if (caps->supported &&
nom_refresh_rate_micro_hz >= caps->min_refresh_in_micro_hz && nom_refresh_rate_uhz >= caps->min_refresh_in_micro_hz &&
nom_refresh_rate_micro_hz <= caps->max_refresh_in_micro_hz) nom_refresh_rate_uhz <= caps->max_refresh_in_micro_hz)
core_stream->public.ignore_msa_timing_param = 1; core_stream->public.ignore_msa_timing_param = 1;
core_freesync->num_entities++; core_freesync->num_entities++;
...@@ -865,6 +867,11 @@ void mod_freesync_update_state(struct mod_freesync *mod_freesync, ...@@ -865,6 +867,11 @@ void mod_freesync_update_state(struct mod_freesync *mod_freesync,
unsigned int map_index = map_index_from_stream(core_freesync, unsigned int map_index = map_index_from_stream(core_freesync,
streams[stream_index]); streams[stream_index]);
bool is_embedded = dc_is_embedded_signal(
streams[stream_index]->sink->sink_signal);
struct freesync_registry_options *opts = &core_freesync->opts;
state = &core_freesync->map[map_index].state; state = &core_freesync->map[map_index].state;
switch (freesync_params->state){ switch (freesync_params->state){
...@@ -875,25 +882,24 @@ void mod_freesync_update_state(struct mod_freesync *mod_freesync, ...@@ -875,25 +882,24 @@ void mod_freesync_update_state(struct mod_freesync *mod_freesync,
freesync_params->windowed_fullscreen; freesync_params->windowed_fullscreen;
break; break;
case FREESYNC_STATE_STATIC_SCREEN: case FREESYNC_STATE_STATIC_SCREEN:
/* Static screen ramp is only enabled for embedded /* Static screen ramp is disabled by default, but can
* panels. Also change core variables only if there * be enabled through regkey.
* is a change.
*/ */
if ((dc_is_embedded_signal( if ((is_embedded && opts->drr_internal_supported) ||
streams[stream_index]->sink->sink_signal) || (!is_embedded && opts->drr_external_supported))
core_freesync->map[map_index].caps->
no_static_for_external_dp == false) &&
state->static_screen !=
freesync_params->enable) {
/* Change the state flag */ if (state->static_screen !=
state->static_screen = freesync_params->enable; freesync_params->enable) {
/* Change static screen ramp variables */ /* Change the state flag */
set_static_ramp_variables(core_freesync, state->static_screen =
freesync_params->enable;
/* Update static screen ramp */
set_static_ramp_variables(core_freesync,
map_index, map_index,
freesync_params->enable); freesync_params->enable);
} }
/* We program the ramp starting next VUpdate */ /* We program the ramp starting next VUpdate */
break; break;
case FREESYNC_STATE_VIDEO: case FREESYNC_STATE_VIDEO:
......
...@@ -88,7 +88,6 @@ struct mod_freesync_caps { ...@@ -88,7 +88,6 @@ struct mod_freesync_caps {
unsigned int max_refresh_in_micro_hz; unsigned int max_refresh_in_micro_hz;
bool btr_supported; bool btr_supported;
bool no_static_for_external_dp;
}; };
struct mod_freesync_params { struct mod_freesync_params {
......
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