[GTK] Initial implementation of Accelerated Compositing using Clutter
authorjoone.hur@collabora.co.uk <joone.hur@collabora.co.uk@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Dec 2011 09:40:49 +0000 (09:40 +0000)
committerjoone.hur@collabora.co.uk <joone.hur@collabora.co.uk@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Dec 2011 09:40:49 +0000 (09:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=73319

.:

Reviewed by Gustavo Noronha Silva.

* GNUmakefile.am: Export new compilation macros.
* configure.ac: Add clutter backend for Accelerated Compositing.

Source/WebCore:

Reviewed by Gustavo Noronha Silva.

No new tests added as this feature will be able to reuse the existing
CSS3 transforms layout tests.

* GNUmakefile.am: Include WebCore/platform/graphics/clutter path.
* GNUmakefile.list.am: Add GraphicsLayerClutter.
* platform/clutter/GRefPtrClutter.cpp: Added.
(WTF::adoptGRef):
(WTF::ClutterActor):
* platform/clutter/GRefPtrClutter.h: Added.
* platform/graphics/GraphicsLayer.h: Define PlatformLayer type, which represents ClutterActor.
* platform/graphics/clutter/GraphicsLayerClutter.cpp: Boilerplate implementation.
(WebCore::GraphicsLayerClutter::GraphicsLayerClutter):
(WebCore::GraphicsLayerClutter::platformLayer):
* platform/graphics/clutter/GraphicsLayerClutter.h: Boilerplate implementation.

Source/WebKit/gtk:

This patch allows to add a GtkClutterEmbed to embed Clutter Actors in WebKitWebView and
set the root GraphicsLayer to WebKitWebView when Accelerated Compositing needs to be enabled.

Reviewed by Gustavo Noronha Silva.

* GNUmakefile.am:
* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::attachRootGraphicsLayer): Set the root GraphicsLayer to WebKitWebView.
(WebKit::ChromeClient::allowedCompositingTriggers): Allow to support CSS 3D Transforms only.
* webkit/webkitglobals.cpp:
(webkitInit): Call gtk_clutter_init().
* webkit/webkitwebview.cpp:
(webkit_web_view_size_allocate): Set the size of GtkClutterEmbed when the view is changed.
(webkit_web_view_init)
(webViewSetRootGraphicsLayer): Add the GtkClutterEmbed to the WebKitWebView as a child.
(webViewDetachRootGraphicsLayer): Remove the GtkClutterEmbed from the WebKitWebView.
(webViewSyncLayers): Commit layer changes.
(webViewMarkForSync): Set to call webViewSyncLayers using g_timeout_add.
* webkit/webkitwebviewprivate.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@102448 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
ChangeLog
GNUmakefile.am
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/GNUmakefile.list.am
Source/WebCore/platform/clutter/GRefPtrClutter.cpp [new file with mode: 0644]
Source/WebCore/platform/clutter/GRefPtrClutter.h [new file with mode: 0644]
Source/WebCore/platform/graphics/GraphicsLayer.h
Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.cpp
Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.h
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/GNUmakefile.am
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
Source/WebKit/gtk/webkit/webkitglobals.cpp
Source/WebKit/gtk/webkit/webkitwebview.cpp
Source/WebKit/gtk/webkit/webkitwebviewprivate.h
configure.ac

index c7fcea2..512f5fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-12-09  Joone Hur  <joone.hur@collabora.co.uk>
+
+        [GTK] Initial implementation of Accelerated Compositing using Clutter
+        https://bugs.webkit.org/show_bug.cgi?id=73319
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * GNUmakefile.am: Export new compilation macros.
+        * configure.ac: Add clutter backend for Accelerated Compositing.
+
 2011-12-08  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r102323.
index eabb63e..803ce82 100644 (file)
@@ -180,6 +180,11 @@ global_cppflags += \
        -DWTF_USE_TEXTURE_MAPPER_OPENGL=1
 endif
 
