diff mbox

[1/4] agp/intel-gtt: steal the last gtt page

Message ID 1273405286-3560-2-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State Deferred, archived
Headers show

Commit Message

Daniel Vetter May 9, 2010, 11:41 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index f7793ec..eec043b 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -24,6 +24,7 @@ 
 #include <asm/smp.h>
 #include "agp.h"
 #include "intel-agp.h"
+#include <drm/intel-gtt.h>
 
 /*
  * If we have Intel graphics, we're not going to have anything other than
@@ -37,9 +38,9 @@ 
 
 static const struct aper_size_info_fixed intel_i810_sizes[] =
 {
-	{64, 16384, 4},
+	{64, 16384 - I830_CC_DANCE_PAGES, 4},
 	/* The 32M mode still requires a 64k gatt */
-	{32, 8192, 4}
+	{32, 8192 - I830_CC_DANCE_PAGES, 4}
 };
 
 #define AGP_DCACHE_MEMORY	1
@@ -489,11 +490,11 @@  static unsigned long intel_i810_mask_memory(struct agp_bridge_data *bridge,
 
 static struct aper_size_info_fixed intel_i830_sizes[] =
 {
-	{128, 32768, 5},
+	{128, 32768 - I830_CC_DANCE_PAGES, 5},
 	/* The 64M mode still requires a 128k gatt */
-	{64, 16384, 5},
-	{256, 65536, 6},
-	{512, 131072, 7},
+	{64, 16384 - I830_CC_DANCE_PAGES, 5},
+	{256, 65536 - I830_CC_DANCE_PAGES, 6},
+	{512, 131072 - I830_CC_DANCE_PAGES, 7},
 };
 
 static void intel_i830_init_gtt_entries(void)
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 851a2f8..3e16938 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -39,6 +39,7 @@ 
 #include <linux/pnp.h>
 #include <linux/vga_switcheroo.h>
 #include <linux/slab.h>
+#include <drm/intel-gtt.h>
 
 /* 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
@@ -1448,7 +1449,8 @@  static int i915_load_modeset_init(struct drm_device *dev,
 	 * at the last page of the aperture.  One page should be enough to
 	 * keep any prefetching inside of the aperture.
 	 */
-	i915_gem_do_init(dev, prealloc_size, agp_size - 4096);
+	i915_gem_do_init(dev, prealloc_size,
+			 agp_size - I830_CC_DANCE_PAGES*4096);
 
 	mutex_lock(&dev->struct_mutex);
 	ret = i915_gem_init_ringbuffer(dev);
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h
new file mode 100644
index 0000000..6cec6d2
--- /dev/null
+++ b/include/drm/intel-gtt.h
@@ -0,0 +1,6 @@ 
+/* Header file to share declarations between the intel-agp module and the i915
+ * drm module
+ */
+
+/* This denotes how many pages intel-gtt steals at the end of the gart. */
+#define I830_CC_DANCE_PAGES 1