From 2c3827aced46547c8e8ab441e1ff2ebf3e02b624 Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Tue, 26 Jul 2011 17:32:47 +0300 Subject: [PATCH] egl-gdl: Provide defaults to be able to initialize a "dummy" context If we are being called without any GDL specific call (either the plane we want to render to or the swap chain length) we can provide sane defaults to still be able to create a context and a surface. https://bugzilla.gnome.org/show_bug.cgi?id=655355 --- cogl/cogl-display.c | 4 ++++ cogl/winsys/cogl-winsys-egl.c | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cogl/cogl-display.c b/cogl/cogl-display.c index 866925305..ec13aa45a 100644 --- a/cogl/cogl-display.c +++ b/cogl/cogl-display.c @@ -97,6 +97,10 @@ cogl_display_new (CoglRenderer *renderer, display->setup = FALSE; +#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT + display->gdl_plane = GDL_PLANE_ID_UPP_C; +#endif + return _cogl_display_object_new (display); } diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c index db01709bd..4ee208a60 100644 --- a/cogl/winsys/cogl-winsys-egl.c +++ b/cogl/winsys/cogl-winsys-egl.c @@ -1091,9 +1091,13 @@ gdl_plane_init (CoglDisplay *display, GError **error) if (rc == GDL_SUCCESS) rc = gdl_plane_set_attr (GDL_PLANE_DST_RECT, &dstRect); + /* Default to triple buffering if we don't have an onscreen template */ if (rc == GDL_SUCCESS) - rc = gdl_plane_set_uint (GDL_PLANE_NUM_GFX_SURFACES, - display->swap_chain->length); + if (display->onscreen_template) + rc = gdl_plane_set_uint (GDL_PLANE_NUM_GFX_SURFACES, + display->onscreen_template->swap_chain->length); + else + rc = gdl_plane_set_uint (GDL_PLANE_NUM_GFX_SURFACES, 3); if (rc == GDL_SUCCESS) rc = gdl_plane_config_end (GDL_FALSE);