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
This commit is contained in:
Jonas Ådahl 2016-07-06 17:05:56 +08:00
parent 767e12125b
commit a465e4c5b8
3 changed files with 7 additions and 3 deletions

View File

@ -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 */

View File

@ -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);

View File

@ -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;