From patchwork Mon Mar 22 18:17:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 87468 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2MIHsrQ009663 for ; Mon, 22 Mar 2010 18:18:29 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD42A9EF18; Mon, 22 Mar 2010 11:17:53 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from outbound-mail-158.bluehost.com (outbound-mail-158.bluehost.com [67.222.39.38]) by gabe.freedesktop.org (Postfix) with SMTP id 22A829EEF8 for ; Mon, 22 Mar 2010 11:17:50 -0700 (PDT) Received: (qmail 2423 invoked by uid 0); 22 Mar 2010 18:17:50 -0000 Received: from unknown (HELO box514.bluehost.com) (74.220.219.114) by cpoproxy2.bluehost.com with SMTP; 22 Mar 2010 18:17:49 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=virtuousgeek.org; h=Received:Date:From:To:Subject:Message-ID:X-Mailer:Mime-Version:Content-Type:Content-Transfer-Encoding:X-Identified-User; b=OJID9FUnBOPC1fnCwwxCKNOx2gq0vmcO3CaEDqjc7siEP05Ck5uDfU+CDsSbWGuMCbZXo5ufHVgBeD1rzBN66GFAHduBUsDgsbceiOeDiDC30XM26T4RHiHa+r9TwhlF; Received: from [75.110.194.140] (helo=jbarnes-piketon) by box514.bluehost.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1NtmCD-00066F-C8 for intel-gfx@lists.freedesktop.org; Mon, 22 Mar 2010 12:17:49 -0600 Date: Mon, 22 Mar 2010 11:17:46 -0700 From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Message-ID: <20100322111746.01f21241@jbarnes-piketon> X-Mailer: Claws Mail 3.7.2 (GTK+ 2.18.3; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 75.110.194.140 authed with jbarnes@virtuousgeek.org} Subject: [Intel-gfx] [PATCH] drm/agp: agp-intel/i915: trim stolen space to 16M 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: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 22 Mar 2010 18:18:29 +0000 (UTC) diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index c1c07a2..5a2be66 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c @@ -13,6 +13,10 @@ int intel_agp_enabled; EXPORT_SYMBOL(intel_agp_enabled); +/* Max amount of stolen space, anything above will be returned to Linux */ +int intel_max_stolen = 16 * 1024 * 1024; +EXPORT_SYMBOL(intel_max_stolen); + /* * If we have Intel graphics, we're not going to have anything other than * an Intel IOMMU. So make the correct use of the PCI DMA API contingent @@ -869,7 +873,13 @@ static void intel_i830_init_gtt_entries(void) break; } } - if (gtt_entries > 0) { + + if (!local && gtt_entries > intel_max_stolen) { + dev_info(&agp_bridge->dev->dev, + "detected %dK stolen memory, trimming to %dK\n", + gtt_entries / KB(1), intel_max_stolen / KB(1)); + gtt_entries = intel_max_stolen / KB(4); + } else if (gtt_entries > 0) { dev_info(&agp_bridge->dev->dev, "detected %dK %s memory\n", gtt_entries / KB(1), local ? "local" : "stolen"); gtt_entries /= KB(4); diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index b63638a..6a428b2 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -38,6 +38,8 @@ #include #include +extern int intel_max_stolen; /* from AGP driver */ + /* Really want an OS-independent resettable timer. Would like to have * this loop run for (eg) 3 sec, but have the timer reset every time * the head pointer changes, so that EBUSY only happens if the ring @@ -1608,6 +1610,12 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) if (ret) goto out_iomapfree; + if (prealloc_size > intel_max_stolen) { + DRM_INFO("detected %dM stolen memory, trimming to %dM\n", + prealloc_size >> 20, intel_max_stolen >> 20); + prealloc_size = intel_max_stolen; + } + dev_priv->wq = create_singlethread_workqueue("i915"); if (dev_priv->wq == NULL) { DRM_ERROR("Failed to create our workqueue.\n");