Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "Revert "drm/i810: cleanup reclaim_buffers""

This reverts commit 6e877b576ddf7cde5db2e9a6dcb56fef0ea77e64,
reinstating the original commit:

commit 87499ffdcb1c70f66988cd8febc4ead0ba2f9118
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Tue Oct 25 23:51:24 2011 +0200

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/

The original problem with that was that I've moved it ahead in the
series so that it could be included despite some patches not being
ready quite yet. The little problem is that this patch required some
of the previous rework to work correctly.

Now that everything is in the right order again, this actually works
on my i810 and does speed up closing gl apps as the original commit
claimed. Without hanging the machine, as the revert says.

Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

Daniel Vetter and committed by
Dave Airlie
d5346b37 3ae6b644

+13 -11
+11 -6
drivers/gpu/drm/i810/i810_dma.c
··· 881 881 } 882 882 883 883 /* Must be called with the lock held */ 884 - static void i810_reclaim_buffers(struct drm_device *dev, 884 + void i810_driver_reclaim_buffers(struct drm_device *dev, 885 885 struct drm_file *file_priv) 886 886 { 887 887 struct drm_device_dma *dma = dev->dma; ··· 1220 1220 if (dev_priv->page_flipping) 1221 1221 i810_do_cleanup_pageflip(dev); 1222 1222 } 1223 - } 1224 1223 1225 - void i810_driver_reclaim_buffers_locked(struct drm_device *dev, 1226 - struct drm_file *file_priv) 1227 - { 1228 - i810_reclaim_buffers(dev, file_priv); 1224 + if (file_priv->master && file_priv->master->lock.hw_lock) { 1225 + drm_idlelock_take(&file_priv->master->lock); 1226 + i810_driver_reclaim_buffers(dev, file_priv); 1227 + drm_idlelock_release(&file_priv->master->lock); 1228 + } else { 1229 + /* master disappeared, clean up stuff anyway and hope nothing 1230 + * goes wrong */ 1231 + i810_driver_reclaim_buffers(dev, file_priv); 1232 + } 1233 + 1229 1234 } 1230 1235 1231 1236 int i810_driver_dma_quiescent(struct drm_device *dev)
-1
drivers/gpu/drm/i810/i810_drv.c
··· 63 63 .lastclose = i810_driver_lastclose, 64 64 .preclose = i810_driver_preclose, 65 65 .device_is_agp = i810_driver_device_is_agp, 66 - .reclaim_buffers_locked = i810_driver_reclaim_buffers_locked, 67 66 .dma_quiescent = i810_driver_dma_quiescent, 68 67 .ioctls = i810_ioctls, 69 68 .fops = &i810_driver_fops,
+2 -4
drivers/gpu/drm/i810/i810_drv.h
··· 116 116 117 117 /* i810_dma.c */ 118 118 extern int i810_driver_dma_quiescent(struct drm_device *dev); 119 - extern void i810_driver_reclaim_buffers_locked(struct drm_device *dev, 120 - struct drm_file *file_priv); 119 + void i810_driver_reclaim_buffers(struct drm_device *dev, 120 + struct drm_file *file_priv); 121 121 extern int i810_driver_load(struct drm_device *, unsigned long flags); 122 122 extern void i810_driver_lastclose(struct drm_device *dev); 123 123 extern void i810_driver_preclose(struct drm_device *dev, 124 124 struct drm_file *file_priv); 125 - extern void i810_driver_reclaim_buffers_locked(struct drm_device *dev, 126 - struct drm_file *file_priv); 127 125 extern int i810_driver_device_is_agp(struct drm_device *dev); 128 126 129 127 extern long i810_ioctl(struct file *file, unsigned int cmd, unsigned long arg);