drm/amd/display: Make sure v_total_min and max not less than v_total.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Yongqiang Sun
2017-04-21 11:00:43 -04:00
committed by Alex Deucher
parent 15350179f2
commit 6c626ffb1b
3 changed files with 16 additions and 4 deletions

View File

@@ -347,6 +347,7 @@ static void calc_vmin_vmax(struct core_freesync *core_freesync,
{
unsigned int min_frame_duration_in_ns = 0, max_frame_duration_in_ns = 0;
unsigned int index = map_index_from_stream(core_freesync, stream);
uint32_t vtotal = stream->timing.v_total;
min_frame_duration_in_ns = ((unsigned int) (div64_u64(
(1000000000ULL * 1000000),
@@ -362,6 +363,17 @@ static void calc_vmin_vmax(struct core_freesync *core_freesync,
*vmin = div64_u64(div64_u64(((unsigned long long)(
min_frame_duration_in_ns) * stream->timing.pix_clk_khz),
stream->timing.h_total), 1000000);
/* In case of 4k free sync monitor, vmin or vmax cannot be less than vtotal */
if (*vmin < vtotal) {
ASSERT(false);
*vmin = vtotal;
}
if (*vmax < vtotal) {
ASSERT(false);
*vmax = vtotal;
}
}
static void calc_v_total_from_duration(const struct dc_stream *stream,