From: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [RFC] drm/i915/display: Update vtotal math to address 32b build
Date: Wed, 12 Jun 2024 00:02:08 +0530 [thread overview]
Message-ID: <20240611183208.159878-1-mitulkumar.ajitkumar.golani@intel.com> (raw)
Fix few divisions which may not work on 32b builds.
Use DIV_ROUND_UP, with that expecting deviate params
from +/- 1 accuracy in value.
Fixes: 1676ecd303ac ("drm/i915: Compute CMRR and calculate vtotal")
Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
---
drivers/gpu/drm/i915/display/intel_vrr.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c
index 05f67dc9d98d..5112961f6964 100644
--- a/drivers/gpu/drm/i915/display/intel_vrr.c
+++ b/drivers/gpu/drm/i915/display/intel_vrr.c
@@ -122,10 +122,11 @@ is_cmrr_frac_required(struct intel_crtc_state *crtc_state)
actual_refresh_k =
drm_mode_vrefresh(adjusted_mode) * FIXED_POINT_PRECISION;
- pixel_clock_per_line =
- adjusted_mode->crtc_clock * 1000 / adjusted_mode->crtc_htotal;
+ pixel_clock_per_line = DIV_ROUND_UP(adjusted_mode->crtc_clock * 1000,
+ adjusted_mode->crtc_htotal);
calculated_refresh_k =
- pixel_clock_per_line * FIXED_POINT_PRECISION / adjusted_mode->crtc_vtotal;
+ DIV_ROUND_UP(pixel_clock_per_line * FIXED_POINT_PRECISION,
+ adjusted_mode->crtc_vtotal);
if ((actual_refresh_k - calculated_refresh_k) < CMRR_PRECISION_TOLERANCE)
return false;
@@ -149,7 +150,8 @@ cmrr_get_vtotal(struct intel_crtc_state *crtc_state, bool video_mode_required)
crtc_state->cmrr.cmrr_n =
desired_refresh_rate * adjusted_mode->crtc_htotal * multiplier_n;
- vtotal = (adjusted_mode->crtc_clock * 1000 * multiplier_n) / crtc_state->cmrr.cmrr_n;
+ vtotal = DIV_ROUND_UP(adjusted_mode->crtc_clock * 1000 * multiplier_n,
+ crtc_state->cmrr.cmrr_n);
adjusted_pixel_rate = adjusted_mode->crtc_clock * 1000 * multiplier_m;
crtc_state->cmrr.cmrr_m = do_div(adjusted_pixel_rate, crtc_state->cmrr.cmrr_n);
--
2.45.2
next reply other threads:[~2024-06-11 18:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-11 18:32 Mitul Golani [this message]
2024-06-11 21:29 ` ✓ CI.Patch_applied: success for drm/i915/display: Update vtotal math to address 32b build Patchwork
2024-06-11 21:29 ` ✓ CI.checkpatch: " Patchwork
2024-06-11 21:30 ` ✓ CI.KUnit: " Patchwork
2024-06-11 21:42 ` ✓ CI.Build: " Patchwork
2024-06-11 21:45 ` ✗ CI.Hooks: failure " Patchwork
2024-06-12 4:16 ` Lucas De Marchi
2024-06-11 21:47 ` ✗ CI.checksparse: warning " Patchwork
2024-06-11 22:09 ` ✓ CI.BAT: success " Patchwork
2024-06-12 3:27 ` ✗ CI.FULL: failure " Patchwork
2024-06-12 4:32 ` [RFC] " Lucas De Marchi
2024-06-12 6:31 ` Golani, Mitulkumar Ajitkumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240611183208.159878-1-mitulkumar.ajitkumar.golani@intel.com \
--to=mitulkumar.ajitkumar.golani@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox