[Intel-gfx] [PATCH 1/4] agp/intel-gtt: steal the last gtt page
Daniel Vetter
daniel.vetter at ffwll.ch
Sun May 9 13:41:23 CEST 2010
This page will be used to check cache coherency on i8xx chips.
Furthermore gem in drm/i915 doesn't use the last page in the gtt
already to prevent pagefaults due to the gpu prefetcher crossing
into unmapped memory. So this page is useless, anyway.
This introduces include/drm/intel-gtt.h. Atm it only contains this
single define. But I've already noticed quite some code duplication
between the intel-agp and the i915 drm module. The idea is that this
new header file can be used to share some code between these two
modules.
Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
drivers/char/agp/intel-gtt.c | 13 +++++++------
drivers/gpu/drm/i915/i915_dma.c | 4 +++-
include/drm/intel-gtt.h | 6 ++++++
3 files changed, 16 insertions(+), 7 deletions(-)
create mode 100644 include/drm/intel-gtt.h
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
--
1.7.1
More information about the Intel-gfx
mailing list