diff options
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 6dca9fc7c1db..4642115902d6 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1596,8 +1596,19 @@ i915_gem_retire_request(struct drm_device *dev, | |||
1596 | 1596 | ||
1597 | if (obj->write_domain != 0) | 1597 | if (obj->write_domain != 0) |
1598 | i915_gem_object_move_to_flushing(obj); | 1598 | i915_gem_object_move_to_flushing(obj); |
1599 | else | 1599 | else { |
1600 | /* Take a reference on the object so it won't be | ||
1601 | * freed while the spinlock is held. The list | ||
1602 | * protection for this spinlock is safe when breaking | ||
1603 | * the lock like this since the next thing we do | ||
1604 | * is just get the head of the list again. | ||
1605 | */ | ||
1606 | drm_gem_object_reference(obj); | ||
1600 | i915_gem_object_move_to_inactive(obj); | 1607 | i915_gem_object_move_to_inactive(obj); |
1608 | spin_unlock(&dev_priv->mm.active_list_lock); | ||
1609 | drm_gem_object_unreference(obj); | ||
1610 | spin_lock(&dev_priv->mm.active_list_lock); | ||
1611 | } | ||
1601 | } | 1612 | } |
1602 | out: | 1613 | out: |
1603 | spin_unlock(&dev_priv->mm.active_list_lock); | 1614 | spin_unlock(&dev_priv->mm.active_list_lock); |