1
0
Fork 0

wayland/surface: Add double-buffered color state

This will be used by the color management protocol to set the color
state of a surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3893>
This commit is contained in:
Sebastian Wick 2024-07-16 17:36:03 +02:00 committed by Marge Bot
parent 1b2d0a4d4a
commit 63fa79c878
3 changed files with 26 additions and 0 deletions

View file

@ -191,6 +191,11 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor
color_state = color_state =
clutter_actor_get_color_state (CLUTTER_ACTOR (surface_actor)); clutter_actor_get_color_state (CLUTTER_ACTOR (surface_actor));
if (surface->color_state)
color_state = surface->color_state;
clutter_actor_set_color_state (CLUTTER_ACTOR (surface_actor),
color_state);
texture = meta_wayland_surface_get_texture (surface); texture = meta_wayland_surface_get_texture (surface);
meta_shaped_texture_set_texture (stex, texture); meta_shaped_texture_set_texture (stex, texture);

View file

@ -135,6 +135,9 @@ struct _MetaWaylandSurfaceState
MetaWaylandSyncPoint *acquire; MetaWaylandSyncPoint *acquire;
MetaWaylandSyncPoint *release; MetaWaylandSyncPoint *release;
} drm_syncobj; } drm_syncobj;
gboolean has_new_color_state;
ClutterColorState *color_state;
}; };
struct _MetaWaylandDragDestFuncs struct _MetaWaylandDragDestFuncs
@ -274,6 +277,9 @@ struct _MetaWaylandSurface
} transaction; } transaction;
MetaLogicalMonitor *main_monitor; MetaLogicalMonitor *main_monitor;
/* color-management */
ClutterColorState *color_state;
}; };
void meta_wayland_shell_init (MetaWaylandCompositor *compositor); void meta_wayland_shell_init (MetaWaylandCompositor *compositor);

View file

@ -453,6 +453,9 @@ meta_wayland_surface_state_set_default (MetaWaylandSurfaceState *state)
state->drm_syncobj.acquire = NULL; state->drm_syncobj.acquire = NULL;
state->drm_syncobj.release = NULL; state->drm_syncobj.release = NULL;
state->has_new_color_state = FALSE;
state->color_state = NULL;
} }
static void static void
@ -475,6 +478,7 @@ meta_wayland_surface_state_clear (MetaWaylandSurfaceState *state)
g_clear_object (&state->texture); g_clear_object (&state->texture);
g_clear_object (&state->drm_syncobj.acquire); g_clear_object (&state->drm_syncobj.acquire);
g_clear_object (&state->drm_syncobj.release); g_clear_object (&state->drm_syncobj.release);
g_clear_object (&state->color_state);
g_clear_pointer (&state->surface_damage, mtk_region_unref); g_clear_pointer (&state->surface_damage, mtk_region_unref);
g_clear_pointer (&state->buffer_damage, mtk_region_unref); g_clear_pointer (&state->buffer_damage, mtk_region_unref);
@ -645,6 +649,14 @@ meta_wayland_surface_state_merge_into (MetaWaylandSurfaceState *from,
g_clear_object (&from->drm_syncobj.acquire); g_clear_object (&from->drm_syncobj.acquire);
g_set_object (&to->drm_syncobj.release, from->drm_syncobj.release); g_set_object (&to->drm_syncobj.release, from->drm_syncobj.release);
g_clear_object (&from->drm_syncobj.release); g_clear_object (&from->drm_syncobj.release);
if (from->has_new_color_state)
{
g_set_object (&to->color_state, from->color_state);
g_clear_object (&from->color_state);
to->has_new_color_state = TRUE;
}
} }
static void static void
@ -840,6 +852,9 @@ meta_wayland_surface_apply_state (MetaWaylandSurface *surface,
surface->input_region = mtk_region_ref (state->input_region); surface->input_region = mtk_region_ref (state->input_region);
} }
if (state->has_new_color_state)
g_set_object (&surface->color_state, state->color_state);
/* /*
* A new commit indicates a new content update, so any previous * A new commit indicates a new content update, so any previous
* content update did not go on screen and needs to be discarded. * content update did not go on screen and needs to be discarded.