aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem.c
diff options
context:
space:
mode:
authorBen Widawsky <benjamin.widawsky@intel.com>2013-12-06 17:11:18 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-12-18 09:32:14 -0500
commitbdf4fd7ea0765966c920f62a360532e3929177ca (patch)
tree31042a82869683aa3fc7b6cc62716c682eb550f1 /drivers/gpu/drm/i915/i915_gem.c
parent80da2161710cf28bca96c9a03331f8b24616e24d (diff)
drm/i915: Do aliasing PPGTT init with contexts
We have a default context which suits the aliasing PPGTT well. Tie them together so it looks like any other context/PPGTT pair. This makes the code cleaner as it won't have to special case aliasing as often. The patch has one slightly tricky part in the default context creation function. In the future (and on aliased setup) we create a new VM for a context (potentially). However, if we have aliasing PPGTT, which occurs at this point in time for all platforms GEN6+, we can simply manage the refcounting to allow things to behave as normal. Now is a good time to recall that the aliasing_ppgtt doesn't have a real VM, it uses the GGTT drm_mm. Signed-off-by: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index cc1ac797fba5..427596b8d66a 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4404,7 +4404,6 @@ int
4404i915_gem_init_hw(struct drm_device *dev) 4404i915_gem_init_hw(struct drm_device *dev)
4405{ 4405{
4406 drm_i915_private_t *dev_priv = dev->dev_private; 4406 drm_i915_private_t *dev_priv = dev->dev_private;
4407 struct i915_hw_ppgtt *ppgtt;
4408 int ret, i; 4407 int ret, i;
4409 4408
4410 if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt()) 4409 if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
@@ -4446,16 +4445,6 @@ i915_gem_init_hw(struct drm_device *dev)
4446 goto err_out; 4445 goto err_out;
4447 } 4446 }
4448 4447
4449 if (dev_priv->mm.aliasing_ppgtt) {
4450 ppgtt = dev_priv->mm.aliasing_ppgtt;
4451 ret = ppgtt->enable(ppgtt);
4452 if (ret) {
4453 i915_gem_cleanup_aliasing_ppgtt(dev);
4454 DRM_INFO("PPGTT enable failed. This is not fatal, but unexpected\n");
4455 ret = 0;
4456 }
4457 }
4458
4459 return 0; 4448 return 0;
4460 4449
4461err_out: 4450err_out:
@@ -4486,8 +4475,8 @@ int i915_gem_init(struct drm_device *dev)
4486 ret = i915_gem_init_hw(dev); 4475 ret = i915_gem_init_hw(dev);
4487 mutex_unlock(&dev->struct_mutex); 4476 mutex_unlock(&dev->struct_mutex);
4488 if (ret) { 4477 if (ret) {
4478 WARN_ON(dev_priv->mm.aliasing_ppgtt);
4489 i915_gem_context_fini(dev); 4479 i915_gem_context_fini(dev);
4490 i915_gem_cleanup_aliasing_ppgtt(dev);
4491 drm_mm_takedown(&dev_priv->gtt.base.mm); 4480 drm_mm_takedown(&dev_priv->gtt.base.mm);
4492 return ret; 4481 return ret;
4493 } 4482 }