summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cogl/Makefile.am2
-rw-r--r--cogl/cogl-display-private.h5
-rw-r--r--cogl/cogl-display.c12
-rw-r--r--cogl/cogl-display.h12
-rw-r--r--cogl/cogl-swap-chain-private.h1
-rw-r--r--cogl/cogl-swap-chain.c8
-rw-r--r--cogl/cogl-swap-chain.h5
-rw-r--r--cogl/winsys/cogl-winsys-egl.c131
-rw-r--r--configure.ac2
9 files changed, 175 insertions, 3 deletions
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index 335f21d7..3cee5fad 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -338,7 +338,7 @@ if SUPPORT_EGL_PLATFORM_POWERVR_NULL
cogl_sources_c += \
$(srcdir)/winsys/cogl-winsys-egl.c
endif
-if SUPPORT_EGL_PLATFORM_POWERVR_GDL
+if SUPPORT_EGL_PLATFORM_GDL
cogl_sources_c += \
$(srcdir)/winsys/cogl-winsys-egl.c
endif
diff --git a/cogl/cogl-display-private.h b/cogl/cogl-display-private.h
index 1bda21de..964dfb67 100644
--- a/cogl/cogl-display-private.h
+++ b/cogl/cogl-display-private.h
@@ -26,6 +26,7 @@
#define __COGL_DISPLAY_PRIVATE_H
#include "cogl-object-private.h"
+#include "cogl-display.h"
#include "cogl-renderer.h"
#include "cogl-onscreen-template.h"
@@ -37,6 +38,10 @@ struct _CoglDisplay
CoglRenderer *renderer;
CoglOnscreenTemplate *onscreen_template;
+#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
+ struct gdl_plane *gdl_plane;
+#endif
+
void *winsys;
};
diff --git a/cogl/cogl-display.c b/cogl/cogl-display.c
index bb792b75..0953f1f0 100644
--- a/cogl/cogl-display.c
+++ b/cogl/cogl-display.c
@@ -121,3 +121,15 @@ cogl_display_setup (CoglDisplay *display,
return TRUE;
}
+
+#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
+void
+cogl_gdl_display_set_plane (CoglDisplay *display,
+ struct gdl_plane *plane)
+{
+ g_return_if_fail (display->setup == FALSE);
+
+ display->gdl_plane = plane;
+}
+#endif
+
diff --git a/cogl/cogl-display.h b/cogl/cogl-display.h
index 00ce4fb0..720b86b2 100644
--- a/cogl/cogl-display.h
+++ b/cogl/cogl-display.h
@@ -36,6 +36,10 @@
G_BEGIN_DECLS
+#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
+#include <@CLUTTER_CEX100_LIBGDL_PREFIX@libgdl.h>
+#endif
+
/**
* SECTION:cogl-display
* @short_description: Represents a display pipeline
@@ -82,6 +86,14 @@ gboolean
cogl_display_setup (CoglDisplay *display,
GError **error);
+#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
+#define cogl_gdl_display_set_plane \
+ cogl_gdl_display_set_plane_EXP
+void
+cogl_gdl_display_set_plane (CoglDisplay *display,
+ struct gdl_plane *plane);
+#endif
+
G_END_DECLS
#endif /* __COGL_DISPLAY_H__ */
diff --git a/cogl/cogl-swap-chain-private.h b/cogl/cogl-swap-chain-private.h
index 5edadeb3..2f631097 100644
--- a/cogl/cogl-swap-chain-private.h
+++ b/cogl/cogl-swap-chain-private.h
@@ -32,6 +32,7 @@ struct _CoglSwapChain
gboolean has_alpha;
+ int length;
};
#endif /* __COGL_SWAP_CHAIN_PRIVATE_H */
diff --git a/cogl/cogl-swap-chain.c b/cogl/cogl-swap-chain.c
index 9622e9ec..93261460 100644
--- a/cogl/cogl-swap-chain.c
+++ b/cogl/cogl-swap-chain.c
@@ -54,6 +54,8 @@ cogl_swap_chain_new (void)
{
CoglSwapChain *swap_chain = g_slice_new0 (CoglSwapChain);
+ swap_chain->length = -1; /* no preference */
+
return _cogl_swap_chain_object_new (swap_chain);
}
@@ -64,3 +66,9 @@ cogl_swap_chain_set_has_alpha (CoglSwapChain *swap_chain,
swap_chain->has_alpha = has_alpha;
}
+void
+cogl_swap_chain_set_length (CoglSwapChain *swap_chain,
+ int length)
+{
+ swap_chain->length = length;
+}
diff --git a/cogl/cogl-swap-chain.h b/cogl/cogl-swap-chain.h
index 7791e234..2f3ae587 100644
--- a/cogl/cogl-swap-chain.h
+++ b/cogl/cogl-swap-chain.h
@@ -41,6 +41,11 @@ void
cogl_swap_chain_set_has_alpha (CoglSwapChain *swap_chain,
gboolean has_alpha);
+#define cogl_swap_chain_set_length cogl_swap_chain_set_length_EXP
+void
+cogl_swap_chain_set_length (CoglSwapChain *swap_chain,
+ int length);
+
G_END_DECLS
#endif /* __COGL_SWAP_CHAIN_H__ */
diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c
index da39cbdb..61b733ec 100644
--- a/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/winsys/cogl-winsys-egl.c
@@ -81,6 +81,10 @@ typedef struct _CoglRendererEGL
EGLint egl_version_major;
EGLint egl_version_minor;
+#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
+ gboolean gdl_initialized;
+#endif
+
/* Function pointers for GLX specific extensions */
#define COGL_WINSYS_FEATURE_BEGIN(a, b, c, d, e, f)
@@ -105,7 +109,8 @@ typedef struct _CoglDisplayEGL
EGLContext egl_context;
#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
EGLSurface dummy_surface;
-#elif defined (COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT)
+#elif defined (COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT) || \
+ defined (COGL_HAS_EGL_PLATFORM_GDL_SUPPORT)
EGLSurface egl_surface;
int egl_surface_width;
int egl_surface_height;
@@ -242,6 +247,11 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
{
CoglRendererEGL *egl_renderer = renderer->winsys;
+#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
+ if (egl_renderer->gdl_initialized)
+ gdl_close ();
+#endif
+
#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
_cogl_renderer_xlib_disconnect (renderer);
#endif
@@ -260,6 +270,10 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
CoglRendererXlib *xlib_renderer;
#endif
EGLBoolean status;
+#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
+ gdl_ret_t rc = GDL_SUCCESS;
+ gdl_display_info_t gdl_display_info;
+#endif
renderer->winsys = g_slice_new0 (CoglRendererEGL);
@@ -282,6 +296,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
status = eglInitialize (egl_renderer->edpy,
&egl_renderer->egl_version_major,
&egl_renderer->egl_version_minor);
+#endif
if (status != EGL_TRUE)
{
@@ -290,6 +305,32 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
"Failed to initialize EGL");
goto error;
}
+
+#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
+ /* Check we can talk to the GDL library */
+
+ rc = gdl_init (NULL);
+ if (rc != GDL_SUCCESS)
+ {
+ g_set_error (error, COGL_WINSYS_ERROR,
+ COGL_WINSYS_ERROR_INIT,
+ "GDL initialize failed. %s",
+ gdl_get_error_string (rc));
+ goto error;
+ }
+
+ rc = gdl_get_display_info (GDL_DISPLAY_ID_0, &gdl_display_info);
+ if (rc != GDL_SUCCESS)
+ {
+ g_set_error (error, COGL_WINSYS_ERROR,
+ COGL_WINSYS_ERROR_INIT,
+ "GDL failed to get display information: %s",
+ gdl_get_error_string (rc));
+ gdl_close ();
+ goto error;
+ }
+
+ gdl_close ();
#endif
return TRUE;
@@ -427,6 +468,12 @@ try_create_context (CoglDisplay *display,
EGL_DEPTH_SIZE, 1,
+ /* XXX: Why does the GDL platform choose these by default? */
+#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
+ EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE,
+ EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE,
+#endif
+
EGL_BUFFER_SIZE, EGL_DONT_CARE,
#if defined (HAVE_COGL_GL)
@@ -528,6 +575,8 @@ try_create_context (CoglDisplay *display,
if (egl_display->dummy_surface == EGL_NO_SURFACE)
{
+ /* FIXME: we shouldn't be calling g_set_error here we should
+ * just set error_message same goes for below. */
g_set_error (error, COGL_WINSYS_ERROR,
COGL_WINSYS_ERROR_CREATE_CONTEXT,
"Unable to create an EGL surface");
@@ -688,6 +737,81 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
display->winsys = NULL;
}
+#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
+static gboolean
+gdl_plane_init (CoglDisplay *display, GError **error)
+{
+ gboolean ret = TRUE;
+ gdl_color_space_t colorSpace = GDL_COLOR_SPACE_RGB;
+ gdl_rectangle_t dstRect;
+ gdl_display_info_t display_info;
+ gdl_ret_t rc = GDL_SUCCESS;
+
+ if (!display->gdl_plane)
+ {
+ g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
+ "No GDL plane specified with "
+ "cogl_gdl_display_set_plane");
+ return FALSE;
+ }
+
+ rc = gdl_init (NULL);
+ if (rc != GDL_SUCCESS)
+ {
+ g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
+ "GDL initialize failed. %s", gdl_get_error_string (rc));
+ return FALSE;
+ }
+
+ rc = gdl_get_display_info (GDL_DISPLAY_ID_0, &display_info);
+ if (rc != GDL_SUCCESS)
+ {
+ g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
+ "GDL failed to get display infomation: %s",
+ gdl_get_error_string (rc));
+ gdl_close ();
+ return FALSE;
+ }
+
+ dstRect.origin.x = 0;
+ dstRect.origin.y = 0;
+ dstRect.width = display_info.tvmode.width;
+ dstRect.height = display_info.tvmode.height;
+
+ /* Configure the plane attribute. */
+ rc = gdl_plane_reset (plane);
+ if (rc == GDL_SUCCESS)
+ rc = gdl_plane_config_begin (plane);
+
+ if (rc == GDL_SUCCESS)
+ rc = gdl_plane_set_attr (GDL_PLANE_SRC_COLOR_SPACE, &colorSpace);
+
+ if (rc == GDL_SUCCESS)
+ rc = gdl_plane_set_attr (GDL_PLANE_PIXEL_FORMAT, &pixfmt);
+
+ if (rc == GDL_SUCCESS)
+ rc = gdl_plane_set_attr (GDL_PLANE_DST_RECT, &dstRect);
+
+ if (rc == GDL_SUCCESS)
+ rc = gdl_plane_set_uint (GDL_PLANE_NUM_GFX_SURFACES,
+ display->swap_chain->length);
+
+ if (rc == GDL_SUCCESS)
+ rc = gdl_plane_config_end (GDL_FALSE);
+ else
+ gdl_plane_config_end (GDL_TRUE);
+
+ if (rc != GDL_SUCCESS)
+ {
+ g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
+ "GDL configuration failed: %s.", gdl_get_error_string (rc));
+ ret = FALSE;
+ }
+
+ gdl_close ();
+}
+#endif
+
static gboolean
_cogl_winsys_display_setup (CoglDisplay *display,
GError **error)
@@ -699,6 +823,11 @@ _cogl_winsys_display_setup (CoglDisplay *display,
egl_display = g_slice_new0 (CoglDisplayEGL);
display->winsys = egl_display;
+#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
+ if (!gdl_plane_init (display, error))
+ goto error;
+#endif
+
if (!create_context (display, error))
goto error;
diff --git a/configure.ac b/configure.ac
index 89c43da5..066c87b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -271,7 +271,7 @@ AM_CONDITIONAL(SUPPORT_XLIB, [true])
AM_CONDITIONAL(SUPPORT_EGL, [false])
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_X11, [false])
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_NULL, [false])
-AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_GDL, [false])
+AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_GDL, [false])
AM_CONDITIONAL(SUPPORT_OSX, [false])
AM_CONDITIONAL(SUPPORT_WIN32, [false])
AM_CONDITIONAL(SUPPORT_CEX100, [false])