Skip to content

Commit

Permalink
revert to default fd_bo_close_handle_drm
Browse files Browse the repository at this point in the history
migrade kgsl to new system, let's hope this works
  • Loading branch information
SolDev69 committed Dec 7, 2023
1 parent 642ea4f commit 1395832
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
11 changes: 5 additions & 6 deletions src/freedreno/drm/freedreno_bo.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ fd_bo_init_common(struct fd_bo *bo, struct fd_device *dev)
VG_BO_ALLOC(bo);
}


/* allocate a new buffer object, call w/ table_lock held */
static struct fd_bo *
import_bo_from_handle(struct fd_device *dev, uint32_t size, uint32_t handle)
Expand Down Expand Up @@ -447,12 +448,10 @@ fd_bo_fini_fences(struct fd_bo *bo)
}

void
fd_bo_close_handle_drm(struct fd_device *dev, uint32_t handle)
fd_bo_close_handle_drm(struct fd_bo *bo)
{
struct drm_gem_close req = {
.handle = handle,
};
drmIoctl(dev->fd, DRM_IOCTL_GEM_CLOSE, &req);
bo->dev->funcs->bo_close_handle(dev, handle);
drmIoctl(bo->dev->fd, DRM_IOCTL_GEM_CLOSE, &req);
}

/**
Expand All @@ -478,7 +477,7 @@ fd_bo_fini_common(struct fd_bo *bo)

if (handle) {
simple_mtx_lock(&table_lock);
dev->funcs->bo_close_handle(dev, handle);
dev->funcs->bo_close_handle(bo);
_mesa_hash_table_remove_key(dev->handle_table, &handle);
if (bo->name)
_mesa_hash_table_remove_key(dev->name_table, &bo->name);
Expand Down
2 changes: 0 additions & 2 deletions src/freedreno/drm/freedreno_drmif.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,6 @@ struct fd_bo *fd_bo_from_handle(struct fd_device *dev, uint32_t handle,
uint32_t size);
struct fd_bo *fd_bo_from_name(struct fd_device *dev, uint32_t name);
struct fd_bo *fd_bo_from_dmabuf(struct fd_device *dev, int fd);
struct fd_bo *fd_bo_from_dmabuf_drm(struct fd_device *dev, int fd);

void fd_bo_mark_for_dump(struct fd_bo *bo);

static inline uint64_t
Expand Down
4 changes: 2 additions & 2 deletions src/freedreno/drm/freedreno_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct fd_device_funcs {
uint32_t handle);
uint32_t (*handle_from_dmabuf)(struct fd_device *dev, int fd);
struct fd_bo *(*bo_from_dmabuf)(struct fd_device *dev, int fd);
void (*bo_close_handle)(struct fd_device *dev, uint32_t handle);
void (*bo_close_handle)(struct fd_bo *bo);

struct fd_pipe *(*pipe_new)(struct fd_device *dev, enum fd_pipe_id id,
unsigned prio);
Expand Down Expand Up @@ -476,7 +476,7 @@ struct fd_bo *fd_bo_new_ring(struct fd_device *dev, uint32_t size);

uint32_t fd_handle_from_dmabuf_drm(struct fd_device *dev, int fd);
struct fd_bo *fd_bo_from_dmabuf_drm(struct fd_device *dev, int fd);
void fd_bo_close_handle_drm(struct fd_device *dev, uint32_t handle);
void fd_bo_close_handle_drm(struct fd_bo *bo);

#define enable_debug 0 /* TODO make dynamic */

Expand Down
6 changes: 3 additions & 3 deletions src/freedreno/drm/kgsl/kgsl_bo.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ kgsl_bo_cpu_prep(struct fd_bo *bo, struct fd_pipe *pipe, uint32_t op)
}

void
kgsl_bo_close_handle(struct fd_device *dev, uint32_t handle)
kgsl_bo_close_handle(struct fd_bo *bo)
{
struct kgsl_gpumem_free_id req = {
.id = handle
.id = bo->handle
};

kgsl_pipe_safe_ioctl(dev->fd, IOCTL_KGSL_GPUMEM_FREE_ID, &req);
kgsl_pipe_safe_ioctl(bo->dev->fd, IOCTL_KGSL_GPUMEM_FREE_ID, &req);
}

static void
Expand Down
2 changes: 1 addition & 1 deletion src/freedreno/drm/kgsl/kgsl_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ FD_DEFINE_CAST(fd_bo, kgsl_bo);
struct fd_bo *kgsl_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags);
struct fd_bo *kgsl_bo_from_dmabuf(struct fd_device *dev, int fd);
struct fd_bo *kgsl_bo_from_handle(struct fd_device *dev, uint32_t size, uint32_t handle);
void kgsl_bo_close_handle(struct fd_device *dev, uint32_t handle);
void kgsl_bo_close_handle(struct fd_bo *bo);

#endif

0 comments on commit 1395832

Please sign in to comment.