aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2010-10-05 06:43:03 -0400
committerDave Airlie <airlied@redhat.com>2010-10-05 21:29:48 -0400
commit3a939a5ece3030e60c966a885c8e9bd329c4faf7 (patch)
tree127e18664f48171e2ab29ebeac56f917b7ef0782 /drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
parent02b001624f0384540299d9288fdaf37b7d37c814 (diff)
drm/vmwgfx: Take the ttm lock around the dirty ioctl
This makes sure noone accesses the fifo while it's taken down using the dirty ioctl. Also make sure all workqueues are idled before the fifo is taken down. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_drv.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index f3e481f9aa86..201c34d1f3ee 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -597,6 +597,8 @@ static void vmw_lastclose(struct drm_device *dev)
597static void vmw_master_init(struct vmw_master *vmaster) 597static void vmw_master_init(struct vmw_master *vmaster)
598{ 598{
599 ttm_lock_init(&vmaster->lock); 599 ttm_lock_init(&vmaster->lock);
600 INIT_LIST_HEAD(&vmaster->fb_surf);
601 mutex_init(&vmaster->fb_surf_mutex);
600} 602}
601 603
602static int vmw_master_create(struct drm_device *dev, 604static int vmw_master_create(struct drm_device *dev,
@@ -608,7 +610,7 @@ static int vmw_master_create(struct drm_device *dev,
608 if (unlikely(vmaster == NULL)) 610 if (unlikely(vmaster == NULL))
609 return -ENOMEM; 611 return -ENOMEM;
610 612
611 ttm_lock_init(&vmaster->lock); 613 vmw_master_init(vmaster);
612 ttm_lock_set_kill(&vmaster->lock, true, SIGTERM); 614 ttm_lock_set_kill(&vmaster->lock, true, SIGTERM);
613 master->driver_priv = vmaster; 615 master->driver_priv = vmaster;
614 616
@@ -699,6 +701,7 @@ static void vmw_master_drop(struct drm_device *dev,
699 701
700 vmw_fp->locked_master = drm_master_get(file_priv->master); 702 vmw_fp->locked_master = drm_master_get(file_priv->master);
701 ret = ttm_vt_lock(&vmaster->lock, false, vmw_fp->tfile); 703 ret = ttm_vt_lock(&vmaster->lock, false, vmw_fp->tfile);
704 vmw_kms_idle_workqueues(vmaster);
702 705
703 if (unlikely((ret != 0))) { 706 if (unlikely((ret != 0))) {
704 DRM_ERROR("Unable to lock TTM at VT switch.\n"); 707 DRM_ERROR("Unable to lock TTM at VT switch.\n");