[mutter] cursor-renderer-native: fallback to texture cursor
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cursor-renderer-native: fallback to texture cursor
- Date: Wed, 29 Mar 2017 03:17:17 +0000 (UTC)
commit 0d5274b3b77f8e38127a2a8251f46b638ebc6fae
Author: Jente Hidskes <hjdskes gmail com>
Date: Fri Mar 24 22:12:54 2017 +0100
cursor-renderer-native: fallback to texture cursor
In some cases the hardware cursor is invisible when Mutter is launched from the
TTY, due to drmModeSetCursor2 failing without a fallback being set.
This patch captures the return value of drmModeSetCursor2 and in case of an
error, enables the texture based fallback. It adds a `broken` state, that is
checked in should_have_hw_cursor() and
meta_cursor_renderer_native_realize_cursor_from_*() to avoid copying every
cursor into a gbm buffer when we know it will fail every single time.
https://bugzilla.gnome.org/show_bug.cgi?id=770020
src/backends/native/meta-cursor-renderer-native.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/backends/native/meta-cursor-renderer-native.c
b/src/backends/native/meta-cursor-renderer-native.c
index 462c598..4f7fcec 100644
--- a/src/backends/native/meta-cursor-renderer-native.c
+++ b/src/backends/native/meta-cursor-renderer-native.c
@@ -65,6 +65,7 @@ struct _MetaCursorRendererNativePrivate
{
gboolean hw_state_invalidated;
gboolean has_hw_cursor;
+ gboolean hw_cursor_broken;
MetaCursorSprite *last_cursor;
guint animation_timeout_id;
@@ -185,8 +186,13 @@ set_crtc_cursor (MetaCursorRendererNative *native,
handle = gbm_bo_get_handle (bo);
meta_cursor_sprite_get_hotspot (cursor_sprite, &hot_x, &hot_y);
- drmModeSetCursor2 (priv->drm_fd, crtc->crtc_id, handle.u32,
- priv->cursor_width, priv->cursor_height, hot_x, hot_y);
+ if (drmModeSetCursor2 (priv->drm_fd, crtc->crtc_id, handle.u32,
+ priv->cursor_width, priv->cursor_height,
+ hot_x, hot_y) < 0)
+ {
+ priv->has_hw_cursor = FALSE;
+ priv->hw_cursor_broken = TRUE;
+ }
if (cursor_priv->pending_bo_state == META_CURSOR_GBM_BO_STATE_SET)
{
@@ -311,8 +317,13 @@ static gboolean
should_have_hw_cursor (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
+ MetaCursorRendererNative *native = META_CURSOR_RENDERER_NATIVE (renderer);
+ MetaCursorRendererNativePrivate *priv = meta_cursor_renderer_native_get_instance_private (native);
CoglTexture *texture;
+ if (priv->hw_cursor_broken)
+ return FALSE;
+
if (!cursor_sprite)
return FALSE;
@@ -528,7 +539,7 @@ meta_cursor_renderer_native_realize_cursor_from_wl_buffer (MetaCursorRenderer *r
CoglTexture *texture;
uint width, height;
- if (!priv->gbm)
+ if (!priv->gbm || priv->hw_cursor_broken)
return;
/* Destroy any previous pending cursor buffer; we'll always either fail (which
@@ -621,7 +632,7 @@ meta_cursor_renderer_native_realize_cursor_from_xcursor (MetaCursorRenderer *ren
MetaCursorRendererNativePrivate *priv =
meta_cursor_renderer_native_get_instance_private (native);
- if (!priv->gbm)
+ if (!priv->gbm || priv->hw_cursor_broken)
return;
invalidate_pending_cursor_sprite_gbm_bo (cursor_sprite);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]