aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
diff options
context:
space:
mode:
authorAnthony Koo <Anthony.Koo@amd.com>2018-04-06 13:55:39 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-08-27 12:10:54 -0400
commit953c2901c860da16963b48db8344bf0fd5b03040 (patch)
tree2eccf98642587febc089fe36a39649cca9ffb056 /drivers/gpu/drm/amd/display/modules/freesync/freesync.c
parent9410a3776bbf1e172cfdb9f8b771a5ce64081a51 (diff)
drm/amd/display: refactor vupdate interrupt registration
We only need to register once OS calls the interrupt control. Also, if we are entering static screen mode, disable after ramping is done. Disable shall be done via timer of 2 seconds regardless of ramping complete or not, just to simplify. Also, ramp to mid instead of min, due to better flicker performance... Signed-off-by: Anthony Koo <Anthony.Koo@amd.com> Reviewed-by: Aric Cyr <Aric.Cyr@amd.com> Acked-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/modules/freesync/freesync.c')
-rw-r--r--drivers/gpu/drm/amd/display/modules/freesync/freesync.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index daad60ec1ce3..349387eb9fe6 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -109,12 +109,6 @@ static unsigned int calc_duration_in_us_from_v_total(
109 * 1000) * stream->timing.h_total, 109 * 1000) * stream->timing.h_total,
110 stream->timing.pix_clk_khz)); 110 stream->timing.pix_clk_khz));
111 111
112 if (duration_in_us < in_vrr->min_duration_in_us)
113 duration_in_us = in_vrr->min_duration_in_us;
114
115 if (duration_in_us > in_vrr->max_duration_in_us)
116 duration_in_us = in_vrr->max_duration_in_us;
117
118 return duration_in_us; 112 return duration_in_us;
119} 113}
120 114
@@ -230,10 +224,9 @@ static void update_v_total_for_static_ramp(
230 } 224 }
231 } 225 }
232 226
233 v_total = calc_v_total_from_duration(stream, 227 v_total = div64_u64(div64_u64(((unsigned long long)(
234 in_out_vrr, 228 current_duration_in_us) * stream->timing.pix_clk_khz),
235 current_duration_in_us); 229 stream->timing.h_total), 1000);
236
237 230
238 in_out_vrr->adjust.v_total_min = v_total; 231 in_out_vrr->adjust.v_total_min = v_total;
239 in_out_vrr->adjust.v_total_max = v_total; 232 in_out_vrr->adjust.v_total_max = v_total;
@@ -702,7 +695,11 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync,
702 } else if (in_out_vrr->state == VRR_STATE_ACTIVE_FIXED) { 695 } else if (in_out_vrr->state == VRR_STATE_ACTIVE_FIXED) {
703 in_out_vrr->fixed.target_refresh_in_uhz = 696 in_out_vrr->fixed.target_refresh_in_uhz =
704 in_out_vrr->min_refresh_in_uhz; 697 in_out_vrr->min_refresh_in_uhz;
705 if (in_out_vrr->fixed.ramping_active) { 698 if (in_out_vrr->fixed.ramping_active &&
699 in_out_vrr->fixed.fixed_active) {
700 /* Do not update vtotals if ramping is already active
701 * in order to continue ramp from current refresh.
702 */
706 in_out_vrr->fixed.fixed_active = true; 703 in_out_vrr->fixed.fixed_active = true;
707 } else { 704 } else {
708 in_out_vrr->fixed.fixed_active = true; 705 in_out_vrr->fixed.fixed_active = true;