]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
drm/nouveau: remove cpu_writers lock
authorBen Skeggs <bskeggs@redhat.com>
Mon, 11 Oct 2010 01:48:45 +0000 (11:48 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 3 Dec 2010 05:05:22 +0000 (15:05 +1000)
No other driver uses this, and userspace should be responsible for handling
locking between them if they share BOs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_drv.h
drivers/gpu/drm/nouveau/nouveau_gem.c
include/drm/nouveau_drm.h

index c3f102125083a58b8b55d629e084256aef9d1154..b78663fc334c8e6a83ad052cc68a22920d21d8e9 100644 (file)
@@ -96,7 +96,6 @@ struct nouveau_bo {
        struct nouveau_tile_reg *tile;
 
        struct drm_gem_object *gem;
-       struct drm_file *cpu_filp;
        int pin_refcnt;
 };
 
index 454d5ceb28f10bc6d1fd1779714aa47785e34db2..e14d10e38870d77e5fa3bfdcd8248de0ae7c0ecd 100644 (file)
@@ -48,9 +48,6 @@ nouveau_gem_object_del(struct drm_gem_object *gem)
                return;
        nvbo->gem = NULL;
 
-       if (unlikely(nvbo->cpu_filp))
-               ttm_bo_synccpu_write_release(bo);
-
        if (unlikely(nvbo->pin_refcnt)) {
                nvbo->pin_refcnt = 1;
                nouveau_bo_unpin(nvbo);
@@ -334,23 +331,6 @@ retry:
                        validate_fini(op, NULL);
                        return -EINVAL;
                }
-
-               if (unlikely(atomic_read(&nvbo->bo.cpu_writers) > 0)) {
-                       validate_fini(op, NULL);
-
-                       if (nvbo->cpu_filp == file_priv) {
-                               NV_ERROR(dev, "bo %p mapped by process trying "
-                                             "to validate it!\n", nvbo);
-                               return -EINVAL;
-                       }
-
-                       ret = ttm_bo_wait_cpu(&nvbo->bo, false);
-                       if (ret) {
-                               NV_ERROR(dev, "fail wait_cpu\n");
-                               return ret;
-                       }
-                       goto retry;
-               }
        }
 
        return 0;
@@ -791,26 +771,9 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data,
                return -ENOENT;
        nvbo = nouveau_gem_object(gem);
 
-       if (nvbo->cpu_filp) {
-               if (nvbo->cpu_filp == file_priv)
-                       goto out;
-
-               ret = ttm_bo_wait_cpu(&nvbo->bo, no_wait);
-               if (ret)
-                       goto out;
-       }
-
-       if (req->flags & NOUVEAU_GEM_CPU_PREP_NOBLOCK) {
-               spin_lock(&nvbo->bo.bdev->fence_lock);
-               ret = ttm_bo_wait(&nvbo->bo, false, false, no_wait);
-               spin_unlock(&nvbo->bo.bdev->fence_lock);
-       } else {
-               ret = ttm_bo_synccpu_write_grab(&nvbo->bo, no_wait);
-               if (ret == 0)
-                       nvbo->cpu_filp = file_priv;
-       }
-
-out:
+       spin_lock(&nvbo->bo.bdev->fence_lock);
+       ret = ttm_bo_wait(&nvbo->bo, true, true, no_wait);
+       spin_unlock(&nvbo->bo.bdev->fence_lock);
        drm_gem_object_unreference_unlocked(gem);
        return ret;
 }
@@ -819,26 +782,7 @@ int
 nouveau_gem_ioctl_cpu_fini(struct drm_device *dev, void *data,
                           struct drm_file *file_priv)
 {
-       struct drm_nouveau_gem_cpu_prep *req = data;
-       struct drm_gem_object *gem;
-       struct nouveau_bo *nvbo;
-       int ret = -EINVAL;
-
-       gem = drm_gem_object_lookup(dev, file_priv, req->handle);
-       if (!gem)
-               return -ENOENT;
-       nvbo = nouveau_gem_object(gem);
-
-       if (nvbo->cpu_filp != file_priv)
-               goto out;
-       nvbo->cpu_filp = NULL;
-
-       ttm_bo_synccpu_write_release(&nvbo->bo);
-       ret = 0;
-
-out:
-       drm_gem_object_unreference_unlocked(gem);
-       return ret;
+       return 0;
 }
 
 int
index bc5590b1a1acbe852314995f11b479e221ba6281..60a7b3e9c2e966d8d553c9166cb427ea38616229 100644 (file)
@@ -171,7 +171,6 @@ struct drm_nouveau_gem_pushbuf {
 };
 
 #define NOUVEAU_GEM_CPU_PREP_NOWAIT                                  0x00000001
-#define NOUVEAU_GEM_CPU_PREP_NOBLOCK                                 0x00000002
 #define NOUVEAU_GEM_CPU_PREP_WRITE                                   0x00000004
 struct drm_nouveau_gem_cpu_prep {
        uint32_t handle;