clutter/stage-view: Always use cogl_blit_framebuffer() from shadowfb

It should only be used when direct blitting is supported, so there is no
reason we should have to deal with pipelines etc when blitting from the
shadow buffer to the onscreen.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1237
This commit is contained in:
Jonas Ådahl 2020-05-05 18:55:03 +02:00 committed by Georges Basile Stavracas Neto
parent 346cadeddb
commit 4e27a4ea1d

View File

@ -57,7 +57,6 @@ typedef struct _ClutterStageViewPrivate
gboolean use_shadowfb;
struct {
CoglOffscreen *framebuffer;
CoglPipeline *pipeline;
} shadow;
CoglScanout *next_scanout;
@ -158,19 +157,6 @@ clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
view_class->setup_offscreen_blit_pipeline (view, priv->offscreen_pipeline);
}
static void
clutter_stage_view_ensure_shadowfb_blit_pipeline (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
if (priv->shadow.pipeline)
return;
priv->shadow.pipeline =
clutter_stage_view_create_framebuffer_pipeline (priv->shadow.framebuffer);
}
void
clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
{
@ -326,12 +312,21 @@ clutter_stage_view_after_paint (ClutterStageView *view)
if (priv->shadow.framebuffer)
{
clutter_stage_view_ensure_shadowfb_blit_pipeline (view);
clutter_stage_view_copy_to_framebuffer (view,
priv->shadow.pipeline,
priv->shadow.framebuffer,
int width, height;
g_autoptr (GError) error = NULL;
width = cogl_framebuffer_get_width (priv->framebuffer);
height = cogl_framebuffer_get_height (priv->framebuffer);
if (!cogl_blit_framebuffer (priv->shadow.framebuffer,
priv->framebuffer,
TRUE);
0, 0,
0, 0,
width, height,
&error))
{
g_warning ("Failed to blit shadow buffer: %s", error->message);
return;
}
}
}
@ -646,7 +641,6 @@ clutter_stage_view_dispose (GObject *object)
g_clear_pointer (&priv->name, g_free);
g_clear_pointer (&priv->framebuffer, cogl_object_unref);
g_clear_pointer (&priv->shadow.framebuffer, cogl_object_unref);
g_clear_pointer (&priv->shadow.pipeline, cogl_object_unref);
g_clear_pointer (&priv->offscreen, cogl_object_unref);
g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);