mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
MetaCursorRendererNative: Always force set hw cursor the first time
The initial state of the hardware cursor is not known, so always force update it the first time we update the cursor. Do this by changing the 'force' flag of update_hw_cursor() to an 'invalidated' hw cursor state. https://bugzilla.gnome.org/show_bug.cgi?id=771056
This commit is contained in:
parent
57f80f091f
commit
962e1d5a69
@ -63,6 +63,7 @@ static GQuark quark_cursor_sprite = 0;
|
||||
|
||||
struct _MetaCursorRendererNativePrivate
|
||||
{
|
||||
gboolean hw_state_invalidated;
|
||||
gboolean has_hw_cursor;
|
||||
|
||||
MetaCursorSprite *last_cursor;
|
||||
@ -159,8 +160,7 @@ set_pending_cursor_sprite_gbm_bo (MetaCursorSprite *cursor_sprite,
|
||||
static void
|
||||
set_crtc_cursor (MetaCursorRendererNative *native,
|
||||
MetaCrtc *crtc,
|
||||
MetaCursorSprite *cursor_sprite,
|
||||
gboolean force)
|
||||
MetaCursorSprite *cursor_sprite)
|
||||
{
|
||||
MetaCursorRendererNativePrivate *priv = meta_cursor_renderer_native_get_instance_private (native);
|
||||
|
||||
@ -177,7 +177,7 @@ set_crtc_cursor (MetaCursorRendererNative *native,
|
||||
else
|
||||
bo = get_active_cursor_sprite_gbm_bo (cursor_sprite);
|
||||
|
||||
if (!force && bo == crtc->cursor_renderer_private)
|
||||
if (!priv->hw_state_invalidated && bo == crtc->cursor_renderer_private)
|
||||
return;
|
||||
|
||||
crtc->cursor_renderer_private = bo;
|
||||
@ -197,7 +197,7 @@ set_crtc_cursor (MetaCursorRendererNative *native,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (force || crtc->cursor_renderer_private != NULL)
|
||||
if (priv->hw_state_invalidated || crtc->cursor_renderer_private != NULL)
|
||||
{
|
||||
drmModeSetCursor2 (priv->drm_fd, crtc->crtc_id, 0, 0, 0, 0, 0);
|
||||
crtc->cursor_renderer_private = NULL;
|
||||
@ -207,8 +207,7 @@ set_crtc_cursor (MetaCursorRendererNative *native,
|
||||
|
||||
static void
|
||||
update_hw_cursor (MetaCursorRendererNative *native,
|
||||
MetaCursorSprite *cursor_sprite,
|
||||
gboolean force)
|
||||
MetaCursorSprite *cursor_sprite)
|
||||
{
|
||||
MetaCursorRendererNativePrivate *priv = meta_cursor_renderer_native_get_instance_private (native);
|
||||
MetaCursorRenderer *renderer = META_CURSOR_RENDERER (native);
|
||||
@ -241,7 +240,7 @@ update_hw_cursor (MetaCursorRendererNative *native,
|
||||
else
|
||||
crtc_cursor = NULL;
|
||||
|
||||
set_crtc_cursor (native, &crtcs[i], crtc_cursor, force);
|
||||
set_crtc_cursor (native, &crtcs[i], crtc_cursor);
|
||||
|
||||
if (crtc_cursor)
|
||||
{
|
||||
@ -252,6 +251,8 @@ update_hw_cursor (MetaCursorRendererNative *native,
|
||||
}
|
||||
}
|
||||
|
||||
priv->hw_state_invalidated = FALSE;
|
||||
|
||||
if (painted)
|
||||
meta_cursor_renderer_emit_painted (renderer, cursor_sprite);
|
||||
}
|
||||
@ -394,7 +395,7 @@ meta_cursor_renderer_native_update_cursor (MetaCursorRenderer *renderer,
|
||||
meta_cursor_renderer_native_trigger_frame (native, cursor_sprite);
|
||||
|
||||
priv->has_hw_cursor = should_have_hw_cursor (renderer, cursor_sprite);
|
||||
update_hw_cursor (native, cursor_sprite, FALSE);
|
||||
update_hw_cursor (native, cursor_sprite);
|
||||
return priv->has_hw_cursor;
|
||||
}
|
||||
|
||||
@ -656,8 +657,11 @@ static void
|
||||
force_update_hw_cursor (MetaCursorRendererNative *native)
|
||||
{
|
||||
MetaCursorRenderer *renderer = META_CURSOR_RENDERER (native);
|
||||
MetaCursorRendererNativePrivate *priv =
|
||||
meta_cursor_renderer_native_get_instance_private (native);
|
||||
|
||||
update_hw_cursor (native, meta_cursor_renderer_get_cursor (renderer), TRUE);
|
||||
priv->hw_state_invalidated = TRUE;
|
||||
update_hw_cursor (native, meta_cursor_renderer_get_cursor (renderer));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -678,6 +682,8 @@ meta_cursor_renderer_native_init (MetaCursorRendererNative *native)
|
||||
g_signal_connect_object (monitors, "monitors-changed",
|
||||
G_CALLBACK (on_monitors_changed), native, 0);
|
||||
|
||||
priv->hw_state_invalidated = TRUE;
|
||||
|
||||
#if defined(CLUTTER_WINDOWING_EGL)
|
||||
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_EGL))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user