+if USE_CLUTTER
+global_cppflags += \
+       -DWTF_USE_CLUTTER=1
+endif
+
 # ----
 # GTK+ 2.x/3.x support
 # ----
index b9501b9..3070a39 100644 (file)
@@ -1,3 +1,25 @@
+2011-12-09  Joone Hur  <joone.hur@collabora.co.uk>, Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk> 
+
+        [GTK] Initial implementation of Accelerated Compositing using Clutter
+        https://bugs.webkit.org/show_bug.cgi?id=73319
+
+        Reviewed by Gustavo Noronha Silva.
+
+        No new tests added as this feature will be able to reuse the existing 
+        CSS3 transforms layout tests.
+
+        * GNUmakefile.am: Include WebCore/platform/graphics/clutter path.
+        * GNUmakefile.list.am: Add GraphicsLayerClutter.
+        * platform/clutter/GRefPtrClutter.cpp: Added.
+        (WTF::adoptGRef):
+        (WTF::ClutterActor):
+        * platform/clutter/GRefPtrClutter.h: Added.
+        * platform/graphics/GraphicsLayer.h: Define PlatformLayer type, which represents ClutterActor.
+        * platform/graphics/clutter/GraphicsLayerClutter.cpp: Boilerplate implementation.
+        (WebCore::GraphicsLayerClutter::GraphicsLayerClutter):
+        (WebCore::GraphicsLayerClutter::platformLayer):
+        * platform/graphics/clutter/GraphicsLayerClutter.h: Boilerplate implementation.
+
 2011-12-08  Vsevolod Vlasov  <vsevik@chromium.org>
 
         Web Inspector: Introduce a Map class allowing to store values indexed by arbitrary objects.
index 758934c..8c7b6f3 100644 (file)
@@ -575,6 +575,12 @@ webcore_cppflags += \
        -I$(srcdir)/Source/WebCore/platform/graphics/texmap
 endif  # END USETEXTURE_MAPPER_GL
 
+if USE_CLUTTER
+webcore_cppflags += \
+       -I$(srcdir)/Source/WebCore/platform/clutter \
+       -I$(srcdir)/Source/WebCore/platform/graphics/clutter
+endif  # END USE_CLUTTER
+
 # ---
 # MHTML support
 # ---
@@ -801,6 +807,7 @@ libWebCore_la_CPPFLAGS = \
        $(javascriptcore_cppflags) \
        -fno-strict-aliasing \
        $(CAIRO_CFLAGS) \
+       $(CLUTTER_CFLAGS) \
        $(COVERAGE_CFLAGS) \
        $(ENCHANT_CFLAGS) \
        $(GEOCLUE_CFLAGS) \
index a44c907..a486818 100644 (file)
@@ -5075,6 +5075,15 @@ endif  # END ENABLE_REQUEST_ANIMATION_FRAME
 # Compile with accelerated compositing support
 # ---
 if USE_ACCELERATED_COMPOSITING
+if USE_CLUTTER
+webcore_sources += \
+       Source/WebCore/platform/clutter/GRefPtrClutter.cpp \
+       Source/WebCore/platform/clutter/GRefPtrClutter.h \
+       Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.cpp \
+       Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.h
+endif  # END USE_CLUTTER
+
+if USE_TEXTURE_MAPPER_CAIRO
 webcore_sources += \
        Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp \
        Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h \
@@ -5082,7 +5091,6 @@ webcore_sources += \
        Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp \
        Source/WebCore/platform/graphics/texmap/TextureMapperNode.h \
        Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h
-if USE_TEXTURE_MAPPER_CAIRO
 webcoregtk_sources += \
        Source/WebCore/platform/graphics/cairo/TextureMapperCairo.cpp \
        Source/WebCore/platform/graphics/cairo/TextureMapperCairo.h
