diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-03-26 03:45:42 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-03-27 07:15:24 -0400 |
commit | d1dd20a96524ac462ed4f28dae168b9637f079e5 (patch) | |
tree | 766c8349ac17cf3066c352b50d4359ad33212362 | |
parent | 9021f284e9eaff1ed1d3e6bab7c90e3712201ac2 (diff) |
drm/i915: clear the entire gtt when using gem
We've lost our guard page somewhere in the gtt rewrite, this patch
here will restore it.
Exercised by i-g-t/tests/gem_cs_prefetch.
v2: Substract the guard page from the range we're supposed to manage
with gem. Suggested by Chris Wilson to increase the odds of old ums +
gem userspace not blowing up. To compensate for the loss of a page,
don't substract the guard page in the modeset init code any longer.
Tested-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44748
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_gtt.c | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index c2d9eaedff33..4f690374fffe 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1207,8 +1207,6 @@ static int i915_load_gem_init(struct drm_device *dev) | |||
1207 | /* PPGTT pdes are stolen from global gtt ptes, so shrink the | 1207 | /* PPGTT pdes are stolen from global gtt ptes, so shrink the |
1208 | * aperture accordingly when using aliasing ppgtt. */ | 1208 | * aperture accordingly when using aliasing ppgtt. */ |
1209 | gtt_size -= I915_PPGTT_PD_ENTRIES*PAGE_SIZE; | 1209 | gtt_size -= I915_PPGTT_PD_ENTRIES*PAGE_SIZE; |
1210 | /* For paranoia keep the guard page in between. */ | ||
1211 | gtt_size -= PAGE_SIZE; | ||
1212 | 1210 | ||
1213 | i915_gem_init_global_gtt(dev, 0, mappable_size, gtt_size); | 1211 | i915_gem_init_global_gtt(dev, 0, mappable_size, gtt_size); |
1214 | 1212 | ||
@@ -1227,7 +1225,7 @@ static int i915_load_gem_init(struct drm_device *dev) | |||
1227 | * aperture. | 1225 | * aperture. |
1228 | */ | 1226 | */ |
1229 | i915_gem_init_global_gtt(dev, 0, mappable_size, | 1227 | i915_gem_init_global_gtt(dev, 0, mappable_size, |
1230 | gtt_size - PAGE_SIZE); | 1228 | gtt_size); |
1231 | } | 1229 | } |
1232 | 1230 | ||
1233 | ret = i915_gem_init_hw(dev); | 1231 | ret = i915_gem_init_hw(dev); |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 98ed612d8d65..5a626f7af0c7 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -429,7 +429,8 @@ void i915_gem_init_global_gtt(struct drm_device *dev, | |||
429 | { | 429 | { |
430 | drm_i915_private_t *dev_priv = dev->dev_private; | 430 | drm_i915_private_t *dev_priv = dev->dev_private; |
431 | 431 | ||
432 | drm_mm_init(&dev_priv->mm.gtt_space, start, end - start); | 432 | /* Substract the guard page ... */ |
433 | drm_mm_init(&dev_priv->mm.gtt_space, start, end - start - PAGE_SIZE); | ||
433 | 434 | ||
434 | dev_priv->mm.gtt_start = start; | 435 | dev_priv->mm.gtt_start = start; |
435 | dev_priv->mm.gtt_mappable_end = mappable_end; | 436 | dev_priv->mm.gtt_mappable_end = mappable_end; |
@@ -437,6 +438,6 @@ void i915_gem_init_global_gtt(struct drm_device *dev, | |||
437 | dev_priv->mm.gtt_total = end - start; | 438 | dev_priv->mm.gtt_total = end - start; |
438 | dev_priv->mm.mappable_gtt_total = min(end, mappable_end) - start; | 439 | dev_priv->mm.mappable_gtt_total = min(end, mappable_end) - start; |
439 | 440 | ||
440 | /* Take over this portion of the GTT */ | 441 | /* ... but ensure that we clear the entire range. */ |
441 | intel_gtt_clear_range(start / PAGE_SIZE, (end-start) / PAGE_SIZE); | 442 | intel_gtt_clear_range(start / PAGE_SIZE, (end-start) / PAGE_SIZE); |
442 | } | 443 | } |