drm/i915: Move drm_framebuffer_unreference out of struct_mutex for flips
intel_user_framebuffer_destroy() requires the struct_mutex for its
object bookkeeping, so this means that all calls to
drm_framebuffer_unreference must not hold that lock.
Regression from commit ab8d66752a
Author: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Date: Mon Feb 2 15:44:15 2015 +0000
drm/i915: Track old framebuffer instead of object
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89166
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
[danvet: Clarify commit message slightly.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
fc1ac8dee1
commit
89ed88baaa
1 changed files with 10 additions and 9 deletions
|
@ -9306,7 +9306,6 @@ static void intel_unpin_work_fn(struct work_struct *__work)
|
||||||
mutex_lock(&dev->struct_mutex);
|
mutex_lock(&dev->struct_mutex);
|
||||||
intel_unpin_fb_obj(intel_fb_obj(work->old_fb));
|
intel_unpin_fb_obj(intel_fb_obj(work->old_fb));
|
||||||
drm_gem_object_unreference(&work->pending_flip_obj->base);
|
drm_gem_object_unreference(&work->pending_flip_obj->base);
|
||||||
drm_framebuffer_unreference(work->old_fb);
|
|
||||||
|
|
||||||
intel_fbc_update(dev);
|
intel_fbc_update(dev);
|
||||||
|
|
||||||
|
@ -9315,6 +9314,7 @@ static void intel_unpin_work_fn(struct work_struct *__work)
|
||||||
mutex_unlock(&dev->struct_mutex);
|
mutex_unlock(&dev->struct_mutex);
|
||||||
|
|
||||||
intel_frontbuffer_flip_complete(dev, INTEL_FRONTBUFFER_PRIMARY(pipe));
|
intel_frontbuffer_flip_complete(dev, INTEL_FRONTBUFFER_PRIMARY(pipe));
|
||||||
|
drm_framebuffer_unreference(work->old_fb);
|
||||||
|
|
||||||
BUG_ON(atomic_read(&to_intel_crtc(work->crtc)->unpin_work_count) == 0);
|
BUG_ON(atomic_read(&to_intel_crtc(work->crtc)->unpin_work_count) == 0);
|
||||||
atomic_dec(&to_intel_crtc(work->crtc)->unpin_work_count);
|
atomic_dec(&to_intel_crtc(work->crtc)->unpin_work_count);
|
||||||
|
@ -9978,10 +9978,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
|
||||||
if (atomic_read(&intel_crtc->unpin_work_count) >= 2)
|
if (atomic_read(&intel_crtc->unpin_work_count) >= 2)
|
||||||
flush_workqueue(dev_priv->wq);
|
flush_workqueue(dev_priv->wq);
|
||||||
|
|
||||||
ret = i915_mutex_lock_interruptible(dev);
|
|
||||||
if (ret)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
/* Reference the objects for the scheduled work. */
|
/* Reference the objects for the scheduled work. */
|
||||||
drm_framebuffer_reference(work->old_fb);
|
drm_framebuffer_reference(work->old_fb);
|
||||||
drm_gem_object_reference(&obj->base);
|
drm_gem_object_reference(&obj->base);
|
||||||
|
@ -9991,6 +9987,10 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
|
||||||
|
|
||||||
work->pending_flip_obj = obj;
|
work->pending_flip_obj = obj;
|
||||||
|
|
||||||
|
ret = i915_mutex_lock_interruptible(dev);
|
||||||
|
if (ret)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
atomic_inc(&intel_crtc->unpin_work_count);
|
atomic_inc(&intel_crtc->unpin_work_count);
|
||||||
intel_crtc->reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter);
|
intel_crtc->reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter);
|
||||||
|
|
||||||
|
@ -10055,13 +10055,14 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
|
||||||
intel_unpin_fb_obj(obj);
|
intel_unpin_fb_obj(obj);
|
||||||
cleanup_pending:
|
cleanup_pending:
|
||||||
atomic_dec(&intel_crtc->unpin_work_count);
|
atomic_dec(&intel_crtc->unpin_work_count);
|
||||||
|
mutex_unlock(&dev->struct_mutex);
|
||||||
|
cleanup:
|
||||||
crtc->primary->fb = old_fb;
|
crtc->primary->fb = old_fb;
|
||||||
update_state_fb(crtc->primary);
|
update_state_fb(crtc->primary);
|
||||||
drm_framebuffer_unreference(work->old_fb);
|
|
||||||
drm_gem_object_unreference(&obj->base);
|
|
||||||
mutex_unlock(&dev->struct_mutex);
|
|
||||||
|
|
||||||
cleanup:
|
drm_gem_object_unreference_unlocked(&obj->base);
|
||||||
|
drm_framebuffer_unreference(work->old_fb);
|
||||||
|
|
||||||
spin_lock_irq(&dev->event_lock);
|
spin_lock_irq(&dev->event_lock);
|
||||||
intel_crtc->unpin_work = NULL;
|
intel_crtc->unpin_work = NULL;
|
||||||
spin_unlock_irq(&dev->event_lock);
|
spin_unlock_irq(&dev->event_lock);
|
||||||
|
|
Loading…
Reference in a new issue