Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
backend/drm: use drmCloseBufferHandle
Browse files Browse the repository at this point in the history
This has been added in [1] and allows us to close buffer handles
without manually calling drmIoctl.

[1]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/192
  • Loading branch information
emersion committed Oct 2, 2021
1 parent 323b849 commit 088e9d9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions backend/drm/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ static uint32_t get_bo_handle_for_fd(struct wlr_drm_backend *drm,
if (!drm_bo_handle_table_ref(&drm->bo_handles, handle)) {
// If that failed, the handle wasn't ref'ed in the table previously,
// so safe to delete
struct drm_gem_close args = { .handle = handle };
drmIoctl(drm->fd, DRM_IOCTL_GEM_CLOSE, &args);
drmCloseBufferHandle(drm->fd, handle);
return 0;
}

Expand All @@ -234,9 +233,8 @@ static void close_bo_handle(struct wlr_drm_backend *drm, uint32_t handle) {
return;
}

struct drm_gem_close args = { .handle = handle };
if (drmIoctl(drm->fd, DRM_IOCTL_GEM_CLOSE, &args) != 0) {
wlr_log_errno(WLR_ERROR, "drmIoctl(GEM_CLOSE) failed");
if (drmCloseBufferHandle(drm->fd, handle) != 0) {
wlr_log_errno(WLR_ERROR, "drmCloseBufferHandle failed");
}
}

Expand Down

0 comments on commit 088e9d9

Please sign in to comment.