From patchwork Sun Jul 1 15:09:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1144341 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 785523FE4F for ; Sun, 1 Jul 2012 15:10:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B44E9EEBC for ; Sun, 1 Jul 2012 08:10:25 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ey0-f177.google.com (mail-ey0-f177.google.com [209.85.215.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 1DE1C9E75E for ; Sun, 1 Jul 2012 08:09:51 -0700 (PDT) Received: by eaaf11 with SMTP id f11so1882892eaa.36 for ; Sun, 01 Jul 2012 08:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer; bh=QE3764O6kHZ43AiYjzurIy8/8dKOBr7Judq8BBmNlH4=; b=bI2+kzvHtjWubpKvblqWgLvjPHvAfRSXFyUW6bnusKTwtfFOk54G8Xggez+rqTcK3d 1U+D21+kWSXxyMnB7UOHlt1APsx5ZPFFyjTSLiTwz8zf1XY9eLCIcAVm0qLqepOXKyPf JtpL//lBju9lnRpXRqwmMiIZ99zZH4vzk90u8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=QE3764O6kHZ43AiYjzurIy8/8dKOBr7Judq8BBmNlH4=; b=K0TQFqn/z82IS06nN/k0mDYDILdnskYgz5dNcSJys5LfUQG/UsIWkImR1C2MQWzvmh MnSQACkm/ppvUVW2QXablAmawh9WtumRxgYWW3tw9eR5Sppbk0rJxtWa/oi04QF8hTGD riOQd5vZCvyNhjiAW76E2/MNq7rRecnhysUtjhpQt4WdDe9Q3Kvoy8crwtz31NN25xs+ BKQzpFMtdJs41YUBm8qku+b49fJ6ErO8S46PwqfmPGb7rHZQEaYqyY6LD47pikQJ0tvt DluGlTrmGe3OaZizDVZcYpZ1QpSHxBe9quoi3cssc8DONy/EhI7rSJ14ijpd3nM8Uio0 hJzg== Received: by 10.14.40.84 with SMTP id e60mr2371574eeb.75.1341155390802; Sun, 01 Jul 2012 08:09:50 -0700 (PDT) Received: from phenom.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id m46sm25952793eeh.9.2012.07.01.08.09.49 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 01 Jul 2012 08:09:49 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Sun, 1 Jul 2012 17:09:42 +0200 Message-Id: <1341155382-4710-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10 X-Gm-Message-State: ALoCoQl7/foZ3Og1f+pP078Xr7H3Psp2FCZmHhWMilkShjXjnKwrxsH074X8nJCK8CStAKXDJcN6 Cc: Dave Airlie , Daniel Vetter , stable@vger.kernel.org, DRI Development Subject: [Intel-gfx] [PATCH] drm/i915: kick any firmware framebuffers before claiming the gtt 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 Especially vesafb likes to map everything as uc- (yikes), and if that mapping hangs around still while we try to map the gtt as wc the kernel will downgrade our request to uc-, resulting in abyssal performance. Unfortunately we can't do this as early as readon does (i.e. as the first thing we do when initializing the hw) because our fb/mmio space region moves around on a per-gen basis. So I've had to move it below the gtt initialization, but that seems to work, too. The important thing is that we do this before we set up the gtt wc mapping. Now an altogether different question is why people compile their kernels with vesafb enabled, but I guess making things just work isn't bad per se ... v2: - s/radeondrmfb/inteldrmfb/ - fix up error handling v3: Kill #ifdef X86, this is Intel after all. Noticed by Ben Widawsky. v4: Jani Nikula complained about the pointless bool primary initialization. v5: Don't oops if we can't allocate, noticed by Chris Wilson. v6: Resolve conflicts with agp rework and fixup whitespace. This is commit e188719a2891f01b3100d in drm-next. Backport to 3.5 -fixes queue requested by Dave Airlie - due to grub using vesa on fedora their initrd seems to load vesafb before loading the real kms driver. So tons more people actually experience a dead-slow gpu. Hence also the Cc: stable. Cc: Dave Airlie Cc: stable@vger.kernel.org Reported-and-tested-by: "Kilarski, Bernard R" Reviewed-by: Chris Wilson Signed-Off-by: Daniel Vetter --- drivers/gpu/drm/i915/i915_dma.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index f947926..36822b9 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -1401,6 +1401,27 @@ i915_mtrr_setup(struct drm_i915_private *dev_priv, unsigned long base, } } +static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv) +{ + struct apertures_struct *ap; + struct pci_dev *pdev = dev_priv->dev->pdev; + bool primary; + + ap = alloc_apertures(1); + if (!ap) + return; + + ap->ranges[0].base = dev_priv->dev->agp->base; + ap->ranges[0].size = + dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; + primary = + pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; + + remove_conflicting_framebuffers(ap, "inteldrmfb", primary); + + kfree(ap); +} + /** * i915_driver_load - setup chip and create an initial config * @dev: DRM device @@ -1446,6 +1467,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) goto free_priv; } + dev_priv->mm.gtt = intel_gtt_get(); + if (!dev_priv->mm.gtt) { + DRM_ERROR("Failed to initialize GTT\n"); + ret = -ENODEV; + goto put_bridge; + } + + i915_kick_out_firmware_fb(dev_priv); + pci_set_master(dev->pdev); /* overlay on gen2 is broken and can't address above 1G */ @@ -1471,13 +1501,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) goto put_bridge; } - dev_priv->mm.gtt = intel_gtt_get(); - if (!dev_priv->mm.gtt) { - DRM_ERROR("Failed to initialize GTT\n"); - ret = -ENODEV; - goto out_rmmap; - } - aperture_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; dev_priv->mm.gtt_mapping =