Commit 834859c3 authored by Daniel Vetter's avatar Daniel Vetter Committed by Dave Airlie

drm/via: clean up reclaim_buffers

A few things
- kill reclaim_buffers, it's never ever called because via does not set
  DRIVER_HAVE_DMA
- inline the idlelock dance into the buffer reclaim logic and make it
  a simple preclose cleanup function
- directly call the the dma_quiescent function and kill the needless
  if check.

v2: Actually drop the idlelock when we take it. Reported by James
Simmons.

v3: Rebased onto latest drm-next.

v4: Fixup the refactor.

v5: More fixup the refactor - I've accidentally changed the check for
any master to checking whether the closing fd is the master.

v6: Don't forget to drop the idlelock in the early return path, too.
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 5bd42f69
...@@ -75,6 +75,7 @@ static struct drm_driver driver = { ...@@ -75,6 +75,7 @@ static struct drm_driver driver = {
.load = via_driver_load, .load = via_driver_load,
.unload = via_driver_unload, .unload = via_driver_unload,
.open = via_driver_open, .open = via_driver_open,
.preclose = via_reclaim_buffers_locked,
.postclose = via_driver_postclose, .postclose = via_driver_postclose,
.context_dtor = via_final_context, .context_dtor = via_final_context,
.get_vblank_counter = via_get_vblank_counter, .get_vblank_counter = via_get_vblank_counter,
...@@ -85,9 +86,6 @@ static struct drm_driver driver = { ...@@ -85,9 +86,6 @@ static struct drm_driver driver = {
.irq_uninstall = via_driver_irq_uninstall, .irq_uninstall = via_driver_irq_uninstall,
.irq_handler = via_driver_irq_handler, .irq_handler = via_driver_irq_handler,
.dma_quiescent = via_driver_dma_quiescent, .dma_quiescent = via_driver_dma_quiescent,
.reclaim_buffers = drm_core_reclaim_buffers,
.reclaim_buffers_locked = NULL,
.reclaim_buffers_idlelocked = via_reclaim_buffers_locked,
.lastclose = via_lastclose, .lastclose = via_lastclose,
.ioctls = via_ioctls, .ioctls = via_ioctls,
.fops = &via_driver_fops, .fops = &via_driver_fops,
......
...@@ -215,14 +215,20 @@ void via_reclaim_buffers_locked(struct drm_device *dev, ...@@ -215,14 +215,20 @@ void via_reclaim_buffers_locked(struct drm_device *dev,
struct via_file_private *file_priv = file->driver_priv; struct via_file_private *file_priv = file->driver_priv;
struct via_memblock *entry, *next; struct via_memblock *entry, *next;
if (!(file->minor->master && file->master->lock.hw_lock))
return;
drm_idlelock_take(&file->master->lock);
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
if (list_empty(&file_priv->obj_list)) { if (list_empty(&file_priv->obj_list)) {
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
drm_idlelock_release(&file->master->lock);
return; return;
} }
if (dev->driver->dma_quiescent) via_driver_dma_quiescent(dev);
dev->driver->dma_quiescent(dev);
list_for_each_entry_safe(entry, next, &file_priv->obj_list, list_for_each_entry_safe(entry, next, &file_priv->obj_list,
owner_list) { owner_list) {
...@@ -231,5 +237,8 @@ void via_reclaim_buffers_locked(struct drm_device *dev, ...@@ -231,5 +237,8 @@ void via_reclaim_buffers_locked(struct drm_device *dev,
kfree(entry); kfree(entry);
} }
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
drm_idlelock_release(&file->master->lock);
return; return;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment