From 01fcd11efd0f02833370901dc47d042dc067627a Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Sat, 28 Aug 2010 10:43:39 +0100 Subject: [PATCH] cex100: Add an API to configure the GDL plane to use Intel CE3100 and CE4100 have several planes (framebuffers) and a hardware blender to blend the planes togeteher to produce the final image. clutter_cex100_set_plane() lets you configure which framebuffer clutter will use for its rendering. --- .gitignore | 1 + clutter/egl/Makefile.am | 1 + clutter/egl/clutter-backend-cex100.c | 35 ++++++++++++++++ clutter/egl/clutter-cex100.h.in | 64 ++++++++++++++++++++++++++++++ configure.ac | 3 ++ doc/reference/clutter/Makefile.am | 2 + doc/reference/clutter/building-clutter.xml | 2 +- doc/reference/clutter/clutter-docs.xml.in | 1 + doc/reference/clutter/clutter-sections.txt | 6 +++ 9 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 clutter/egl/clutter-cex100.h.in diff --git a/.gitignore b/.gitignore index fb8c835..c0335cf 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ stamp-marshal /clutter/cogl/cogl/driver/gles/cogl-defines.h /clutter/cogl/cogl/driver/gles/cogl-fixed-vertex-shader.[ch] /clutter/cogl/cogl/driver/gles/cogl-fixed-fragment-shader.[ch] +/clutter/egl/clutter-cex100.h /clutter/x11/clutter-x11-enum-types.[ch] /clutter/json/*.gir /clutter/cally/cally*.pc diff --git a/clutter/egl/Makefile.am b/clutter/egl/Makefile.am index 1bc681a..5d292e0 100644 --- a/clutter/egl/Makefile.am +++ b/clutter/egl/Makefile.am @@ -42,4 +42,5 @@ endif if SUPPORT_CEX100 libclutter_egl_la_SOURCES += clutter-backend-cex100.c clutter-backend-cex100.h +libclutterinclude_HEADERS += clutter-cex100.h endif diff --git a/clutter/egl/clutter-backend-cex100.c b/clutter/egl/clutter-backend-cex100.c index aee9b02..d93d5bc 100644 --- a/clutter/egl/clutter-backend-cex100.c +++ b/clutter/egl/clutter-backend-cex100.c @@ -35,6 +35,7 @@ #include "clutter-main.h" #include "clutter-backend-cex100.h" +#include "clutter-cex100.h" static gdl_plane_id_t gdl_plane = GDL_PLANE_ID_UPP_C; @@ -42,6 +43,30 @@ G_DEFINE_TYPE (ClutterBackendCex100, clutter_backend_cex100, CLUTTER_TYPE_BACKEND_EGL) +#ifdef CLUTTER_ENABLE_DEBUG +static const gchar * +gdl_get_plane_name (gdl_plane_id_t plane) +{ + switch (plane) + { + case GDL_PLANE_ID_UPP_A: + return "UPP_A"; + case GDL_PLANE_ID_UPP_B: + return "UPP_B"; + case GDL_PLANE_ID_UPP_C: + return "UPP_C"; + case GDL_PLANE_ID_UPP_D: + return "UPP_D"; + case GDL_PLANE_ID_UPP_E: + return "UPP_E"; + default: + g_assert_not_reached (); + } + + return NULL; /* never reached */ +} +#endif + static gboolean gdl_plane_init (gdl_display_id_t dpy, gdl_plane_id_t plane, @@ -141,6 +166,8 @@ clutter_backend_cex100_create_context (ClutterBackend *backend, if (backend_egl->egl_context != EGL_NO_CONTEXT) return TRUE; + CLUTTER_NOTE (BACKEND, "Using the %s plane", gdl_get_plane_name (gdl_plane)); + /* Start by initializing the GDL plane */ if (!gdl_plane_init (GDL_DISPLAY_ID_0, gdl_plane, GDL_PF_ARGB_32)) { @@ -330,3 +357,11 @@ _clutter_backend_impl_get_type (void) { return clutter_backend_cex100_get_type (); } + +void +clutter_cex100_set_plane (gdl_plane_id_t plane) +{ + g_return_if_fail (plane >= GDL_PLANE_ID_UPP_A && plane <= GDL_PLANE_ID_UPP_E); + + gdl_plane = plane; +} diff --git a/clutter/egl/clutter-cex100.h.in b/clutter/egl/clutter-cex100.h.in new file mode 100644 index 0000000..835365f --- /dev/null +++ b/clutter/egl/clutter-cex100.h.in @@ -0,0 +1,64 @@ +/* + * Clutter. + * + * An OpenGL based 'interactive canvas' library. + * + * Copyright (C) 2010 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * Authors: + * Damien Lespiau + */ + +/** + * SECTION:clutter-cex100 + * @short_description: Intel CE3100, CE4100 Specific API + * + * The CEX100 backend for Clutter provides some Intel CE3100/CE4100 + * specific API + * + * You need to include + * <clutter/egl/clutter-cex100.h> + * to have access to the functions documented here. + */ + +#ifndef __CLUTTER_CEX100_H__ +#define __CLUTTER_CEX100_H__ + +#include + +#include <@CLUTTER_CEX100_LIBGDL_PREFIX@libgdl.h> + +G_BEGIN_DECLS + +/** + * clutter_cex100_set_plane: + * @plane: a GDL plane + * + * Intel CE3100 and CE4100 have several planes (frame buffers) and a + * hardware blender to blend the planes togeteher and produce the final + * image. + * + * clutter_cex100_set_plane() let's you configure the GDL plane where + * the stage will be drawn. By default Clutter will pick UPP_C + * (GDL_PLANE_ID_UPP_C). + * + * This function has to be called before clutter_init() + */ +void clutter_cex100_set_plane (gdl_plane_id_t plane); + +G_END_DECLS + +#endif /* __CLUTTER_CEX100_H__ */ diff --git a/configure.ac b/configure.ac index 5b241a5..ff6ac27 100644 --- a/configure.ac +++ b/configure.ac @@ -276,8 +276,10 @@ AS_CASE([$CLUTTER_FLAVOUR], [ FLAVOUR_CFLAGS="-I/usr/include/CE4100" found_gdl=yes + CLUTTER_CEX100_LIBGDL_PREFIX=CE4100/ ]) ) + AC_SUBST(CLUTTER_CEX100_LIBGDL_PREFIX) AS_IF([test x"$found_gdl" = "xno"], AC_MSG_ERROR([libgdl.h not found])) @@ -1113,6 +1115,7 @@ AC_CONFIG_FILES([ clutter/x11/clutter-x11.pc clutter/glx/Makefile clutter/egl/Makefile + clutter/egl/clutter-cex100.h clutter/fruity/Makefile clutter/osx/Makefile clutter/win32/Makefile diff --git a/doc/reference/clutter/Makefile.am b/doc/reference/clutter/Makefile.am index 041231f..b1af75c 100644 --- a/doc/reference/clutter/Makefile.am +++ b/doc/reference/clutter/Makefile.am @@ -53,6 +53,7 @@ HFILE_GLOB=$(top_srcdir)/clutter/*.h \ $(top_srcdir)/clutter/x11/clutter-x11-texture-pixmap.h \ $(top_srcdir)/clutter/glx/clutter-glx-texture-pixmap.h \ $(top_srcdir)/clutter/egl/clutter-egl.h \ + $(top_srcdir)/clutter/egl/clutter-cex100.h \ $(top_srcdir)/clutter/win32/clutter-win32.h CFILE_GLOB=$(top_srcdir)/clutter/*.c \ $(top_srcdir)/clutter/x11/*.c \ @@ -96,6 +97,7 @@ EXTRA_HFILES=\ $(top_srcdir)/clutter/x11/clutter-x11-texture-pixmap.h \ $(top_srcdir)/clutter/glx/clutter-glx-texture-pixmap.h \ $(top_srcdir)/clutter/egl/clutter-egl.h \ + $(top_srcdir)/clutter/egl/clutter-cex100.h \ $(top_srcdir)/clutter/win32/clutter-win32.h # Images to copy into HTML directory. diff --git a/doc/reference/clutter/building-clutter.xml b/doc/reference/clutter/building-clutter.xml index b82d089..53a8e1b 100644 --- a/doc/reference/clutter/building-clutter.xml +++ b/doc/reference/clutter/building-clutter.xml @@ -141,7 +141,7 @@ - --with-flavour=[glx/eglx/eglnative/win32/osx/fruity] + --with-flavour=[glx/eglx/eglnative/win32/osx/fruity/cex100] Select the Clutter backend; default=glx. diff --git a/doc/reference/clutter/clutter-docs.xml.in b/doc/reference/clutter/clutter-docs.xml.in index 89dcec1..e6f750d 100644 --- a/doc/reference/clutter/clutter-docs.xml.in +++ b/doc/reference/clutter/clutter-docs.xml.in @@ -209,6 +209,7 @@ + diff --git a/doc/reference/clutter/clutter-sections.txt b/doc/reference/clutter/clutter-sections.txt index 842cb66..7844a8c 100644 --- a/doc/reference/clutter/clutter-sections.txt +++ b/doc/reference/clutter/clutter-sections.txt @@ -1836,6 +1836,12 @@ clutter_eglx_display
+Intel CE3100, CE4100 Specific Support +clutter-cex100 +clutter_cex100_set_plane +
+ +
Stage Manager clutter-stage-manager ClutterStageManager -- 2.7.4