summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/vgem/vgem_fence.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/vgem/vgem_fence.c')
-rw-r--r--drivers/gpu/drm/vgem/vgem_fence.c40
1 files changed, 11 insertions, 29 deletions
diff --git a/drivers/gpu/drm/vgem/vgem_fence.c b/drivers/gpu/drm/vgem/vgem_fence.c
index eb17c0cd3727..9268f6fc3f66 100644
--- a/drivers/gpu/drm/vgem/vgem_fence.c
+++ b/drivers/gpu/drm/vgem/vgem_fence.c
@@ -21,7 +21,9 @@
*/
#include <linux/dma-buf.h>
-#include <linux/reservation.h>
+#include <linux/dma-resv.h>
+
+#include <drm/drm_file.h>
#include "vgem_drv.h"
@@ -100,22 +102,6 @@ static struct dma_fence *vgem_fence_create(struct vgem_file *vfile,
return &fence->base;
}
-static int attach_dmabuf(struct drm_device *dev,
- struct drm_gem_object *obj)
-{
- struct dma_buf *dmabuf;
-
- if (obj->dma_buf)
- return 0;
-
- dmabuf = dev->driver->gem_prime_export(dev, obj, 0);
- if (IS_ERR(dmabuf))
- return PTR_ERR(dmabuf);
-
- obj->dma_buf = dmabuf;
- return 0;
-}
-
/*
* vgem_fence_attach_ioctl (DRM_IOCTL_VGEM_FENCE_ATTACH):
*
@@ -142,7 +128,7 @@ int vgem_fence_attach_ioctl(struct drm_device *dev,
{
struct drm_vgem_fence_attach *arg = data;
struct vgem_file *vfile = file->driver_priv;
- struct reservation_object *resv;
+ struct dma_resv *resv;
struct drm_gem_object *obj;
struct dma_fence *fence;
int ret;
@@ -157,10 +143,6 @@ int vgem_fence_attach_ioctl(struct drm_device *dev,
if (!obj)
return -ENOENT;
- ret = attach_dmabuf(dev, obj);
- if (ret)
- goto err;
-
fence = vgem_fence_create(vfile, arg->flags);
if (!fence) {
ret = -ENOMEM;
@@ -168,8 +150,8 @@ int vgem_fence_attach_ioctl(struct drm_device *dev,
}
/* Check for a conflicting fence */
- resv = obj->dma_buf->resv;
- if (!reservation_object_test_signaled_rcu(resv,
+ resv = obj->resv;
+ if (!dma_resv_test_signaled_rcu(resv,
arg->flags & VGEM_FENCE_WRITE)) {
ret = -EBUSY;
goto err_fence;
@@ -177,12 +159,12 @@ int vgem_fence_attach_ioctl(struct drm_device *dev,
/* Expose the fence via the dma-buf */
ret = 0;
- reservation_object_lock(resv, NULL);
+ dma_resv_lock(resv, NULL);
if (arg->flags & VGEM_FENCE_WRITE)
- reservation_object_add_excl_fence(resv, fence);
- else if ((ret = reservation_object_reserve_shared(resv, 1)) == 0)
- reservation_object_add_shared_fence(resv, fence);
- reservation_object_unlock(resv);
+ dma_resv_add_excl_fence(resv, fence);
+ else if ((ret = dma_resv_reserve_shared(resv, 1)) == 0)
+ dma_resv_add_shared_fence(resv, fence);
+ dma_resv_unlock(resv);
/* Record the fence in our idr for later signaling */
if (ret == 0) {