Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abfc00b5 authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Daniel Vetter
Browse files

drm/i915: Simplify VLV drain latency computation



The current drain lantency computation relies on hardcoded limits to
determine when the to use the low vs. high precision multiplier.
Rewrite the code to use a more straightforward approach.

Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 12030516
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -755,12 +755,15 @@ static bool vlv_compute_drain_latency(struct drm_crtc *crtc,
		return false;

	entries = DIV_ROUND_UP(clock, 1000) * pixel_size;
	if (IS_CHERRYVIEW(dev))
		*prec_mult = (entries > 32) ? 16 : 8;
	else
		*prec_mult = (entries > 128) ? 64 : 32;

	*prec_mult = IS_CHERRYVIEW(dev) ? 16 : 64;
	*drain_latency = (64 * (*prec_mult) * 4) / entries;

	if (*drain_latency > DRAIN_LATENCY_MASK) {
		*prec_mult /= 2;
		*drain_latency = (64 * (*prec_mult) * 4) / entries;
	}

	if (*drain_latency > DRAIN_LATENCY_MASK)
		*drain_latency = DRAIN_LATENCY_MASK;