diff options
| -rw-r--r-- | drivers/char/agp/intel-gtt.c | 11 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 8 |
2 files changed, 18 insertions, 1 deletions
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index f804325a735e..d22ffb811bf2 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
| @@ -25,6 +25,10 @@ | |||
| 25 | #define USE_PCI_DMA_API 1 | 25 | #define USE_PCI_DMA_API 1 |
| 26 | #endif | 26 | #endif |
| 27 | 27 | ||
| 28 | /* Max amount of stolen space, anything above will be returned to Linux */ | ||
| 29 | int intel_max_stolen = 32 * 1024 * 1024; | ||
| 30 | EXPORT_SYMBOL(intel_max_stolen); | ||
| 31 | |||
| 28 | static const struct aper_size_info_fixed intel_i810_sizes[] = | 32 | static const struct aper_size_info_fixed intel_i810_sizes[] = |
| 29 | { | 33 | { |
| 30 | {64, 16384, 4}, | 34 | {64, 16384, 4}, |
| @@ -713,7 +717,12 @@ static void intel_i830_init_gtt_entries(void) | |||
| 713 | break; | 717 | break; |
| 714 | } | 718 | } |
| 715 | } | 719 | } |
| 716 | if (gtt_entries > 0) { | 720 | if (!local && gtt_entries > intel_max_stolen) { |
| 721 | dev_info(&agp_bridge->dev->dev, | ||
| 722 | "detected %dK stolen memory, trimming to %dK\n", | ||
| 723 | gtt_entries / KB(1), intel_max_stolen / KB(1)); | ||
| 724 | gtt_entries = intel_max_stolen / KB(4); | ||
| 725 | } else if (gtt_entries > 0) { | ||
| 717 | dev_info(&agp_bridge->dev->dev, "detected %dK %s memory\n", | 726 | dev_info(&agp_bridge->dev->dev, "detected %dK %s memory\n", |
| 718 | gtt_entries / KB(1), local ? "local" : "stolen"); | 727 | gtt_entries / KB(1), local ? "local" : "stolen"); |
| 719 | gtt_entries /= KB(4); | 728 | gtt_entries /= KB(4); |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 14054c051e40..f19ffe87af3c 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
| @@ -41,6 +41,8 @@ | |||
| 41 | #include <linux/vga_switcheroo.h> | 41 | #include <linux/vga_switcheroo.h> |
| 42 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
| 43 | 43 | ||
| 44 | extern int intel_max_stolen; /* from AGP driver */ | ||
| 45 | |||
| 44 | /** | 46 | /** |
| 45 | * Sets up the hardware status page for devices that need a physical address | 47 | * Sets up the hardware status page for devices that need a physical address |
| 46 | * in the register. | 48 | * in the register. |
| @@ -2106,6 +2108,12 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
| 2106 | if (ret) | 2108 | if (ret) |
| 2107 | goto out_iomapfree; | 2109 | goto out_iomapfree; |
| 2108 | 2110 | ||
| 2111 | if (prealloc_size > intel_max_stolen) { | ||
| 2112 | DRM_INFO("detected %dM stolen memory, trimming to %dM\n", | ||
| 2113 | prealloc_size >> 20, intel_max_stolen >> 20); | ||
| 2114 | prealloc_size = intel_max_stolen; | ||
| 2115 | } | ||
| 2116 | |||
| 2109 | dev_priv->wq = create_singlethread_workqueue("i915"); | 2117 | dev_priv->wq = create_singlethread_workqueue("i915"); |
| 2110 | if (dev_priv->wq == NULL) { | 2118 | if (dev_priv->wq == NULL) { |
| 2111 | DRM_ERROR("Failed to create our workqueue.\n"); | 2119 | DRM_ERROR("Failed to create our workqueue.\n"); |
