drm/backend: add support for cursor hotspots

Enables DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT and sets the cursor hotspots on the
cursor plane so virtualized drivers can accelerate mouse movement.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3776
This commit is contained in:
Ian Forbes 2024-03-19 16:20:32 -05:00
parent 94c31b824c
commit e3bd318547
4 changed files with 20 additions and 1 deletions

View file

@ -111,6 +111,11 @@ bool check_drm_features(struct wlr_drm_backend *drm) {
wlr_log(WLR_DEBUG, "Using atomic DRM interface");
drm->iface = &atomic_iface;
}
#ifdef DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT
if (drm->iface == &atomic_iface && drmSetClientCap(drm->fd, DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT, 1) == 0) {
wlr_log(WLR_INFO, "DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT supported");
}
#endif
if (drm->iface == &legacy_iface) {
drm->supports_tearing_page_flips = drmGetCap(drm->fd, DRM_CAP_ASYNC_PAGE_FLIP, &cap) == 0 && cap == 1;