diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_context.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_context.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index da74522f377d..0785ddbb3d46 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c | |||
@@ -99,6 +99,42 @@ | |||
99 | static int do_switch(struct intel_ring_buffer *ring, | 99 | static int do_switch(struct intel_ring_buffer *ring, |
100 | struct i915_hw_context *to); | 100 | struct i915_hw_context *to); |
101 | 101 | ||
102 | static void ppgtt_release(struct kref *kref) | ||
103 | { | ||
104 | struct i915_hw_ppgtt *ppgtt = container_of(kref, struct i915_hw_ppgtt, ref); | ||
105 | struct drm_device *dev = ppgtt->base.dev; | ||
106 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
107 | struct i915_address_space *vm = &ppgtt->base; | ||
108 | |||
109 | if (ppgtt == dev_priv->mm.aliasing_ppgtt || | ||
110 | (list_empty(&vm->active_list) && list_empty(&vm->inactive_list))) { | ||
111 | ppgtt->base.cleanup(&ppgtt->base); | ||
112 | return; | ||
113 | } | ||
114 | |||
115 | /* | ||
116 | * Make sure vmas are unbound before we take down the drm_mm | ||
117 | * | ||
118 | * FIXME: Proper refcounting should take care of this, this shouldn't be | ||
119 | * needed at all. | ||
120 | */ | ||
121 | if (!list_empty(&vm->active_list)) { | ||
122 | struct i915_vma *vma; | ||
123 | |||
124 | list_for_each_entry(vma, &vm->active_list, mm_list) | ||
125 | if (WARN_ON(list_empty(&vma->vma_link) || | ||
126 | list_is_singular(&vma->vma_link))) | ||
127 | break; | ||
128 | |||
129 | i915_gem_evict_vm(&ppgtt->base, true); | ||
130 | } else { | ||
131 | i915_gem_retire_requests(dev); | ||
132 | i915_gem_evict_vm(&ppgtt->base, false); | ||
133 | } | ||
134 | |||
135 | ppgtt->base.cleanup(&ppgtt->base); | ||
136 | } | ||
137 | |||
102 | static size_t get_context_alignment(struct drm_device *dev) | 138 | static size_t get_context_alignment(struct drm_device *dev) |
103 | { | 139 | { |
104 | if (IS_GEN6(dev)) | 140 | if (IS_GEN6(dev)) |