freedreno/drm: drop bo's dev reference

This is a bit over-paranoid, and can cause drm device fd leaks if there
is a bo leak somewhere.  Which is kind of a worse outcome.

This "fixes" a fd leak seen in:

dEQP-EGL.functional.query_context.get_current_display.*
dEQP-EGL.functional.query_context.get_current_context.*
dEQP-EGL.functional.query_context.get_current_display.*

(Still tracking down the root leak)

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6900>
This commit is contained in:
Rob Clark 2020-09-25 12:38:51 -07:00 committed by Marge Bot
parent 6a20c630b9
commit 69a3ef6511
2 changed files with 2 additions and 8 deletions

View file

@ -69,7 +69,7 @@ static struct fd_bo * bo_from_handle(struct fd_device *dev,
drmIoctl(dev->fd, DRM_IOCTL_GEM_CLOSE, &req);
return NULL;
}
bo->dev = fd_device_ref(dev);
bo->dev = dev;
bo->size = size;
bo->handle = handle;
bo->iova = bo->funcs->iova(bo);
@ -262,7 +262,7 @@ void fd_bo_del(struct fd_bo *bo)
goto out;
bo_del(bo);
fd_device_del_locked(dev);
out:
pthread_mutex_unlock(&table_lock);
}

View file

@ -180,7 +180,6 @@ retry:
goto retry;
}
p_atomic_set(&bo->refcnt, 1);
fd_device_ref(bo->dev);
bo->flags = FD_RELOC_FLAGS_INIT;
return bo;
}
@ -207,11 +206,6 @@ fd_bo_cache_free(struct fd_bo_cache *cache, struct fd_bo *bo)
list_addtail(&bo->list, &bucket->list);
fd_bo_cache_cleanup(cache, time.tv_sec);
/* bo's in the bucket cache don't have a ref and
* don't hold a ref to the dev:
*/
fd_device_del_locked(bo->dev);
return 0;
}