summaryrefslogtreecommitdiff
path: root/freedreno
diff options
context:
space:
mode:
authorVarad Gautam <varadgautam@gmail.com>2015-08-30 15:30:57 +0530
committerRob Clark <robclark@freedesktop.org>2015-08-31 11:53:53 -0400
commitcc7db673fabb77cf8bb9a00dcb0864c4b125ab6f (patch)
tree686ab44c8e7730dbf7b801213d10d666a29b6b43 /freedreno
parent508a5f77fa7b76246465ca620c8badf281218529 (diff)
freedreno: use drmPrime wrappers to import/export prime bo's
don't call drmIoctl() directly for prime bo's, use the wrappers instead. v3: remove struct drm_prime_handle and split locking Signed-off-by: Varad Gautam <varadgautam@gmail.com> Signed-off-by: Rob Clark <robclark@freedesktop.org>
Diffstat (limited to 'freedreno')
-rw-r--r--freedreno/freedreno_bo.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c
index 596bfbc2..45187459 100644
--- a/freedreno/freedreno_bo.c
+++ b/freedreno/freedreno_bo.c
@@ -226,13 +226,11 @@ out_unlock:
struct fd_bo *
fd_bo_from_dmabuf(struct fd_device *dev, int fd)
{
- struct drm_prime_handle req = {
- .fd = fd,
- };
int ret, size;
+ uint32_t handle;
struct fd_bo *bo;
- ret = drmIoctl(dev->fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &req);
+ ret = drmPrimeFDToHandle(dev->fd, fd, &handle);
if (ret) {
return NULL;
}
@@ -241,7 +239,7 @@ fd_bo_from_dmabuf(struct fd_device *dev, int fd)
size = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_CUR);
- bo = fd_bo_from_handle(dev, req.handle, size);
+ bo = fd_bo_from_handle(dev, handle, size);
bo->fd = fd;
return bo;
@@ -381,18 +379,15 @@ uint32_t fd_bo_handle(struct fd_bo *bo)
int fd_bo_dmabuf(struct fd_bo *bo)
{
if (bo->fd < 0) {
- struct drm_prime_handle req = {
- .handle = bo->handle,
- .flags = DRM_CLOEXEC,
- };
- int ret;
+ int ret, prime_fd;
- ret = drmIoctl(bo->dev->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &req);
+ ret = drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC,
+ &prime_fd);
if (ret) {
return ret;
}
- bo->fd = req.fd;
+ bo->fd = prime_fd;
}
return dup(bo->fd);
}