diff --git a/Source/WebCore/platform/clutter/GRefPtrClutter.cpp b/Source/WebCore/platform/clutter/GRefPtrClutter.cpp
new file mode 100644 (file)
index 0000000..2a34186
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ *  Copyright (C) 2011 Collabora Ltd.
+ *
+ *  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, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+
+#include "config.h"
+#include "GRefPtrClutter.h"
+
+#include <clutter/clutter.h>
+
+namespace WTF {
+
+template <> GRefPtr<ClutterActor> adoptGRef(ClutterActor* ptr)
+{
+    if (g_object_is_floating(ptr))
+        g_object_ref_sink(ptr);
+
+    return GRefPtr<ClutterActor>(ptr, GRefPtrAdopt);
+}
+
+template <> ClutterActor* refGPtr<ClutterActor>(ClutterActor* ptr)
+{
+    if (ptr) {
+        if (g_object_is_floating(ptr))
+            g_object_ref_sink(ptr);
+
+        g_object_ref(ptr);
+    }
+
+    return ptr;
+}
+
+template <> void derefGPtr<ClutterActor>(ClutterActor* ptr)
+{
+    if (ptr)
+        g_object_unref(ptr);
+}
+
+}
diff --git a/Source/WebCore/platform/clutter/GRefPtrClutter.h b/Source/WebCore/platform/clutter/GRefPtrClutter.h
new file mode 100644 (file)
index 0000000..091d27a
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ *  Copyright (C) 2011 Collabora Ltd.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GRefPtrClutter_h
+#define GRefPtrClutter_h
+
+#include "GRefPtr.h"
+
+typedef struct _ClutterActor ClutterActor;
+
+namespace WTF {
+
+template<> ClutterActor* refGPtr<ClutterActor>(ClutterActor* ptr);
+template<> void derefGPtr<ClutterActor>(ClutterActor* ptr);
+
+}
+
+#endif
index 0a18189..604fcca 100644 (file)
@@ -74,6 +74,11 @@ namespace WebCore {
 class TextureMapperPlatformLayer;
 typedef TextureMapperPlatformLayer PlatformLayer;
 };
+#elif USE(CLUTTER)
+typedef struct _ClutterActor ClutterActor;
+namespace WebCore {
+typedef ClutterActor PlatformLayer;
+};
 #endif
 #else
 typedef void* PlatformLayer;
index ceedc3c..56ae610 100644 (file)
@@ -41,12 +41,19 @@ PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client)
 GraphicsLayerClutter::GraphicsLayerClutter(GraphicsLayerClient* client)
     : GraphicsLayer(client)
 {
+    // ClutterRectangle will be used to show the debug border.
+    m_layer = adoptGRef(clutter_rectangle_new());
 }
 
 GraphicsLayerClutter::~GraphicsLayerClutter()
 {
 }
 
+ClutterActor* GraphicsLayerClutter::platformLayer() const
+{
+    return m_layer.get();
+}
+
 void GraphicsLayerClutter::setNeedsDisplay()
 {
     notImplemented();
index db29b1f..42f6b76 100644 (file)
 
 #if USE(ACCELERATED_COMPOSITING)
 
+#include "GRefPtrClutter.h"
 #include "GraphicsLayer.h"
 
+#include <clutter/clutter.h>
+
 namespace WebCore {
 
 class GraphicsLayerClutter : public GraphicsLayer {
@@ -38,8 +41,12 @@ public:
     GraphicsLayerClutter(GraphicsLayerClient*);
     virtual ~GraphicsLayerClutter();
 
+    virtual ClutterActor* platformLayer() const;
     virtual void setNeedsDisplay();
     virtual void setNeedsDisplayInRect(const FloatRect&);
+
+private:
+    GRefPtr<ClutterActor> m_layer;
 };
 
 } // namespace WebCore
index b4ab7d8..b5f0f01 100644 (file)
@@ -1,3 +1,28 @@
+2011-12-09  Joone Hur  <joone.hur@collabora.co.uk>
+
+        [GTK] Initial implementation of Accelerated Compositing using Clutter
+        https://bugs.webkit.org/show_bug.cgi?id=73319
+
+        This patch allows to add a GtkClutterEmbed to embed Clutter Actors in WebKitWebView and 
+        set the root GraphicsLayer to WebKitWebView when Accelerated Compositing needs to be enabled.
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * GNUmakefile.am:
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::attachRootGraphicsLayer): Set the root GraphicsLayer to WebKitWebView.
+        (WebKit::ChromeClient::allowedCompositingTriggers): Allow to support CSS 3D Transforms only.
+        * webkit/webkitglobals.cpp:
+        (webkitInit): Call gtk_clutter_init().
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_size_allocate): Set the size of GtkClutterEmbed when the view is changed.
+        (webkit_web_view_init)
+        (webViewSetRootGraphicsLayer): Add the GtkClutterEmbed to the WebKitWebView as a child.
+        (webViewDetachRootGraphicsLayer): Remove the GtkClutterEmbed from the WebKitWebView.
+        (webViewSyncLayers): Commit layer changes.
+        (webViewMarkForSync): Set to call webViewSyncLayers using g_timeout_add.
+        * webkit/webkitwebviewprivate.h:
+
 2011-12-07  Mary Wu  <mary.wu@torchmobile.com.cn>
 
         Change function name InitializeLoggingChannelsIfNecessary to follow coding style guideline
