mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 21:05:58 +01:00
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
This commit is contained in:
parent
a15c327718
commit
bedfec94bb
4 changed files with 9 additions and 21 deletions
|
@ -151,9 +151,13 @@ static bool legacy_crtc_commit(struct wlr_drm_connector *conn,
|
||||||
|
|
||||||
int ret = drmModeSetCursor(drm->fd, crtc->id, cursor_handle,
|
int ret = drmModeSetCursor(drm->fd, crtc->id, cursor_handle,
|
||||||
cursor_width, cursor_height);
|
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) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -271,7 +271,9 @@ static void close_all_bo_handles(struct wlr_drm_backend *drm,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
close_bo_handle(drm->fd, handles[i]);
|
if (drmCloseBufferHandle(drm->fd, handles[i]) != 0) {
|
||||||
|
wlr_log_errno(WLR_ERROR, "drmCloseBufferHandle failed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
match_obj_(&st, 0, 0, 0, 0);
|
||||||
return st.score;
|
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -36,11 +36,4 @@ size_t match_obj(size_t num_objs, const uint32_t objs[static restrict num_objs],
|
||||||
size_t num_res, const uint32_t res[static restrict num_res],
|
size_t num_res, const uint32_t res[static restrict num_res],
|
||||||
uint32_t out[static restrict num_res]);
|
uint32_t out[static restrict num_res]);
|
||||||
|
|
||||||
/**
|
|
||||||
* Close a GEM buffer handle.
|
|
||||||
*
|
|
||||||
* TODO: replace with drmCloseBufferHandle.
|
|
||||||
*/
|
|
||||||
void close_bo_handle(int drm_fd, uint32_t handle);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue