From patchwork Fri Sep 28 11:25:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 1518741 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 6C4263FE80 for ; Fri, 28 Sep 2012 11:26:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 30A0EA0BC3 for ; Fri, 28 Sep 2012 04:26:10 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (unknown [109.228.6.236]) by gabe.freedesktop.org (Postfix) with ESMTP id B50BE9E844 for ; Fri, 28 Sep 2012 04:25:55 -0700 (PDT) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.73.22; Received: from arrandale.alporthouse.com (unverified [78.156.73.22]) by fireflyinternet.com (Firefly Internet SMTP) with ESMTP id 123025976-1500050 for multiple; Fri, 28 Sep 2012 12:25:41 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 28 Sep 2012 12:25:36 +0100 Message-Id: <1348831536-22546-1-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 1.7.10.4 X-Originating-IP: 78.156.73.22 Subject: [Intel-gfx] [PATCH] drm/i915: Call drm_handle_vblank() after processing pending pageflips X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org When we process a pageflip completion, we append an event to the vblank queue. That queue is processed by drm_handle_vblank() and so by calling drm_handle_vblank() prior to processing the pageflips, we incur an extra frame of latency in reporting the flip event. Signed-off-by: Chris Wilson Reviewed-by: Rodrigo Vivi --- drivers/gpu/drm/i915/i915_irq.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 6361276..e18e56b 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -564,13 +564,12 @@ static irqreturn_t valleyview_irq_handler(DRM_IRQ_ARGS) spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); for_each_pipe(pipe) { - if (pipe_stats[pipe] & PIPE_VBLANK_INTERRUPT_STATUS) - drm_handle_vblank(dev, pipe); - if (pipe_stats[pipe] & PLANE_FLIPDONE_INT_STATUS_VLV) { intel_prepare_page_flip(dev, pipe); intel_finish_page_flip(dev, pipe); } + if (pipe_stats[pipe] & PIPE_VBLANK_INTERRUPT_STATUS) + drm_handle_vblank(dev, pipe); } /* Consume port. Then clear IIR or we'll miss events */ @@ -2220,22 +2219,22 @@ static irqreturn_t i8xx_irq_handler(DRM_IRQ_ARGS) if (iir & I915_USER_INTERRUPT) notify_ring(dev, &dev_priv->ring[RCS]); - if (pipe_stats[0] & PIPE_VBLANK_INTERRUPT_STATUS && - drm_handle_vblank(dev, 0)) { + if (pipe_stats[0] & PIPE_VBLANK_INTERRUPT_STATUS) { if (iir & I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT) { intel_prepare_page_flip(dev, 0); intel_finish_page_flip(dev, 0); flip_mask &= ~I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT; } + drm_handle_vblank(dev, 0); } - if (pipe_stats[1] & PIPE_VBLANK_INTERRUPT_STATUS && - drm_handle_vblank(dev, 1)) { + if (pipe_stats[1] & PIPE_VBLANK_INTERRUPT_STATUS) { if (iir & I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT) { intel_prepare_page_flip(dev, 1); intel_finish_page_flip(dev, 1); flip_mask &= ~I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT; } + drm_handle_vblank(dev, 1); } iir = new_iir; @@ -2418,13 +2417,13 @@ static irqreturn_t i915_irq_handler(DRM_IRQ_ARGS) int plane = pipe; if (IS_MOBILE(dev)) plane = !plane; - if (pipe_stats[pipe] & PIPE_VBLANK_INTERRUPT_STATUS && - drm_handle_vblank(dev, pipe)) { + if (pipe_stats[pipe] & PIPE_VBLANK_INTERRUPT_STATUS) { if (iir & flip[plane]) { intel_prepare_page_flip(dev, plane); intel_finish_page_flip(dev, pipe); flip_mask &= ~flip[plane]; } + drm_handle_vblank(dev, pipe); } if (pipe_stats[pipe] & PIPE_LEGACY_BLC_EVENT_STATUS) @@ -2662,17 +2661,16 @@ static irqreturn_t i965_irq_handler(DRM_IRQ_ARGS) intel_prepare_page_flip(dev, 1); for_each_pipe(pipe) { - if (pipe_stats[pipe] & PIPE_START_VBLANK_INTERRUPT_STATUS && - drm_handle_vblank(dev, pipe)) { + if (pipe_stats[pipe] & PIPE_START_VBLANK_INTERRUPT_STATUS) { i915_pageflip_stall_check(dev, pipe); intel_finish_page_flip(dev, pipe); + drm_handle_vblank(dev, pipe); } if (pipe_stats[pipe] & PIPE_LEGACY_BLC_EVENT_STATUS) blc_event = true; } - if (blc_event || (iir & I915_ASLE_INTERRUPT)) intel_opregion_asle_intr(dev);