drm/vmwgfx: use rcu in vmw_user_dmabuf_synccpu_grab
authorMaarten Lankhorst <maarten.lankhorst@canonical.com>
Wed, 14 May 2014 13:41:49 +0000 (15:41 +0200)
committerMaarten Lankhorst <maarten.lankhorst@canonical.com>
Tue, 2 Sep 2014 15:28:47 +0000 (17:28 +0200)
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c

index 98d5afd..ff0e03b 100644 (file)
@@ -568,13 +568,17 @@ static int vmw_user_dmabuf_synccpu_grab(struct vmw_user_dma_buffer *user_bo,
 
        if (flags & drm_vmw_synccpu_allow_cs) {
                bool nonblock = !!(flags & drm_vmw_synccpu_dontblock);
+               long lret;
 
-               ret = ttm_bo_reserve(bo, true, nonblock, false, NULL);
-               if (!ret) {
-                       ret = ttm_bo_wait(bo, false, true, nonblock);
-                       ttm_bo_unreserve(bo);
-               }
-               return ret;
+               if (nonblock)
+                       return reservation_object_test_signaled_rcu(bo->resv, true) ? 0 : -EBUSY;
+
+               lret = reservation_object_wait_timeout_rcu(bo->resv, true, true, MAX_SCHEDULE_TIMEOUT);
+               if (!lret)
+                       return -EBUSY;
+               else if (lret < 0)
+                       return lret;
+               return 0;
        }
 
        ret = ttm_bo_synccpu_write_grab