From a465e4c5b8e4ea9de71c02081ee481d088f0b015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 6 Jul 2016 17:05:56 +0800 Subject: [PATCH] compositor: Initiate cogl context field on creation There will only ever be one context; just get it from clutter instead of waiting for we interact with a framebuffer. https://bugzilla.gnome.org/show_bug.cgi?id=768976 --- src/backends/meta-backend-private.h | 2 ++ src/backends/meta-backend.c | 2 +- src/compositor/compositor.c | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/backends/meta-backend-private.h b/src/backends/meta-backend-private.h index f313585b3..109e43f78 100644 --- a/src/backends/meta-backend-private.h +++ b/src/backends/meta-backend-private.h @@ -138,4 +138,6 @@ gboolean meta_backend_get_relative_motion_deltas (MetaBackend *backend, void meta_backend_set_client_pointer_constraint (MetaBackend *backend, MetaPointerConstraint *constraint); +ClutterBackend * meta_backend_get_clutter_backend (MetaBackend *backend); + #endif /* META_BACKEND_PRIVATE_H */ diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c index e04f50fb4..2ad6b8445 100644 --- a/src/backends/meta-backend.c +++ b/src/backends/meta-backend.c @@ -671,7 +671,7 @@ static GSourceFuncs event_funcs = { event_dispatch }; -static ClutterBackend * +ClutterBackend * meta_backend_get_clutter_backend (MetaBackend *backend) { MetaBackendPrivate *priv = meta_backend_get_instance_private (backend); diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index b2f4f932e..49b039d51 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -1051,7 +1051,6 @@ meta_pre_paint_func (gpointer data) frame_callback, compositor, NULL); - compositor->context = cogl_framebuffer_get_context (COGL_FRAMEBUFFER (compositor->onscreen)); } if (compositor->windows == NULL) @@ -1159,10 +1158,13 @@ on_shadow_factory_changed (MetaShadowFactory *factory, MetaCompositor * meta_compositor_new (MetaDisplay *display) { - MetaCompositor *compositor; + MetaBackend *backend = meta_get_backend (); + ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); + MetaCompositor *compositor; compositor = g_new0 (MetaCompositor, 1); compositor->display = display; + compositor->context = clutter_backend->cogl_context; if (g_getenv("META_DISABLE_MIPMAPS")) compositor->no_mipmaps = TRUE;