cex100: Add an API to configure the GDL plane to use
authorDamien Lespiau <damien.lespiau@intel.com>
Sat, 28 Aug 2010 09:43:39 +0000 (10:43 +0100)
committerDamien Lespiau <damien.lespiau@intel.com>
Fri, 3 Sep 2010 10:13:35 +0000 (11:13 +0100)
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
clutter/egl/Makefile.am
clutter/egl/clutter-backend-cex100.c
clutter/egl/clutter-cex100.h.in [new file with mode: 0644]
configure.ac
doc/reference/clutter/Makefile.am
doc/reference/clutter/building-clutter.xml
doc/reference/clutter/clutter-docs.xml.in
doc/reference/clutter/clutter-sections.txt

index fb8c835..c0335cf 100644 (file)
@@ -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
index 1bc681a..5d292e0 100644 (file)
@@ -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
index aee9b02..d93d5bc 100644 (file)
@@ -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 (file)
index 0000000..835365f
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *   Damien Lespiau <damien.lespiau@intel.com>
+ */
+
+/**
+ * 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
+ * <filename class="headerfile">&lt;clutter/egl/clutter-cex100.h&gt;</filename>
+ * to have access to the functions documented here.
+ */
+
+#ifndef __CLUTTER_CEX100_H__
+#define __CLUTTER_CEX100_H__
+
+#include <glib.h>
+
+#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).
+ *
+ * <note>This function has to be called before clutter_init()</note>
+ */
+void clutter_cex100_set_plane (gdl_plane_id_t plane);
+
+G_END_DECLS
+
+#endif /* __CLUTTER_CEX100_H__ */
index 5b241a5..ff6ac27 100644 (file)
@@ -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
index 041231f..b1af75c 100644 (file)
@@ -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.
index b82d089..53a8e1b 100644 (file)
               </varlistentry>
 
               <varlistentry>
-                <term>--with-flavour=[glx/eglx/eglnative/win32/osx/fruity]</term>
+                <term>--with-flavour=[glx/eglx/eglnative/win32/osx/fruity/cex100]</term>
                 <listitem>
                   <para>Select the Clutter backend; default=glx.
                   </para>
index 89dcec1..e6f750d 100644 (file)
     <xi:include href="xml/clutter-glx.xml"/>
     <xi:include href="xml/clutter-win32.xml"/>
     <xi:include href="xml/clutter-egl.xml"/>
+    <xi:include href="xml/clutter-cex100.xml"/>
   </part>
 
   <part id="additionaldocs">
index 842cb66..7844a8c 100644 (file)
@@ -1836,6 +1836,12 @@ clutter_eglx_display
 </SECTION>
 
 <SECTION>
+<TITLE>Intel CE3100, CE4100 Specific Support</TITLE>
+<FILE>clutter-cex100</FILE>
+clutter_cex100_set_plane
+</SECTION>
+
+<SECTION>
 <TITLE>Stage Manager</TITLE>
 <FILE>clutter-stage-manager</FILE>
 ClutterStageManager