[PATCH 12/27] drm/amd/display: sometime VtotalMin less than VTotal (rounding issue)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Charlene Liu <charlene.liu@xxxxxxx>

Change-Id: I1f8de5415aac149d85b73a28fb630c50696a9250
Signed-off-by: Charlene Liu <charlene.liu at amd.com>
Acked-by: Harry Wentland <Harry.Wentland at amd.com>
Reviewed-by: Jordan Lazare <Jordan.Lazare at amd.com>
---
 drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index 2026ef34b11b..7a0731e2dbb0 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -905,7 +905,6 @@ void mod_freesync_notify_mode_change(struct mod_freesync *mod_freesync,
 	core_freesync = MOD_FREESYNC_TO_CORE(mod_freesync);
 
 	for (stream_index = 0; stream_index < num_streams; stream_index++) {
-
 		map_index = map_index_from_stream(core_freesync,
 				streams[stream_index]);
 
@@ -913,11 +912,12 @@ void mod_freesync_notify_mode_change(struct mod_freesync *mod_freesync,
 
 		if (core_freesync->map[map_index].caps->supported) {
 			/* Update the field rate for new timing */
-			state->nominal_refresh_rate_in_micro_hz = 1000000 *
-				div64_u64(div64_u64((streams[stream_index]->
-				timing.pix_clk_khz * 1000),
-				streams[stream_index]->timing.v_total),
-				streams[stream_index]->timing.h_total);
+			unsigned long long temp;
+			temp = streams[stream_index]->timing.pix_clk_khz;
+			temp *= 1000ULL * 1000ULL * 1000ULL;
+			temp = div_u64(temp, streams[stream_index]->timing.h_total);
+			temp = div_u64(temp, streams[stream_index]->timing.v_total);
+			state->nominal_refresh_rate_in_micro_hz = (unsigned int) temp;
 
 			/* Update the stream */
 			update_stream(core_freesync, streams[stream_index]);
-- 
2.10.2



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux