diff mbox series

drm/i915/display: Update vtotal math to address 32b build

Message ID 20240612055203.270550-1-mitulkumar.ajitkumar.golani@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/display: Update vtotal math to address 32b build | expand

Commit Message

Golani, Mitulkumar Ajitkumar June 12, 2024, 5:52 a.m. UTC
Fix vtotal division calculation which works for 32b systems.

Fixes: 1676ecd303ac ("drm/i915: Compute CMRR and calculate vtotal")
Cc: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Cc: Suraj Kandpal <suraj.kandpal@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
---
 drivers/gpu/drm/i915/display/intel_vrr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Kandpal, Suraj June 13, 2024, 4:24 a.m. UTC | #1
Thanks for patches and reviews
Pushed to drm-intel-next

Regards,
Suraj Kandpal

> -----Original Message-----
> From: Intel-gfx-trybot <intel-gfx-trybot-bounces@lists.freedesktop.org> On
> Behalf Of Mitul Golani
> Sent: Wednesday, June 12, 2024 2:07 PM
> To: intel-gfx-trybot@lists.freedesktop.org; intel-gfx@lists.freedesktop.org
> Subject: drm/i915/display: Update vtotal math to address 32b build
> 
> Fix vtotal division calculation which works for 32b systems.
> 
> Fixes: 1676ecd303ac ("drm/i915: Compute CMRR and calculate vtotal")
> Cc: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
> Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> Cc: Suraj Kandpal <suraj.kandpal@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_vrr.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c
> b/drivers/gpu/drm/i915/display/intel_vrr.c
> index 05f67dc9d98d..1e37383e14e7 100644
> --- a/drivers/gpu/drm/i915/display/intel_vrr.c
> +++ b/drivers/gpu/drm/i915/display/intel_vrr.c
> @@ -149,7 +149,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_ULL(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);
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c
index 05f67dc9d98d..1e37383e14e7 100644
--- a/drivers/gpu/drm/i915/display/intel_vrr.c
+++ b/drivers/gpu/drm/i915/display/intel_vrr.c
@@ -149,7 +149,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_ULL(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);