compositor-view/native: Don't scan out surface with color state mismatch

If the color state of a surface doesn't match the output, don't try to
scan it out, as it needs to pass through color state transformations to
look correct.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
This commit is contained in:
Jonas Ådahl
2024-06-18 22:58:31 +02:00
committed by Sebastian Wick
parent 6b07141f1a
commit 20c7653d49
4 changed files with 20 additions and 2 deletions

View File

@ -81,5 +81,3 @@ CLUTTER_EXPORT
void clutter_stage_view_notify_ready (ClutterStageView *view);
void clutter_stage_view_invalidate_input_devices (ClutterStageView *view);
ClutterColorState * clutter_stage_view_get_color_state (ClutterStageView *view);

View File

@ -1322,6 +1322,9 @@ clutter_stage_view_get_default_paint_flags (ClutterStageView *view)
return CLUTTER_PAINT_FLAG_NONE;
}
/**
* clutter_stage_view_get_color_state: (skip)
*/
ClutterColorState *
clutter_stage_view_get_color_state (ClutterStageView *view)
{

View File

@ -94,3 +94,6 @@ void clutter_stage_view_schedule_update_now (ClutterStageView *view);
CLUTTER_EXPORT
ClutterPaintFlag clutter_stage_view_get_default_paint_flags (ClutterStageView *view);
CLUTTER_EXPORT
ClutterColorState * clutter_stage_view_get_color_state (ClutterStageView *view);

View File

@ -159,6 +159,8 @@ find_scanout_candidate (MetaCompositorView *compositor_view,
ClutterActorBox actor_box;
MetaSurfaceActor *surface_actor;
MetaSurfaceActorWayland *surface_actor_wayland;
ClutterColorState *view_color_state;
ClutterColorState *surface_color_state;
MetaWaylandSurface *surface;
if (meta_compositor_is_unredirect_inhibited (compositor))
@ -285,6 +287,18 @@ find_scanout_candidate (MetaCompositorView *compositor_view,
return FALSE;
}
view_color_state =
clutter_stage_view_get_color_state (CLUTTER_STAGE_VIEW (view));
surface_color_state =
clutter_actor_get_color_state (CLUTTER_ACTOR (surface_actor));
if (!clutter_color_state_equals (view_color_state, surface_color_state))
{
meta_topic (META_DEBUG_RENDER,
"No direct scanout candidate: "
"surface color state doesn't match the outputs");
return FALSE;
}
if (meta_surface_actor_is_effectively_obscured (surface_actor))
{
meta_topic (META_DEBUG_RENDER,