drm/i915: Round up when calculating display bandwidth requirements
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 3 Mar 2022 19:12:04 +0000 (21:12 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 21 Mar 2022 15:55:39 +0000 (17:55 +0200)
We should round up when doing bandwidth calculations to make sure
our estimates don't fall short of the actual number.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220303191207.27931-7-ville.syrjala@linux.intel.com
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
drivers/gpu/drm/i915/display/intel_bw.c

index e991949..8155f23 100644 (file)
@@ -638,7 +638,7 @@ static unsigned int intel_bw_data_rate(struct drm_i915_private *dev_priv,
                data_rate += bw_state->data_rate[pipe];
 
        if (DISPLAY_VER(dev_priv) >= 13 && intel_vtd_active(dev_priv))
-               data_rate = data_rate * 105 / 100;
+               data_rate = DIV_ROUND_UP(data_rate * 105, 100);
 
        return data_rate;
 }
@@ -763,7 +763,7 @@ int intel_bw_calc_min_cdclk(struct intel_atomic_state *state)
                }
        }
 
-       new_bw_state->min_cdclk = max_bw / 64;
+       new_bw_state->min_cdclk = DIV_ROUND_UP(max_bw, 64);
 
        if (new_bw_state->min_cdclk != old_bw_state->min_cdclk) {
                int ret = intel_atomic_lock_global_state(&new_bw_state->base);