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 <robclark@freedesktop.org>
main
Rob Clark 2015-09-04 11:41:47 -04:00 committed by Rob Clark
parent 691d14c9a8
commit 76a1e97eae
4 changed files with 10 additions and 19 deletions

View File

@ -298,11 +298,6 @@ void fd_bo_del(struct fd_bo *bo)
if (!atomic_dec_and_test(&bo->refcnt)) if (!atomic_dec_and_test(&bo->refcnt))
return; return;
if (bo->fd >= 0) {
close(bo->fd);
bo->fd = -1;
}
pthread_mutex_lock(&table_lock); pthread_mutex_lock(&table_lock);
if (bo->bo_reuse) { 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) int fd_bo_dmabuf(struct fd_bo *bo)
{ {
if (bo->fd < 0) { int ret, prime_fd;
int ret, prime_fd;
ret = drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC, ret = drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC,
&prime_fd); &prime_fd);
if (ret) { if (ret) {
return ret; ERROR_MSG("failed to get dmabuf fd: %d", ret);
} return ret;
bo->fd = prime_fd;
bo->bo_reuse = 0;
} }
return dup(bo->fd);
bo->bo_reuse = 0;
return prime_fd;
} }
uint32_t fd_bo_size(struct fd_bo *bo) uint32_t fd_bo_size(struct fd_bo *bo)

View File

@ -138,7 +138,6 @@ struct fd_bo {
uint32_t size; uint32_t size;
uint32_t handle; uint32_t handle;
uint32_t name; uint32_t name;
int fd; /* dmabuf handle */
void *map; void *map;
atomic_t refcnt; atomic_t refcnt;
const struct fd_bo_funcs *funcs; const struct fd_bo_funcs *funcs;

View File

@ -168,7 +168,6 @@ drm_private struct fd_bo * kgsl_bo_from_handle(struct fd_device *dev,
bo = &kgsl_bo->base; bo = &kgsl_bo->base;
bo->funcs = &funcs; bo->funcs = &funcs;
bo->fd = -1;
for (i = 0; i < ARRAY_SIZE(kgsl_bo->list); i++) for (i = 0; i < ARRAY_SIZE(kgsl_bo->list); i++)
list_inithead(&kgsl_bo->list[i]); list_inithead(&kgsl_bo->list[i]);

View File

@ -136,7 +136,6 @@ drm_private struct fd_bo * msm_bo_from_handle(struct fd_device *dev,
bo = &msm_bo->base; bo = &msm_bo->base;
bo->funcs = &funcs; bo->funcs = &funcs;
bo->fd = -1;
return bo; return bo;
} }