drm/i810: cleanup reclaim_buffers

My dear old i815 always hits the deadlocked on reclaim_buffers
warning. Switch over to the idlelock duct-tape on hope that
works better. I've fired up my i815 and now closing glxgears doesn't
take 5 seconds anymore. \o/

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter 2011-10-25 23:51:24 +02:00
parent 7a6e0daaf4
commit 87499ffdcb
3 changed files with 13 additions and 11 deletions

View File

@ -888,7 +888,7 @@ static int i810_flush_queue(struct drm_device *dev)
} }
/* Must be called with the lock held */ /* Must be called with the lock held */
static void i810_reclaim_buffers(struct drm_device *dev, void i810_driver_reclaim_buffers(struct drm_device *dev,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_device_dma *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
@ -1225,12 +1225,17 @@ void i810_driver_preclose(struct drm_device *dev, struct drm_file *file_priv)
if (dev_priv->page_flipping) if (dev_priv->page_flipping)
i810_do_cleanup_pageflip(dev); i810_do_cleanup_pageflip(dev);
} }
}
void i810_driver_reclaim_buffers_locked(struct drm_device *dev, if (file_priv->master && file_priv->master->lock.hw_lock) {
struct drm_file *file_priv) drm_idlelock_take(&file_priv->master->lock);
{ i810_driver_reclaim_buffers(dev, file_priv);
i810_reclaim_buffers(dev, file_priv); drm_idlelock_release(&file_priv->master->lock);
} else {
/* master disappeared, clean up stuff anyway and hope nothing
* goes wrong */
i810_driver_reclaim_buffers(dev, file_priv);
}
} }
int i810_driver_dma_quiescent(struct drm_device *dev) int i810_driver_dma_quiescent(struct drm_device *dev)

View File

@ -63,7 +63,6 @@ static struct drm_driver driver = {
.lastclose = i810_driver_lastclose, .lastclose = i810_driver_lastclose,
.preclose = i810_driver_preclose, .preclose = i810_driver_preclose,
.device_is_agp = i810_driver_device_is_agp, .device_is_agp = i810_driver_device_is_agp,
.reclaim_buffers_locked = i810_driver_reclaim_buffers_locked,
.dma_quiescent = i810_driver_dma_quiescent, .dma_quiescent = i810_driver_dma_quiescent,
.ioctls = i810_ioctls, .ioctls = i810_ioctls,
.fops = &i810_driver_fops, .fops = &i810_driver_fops,

View File

@ -116,14 +116,12 @@ typedef struct drm_i810_private {
/* i810_dma.c */ /* i810_dma.c */
extern int i810_driver_dma_quiescent(struct drm_device *dev); extern int i810_driver_dma_quiescent(struct drm_device *dev);
extern void i810_driver_reclaim_buffers_locked(struct drm_device *dev, void i810_driver_reclaim_buffers(struct drm_device *dev,
struct drm_file *file_priv); struct drm_file *file_priv);
extern int i810_driver_load(struct drm_device *, unsigned long flags); extern int i810_driver_load(struct drm_device *, unsigned long flags);
extern void i810_driver_lastclose(struct drm_device *dev); extern void i810_driver_lastclose(struct drm_device *dev);
extern void i810_driver_preclose(struct drm_device *dev, extern void i810_driver_preclose(struct drm_device *dev,
struct drm_file *file_priv); struct drm_file *file_priv);
extern void i810_driver_reclaim_buffers_locked(struct drm_device *dev,
struct drm_file *file_priv);
extern int i810_driver_device_is_agp(struct drm_device *dev); extern int i810_driver_device_is_agp(struct drm_device *dev);
extern long i810_ioctl(struct file *file, unsigned int cmd, unsigned long arg); extern long i810_ioctl(struct file *file, unsigned int cmd, unsigned long arg);