index e34b442..38dd279 100644 (file)
@@ -58,6 +58,8 @@ libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CPPF
        $(webkitgtk_cppflags) \
        -fno-strict-aliasing \
        $(HILDON_CPPFLAGS) \
+       $(CLUTTER_CFLAGS) \
+       $(CLUTTER_GTK_CFLAGS) \
        $(COVERAGE_CFLAGS) \
        $(ENCHANT_CFLAGS) \
        $(GAIL_CFLAGS) \
@@ -87,6 +89,8 @@ libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBA
        libjavascriptcoregtk-@WEBKITGTK_API_MAJOR_VERSION@.@WEBKITGTK_API_MINOR_VERSION@.la \
        $(webcore_ldflags) \
        $(CAIRO_LIBS) \
+       $(CLUTTER_LIBS) \
+       $(CLUTTER_GTK_LIBS) \
        $(COVERAGE_LDFLAGS) \
        $(ENCHANT_LIBS) \
        $(FREETYPE_LIBS) \
index ad8cf9a..116667c 100644 (file)
@@ -912,7 +912,10 @@ void ChromeClient::exitFullScreenForElement(WebCore::Element* element)
 #if USE(ACCELERATED_COMPOSITING)
 void ChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* rootLayer)
 {
-    webViewSetRootGraphicsLayer(m_webView, rootLayer);
+    if (rootLayer)
+        webViewSetRootGraphicsLayer(m_webView, rootLayer);
+    else
+        webViewDetachRootGraphicsLayer(m_webView);
 }
 
 void ChromeClient::setNeedsOneShotDrawingSynchronization()
@@ -927,7 +930,14 @@ void ChromeClient::scheduleCompositingLayerSync()
 
 ChromeClient::CompositingTriggerFlags ChromeClient::allowedCompositingTriggers() const
 {
+     if (!platformPageClient())
+        return false;
+#if USE(CLUTTER)
+    // Currently, we only support CSS 3D Transforms.
+    return ThreeDTransformTrigger;
+#else
     return AllTriggers;
+#endif
 }
 #endif
 
index e96e178..71433c8 100644 (file)
 #include <stdlib.h>
 #include <wtf/MainThread.h>
 
+#if USE(CLUTTER)
+#include <clutter-gtk/clutter-gtk.h>
+#endif
+
 static WebKitCacheModel cacheModel = WEBKIT_CACHE_MODEL_DEFAULT;
 
 using namespace WebCore;
@@ -340,5 +344,9 @@ void webkitInit()
 
     soup_session_add_feature_by_type(session, SOUP_TYPE_CONTENT_DECODER);
 
+#if USE(CLUTTER)
+    gtk_clutter_init(0, 0);
+#endif
+
     atexit(webkitExit);
 }
