Revert "Revert "drm/i810: cleanup reclaim_buffers""
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 11 Jun 2012 19:50:23 +0000 (21:50 +0200)
committerDave Airlie <airlied@redhat.com>
Fri, 20 Jul 2012 02:49:49 +0000 (22:49 -0400)
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>
drivers/gpu/drm/i810/i810_dma.c
drivers/gpu/drm/i810/i810_drv.c
drivers/gpu/drm/i810/i810_drv.h

index fa9439159ebd6bc85cdf4e27a307d9cde12dcbd6..57d892eaaa6effc66defdbb890bb9f1b68208515 100644 (file)
@@ -881,7 +881,7 @@ static int i810_flush_queue(struct drm_device *dev)
 }
 
 /* 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_device_dma *dma = dev->dma;
@@ -1220,12 +1220,17 @@ void i810_driver_preclose(struct drm_device *dev, struct drm_file *file_priv)
                if (dev_priv->page_flipping)
                        i810_do_cleanup_pageflip(dev);
        }
-}
 
-void i810_driver_reclaim_buffers_locked(struct drm_device *dev,
-                                       struct drm_file *file_priv)
-{
-       i810_reclaim_buffers(dev, file_priv);
+       if (file_priv->master && file_priv->master->lock.hw_lock) {
+               drm_idlelock_take(&file_priv->master->lock);
+               i810_driver_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)
index ec12f7dc717a863ed7fcd17911aec55a1c486fce..053f1ee58393a885e6aff3d1b8e9c5de8f7c5cf5 100644 (file)
@@ -63,7 +63,6 @@ static struct drm_driver driver = {
        .lastclose = i810_driver_lastclose,
        .preclose = i810_driver_preclose,
        .device_is_agp = i810_driver_device_is_agp,
-       .reclaim_buffers_locked = i810_driver_reclaim_buffers_locked,
        .dma_quiescent = i810_driver_dma_quiescent,
        .ioctls = i810_ioctls,
        .fops = &i810_driver_fops,
index c9339f48179551dacd84b03bd74bd327d4750d80..6e0acad9e0f556549621e7945a00d7cafd0abbac 100644 (file)
@@ -116,14 +116,12 @@ typedef struct drm_i810_private {
 
                                /* i810_dma.c */
 extern int i810_driver_dma_quiescent(struct drm_device *dev);
-extern void i810_driver_reclaim_buffers_locked(struct drm_device *dev,
-                                              struct drm_file *file_priv);
+void i810_driver_reclaim_buffers(struct drm_device *dev,
+                                struct drm_file *file_priv);
 extern int i810_driver_load(struct drm_device *, unsigned long flags);
 extern void i810_driver_lastclose(struct drm_device *dev);
 extern void i810_driver_preclose(struct drm_device *dev,
                                 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 long i810_ioctl(struct file *file, unsigned int cmd, unsigned long arg);