Commit a8a2e134 authored by Vladimir Stempen's avatar Vladimir Stempen Committed by Alex Deucher

drm/amd/display: Fix 64 bit modulus operation using div64 API

[why]
Synchronization displays with different timings feature uses
reminder of 64 bit division (modulus operator) , which is not
supported by 32 bit platforms

[how]
Use div64 API for 64 bit modulus
Signed-off-by: default avatarVladimir Stempen <vladimir.stempen@amd.com>
Tested-by: Bindu Ramamurthy<bindu.r@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 783bf403
...@@ -1893,16 +1893,21 @@ uint64_t reduceSizeAndFraction( ...@@ -1893,16 +1893,21 @@ uint64_t reduceSizeAndFraction(
num = *numerator; num = *numerator;
denom = *denominator; denom = *denominator;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
uint32_t num_reminder, denom_reminder;
uint64_t num_result, denom_result;
if (checkUint32Bounary && if (checkUint32Bounary &&
num <= max_int32 && denom <= max_int32) { num <= max_int32 && denom <= max_int32) {
ret = true; ret = true;
break; break;
} }
while (num % prime_numbers[i] == 0 && do {
denom % prime_numbers[i] == 0) { num_result = div_u64_rem(num, prime_numbers[i], &num_reminder);
num = div_u64(num, prime_numbers[i]); denom_result = div_u64_rem(denom, prime_numbers[i], &denom_reminder);
denom = div_u64(denom, prime_numbers[i]); if (num_reminder == 0 && denom_reminder == 0) {
num = num_result;
denom = denom_result;
} }
} while (num_reminder == 0 && denom_reminder == 0);
} }
*numerator = num; *numerator = num;
*denominator = denom; *denominator = denom;
......
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