index 91f2dfa..4c282f8 100644 (file)
@@ -856,6 +856,14 @@ static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allo
     WebKit::ChromeClient* chromeClient = static_cast<WebKit::ChromeClient*>(page->chrome()->client());
     chromeClient->widgetSizeChanged(oldSize, IntSize(allocation->width, allocation->height));
     chromeClient->adjustmentWatcher()->updateAdjustmentsFromScrollbars();
+
+#if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
+    if (webView->priv->rootLayerEmbedder) {
+        allocation->x = 0;
+        allocation->y = 0;
+        gtk_widget_size_allocate(GTK_WIDGET(webView->priv->rootLayerEmbedder), allocation);
+    }
+#endif
 }
 
 static void webkit_web_view_grab_focus(GtkWidget* widget)
@@ -4885,13 +4893,63 @@ void webViewExitFullscreen(WebKitWebView* webView)
 #if USE(ACCELERATED_COMPOSITING)
 void webViewSetRootGraphicsLayer(WebKitWebView* webView, GraphicsLayer* graphicsLayer)
 {
+#if USE(CLUTTER)
+    WebKitWebViewPrivate* priv = webView->priv;
+
+    // Create an instance of GtkClutterEmbed to host actors as web layers.
+    if (!priv->rootLayerEmbedder) {
+        priv->rootLayerEmbedder = gtk_clutter_embed_new();
+        gtk_container_add(GTK_CONTAINER(webView), priv->rootLayerEmbedder);
+        gtk_widget_show(priv->rootLayerEmbedder);
+    }
+
+    // Add a root layer to the stage.
+    if (graphicsLayer) {
+        priv->rootGraphicsLayer = graphicsLayer;
+        // set white background
+        ClutterColor stageColor = { 0xFF, 0xFF, 0xFF, 0xFF };
+        ClutterActor* stage = gtk_clutter_embed_get_stage(GTK_CLUTTER_EMBED(priv->rootLayerEmbedder));
+        clutter_stage_set_color(CLUTTER_STAGE (stage), &stageColor);
+        clutter_container_add_actor(CLUTTER_CONTAINER(stage), priv->rootGraphicsLayer->platformLayer());
+        clutter_actor_show_all(stage);
+    }
+#else
+    notImplemented();
+#endif
+}
+
+void webViewDetachRootGraphicsLayer(WebKitWebView* webView)
+{
+#if USE(CLUTTER)
+    WebKitWebViewPrivate* priv = webView->priv;
+    // Detach the root layer from the hosting view.
+    gtk_container_remove(GTK_CONTAINER(webView), priv->rootLayerEmbedder);
+    priv->rootLayerEmbedder = 0;
+    priv->rootGraphicsLayer = 0;
+#else
     notImplemented();
+#endif
 }
 
+#if USE(CLUTTER)
+static gboolean webViewSyncLayers(gpointer data)
+{
+    WebKitWebView* webView = WEBKIT_WEB_VIEW(data);
+    core(webView)->mainFrame()->view()->syncCompositingStateIncludingSubframes();
+
+    return FALSE;
+}
+#endif
+
 void webViewMarkForSync(WebKitWebView* webView, gboolean scheduleSync)
 {
+#if USE(CLUTTER)
+    g_timeout_add(0, webViewSyncLayers, webView);
+#else
     notImplemented();
+#endif
 }
