From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: [PATCH 1/4] agp/intel-gtt: steal the last gtt page Date: Sun, 9 May 2010 13:41:23 +0200 Message-ID: <1273405286-3560-2-git-send-email-daniel.vetter@ffwll.ch> References: <1273405286-3560-1-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail.ffwll.ch (cable-static-49-187.intergga.ch [157.161.49.187]) by gabe.freedesktop.org (Postfix) with ESMTP id 581749EB1F for ; Sun, 9 May 2010 04:40:36 -0700 (PDT) In-Reply-To: <1273405286-3560-1-git-send-email-daniel.vetter@ffwll.ch> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org Cc: Daniel Vetter List-Id: intel-gfx@lists.freedesktop.org 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 --- 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 #include "agp.h" #include "intel-agp.h" +#include /* * 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 #include #include +#include /* 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