diff options
author | Eric Anholt <eric@anholt.net> | 2008-12-23 21:42:32 -0500 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2009-01-06 20:49:39 -0500 |
commit | 9bb2d6f94aeb9a185d69aedbd19421b6da4e3309 (patch) | |
tree | addc6ecaa172ccfca9273a94567a6e35248acece /drivers/gpu | |
parent | c861ea2cb2c25c1698734d9b0540a09e253690a1 (diff) |
drm/i915: Don't allow objects to get bound while VT switched.
This avoids a BUG_ON in the enter_vt path due to objects being in the GTT
when we shouldn't have ever let them be (as we're not supposed to touch the
device during that time).
This was triggered by a change in the 2D driver to use the GTT mapping of
objects after pinning them to improve software fallback performance.
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index cc2ca5561feb..14afc23a0e24 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1623,6 +1623,8 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment) | |||
1623 | struct drm_mm_node *free_space; | 1623 | struct drm_mm_node *free_space; |
1624 | int page_count, ret; | 1624 | int page_count, ret; |
1625 | 1625 | ||
1626 | if (dev_priv->mm.suspended) | ||
1627 | return -EBUSY; | ||
1626 | if (alignment == 0) | 1628 | if (alignment == 0) |
1627 | alignment = PAGE_SIZE; | 1629 | alignment = PAGE_SIZE; |
1628 | if (alignment & (PAGE_SIZE - 1)) { | 1630 | if (alignment & (PAGE_SIZE - 1)) { |
@@ -2641,7 +2643,7 @@ i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment) | |||
2641 | if (obj_priv->gtt_space == NULL) { | 2643 | if (obj_priv->gtt_space == NULL) { |
2642 | ret = i915_gem_object_bind_to_gtt(obj, alignment); | 2644 | ret = i915_gem_object_bind_to_gtt(obj, alignment); |
2643 | if (ret != 0) { | 2645 | if (ret != 0) { |
2644 | if (ret != -ERESTARTSYS) | 2646 | if (ret != -EBUSY && ret != -ERESTARTSYS) |
2645 | DRM_ERROR("Failure to bind: %d", ret); | 2647 | DRM_ERROR("Failure to bind: %d", ret); |
2646 | return ret; | 2648 | return ret; |
2647 | } | 2649 | } |
@@ -3219,20 +3221,21 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data, | |||
3219 | dev_priv->mm.wedged = 0; | 3221 | dev_priv->mm.wedged = 0; |
3220 | } | 3222 | } |
3221 | 3223 | ||
3222 | ret = i915_gem_init_ringbuffer(dev); | ||
3223 | if (ret != 0) | ||
3224 | return ret; | ||
3225 | |||
3226 | dev_priv->mm.gtt_mapping = io_mapping_create_wc(dev->agp->base, | 3224 | dev_priv->mm.gtt_mapping = io_mapping_create_wc(dev->agp->base, |
3227 | dev->agp->agp_info.aper_size | 3225 | dev->agp->agp_info.aper_size |
3228 | * 1024 * 1024); | 3226 | * 1024 * 1024); |
3229 | 3227 | ||
3230 | mutex_lock(&dev->struct_mutex); | 3228 | mutex_lock(&dev->struct_mutex); |
3229 | dev_priv->mm.suspended = 0; | ||
3230 | |||
3231 | ret = i915_gem_init_ringbuffer(dev); | ||
3232 | if (ret != 0) | ||
3233 | return ret; | ||
3234 | |||
3231 | BUG_ON(!list_empty(&dev_priv->mm.active_list)); | 3235 | BUG_ON(!list_empty(&dev_priv->mm.active_list)); |
3232 | BUG_ON(!list_empty(&dev_priv->mm.flushing_list)); | 3236 | BUG_ON(!list_empty(&dev_priv->mm.flushing_list)); |
3233 | BUG_ON(!list_empty(&dev_priv->mm.inactive_list)); | 3237 | BUG_ON(!list_empty(&dev_priv->mm.inactive_list)); |
3234 | BUG_ON(!list_empty(&dev_priv->mm.request_list)); | 3238 | BUG_ON(!list_empty(&dev_priv->mm.request_list)); |
3235 | dev_priv->mm.suspended = 0; | ||
3236 | mutex_unlock(&dev->struct_mutex); | 3239 | mutex_unlock(&dev->struct_mutex); |
3237 | 3240 | ||
3238 | drm_irq_install(dev); | 3241 | drm_irq_install(dev); |