diff --git a/src/backends/native/meta-kms-impl-simple.c b/src/backends/native/meta-kms-impl-simple.c index ddc31b938..e50b1c888 100644 --- a/src/backends/native/meta-kms-impl-simple.c +++ b/src/backends/native/meta-kms-impl-simple.c @@ -771,14 +771,27 @@ process_cursor_plane_assignment (MetaKmsImpl *impl, if (!(plane_assignment->flags & META_KMS_ASSIGN_PLANE_FLAG_FB_UNCHANGED)) { int width, height; - int ret; + int ret = -1; width = meta_fixed_16_to_int (plane_assignment->dst_rect.width); height = meta_fixed_16_to_int (plane_assignment->dst_rect.height); - ret = drmModeSetCursor (fd, meta_kms_crtc_get_id (plane_assignment->crtc), - plane_assignment->fb_id, - width, height); + if (plane_assignment->cursor_hotspot.is_valid) + { + ret = drmModeSetCursor2 (fd, meta_kms_crtc_get_id (plane_assignment->crtc), + plane_assignment->fb_id, + width, height, + plane_assignment->cursor_hotspot.x, + plane_assignment->cursor_hotspot.y); + } + + if (ret != 0) + { + ret = drmModeSetCursor (fd, meta_kms_crtc_get_id (plane_assignment->crtc), + plane_assignment->fb_id, + width, height); + } + if (ret != 0) { g_set_error (error, G_IO_ERROR, g_io_error_from_errno (-ret), diff --git a/src/backends/native/meta-kms-update-private.h b/src/backends/native/meta-kms-update-private.h index 91a1de6dc..4d4d4a276 100644 --- a/src/backends/native/meta-kms-update-private.h +++ b/src/backends/native/meta-kms-update-private.h @@ -51,6 +51,12 @@ typedef struct _MetaKmsPlaneAssignment MetaKmsAssignPlaneFlag flags; GList *plane_properties; + + struct { + gboolean is_valid; + int x; + int y; + } cursor_hotspot; } MetaKmsPlaneAssignment; typedef struct _MetaKmsModeSet diff --git a/src/backends/native/meta-kms-update.c b/src/backends/native/meta-kms-update.c index 0371782b7..5ace83021 100644 --- a/src/backends/native/meta-kms-update.c +++ b/src/backends/native/meta-kms-update.c @@ -340,6 +340,16 @@ meta_kms_plane_assignment_set_plane_property (MetaKmsPlaneAssignment *plane_assi g_list_prepend (plane_assignment->plane_properties, plane_prop); } +void +meta_kms_plane_assignment_set_cursor_hotspot (MetaKmsPlaneAssignment *plane_assignment, + int x, + int y) +{ + plane_assignment->cursor_hotspot.is_valid = TRUE; + plane_assignment->cursor_hotspot.x = x; + plane_assignment->cursor_hotspot.y = y; +} + MetaKmsPlaneAssignment * meta_kms_update_get_primary_plane_assignment (MetaKmsUpdate *update, MetaKmsCrtc *crtc) diff --git a/src/backends/native/meta-kms-update.h b/src/backends/native/meta-kms-update.h index cd1822e4a..13dff16dd 100644 --- a/src/backends/native/meta-kms-update.h +++ b/src/backends/native/meta-kms-update.h @@ -108,6 +108,10 @@ void meta_kms_update_custom_page_flip (MetaKmsUpdate *update, MetaKmsCustomPageFlipFunc custom_page_flip_func, gpointer custom_page_flip_user_data); +void meta_kms_plane_assignment_set_cursor_hotspot (MetaKmsPlaneAssignment *plane_assignment, + int x, + int y); + static inline MetaFixed16 meta_fixed_16_from_int (int16_t d) {