cursor-renderer-native: Set cursor hotspot metadata on plane assignment
This triggers the paths in the legacy KMS backend to use drmModeSetCursor2(), making virtual machines using "seamless mouse mode" behave correctly again. Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/1094 https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1136
This commit is contained in:
parent
55cf1c1496
commit
a68e6972a2
@ -223,6 +223,31 @@ set_pending_cursor_sprite_gbm_bo (MetaCursorSprite *cursor_sprite,
|
||||
cursor_gpu_state->pending_bo_state = META_CURSOR_GBM_BO_STATE_SET;
|
||||
}
|
||||
|
||||
static void
|
||||
calculate_crtc_cursor_hotspot (MetaCursorSprite *cursor_sprite,
|
||||
int *cursor_hotspot_x,
|
||||
int *cursor_hotspot_y)
|
||||
{
|
||||
MetaCursorNativePrivate *cursor_priv = get_cursor_priv (cursor_sprite);
|
||||
int hot_x, hot_y;
|
||||
int width, height;
|
||||
float scale;
|
||||
MetaMonitorTransform transform;
|
||||
|
||||
scale = cursor_priv->preprocess_state.current_relative_scale;
|
||||
transform = cursor_priv->preprocess_state.current_relative_transform;
|
||||
|
||||
meta_cursor_sprite_get_hotspot (cursor_sprite, &hot_x, &hot_y);
|
||||
width = meta_cursor_sprite_get_width (cursor_sprite);
|
||||
height = meta_cursor_sprite_get_height (cursor_sprite);
|
||||
meta_monitor_transform_transform_point (transform,
|
||||
width, height,
|
||||
hot_x, hot_y,
|
||||
&hot_x, &hot_y);
|
||||
*cursor_hotspot_x = (int) roundf (hot_x * scale);
|
||||
*cursor_hotspot_y = (int) roundf (hot_y * scale);
|
||||
}
|
||||
|
||||
static void
|
||||
set_crtc_cursor (MetaCursorRendererNative *native,
|
||||
MetaKmsUpdate *kms_update,
|
||||
@ -248,6 +273,9 @@ set_crtc_cursor (MetaCursorRendererNative *native,
|
||||
MetaFixed16Rectangle src_rect;
|
||||
MetaFixed16Rectangle dst_rect;
|
||||
MetaKmsAssignPlaneFlag flags;
|
||||
int cursor_hotspot_x;
|
||||
int cursor_hotspot_y;
|
||||
MetaKmsPlaneAssignment *plane_assignment;
|
||||
|
||||
if (cursor_gpu_state->pending_bo_state == META_CURSOR_GBM_BO_STATE_SET)
|
||||
bo = get_pending_cursor_sprite_gbm_bo (cursor_gpu_state);
|
||||
@ -280,7 +308,7 @@ set_crtc_cursor (MetaCursorRendererNative *native,
|
||||
if (!priv->hw_state_invalidated && bo == crtc->cursor_renderer_private)
|
||||
flags |= META_KMS_ASSIGN_PLANE_FLAG_FB_UNCHANGED;
|
||||
|
||||
meta_kms_update_assign_plane (kms_update,
|
||||
plane_assignment = meta_kms_update_assign_plane (kms_update,
|
||||
kms_crtc,
|
||||
cursor_plane,
|
||||
handle.u32,
|
||||
@ -288,6 +316,13 @@ set_crtc_cursor (MetaCursorRendererNative *native,
|
||||
dst_rect,
|
||||
flags);
|
||||
|
||||
calculate_crtc_cursor_hotspot (cursor_sprite,
|
||||
&cursor_hotspot_x,
|
||||
&cursor_hotspot_y);
|
||||
meta_kms_plane_assignment_set_cursor_hotspot (plane_assignment,
|
||||
cursor_hotspot_x,
|
||||
cursor_hotspot_y);
|
||||
|
||||
crtc->cursor_renderer_private = bo;
|
||||
|
||||
if (cursor_gpu_state->pending_bo_state == META_CURSOR_GBM_BO_STATE_SET)
|
||||
|
Loading…
Reference in New Issue
Block a user