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 9a74e56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 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
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ wayland_client = dependency('wayland-client',
default_options: wayland_project_options,
)

drm = dependency('libdrm', version: '>=2.4.105')
drm = dependency('libdrm', version: '>=2.4.108')
gbm = dependency('gbm', version: '>=17.1.0')
xkbcommon = dependency('xkbcommon')
udev = dependency('libudev')
Expand Down

0 comments on commit 9a74e56

Please sign in to comment.