+
 #endif
 
 namespace WebKit {
index 92c355e..f7671fc 100644 (file)
 #include "WidgetBackingStore.h"
 #include <webkit/webkitwebview.h>
 
+#if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
+#include <clutter-gtk/clutter-gtk.h>
+#include <clutter/clutter.h>
+#endif
+
 namespace WebKit {
 WebCore::Page* core(WebKitWebView*);
 WebKitWebView* kit(WebCore::Page*);
@@ -92,6 +97,10 @@ struct _WebKitWebViewPrivate {
     WebCore::GtkClickCounter clickCounter;
     WebCore::GtkDragAndDropHelper dragAndDropHelper;
     bool selfScrolling;
+#if USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
+    WebCore::GraphicsLayer* rootGraphicsLayer;
+    GtkWidget* rootLayerEmbedder;
+#endif
 };
 
 void webkit_web_view_notify_ready(WebKitWebView*);
@@ -114,6 +123,7 @@ void webViewExitFullscreen(WebKitWebView* webView);
 
 #if USE(ACCELERATED_COMPOSITING)
 void webViewSetRootGraphicsLayer(WebKitWebView*, WebCore::GraphicsLayer*);
+void webViewDetachRootGraphicsLayer(WebKitWebView*);
 void webViewMarkForSync(WebKitWebView*, gboolean);
 #endif
 }
index 64ffc79..518910f 100644 (file)
@@ -286,6 +286,8 @@ GSTREAMER_REQUIRED_VERSION=0.10
 GSTREAMER_PLUGINS_BASE_REQUIRED_VERSION=0.10.30
 ENCHANT_REQUIRED_VERSION=0.22
 LIBFFTW_REQUIRED_VERSION=3.2.2
+CLUTTER_REQUIRED_VERSION=1.8.2
+CLUTTER_GTK_REQUIRED_VERSION=1.0.2
 
 # Available modules
 #
@@ -397,7 +399,7 @@ AC_MSG_RESULT([$enable_webgl])
 # check whether to enable accelerated compositing support
 AC_MSG_CHECKING([whether to enable accelerated compositing support])
 AC_ARG_WITH(accelerated_compositing,
-            AC_HELP_STRING([--with-accelerated-compositing=@<:@no/opengl/cairo@:>@],
+            AC_HELP_STRING([--with-accelerated-compositing=@<:@no/opengl/cairo/clutter@:>@],
                            [use accelerated compositing (experimental) [default=no]]),
             [], [with_accelerated_compositing="no"])
 AC_MSG_RESULT([$with_accelerated_compositing])
@@ -1082,6 +1084,17 @@ if test "$enable_web_audio" = "yes"; then
     AC_SUBST([LIBFFTW_LIBS])
 fi
 
+if test "$with_accelerated_compositing" = "clutter"; then
+   PKG_CHECK_MODULES(CLUTTER, clutter-1.0 >= $CLUTTER_REQUIRED_VERSION)
+   PKG_CHECK_MODULES([CLUTTER_GTK],
+                     [clutter-gtk-1.0 >= $CLUTTER_GTK_REQUIRED_VERSION])
+
+   AC_SUBST(CLUTTER_CFLAGS)
+   AC_SUBST(CLUTTER_LIBS)
+   AC_SUBST(CLUTTER_GTK_CFLAGS)
+   AC_SUBST(CLUTTER_GTK_LIBS)
+fi
+
 # check for code coverage support
 if test "$enable_coverage" = "yes"; then
    COVERAGE_CFLAGS="-MD"
@@ -1156,9 +1169,10 @@ AM_CONDITIONAL([USE_PANGO], [test "$with_font_backend" = "pango"])
 AM_CONDITIONAL([USE_GSTREAMER], [test "$have_gstreamer" = "yes"])
 
 # Accelerated compositing conditional
-AM_CONDITIONAL([USE_ACCELERATED_COMPOSITING], [test "$with_accelerated_compositing" = "cairo" || test "$with_accelerated_compositing" = "opengl"])
+AM_CONDITIONAL([USE_ACCELERATED_COMPOSITING], [test "$with_accelerated_compositing" = "cairo" || test "$with_accelerated_compositing" = "opengl" || test "$with_accelerated_compositing" = "clutter"])
 AM_CONDITIONAL([USE_TEXTURE_MAPPER_CAIRO], [test "$with_accelerated_compositing" = "cairo"])
 AM_CONDITIONAL([USE_TEXTURE_MAPPER_GL], [test "$with_accelerated_compositing" = "opengl"])
+AM_CONDITIONAL([USE_CLUTTER], [test "$with_accelerated_compositing" = "clutter"])
 
 # WebKit feature conditionals
 AM_CONDITIONAL([ENABLE_DEBUG],[test "$enable_debug_features" = "yes"])