All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH 1/4] agp/intel-gtt: steal the last gtt page
Date: Sun,  9 May 2010 13:41:23 +0200	[thread overview]
Message-ID: <1273405286-3560-2-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1273405286-3560-1-git-send-email-daniel.vetter@ffwll.ch>

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@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

  reply	other threads:[~2010-05-09 11:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-09 11:41 [PATCH 0/4] gtt cache coherency checker for i830 class hw Daniel Vetter
2010-05-09 11:41 ` Daniel Vetter [this message]
2010-05-09 11:41 ` [PATCH 2/4] drm/i915: add locking around chipset flush Daniel Vetter
2010-05-09 11:41 ` [PATCH 3/4] agp/intel-gtt: check cache-coherency on i830 class chipsets Daniel Vetter
2010-05-09 11:41 ` [PATCH 4/4] agp/intel-gtt: extract mch buffer flush in i830 chipset flush Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1273405286-3560-2-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.