1
0
Fork 0

surface-actor: Add meta_surface_actor_schedule_update()

This function allows scheduling a stage update in the context of a
surface actor and emit the "update-scheduled" signal. This signal is
similar to "repaint-scheduled", but can be used to be notified of
updates that do not necessarily result in a repaint.

With variable refresh rate, any update potentially affecting the
frame pacing of a surface actor needs to be handled differently
depending on whether that surface actor drives the refresh rate or
not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
This commit is contained in:
Dor Askayo 2024-02-03 19:31:32 +02:00 committed by Marge Bot
parent 1318cd3faf
commit 627ab24721
2 changed files with 22 additions and 0 deletions

View file

@ -62,6 +62,7 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaSurfaceActor, meta_surface_actor, CLUTTER_
enum
{
REPAINT_SCHEDULED,
UPDATE_SCHEDULED,
SIZE_CHANGED,
LAST_SIGNAL,
@ -293,6 +294,14 @@ meta_surface_actor_class_init (MetaSurfaceActorClass *klass)
NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[UPDATE_SCHEDULED] = g_signal_new ("update-scheduled",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[SIZE_CHANGED] = g_signal_new ("size-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@ -393,6 +402,17 @@ meta_surface_actor_get_texture (MetaSurfaceActor *self)
return priv->texture;
}
void
meta_surface_actor_schedule_update (MetaSurfaceActor *self)
{
ClutterStage *stage =
CLUTTER_STAGE (clutter_actor_get_stage (CLUTTER_ACTOR (self)));
clutter_stage_schedule_update (stage);
g_signal_emit (self, signals[UPDATE_SCHEDULED], 0);
}
void
meta_surface_actor_update_area (MetaSurfaceActor *self,
int x,

View file

@ -49,6 +49,8 @@ void meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
MtkRegion *region);
MtkRegion * meta_surface_actor_get_opaque_region (MetaSurfaceActor *self);
void meta_surface_actor_schedule_update (MetaSurfaceActor *self);
void meta_surface_actor_process_damage (MetaSurfaceActor *actor,
int x, int y, int width, int height);