From 76a1e97eae3948827ccc100c593d1e96d7a8ce74 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Fri, 4 Sep 2015 11:41:47 -0400 Subject: freedreno: drop exported dmabuf fd tracking There is really no reason to keep around the fd, it just consumes an extra file handle. Signed-off-by: Rob Clark --- freedreno/freedreno_bo.c | 26 ++++++++++---------------- freedreno/freedreno_priv.h | 1 - freedreno/kgsl/kgsl_bo.c | 1 - freedreno/msm/msm_bo.c | 1 - 4 files changed, 10 insertions(+), 19 deletions(-) (limited to 'freedreno') diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c index fee32fca..a23c65d0 100644 --- a/freedreno/freedreno_bo.c +++ b/freedreno/freedreno_bo.c @@ -298,11 +298,6 @@ void fd_bo_del(struct fd_bo *bo) if (!atomic_dec_and_test(&bo->refcnt)) return; - if (bo->fd >= 0) { - close(bo->fd); - bo->fd = -1; - } - pthread_mutex_lock(&table_lock); if (bo->bo_reuse) { @@ -386,19 +381,18 @@ uint32_t fd_bo_handle(struct fd_bo *bo) int fd_bo_dmabuf(struct fd_bo *bo) { - if (bo->fd < 0) { - int ret, prime_fd; - - ret = drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC, - &prime_fd); - if (ret) { - return ret; - } + int ret, prime_fd; - bo->fd = prime_fd; - bo->bo_reuse = 0; + ret = drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC, + &prime_fd); + if (ret) { + ERROR_MSG("failed to get dmabuf fd: %d", ret); + return ret; } - return dup(bo->fd); + + bo->bo_reuse = 0; + + return prime_fd; } uint32_t fd_bo_size(struct fd_bo *bo) diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h index 4e442e42..53817b19 100644 --- a/freedreno/freedreno_priv.h +++ b/freedreno/freedreno_priv.h @@ -138,7 +138,6 @@ struct fd_bo { uint32_t size; uint32_t handle; uint32_t name; - int fd; /* dmabuf handle */ void *map; atomic_t refcnt; const struct fd_bo_funcs *funcs; diff --git a/freedreno/kgsl/kgsl_bo.c b/freedreno/kgsl/kgsl_bo.c index b8ac1026..2b45b5e2 100644 --- a/freedreno/kgsl/kgsl_bo.c +++ b/freedreno/kgsl/kgsl_bo.c @@ -168,7 +168,6 @@ drm_private struct fd_bo * kgsl_bo_from_handle(struct fd_device *dev, bo = &kgsl_bo->base; bo->funcs = &funcs; - bo->fd = -1; for (i = 0; i < ARRAY_SIZE(kgsl_bo->list); i++) list_inithead(&kgsl_bo->list[i]); diff --git a/freedreno/msm/msm_bo.c b/freedreno/msm/msm_bo.c index ee668aba..cd05a6cd 100644 --- a/freedreno/msm/msm_bo.c +++ b/freedreno/msm/msm_bo.c @@ -136,7 +136,6 @@ drm_private struct fd_bo * msm_bo_from_handle(struct fd_device *dev, bo = &msm_bo->base; bo->funcs = &funcs; - bo->fd = -1; return bo; } -- cgit v1.2.3