drm/amd/display: Check for Zero Range in FreeSync Calc
authorEric Cook <Eric.Cook@amd.com>
Wed, 26 Apr 2017 15:51:38 +0000 (11:51 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Sep 2017 22:06:43 +0000 (18:06 -0400)
-check for min/max range in freesync calculation and handle it accordingly

Signed-off-by: Eric <eric.cook@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/modules/freesync/freesync.c

index d3d57008271b4eb178039c043fe721eb861bf8f4..009cb797bcfa7213bd24692afb3920cdee979ce2 100644 (file)
@@ -363,6 +363,21 @@ static void calc_freesync_range(struct core_freesync *core_freesync,
        unsigned int index = map_index_from_stream(core_freesync, stream);
        uint32_t vtotal = stream->timing.v_total;
 
+       if ((min_refresh_in_uhz == 0) || (max_refresh_in_uhz == 0)) {
+               state->freesync_range.min_refresh =
+                               state->nominal_refresh_rate_in_micro_hz;
+               state->freesync_range.max_refresh =
+                               state->nominal_refresh_rate_in_micro_hz;
+
+               state->freesync_range.max_frame_duration = 0;
+               state->freesync_range.min_frame_duration = 0;
+
+               state->freesync_range.vmax = vtotal;
+               state->freesync_range.vmin = vtotal;
+
+               return;
+       }
+
        min_frame_duration_in_ns = ((unsigned int) (div64_u64(
                                        (1000000000ULL * 1000000),
                                        max_refresh_in_uhz)));