From patchwork Thu Apr 21 21:18:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 725891 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3LLOdGv010533 for ; Thu, 21 Apr 2011 21:24:59 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 761AD9E8BB for ; Thu, 21 Apr 2011 14:24:39 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (server109-228-6-236.live-servers.net [109.228.6.236]) by gabe.freedesktop.org (Postfix) with ESMTP id 6C73C9E852 for ; Thu, 21 Apr 2011 14:18:54 -0700 (PDT) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.66.37; Received: from arrandale.alporthouse.com (unverified [78.156.66.37]) by fireflyinternet.com (Firefly Internet SMTP) with ESMTP id 32744343-1500050 for multiple; Thu, 21 Apr 2011 22:18:39 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 21 Apr 2011 22:18:21 +0100 Message-Id: <1303420712-6369-7-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1303420712-6369-1-git-send-email-chris@chris-wilson.co.uk> References: <1303420712-6369-1-git-send-email-chris@chris-wilson.co.uk> X-Originating-IP: 78.156.66.37 Subject: [Intel-gfx] [PATCH 06/17] drm/i915: Check that the plane points to the pipe's framebuffer before enabling X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 21 Apr 2011 21:24:59 +0000 (UTC) Knut Petersen reported a GPU hang when he left x11perf running overnight. The error state quite clearly indicates that plane A was enabled without being fully setup: PGTBL_ER: 0x00000010 Display A: Invalid GTT PTE Plane [0]: CNTR: c1000000 STRIDE: 00000c80 SIZE: 03ff04ff POS: 00000000 ADDR: 00000000 [That GTT offset on his system being pinned for the ringbuffer.] This is a simple debugging patch to assert that this cannot be so! References: https://bugs.freedesktop.org/show_bug.cgi?id=36246 Signed-off-by: Chris Wilson Reviewed-by: Jesse Barnes --- drivers/gpu/drm/i915/intel_display.c | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 16f38e4..647e492 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -1560,6 +1560,34 @@ static void intel_disable_pipe(struct drm_i915_private *dev_priv, intel_wait_for_pipe_off(dev_priv->dev, pipe); } +/* Check that the display plane points to the pipe's framebuffer. */ +static void assert_fb_bound_to_plane(struct drm_i915_private *dev_priv, + enum pipe pipe, enum plane plane) +{ + struct drm_crtc *crtc; + struct intel_framebuffer *intel_fb; + u32 val, base, size; + + crtc = intel_get_crtc_for_pipe(dev_priv->dev, pipe); + if (WARN(crtc->fb == NULL, + "no framebuffer attached to pipe %c\n", + pipe_name(pipe))) + return; + + intel_fb = to_intel_framebuffer(crtc->fb); + base = intel_fb->obj->gtt_offset; + size = intel_fb->obj->base.size; + + if (dev_priv->info->gen >= 4) + val = I915_READ(DSPSURF(plane)); + else + val = I915_READ(DSPADDR(plane)); + WARN(val < base || val >= base + size, + "mismatching framebuffer for plane %c attached to pipe %c, expected %x-%x found %x\n", + plane_name(plane), pipe_name(pipe), + base, base + size, val); +} + /** * intel_enable_plane - enable a display plane on a given pipe * @dev_priv: i915 private structure @@ -1576,6 +1604,7 @@ static void intel_enable_plane(struct drm_i915_private *dev_priv, /* If the pipe isn't enabled, we can't pump pixels and may hang */ assert_pipe_enabled(dev_priv, pipe); + assert_fb_bound_to_plane(dev_priv, pipe, plane); reg = DSPCNTR(plane); val = I915_READ(reg);