From 7dbe119a0d893565ccdee2e97f9761e9fbe11d51 Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Wed, 3 Oct 2012 17:11:01 -0700 Subject: [PATCH] CHROMIUM: gpu: i915: optimize vblank timeout MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit On the resume path, wait_for_vblank is called 4 times and waits until its timeout. To reduce the delays on that path, let's compute the maximum vblank delay instead of always using the arbitrary 50 ms value. Signed-off-by: Vincent Palatin BUG=chrome-os-partner:13364 TEST=On Link, measure resume time and see a 130ms improvement. Change-Id: I88231de43573432b6d71255f622eb9860fe3c28d Reviewed-on: https://gerrit.chromium.org/gerrit/34624 Reviewed-by: Sameer Nanda Reviewed-by: Stéphane Marchesin Commit-Ready: Vincent Palatin Tested-by: Vincent Palatin --- drivers/gpu/drm/i915/intel_display.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 4cb8dd7bb3b8..db03d8db0dff 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -718,6 +718,9 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe) { struct drm_i915_private *dev_priv = dev->dev_private; int pipestat_reg = PIPESTAT(pipe); + struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; + int timeout = crtc->hwmode.vrefresh ? + DIV_ROUND_UP(1000, crtc->hwmode.vrefresh) : 50; /* Clear existing vblank status. Note this will clear any other * sticky status fields as well. @@ -738,7 +741,7 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe) /* Wait for vblank interrupt bit to set */ if (wait_for(I915_READ(pipestat_reg) & PIPE_VBLANK_INTERRUPT_STATUS, - 50)) + timeout)) DRM_DEBUG_KMS("vblank wait timed out\n"); } -- 2.20.1