Skip to content

Commit 7b0cdf3

Browse files
committed
drm/vgem: Ditch attach trickery in the fence ioctl
It looks like this was done purely to get a consistent place to look up the reservation object pointer. With the drm_prime.c helper code now also setting gem_object->resv for imported objects we can just use that pointer directly, instead of first ensuring a dma-buf exists. v2: Note that I screwed up the patch ordering, hence why this needed a Fixes: tag - CI spotted the broken intermediate state. Fixes: 5eab998 ("drm/vgem: Drop drm_gem_prime_export") Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190614203615.12639-49-daniel.vetter@ffwll.ch
1 parent 5f6ed98 commit 7b0cdf3

1 file changed

Lines changed: 1 addition & 21 deletions

File tree

‎drivers/gpu/drm/vgem/vgem_fence.c‎

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,6 @@ static struct dma_fence *vgem_fence_create(struct vgem_file *vfile,
100100
return &fence->base;
101101
}
102102

103-
static int attach_dmabuf(struct drm_device *dev,
104-
struct drm_gem_object *obj)
105-
{
106-
struct dma_buf *dmabuf;
107-
108-
if (obj->dma_buf)
109-
return 0;
110-
111-
dmabuf = dev->driver->gem_prime_export(obj, 0);
112-
if (IS_ERR(dmabuf))
113-
return PTR_ERR(dmabuf);
114-
115-
obj->dma_buf = dmabuf;
116-
return 0;
117-
}
118-
119103
/*
120104
* vgem_fence_attach_ioctl (DRM_IOCTL_VGEM_FENCE_ATTACH):
121105
*
@@ -157,18 +141,14 @@ int vgem_fence_attach_ioctl(struct drm_device *dev,
157141
if (!obj)
158142
return -ENOENT;
159143

160-
ret = attach_dmabuf(dev, obj);
161-
if (ret)
162-
goto err;
163-
164144
fence = vgem_fence_create(vfile, arg->flags);
165145
if (!fence) {
166146
ret = -ENOMEM;
167147
goto err;
168148
}
169149

170150
/* Check for a conflicting fence */
171-
resv = obj->dma_buf->resv;
151+
resv = obj->resv;
172152
if (!reservation_object_test_signaled_rcu(resv,
173153
arg->flags & VGEM_FENCE_WRITE)) {
174154
ret = -EBUSY;

0 commit comments

Comments
 (0)