mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 18: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
790b386c5f
commit
8ccbd36315
@ -63,6 +63,7 @@ static GQuark quark_cursor_sprite = 0;
|
|||||||
|
|
||||||
struct _MetaCursorRendererNativePrivate
|
struct _MetaCursorRendererNativePrivate
|
||||||
{
|
{
|
||||||
|
gboolean hw_state_invalidated;
|
||||||
gboolean has_hw_cursor;
|
gboolean has_hw_cursor;
|
||||||
|
|
||||||
MetaCursorSprite *last_cursor;
|
MetaCursorSprite *last_cursor;
|
||||||
@ -159,8 +160,7 @@ set_pending_cursor_sprite_gbm_bo (MetaCursorSprite *cursor_sprite,
|
|||||||
static void
|
static void
|
||||||
set_crtc_cursor (MetaCursorRendererNative *native,
|
set_crtc_cursor (MetaCursorRendererNative *native,
|
||||||
MetaCRTC *crtc,
|
MetaCRTC *crtc,
|
||||||
MetaCursorSprite *cursor_sprite,
|
MetaCursorSprite *cursor_sprite)
|
||||||
gboolean force)
|
|
||||||
{
|
{
|
||||||
MetaCursorRendererNativePrivate *priv = meta_cursor_renderer_native_get_instance_private (native);
|
MetaCursorRendererNativePrivate *priv = meta_cursor_renderer_native_get_instance_private (native);
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ set_crtc_cursor (MetaCursorRendererNative *native,
|
|||||||
else
|
else
|
||||||
bo = get_active_cursor_sprite_gbm_bo (cursor_sprite);
|
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;
|
return;
|
||||||
|
|
||||||
crtc->cursor_renderer_private = bo;
|
crtc->cursor_renderer_private = bo;
|
||||||
@ -197,7 +197,7 @@ set_crtc_cursor (MetaCursorRendererNative *native,
|
|||||||
}
|
}
|
||||||
else
|
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);
|
drmModeSetCursor2 (priv->drm_fd, crtc->crtc_id, 0, 0, 0, 0, 0);
|
||||||
crtc->cursor_renderer_private = NULL;
|
crtc->cursor_renderer_private = NULL;
|
||||||
@ -207,8 +207,7 @@ set_crtc_cursor (MetaCursorRendererNative *native,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
update_hw_cursor (MetaCursorRendererNative *native,
|
update_hw_cursor (MetaCursorRendererNative *native,
|
||||||
MetaCursorSprite *cursor_sprite,
|
MetaCursorSprite *cursor_sprite)
|
||||||
gboolean force)
|
|
||||||
{
|
{
|
||||||
MetaCursorRendererNativePrivate *priv = meta_cursor_renderer_native_get_instance_private (native);
|
MetaCursorRendererNativePrivate *priv = meta_cursor_renderer_native_get_instance_private (native);
|
||||||
MetaCursorRenderer *renderer = META_CURSOR_RENDERER (native);
|
MetaCursorRenderer *renderer = META_CURSOR_RENDERER (native);
|
||||||
@ -241,7 +240,7 @@ update_hw_cursor (MetaCursorRendererNative *native,
|
|||||||
else
|
else
|
||||||
crtc_cursor = NULL;
|
crtc_cursor = NULL;
|
||||||
|
|
||||||
set_crtc_cursor (native, &crtcs[i], crtc_cursor, force);
|
set_crtc_cursor (native, &crtcs[i], crtc_cursor);
|
||||||
|
|
||||||
if (crtc_cursor)
|
if (crtc_cursor)
|
||||||
{
|
{
|
||||||
@ -252,6 +251,8 @@ update_hw_cursor (MetaCursorRendererNative *native,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priv->hw_state_invalidated = FALSE;
|
||||||
|
|
||||||
if (painted)
|
if (painted)
|
||||||
meta_cursor_renderer_emit_painted (renderer, cursor_sprite);
|
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);
|
meta_cursor_renderer_native_trigger_frame (native, cursor_sprite);
|
||||||
|
|
||||||
priv->has_hw_cursor = should_have_hw_cursor (renderer, 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;
|
return priv->has_hw_cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -648,8 +649,11 @@ static void
|
|||||||
force_update_hw_cursor (MetaCursorRendererNative *native)
|
force_update_hw_cursor (MetaCursorRendererNative *native)
|
||||||
{
|
{
|
||||||
MetaCursorRenderer *renderer = META_CURSOR_RENDERER (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
|
static void
|
||||||
@ -670,6 +674,8 @@ meta_cursor_renderer_native_init (MetaCursorRendererNative *native)
|
|||||||
g_signal_connect_object (monitors, "monitors-changed",
|
g_signal_connect_object (monitors, "monitors-changed",
|
||||||
G_CALLBACK (on_monitors_changed), native, 0);
|
G_CALLBACK (on_monitors_changed), native, 0);
|
||||||
|
|
||||||
|
priv->hw_state_invalidated = TRUE;
|
||||||
|
|
||||||
#if defined(CLUTTER_WINDOWING_EGL)
|
#if defined(CLUTTER_WINDOWING_EGL)
|
||||||
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_EGL))
|
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_EGL))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user