aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2011-10-25 18:14:15 -0400
committerDave Airlie <airlied@redhat.com>2012-07-19 22:50:16 -0400
commite2b3c5b64b35af35b0715936f88212c457394c2f (patch)
tree9a6afff5fe812b63bed412cf442fe2c3a453671e /drivers/gpu
parent923d1fe86b4a98292bee8f08f386eb3eb4c7927e (diff)
drm/savage: clean up reclaim_buffers
The reclaim_buffers function of the savage driver actually wants to run with the hw_lock held - at least there are printks in the call-chain to that effect. But the drm core only calls reclaim_buffers as used by savage _after_ forcefully dropping the hwlock (in case it's still hold by the closing fd). So do the same idlelock dance as for the other dma drivers and hope that papers over any issues. v2: Don't let the idlelock linger around. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Tested-by: Tormod Volden <debian.tormod@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/savage/savage_bci.c9
-rw-r--r--drivers/gpu/drm/savage/savage_drv.c2
2 files changed, 8 insertions, 3 deletions
diff --git a/drivers/gpu/drm/savage/savage_bci.c b/drivers/gpu/drm/savage/savage_bci.c
index 6eb507a5d130..1efbb9075837 100644
--- a/drivers/gpu/drm/savage/savage_bci.c
+++ b/drivers/gpu/drm/savage/savage_bci.c
@@ -1050,6 +1050,7 @@ void savage_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv)
1050{ 1050{
1051 struct drm_device_dma *dma = dev->dma; 1051 struct drm_device_dma *dma = dev->dma;
1052 drm_savage_private_t *dev_priv = dev->dev_private; 1052 drm_savage_private_t *dev_priv = dev->dev_private;
1053 int release_idlelock = 0;
1053 int i; 1054 int i;
1054 1055
1055 if (!dma) 1056 if (!dma)
@@ -1059,7 +1060,10 @@ void savage_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv)
1059 if (!dma->buflist) 1060 if (!dma->buflist)
1060 return; 1061 return;
1061 1062
1062 /*i830_flush_queue(dev); */ 1063 if (file_priv->master && file_priv->master->lock.hw_lock) {
1064 drm_idlelock_take(&file_priv->master->lock);
1065 release_idlelock = 1;
1066 }
1063 1067
1064 for (i = 0; i < dma->buf_count; i++) { 1068 for (i = 0; i < dma->buf_count; i++) {
1065 struct drm_buf *buf = dma->buflist[i]; 1069 struct drm_buf *buf = dma->buflist[i];
@@ -1075,7 +1079,8 @@ void savage_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv)
1075 } 1079 }
1076 } 1080 }
1077 1081
1078 drm_core_reclaim_buffers(dev, file_priv); 1082 if (release_idlelock)
1083 drm_idlelock_release(&file_priv->master->lock);
1079} 1084}
1080 1085
1081struct drm_ioctl_desc savage_ioctls[] = { 1086struct drm_ioctl_desc savage_ioctls[] = {
diff --git a/drivers/gpu/drm/savage/savage_drv.c b/drivers/gpu/drm/savage/savage_drv.c
index 89afe0b83643..d31d4cca9a4c 100644
--- a/drivers/gpu/drm/savage/savage_drv.c
+++ b/drivers/gpu/drm/savage/savage_drv.c
@@ -52,9 +52,9 @@ static struct drm_driver driver = {
52 .dev_priv_size = sizeof(drm_savage_buf_priv_t), 52 .dev_priv_size = sizeof(drm_savage_buf_priv_t),
53 .load = savage_driver_load, 53 .load = savage_driver_load,
54 .firstopen = savage_driver_firstopen, 54 .firstopen = savage_driver_firstopen,
55 .preclose = savage_reclaim_buffers,
55 .lastclose = savage_driver_lastclose, 56 .lastclose = savage_driver_lastclose,
56 .unload = savage_driver_unload, 57 .unload = savage_driver_unload,
57 .reclaim_buffers = savage_reclaim_buffers,
58 .ioctls = savage_ioctls, 58 .ioctls = savage_ioctls,
59 .dma_ioctl = savage_bci_buffers, 59 .dma_ioctl = savage_bci_buffers,
60 .fops = &savage_driver_fops, 60 .fops = &savage_driver_fops,