cursor-renderer/native: Replace HW cursor with KMS cursor manager
This removes the old hardware cursor management code and outsources it to MetaKmsCursorManager. What the native cursor renderer still does, however, is the preprocessing i.e. rotating/scaling cursor that wouldn't otherwise be fit for a cursor plane. The cursor DRM buffers are instead of being per cursor sprite now per CRTC, meaning we don't need to stop doing hardware cursors if part of the cursor is on an output that doesn't support it. This is why the whole scale/transform code changed from being per GPU to per CRTC. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
This commit is contained in:
@ -327,12 +327,11 @@ meta_cursor_renderer_init (MetaCursorRenderer *renderer)
|
||||
{
|
||||
}
|
||||
|
||||
graphene_rect_t
|
||||
meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
|
||||
MetaCursorSprite *cursor_sprite)
|
||||
static gboolean
|
||||
calculate_sprite_geometry (MetaCursorSprite *cursor_sprite,
|
||||
graphene_size_t *size,
|
||||
graphene_point_t *hotspot)
|
||||
{
|
||||
MetaCursorRendererPrivate *priv =
|
||||
meta_cursor_renderer_get_instance_private (renderer);
|
||||
CoglTexture *texture;
|
||||
int hot_x, hot_y;
|
||||
int width, height;
|
||||
@ -341,23 +340,39 @@ meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
|
||||
meta_cursor_sprite_realize_texture (cursor_sprite);
|
||||
texture = meta_cursor_sprite_get_cogl_texture (cursor_sprite);
|
||||
if (!texture)
|
||||
return (graphene_rect_t) GRAPHENE_RECT_INIT_ZERO;
|
||||
return FALSE;
|
||||
|
||||
meta_cursor_sprite_get_hotspot (cursor_sprite, &hot_x, &hot_y);
|
||||
texture_scale = meta_cursor_sprite_get_texture_scale (cursor_sprite);
|
||||
width = cogl_texture_get_width (texture);
|
||||
height = cogl_texture_get_height (texture);
|
||||
|
||||
return (graphene_rect_t) {
|
||||
.origin = {
|
||||
.x = priv->current_x - (hot_x * texture_scale),
|
||||
.y = priv->current_y - (hot_y * texture_scale)
|
||||
},
|
||||
.size = {
|
||||
.width = width * texture_scale,
|
||||
.height = height * texture_scale
|
||||
}
|
||||
*size = (graphene_size_t) {
|
||||
.width = width * texture_scale,
|
||||
.height = height * texture_scale
|
||||
};
|
||||
*hotspot = (graphene_point_t) {
|
||||
.x = hot_x * texture_scale,
|
||||
.y = hot_y * texture_scale
|
||||
};
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
graphene_rect_t
|
||||
meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
|
||||
MetaCursorSprite *cursor_sprite)
|
||||
{
|
||||
MetaCursorRendererPrivate *priv =
|
||||
meta_cursor_renderer_get_instance_private (renderer);
|
||||
graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
|
||||
graphene_point_t hotspot;
|
||||
|
||||
if (!calculate_sprite_geometry (cursor_sprite, &rect.size, &hotspot))
|
||||
return GRAPHENE_RECT_INIT_ZERO;
|
||||
|
||||
rect.origin = (graphene_point_t) { .x = -hotspot.x, .y = -hotspot.y };
|
||||
graphene_rect_offset (&rect, priv->current_x, priv->current_y);
|
||||
return rect;
|
||||
}
|
||||
|
||||
static float
|
||||
|
Reference in New Issue
Block a user