aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-10-02 17:24:08 +0200
committerSimon Ser <contact@emersion.fr>2021-12-14 14:33:00 +0100
commitbedfec94bb57cf7dc32f03fce463a30d3370bb20 (patch)
treed64b6b5e4ff0984d3e7e55f0dee0762bc15588c0 /backend/drm
parenta15c327718dafb1b7b7f1213c8878187b6351dba (diff)
backend/drm: use drmCloseBufferHandle
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
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/legacy.c8
-rw-r--r--backend/drm/renderer.c4
-rw-r--r--backend/drm/util.c11
3 files changed, 9 insertions, 14 deletions
diff --git a/backend/drm/legacy.c b/backend/drm/legacy.c
index cb672023..84e8a914 100644
--- a/backend/drm/legacy.c
+++ b/backend/drm/legacy.c
@@ -151,9 +151,13 @@ static bool legacy_crtc_commit(struct wlr_drm_connector *conn,
int ret = drmModeSetCursor(drm->fd, crtc->id, cursor_handle,
cursor_width, cursor_height);
- close_bo_handle(drm->fd, cursor_handle);
+ int set_cursor_errno = errno;
+ if (drmCloseBufferHandle(drm->fd, cursor_handle) != 0) {
+ wlr_log_errno(WLR_ERROR, "drmCloseBufferHandle failed");
+ }
if (ret != 0) {
- wlr_drm_conn_log_errno(conn, WLR_DEBUG, "drmModeSetCursor failed");
+ wlr_drm_conn_log(conn, WLR_DEBUG, "drmModeSetCursor failed: %s",
+ strerror(set_cursor_errno));
return false;
}
diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c
index 815ba981..792de938 100644
--- a/backend/drm/renderer.c
+++ b/backend/drm/renderer.c
@@ -271,7 +271,9 @@ static void close_all_bo_handles(struct wlr_drm_backend *drm,
continue;
}
- close_bo_handle(drm->fd, handles[i]);
+ if (drmCloseBufferHandle(drm->fd, handles[i]) != 0) {
+ wlr_log_errno(WLR_ERROR, "drmCloseBufferHandle failed");
+ }
}
}
diff --git a/backend/drm/util.c b/backend/drm/util.c
index 407c19a5..3cf656fb 100644
--- a/backend/drm/util.c
+++ b/backend/drm/util.c
@@ -320,14 +320,3 @@ size_t match_obj(size_t num_objs, const uint32_t objs[static restrict num_objs],
match_obj_(&st, 0, 0, 0, 0);
return st.score;
}
-
-void close_bo_handle(int drm_fd, uint32_t handle) {
- if (handle == 0) {
- 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");
- }
-}