[GTK] Add TextureMapperGL implementation
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Feb 2012 04:41:08 +0000 (04:41 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Feb 2012 04:41:08 +0000 (04:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=75308

.:

Patch by Martin Robinson  <mrobinson@igalia.com> and Nayan Kumar K <nayankk@motorola.com> on 2012-02-06
Reviewed by Alejandro G. Castro.

* GNUmakefile.am: TextureMapperGL implies USE(TEXTURE_MAPPER)
* configure.ac: Only allow enabling the GL version of TextureMapper on X11.

Source/WebCore:

Patch by Martin Robinson  <mrobinson@igalia.com> and Nayan Kumar K <nayankk@motorola.com> on 2012-02-06
Reviewed by Alejandro G. Castro.

No new tests. This will be covered by accelerated compositing and
3D CSS transform tests eventually.

* GNUmakefile.list.am: Added some files necessary to build TextureMapperGL.
* platform/graphics/cairo/TextureMapperGLCairo.cpp: Added implementations.
* platform/graphics/cairo/TextureMapperGLCairo.h: Updated member list.
* platform/graphics/gtk/WindowGLContext.h: Added.
* platform/graphics/gtk/WindowGLContextGLX.cpp: Added.
* platform/graphics/opengl/TextureMapperGL.cpp: Use the GL shims on GTK.

Source/WebKit/gtk:

Patch by Martin Robinson  <mrobinson@igalia.com> and Nayan Kumar K <nayankk@motorola.com> on 2012-02-06
Reviewed by Alejandro G. Castro.

* GNUmakefile.am: Add AcceleratedCompositingContextGL to the list.
* WebCoreSupport/AcceleratedCompositingContext.h:
(AcceleratedCompositingContext): Added some members for AcceleratedCompositingContextGL.
* WebCoreSupport/AcceleratedCompositingContextClutter.cpp: Added empty implementations
for GraphicsLayerClient. This is only used for the GL variant.
* WebCoreSupport/AcceleratedCompositingContextGL.cpp: Added.
* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::performAllPendingScrolls): Update the root layer while scrolling.
(WebKit::ChromeClient::paint): Update the root layer after painting.
* webkit/webkitwebsettings.cpp: Added an enable-accelerated-compositing setting.
* webkit/webkitwebsettingsprivate.h: Ditto.
* webkit/webkitwebview.cpp:
(webkit_web_view_draw): Call into TextureMapper now.
(webkit_web_view_realize): Use gdk_window_ensure_native here.
(webkit_web_view_update_settings): Support the new enable-accelerated-compositing setting.
(webkit_web_view_settings_notify): Ditto.

Source/WebKit2:

Reviewed by Alejandro G. Castro.

Fix the WebKit2 + AC build for GTK+.

* GNUmakefile.am: Add some missing source files.
* UIProcess/DrawingAreaProxy.cpp:
(WebKit): Add USE(TILED_BACKING_STORE) to the guard.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didReceiveMessage): Ditto.
* WebProcess/WebPage/DrawingArea.h:
(DrawingArea): Ditto.
* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit): Ditto.
* WebProcess/WebPage/DrawingAreaImpl.h:
(DrawingAreaImpl): Ditto.

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

29 files changed:
ChangeLog
GNUmakefile.am
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
Source/WebCore/platform/graphics/cairo/TextureMapperGLCairo.cpp [deleted file]
Source/WebCore/platform/graphics/cairo/TextureMapperGLCairo.h [deleted file]
Source/WebCore/platform/graphics/gtk/WindowGLContext.h [new file with mode: 0644]
Source/WebCore/platform/graphics/gtk/WindowGLContextGLX.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/GNUmakefile.am
Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h
Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp
Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp [new file with mode: 0644]
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
Source/WebKit/gtk/webkit/webkitwebsettings.cpp
Source/WebKit/gtk/webkit/webkitwebsettingsprivate.h
Source/WebKit/gtk/webkit/webkitwebview.cpp
Source/WebKit/gtk/webkit/webkitwebviewprivate.h
Source/WebKit2/ChangeLog
Source/WebKit2/GNUmakefile.am
Source/WebKit2/UIProcess/DrawingAreaProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/WebProcess/WebPage/DrawingArea.h
Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
configure.ac

index 4e5d1ca..5e2f982 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-02-06  Martin Robinson  <mrobinson@igalia.com> and Nayan Kumar K  <nayankk@motorola.com>
+
+        [GTK] Add TextureMapperGL implementation
+        https://bugs.webkit.org/show_bug.cgi?id=75308
+
+        Reviewed by Alejandro G. Castro.
+
+        * GNUmakefile.am: TextureMapperGL implies USE(TEXTURE_MAPPER)
+        * configure.ac: Only allow enabling the GL version of TextureMapper on X11.
+
 2012-02-06  Ryosuke Niwa  <rniwa@webkit.org>
 
         Perf-o-matic should show min/max/stdev on graphs
index 747ea2e..4b3ed3b 100644 (file)
@@ -185,11 +185,13 @@ endif
 
 if USE_TEXTURE_MAPPER_CAIRO
 global_cppflags += \
+       -DWTF_USE_TEXTURE_MAPPER=1 \
        -DWTF_USE_TEXTURE_MAPPER_CAIRO=1
 endif
 
 if USE_TEXTURE_MAPPER_GL
 global_cppflags += \
+       -DWTF_USE_TEXTURE_MAPPER=1 \
        -DWTF_USE_TEXTURE_MAPPER_GL=1
 endif
 
index dbac022..ab141d2 100644 (file)
@@ -1,3 +1,20 @@
+2012-02-06  Martin Robinson  <mrobinson@igalia.com> and Nayan Kumar K  <nayankk@motorola.com>
+
+        [GTK] Add TextureMapperGL implementation
+        https://bugs.webkit.org/show_bug.cgi?id=75308
+
+        Reviewed by Alejandro G. Castro.
+
+        No new tests. This will be covered by accelerated compositing and
+        3D CSS transform tests eventually.
+
+        * GNUmakefile.list.am: Added some files necessary to build TextureMapperGL.
+        * platform/graphics/cairo/TextureMapperGLCairo.cpp: Added implementations.
+        * platform/graphics/cairo/TextureMapperGLCairo.h: Updated member list.
+        * platform/graphics/gtk/WindowGLContext.h: Added.
+        * platform/graphics/gtk/WindowGLContextGLX.cpp: Added.
+        * platform/graphics/opengl/TextureMapperGL.cpp: Use the GL shims on GTK.
+
 2012-02-06  Emil A Eklund  <eae@chromium.org>
 
         Change baselinePosition and lineHeight to LayoutUnit
index 7374793..c1ec70c 100644 (file)
@@ -5752,14 +5752,14 @@ webcore_sources += \
        Source/WebCore/platform/graphics/texmap/TextureMapper.h \
        Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp \
        Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h \
-        Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp \
-        Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h \
-        Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp \
-        Source/WebCore/platform/graphics/texmap/TextureMapperNode.h \
+       Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp \
+       Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h \
+       Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp \
+       Source/WebCore/platform/graphics/texmap/TextureMapperNode.h \
        Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h
 webcoregtk_sources += \
-       Source/WebCore/platform/graphics/cairo/TextureMapperGLCairo.cpp \
-       Source/WebCore/platform/graphics/cairo/TextureMapperGLCairo.h
+       Source/WebCore/platform/graphics/gtk/WindowGLContextGLX.cpp \
+       Source/WebCore/platform/graphics/gtk/WindowGLContext.h
 endif  # END USE_TEXTURE_MAPPER_GL
 endif  # USE_ACCELERATED_COMPOSITING
 
index 4c3447b..ba886a0 100644 (file)
@@ -1139,6 +1139,24 @@ InterpolationQuality GraphicsContext::imageInterpolationQuality() const
     return platformContext()->imageInterpolationQuality();
 }
 
+#if ENABLE(3D_RENDERING) && USE(TEXTURE_MAPPER)
+TransformationMatrix GraphicsContext::get3DTransform() const
+{
+    notImplemented();
+    return TransformationMatrix();
+}
+
+void GraphicsContext::concat3DTransform(const TransformationMatrix& transform)
+{
+    notImplemented();
+}
+
+void GraphicsContext::set3DTransform(const TransformationMatrix& transform)
+{
+    notImplemented();
+}
+#endif
+
 } // namespace WebCore
 
 #endif // USE(CAIRO)
diff --git a/Source/WebCore/platform/graphics/cairo/TextureMapperGLCairo.cpp b/Source/WebCore/platform/graphics/cairo/TextureMapperGLCairo.cpp
deleted file mode 100644 (file)
index 1371b66..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2011 ChangSeok Oh <shivamidow@gmail.com>
- *
- * 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.
- */
-
-#include "config.h"
-#include "TextureMapperGLCairo.h"
-
-#include "NotImplemented.h"
-
-namespace WebCore {
-
-BGRA32PremultimpliedBufferCairo::BGRA32PremultimpliedBufferCairo()
-    : m_context(0)
-    , m_cairoContext(0)
-    , m_cairoSurface(0) 
-{
-    notImplemented();
-}
-
-BGRA32PremultimpliedBufferCairo::~BGRA32PremultimpliedBufferCairo()
-{
-    notImplemented();
-}
-
-PlatformGraphicsContext* BGRA32PremultimpliedBufferCairo::beginPaint(const IntRect& dirtyRect, bool opaque)
-{
-    notImplemented();
-    return 0;
-}
-
-void* BGRA32PremultimpliedBufferCairo::data()
-{
-    notImplemented();
-    return 0;
-}
-
-void BGRA32PremultimpliedBufferCairo::endPaint()
-{
-    notImplemented();
-}
-
-uint64_t uidForImage(Image* image)
-{
-    notImplemented();
-    return 0;
-}
-
-PassOwnPtr<BGRA32PremultimpliedBuffer> BGRA32PremultimpliedBuffer::create()
-{
-    notImplemented();
-    return adoptPtr(new BGRA32PremultimpliedBufferCairo());
-}
-
-};
diff --git a/Source/WebCore/platform/graphics/cairo/TextureMapperGLCairo.h b/Source/WebCore/platform/graphics/cairo/TextureMapperGLCairo.h
deleted file mode 100644 (file)
index 618806d..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2011 ChangSeok Oh <shivamidow@gmail.com>
- *
- * 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 TextureMapperGLCairo_h
-#define TextureMapperGLCairo_h
-
-#include "TextureMapperGL.h"
-
-namespace WebCore {
-
-class BGRA32PremultimpliedBufferCairo: public BGRA32PremultimpliedBuffer {
-public:
-    BGRA32PremultimpliedBufferCairo();
-    virtual ~BGRA32PremultimpliedBufferCairo();
-    virtual PlatformGraphicsContext* beginPaint(const IntRect& dirtyRect, bool opaque);
-    virtual void endPaint(); 
-    virtual void* data(); 
-
-private:
-    PlatformContextCairo* m_context;
-    cairo_t* m_cairoContext;
-    cairo_surface_t* m_cairoSurface;
-};
-
-}
-#endif
diff --git a/Source/WebCore/platform/graphics/gtk/WindowGLContext.h b/Source/WebCore/platform/graphics/gtk/WindowGLContext.h
new file mode 100644 (file)
index 0000000..9623568
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ *  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
+ */
+
+#ifndef WindowGLContext_h
+#define WindowGLContext_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
+
+#if defined(XP_UNIX)
+typedef struct __GLXcontextRec* GLXContext;
+typedef struct _XDisplay Display;
+#endif
+
+namespace WebCore {
+
+class WindowGLContext {
+    WTF_MAKE_NONCOPYABLE(WindowGLContext);
+public:
+    static PassOwnPtr<WindowGLContext> createContextWithGdkWindow(GdkWindow*);
+    virtual ~WindowGLContext();
+    void startDrawing();
+    void finishDrawing();
+
+private:
+    WindowGLContext(GdkWindow*);
+    GdkWindow* m_window;
+
+#if defined(XP_UNIX)
+    GLXContext m_context;
+    Display* m_display;
+    bool m_needToCloseDisplay;
+#endif
+};
+
+}
+
+#endif // WindowGLContext_h
diff --git a/Source/WebCore/platform/graphics/gtk/WindowGLContextGLX.cpp b/Source/WebCore/platform/graphics/gtk/WindowGLContextGLX.cpp
new file mode 100644 (file)
index 0000000..c16a4f4
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2012 Igalia, S.L.
+ *
+ *  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 "WindowGLContext.h"
+
+#include <GL/glx.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+PassOwnPtr<WindowGLContext> WindowGLContext::createContextWithGdkWindow(GdkWindow* window)
+{
+    OwnPtr<WindowGLContext> context = adoptPtr(new WindowGLContext(window));
+    if (!context->m_context)
+        return nullptr;
+    return context.release();
+}
+
+WindowGLContext::WindowGLContext(GdkWindow* window)
+    : m_window(window)
+    , m_context(0)
+    , m_display(0)
+    , m_needToCloseDisplay(0)
+{
+    GdkDisplay* gdkDisplay = gdk_window_get_display(m_window);
+    if (gdkDisplay)
+        m_display = GDK_DISPLAY_XDISPLAY(gdkDisplay);
+    else {
+        m_display = XOpenDisplay(0);
+        m_needToCloseDisplay = true;
+    }
+
+    XWindowAttributes attributes;
+    if (!XGetWindowAttributes(m_display, GDK_WINDOW_XID(m_window), &attributes))
+        return;
+
+    XVisualInfo visualInfo;
+    visualInfo.visualid = XVisualIDFromVisual(attributes.visual);
+
+    int numReturned = 0;
+    XVisualInfo* visualInfoList = XGetVisualInfo(m_display, VisualIDMask, &visualInfo, &numReturned);
+    m_context = glXCreateContext(m_display, visualInfoList, 0, True);
+    XFree(visualInfoList);
+}
+
+WindowGLContext::~WindowGLContext()
+{
+    if (!m_context)
+        return;
+    glXMakeCurrent(m_display, None, None);
+    glXDestroyContext(m_display, m_context);
+
+    if (m_needToCloseDisplay)
+        XCloseDisplay(m_display);
+}
+
+void WindowGLContext::startDrawing()
+{
+    glXMakeCurrent(m_display, GDK_WINDOW_XID(m_window), m_context);
+}
+
+void WindowGLContext::finishDrawing()
+{
+    glXSwapBuffers(m_display, GDK_WINDOW_XID(m_window));
+}
+
+} // namespace WebCore
index 7c03781..9e69ce6 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #include "config.h"
-
 #include "TextureMapperGL.h"
 
 #include "GraphicsContext.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
-#if PLATFORM(QT) && QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if PLATFORM(QT)
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 #include <QPlatformPixmap>
 #endif
+#endif
 
-#if PLATFORM(QT)
+#if PLATFORM(QT) || USE(CAIRO)
 #include <cairo/OpenGLShims.h>
 #elif defined(TEXMAP_OPENGL_ES_2)
 #include <GLES2/gl2.h>
 #include <GL/glx.h>
 #endif
 
-#if !defined(TEXMAP_OPENGL_ES_2) && !PLATFORM(QT)
+#if USE(CAIRO)
+#include "CairoUtilities.h"
+#include "RefPtrCairo.h"
+#include <cairo.h>
+#include <wtf/ByteArray.h>
+#endif
+
+#if !defined(TEXMAP_OPENGL_ES_2) && !PLATFORM(QT) && !PLATFORM(GTK)
 extern "C" {
     void glUniform1f(GLint, GLfloat);
     void glUniform1i(GLint, GLint);
@@ -608,7 +616,7 @@ void BitmapTextureGL::reset(const IntSize& newSize, bool opaque)
     m_surfaceNeedsReset = true;
 }
 
-
+#if PLATFORM(QT) || (USE(CAIRO) && defined(TEXMAP_OPENGL_ES_2))
 static void swizzleBGRAToRGBA(uint32_t* data, const IntSize& size)
 {
     int width = size.width();
@@ -619,6 +627,7 @@ static void swizzleBGRAToRGBA(uint32_t* data, const IntSize& size)
             p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00);
     }
 }
+#endif
 
 void BitmapTextureGL::updateContents(const void* data, const IntRect& targetRect)
 {
@@ -652,6 +661,29 @@ void BitmapTextureGL::updateContents(Image* image, const IntRect& targetRect, co
     if (format == BGRAFormat || format == BGRFormat)
         swizzleBGRAToRGBA(reinterpret_cast<uint32_t*>(qtImage.bits()), qtImage.size());
     GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, GL_UNSIGNED_BYTE, qtImage.constBits()))
+
+#elif USE(CAIRO)
+
+#if !CPU(BIG_ENDIAN)
+#if defined(TEXMAP_OPENGL_ES_2)
+    swizzleBGRAToRGBA(reinterpret_cast<uint32_t*>(cairo_image_surface_get_data(frameImage)),
+                      cairo_image_surface_get_stride(frameImage) * cairo_image_surface_get_height(frameImage));
+#else
+    glFormat = isOpaque() ? GL_BGR : GL_BGRA;
+#endif
+#endif
+
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, cairo_image_surface_get_stride(frameImage) / 4);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, sourceRect.y());
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, sourceRect.x());
+    GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0,
+                           targetRect.x(), targetRect.y(),
+                           targetRect.width(), targetRect.height(),
+                           glFormat, GL_UNSIGNED_BYTE,
+                           cairo_image_surface_get_data(frameImage)));
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
 #endif
 }
 
index 212e466..7406533 100644 (file)
@@ -1,3 +1,27 @@
+2012-02-06  Martin Robinson  <mrobinson@igalia.com> and Nayan Kumar K  <nayankk@motorola.com>
+
+        [GTK] Add TextureMapperGL implementation
+        https://bugs.webkit.org/show_bug.cgi?id=75308
+
+        Reviewed by Alejandro G. Castro.
+
+        * GNUmakefile.am: Add AcceleratedCompositingContextGL to the list.
+        * WebCoreSupport/AcceleratedCompositingContext.h:
+        (AcceleratedCompositingContext): Added some members for AcceleratedCompositingContextGL.
+        * WebCoreSupport/AcceleratedCompositingContextClutter.cpp: Added empty implementations
+        for GraphicsLayerClient. This is only used for the GL variant.
+        * WebCoreSupport/AcceleratedCompositingContextGL.cpp: Added.
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::performAllPendingScrolls): Update the root layer while scrolling.
+        (WebKit::ChromeClient::paint): Update the root layer after painting.
+        * webkit/webkitwebsettings.cpp: Added an enable-accelerated-compositing setting.
+        * webkit/webkitwebsettingsprivate.h: Ditto.
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_draw): Call into TextureMapper now.
+        (webkit_web_view_realize): Use gdk_window_ensure_native here.
+        (webkit_web_view_update_settings): Support the new enable-accelerated-compositing setting.
+        (webkit_web_view_settings_notify): Ditto.
+
 2012-02-06  Gustavo Noronha Silva  <gns@gnome.org>
 
         Do not try to chdir to the directory where the executable is in
index 6e5b502..38d2bb0 100644 (file)
@@ -184,6 +184,7 @@ webkitgtk_sources += \
        Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.h \
        Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h \
        Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp \
+       Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp \
        Source/WebKit/gtk/WebCoreSupport/AssertMatchingEnums.cpp \
        Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \
        Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \
index 61c23b7..42a5f24 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef AcceleratedCompositingContext_h
 #define AcceleratedCompositingContext_h
 
+#include "GraphicsLayer.h"
 #include "GraphicsLayerClient.h"
 #include "IntRect.h"
 #include "IntSize.h"
 #include "webkitwebview.h"
 #include <wtf/PassOwnPtr.h>
 
-#if USE(ACCELERATED_COMPOSITING)
+#if USE(TEXTURE_MAPPER_GL)
+#include "TextureMapperNode.h"
+#include "WindowGLContext.h"
+#endif
 
-namespace WebCore {
-class GraphicsLayer;
-}
+#if USE(ACCELERATED_COMPOSITING)
 
 namespace WebKit {
 
-class AcceleratedCompositingContext {
+class AcceleratedCompositingContext : public WebCore::GraphicsLayerClient {
     WTF_MAKE_NONCOPYABLE(AcceleratedCompositingContext);
 public:
     static PassOwnPtr<AcceleratedCompositingContext> create(WebKitWebView* webView)
@@ -47,7 +49,17 @@ public:
     void scheduleRootLayerRepaint(const WebCore::IntRect&);
     void markForSync();
     void syncLayersTimeout(WebCore::Timer<AcceleratedCompositingContext>*);
+    void syncLayersNow();
     void resizeRootLayer(const WebCore::IntSize&);
+    bool renderLayersToWindow(const WebCore::IntRect& clipRect);
+    bool enabled();
+
+    // GraphicsLayerClient
+    virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time);
+    virtual void notifySyncRequired(const WebCore::GraphicsLayer*);
+    virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& rectToPaint);
+    virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const;
+    virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const;
 
 private:
     WebKitWebView* m_webView;
@@ -56,6 +68,13 @@ private:
 
 #if USE(CLUTTER)
     GtkWidget* m_rootLayerEmbedder;
+#elif USE(TEXTURE_MAPPER_GL)
+    void initializeIfNecessary();
+
+    bool m_initialized;
+    WebCore::TextureMapperNode* m_rootTextureMapperNode;
+    OwnPtr<WebCore::WindowGLContext> m_context;
+    OwnPtr<WebCore::TextureMapper> m_textureMapper;
 #endif
 
     AcceleratedCompositingContext(WebKitWebView*);
index 4657ec4..b52b409 100644 (file)
@@ -45,6 +45,11 @@ AcceleratedCompositingContext::~AcceleratedCompositingContext()
 {
 }
 
+bool AcceleratedCompositingContext::enabled()
+{
+    return m_rootGraphicsLayer;
+}
+
 bool AcceleratedCompositingContext::renderLayersToWindow(cairo_t* widgetCr, const IntRect& clipRect)
 {
     notImplemented();
@@ -116,6 +121,32 @@ void AcceleratedCompositingContext::syncLayersTimeout(Timer<AcceleratedCompositi
     core(m_webView)->mainFrame()->view()->syncCompositingStateIncludingSubframes();
 }
 
+void AcceleratedCompositingContext::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time)
+{
+    ASSERT_NOT_REACHED();
+}
+void AcceleratedCompositingContext::notifySyncRequired(const WebCore::GraphicsLayer*)
+{
+    ASSERT_NOT_REACHED();
+}
+
+void AcceleratedCompositingContext::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&)
+{
+    ASSERT_NOT_REACHED();
+}
+
+bool AcceleratedCompositingContext::showDebugBorders(const WebCore::GraphicsLayer*) const
+{
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+bool AcceleratedCompositingContext::showRepaintCounter(const WebCore::GraphicsLayer*) const
+{
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
 } // namespace WebKit
 
 #endif // USE(ACCELERATED_COMPOSITING) && USE(CLUTTER)
diff --git a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp
new file mode 100644 (file)
index 0000000..9bfa3d0
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ * Copyright (C) 2012 Igalia, S.L.
+ *
+ *  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 "AcceleratedCompositingContext.h"
+
+#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL)
+
+#include "CairoUtilities.h"
+#include "Chrome.h"
+#include "ChromeClientGtk.h"
+#include "Frame.h"
+#include "FrameView.h"
+#include "PlatformContextCairo.h"
+#include "TextureMapperGL.h"
+#include "TextureMapperNode.h"
+#include "webkitwebviewprivate.h"
+#include <GL/gl.h>
+#include <cairo.h>
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+AcceleratedCompositingContext::AcceleratedCompositingContext(WebKitWebView* webView)
+    : m_webView(webView)
+    , m_syncTimer(this, &AcceleratedCompositingContext::syncLayersTimeout)
+    , m_initialized(false)
+    , m_rootTextureMapperNode(0)
+{
+}
+
+AcceleratedCompositingContext::~AcceleratedCompositingContext()
+{
+
+}
+
+void AcceleratedCompositingContext::initializeIfNecessary()
+{
+    if (m_initialized)
+        return;
+
+    m_initialized = true;
+
+    // The GTK+ docs say that we can fail to create a native window.
+    // FIXME: We should fall back to the ImageBuffer TextureMapper when it exists.
+    if (!m_webView->priv->hasNativeWindow)
+        return;
+
+    m_context = WebCore::WindowGLContext::createContextWithGdkWindow(gtk_widget_get_window(GTK_WIDGET(m_webView)));
+}
+
+bool AcceleratedCompositingContext::enabled()
+{
+    return m_rootTextureMapperNode && m_textureMapper;
+}
+
+
+bool AcceleratedCompositingContext::renderLayersToWindow(const IntRect& clipRect)
+{
+    if (!enabled())
+        return false;
+
+    // We initialize the context lazily here so that we know that the GdkWindow realized.
+    initializeIfNecessary();
+    if (!m_context)
+        return false;
+
+    m_context->startDrawing();
+
+    GtkAllocation allocation;
+    gtk_widget_get_allocation(GTK_WIDGET(m_webView), &allocation);
+    glViewport(0, 0, allocation.width, allocation.height);
+
+    m_textureMapper->beginPainting();
+    m_rootTextureMapperNode->paint();
+    m_textureMapper->endPainting();
+
+    m_context->finishDrawing();
+    return true;
+}
+
+void AcceleratedCompositingContext::attachRootGraphicsLayer(GraphicsLayer* graphicsLayer)
+{
+    if (!graphicsLayer) {
+        m_rootGraphicsLayer.clear();
+        m_rootTextureMapperNode = 0;
+        return;
+    }
+
+    m_rootGraphicsLayer = GraphicsLayer::create(this);
+    m_rootTextureMapperNode = toTextureMapperNode(m_rootGraphicsLayer.get());
+    m_rootGraphicsLayer->addChild(graphicsLayer);
+    m_rootGraphicsLayer->setDrawsContent(true);
+    m_rootGraphicsLayer->setMasksToBounds(false);
+    m_rootGraphicsLayer->setNeedsDisplay();
+    m_rootGraphicsLayer->setSize(core(m_webView)->mainFrame()->view()->frameRect().size());
+
+    // We initialize the context lazily here so that we know that the GdkWindow realized.
+    initializeIfNecessary();
+    if (!m_context)
+        return;
+
+    // The context needs to be active when creating the texture mapper. It's fine to
+    // avoid calling endDrawing here, because it will just initialize shaders.
+    m_context->startDrawing();
+
+    GtkAllocation allocation;
+    gtk_widget_get_allocation(GTK_WIDGET(m_webView), &allocation);
+    glViewport(0, 0, allocation.width, allocation.height);
+
+    m_textureMapper = TextureMapperGL::create();
+    m_rootTextureMapperNode->setTextureMapper(m_textureMapper.get());
+    m_rootGraphicsLayer->syncCompositingStateForThisLayerOnly();
+}
+
+void AcceleratedCompositingContext::scheduleRootLayerRepaint(const IntRect& rect)
+{
+    if (!m_rootGraphicsLayer)
+        return;
+    if (rect.isEmpty()) {
+        m_rootGraphicsLayer->setNeedsDisplay();
+        return;
+    }
+    m_rootGraphicsLayer->setNeedsDisplayInRect(rect);
+}
+
+void AcceleratedCompositingContext::resizeRootLayer(const IntSize& size)
+{
+    if (!m_rootGraphicsLayer)
+        return;
+    m_rootGraphicsLayer->setSize(size);
+    m_rootGraphicsLayer->setNeedsDisplay();
+}
+
+void AcceleratedCompositingContext::markForSync()
+{
+    if (m_syncTimer.isActive())
+        return;
+    m_syncTimer.startOneShot(0);
+}
+
+void AcceleratedCompositingContext::syncLayersNow()
+{
+    if (m_rootGraphicsLayer)
+        m_rootGraphicsLayer->syncCompositingStateForThisLayerOnly();
+
+    core(m_webView)->mainFrame()->view()->syncCompositingStateIncludingSubframes();
+}
+
+void AcceleratedCompositingContext::syncLayersTimeout(Timer<AcceleratedCompositingContext>*)
+{
+    syncLayersNow();
+    if (!m_rootGraphicsLayer)
+        return;
+
+    renderLayersToWindow(IntRect());
+
+    if (toTextureMapperNode(m_rootGraphicsLayer.get())->descendantsOrSelfHaveRunningAnimations())
+        m_syncTimer.startOneShot(1.0 / 60.0);
+}
+
+void AcceleratedCompositingContext::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time)
+{
+
+}
+void AcceleratedCompositingContext::notifySyncRequired(const WebCore::GraphicsLayer*)
+{
+
+}
+
+void AcceleratedCompositingContext::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& context, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& rectToPaint)
+{
+    cairo_t* cr = context.platformContext()->cr();
+    copyRectFromCairoSurfaceToContext(m_webView->priv->backingStore->cairoSurface(), cr,
+                                      IntSize(), rectToPaint);
+}
+
+bool AcceleratedCompositingContext::showDebugBorders(const WebCore::GraphicsLayer*) const
+{
+    return false;
+}
+
+bool AcceleratedCompositingContext::showRepaintCounter(const WebCore::GraphicsLayer*) const
+{
+    return false;
+}
+
+} // namespace WebKit
+
+#endif // USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL)
index 2045aec..955c166 100644 (file)
@@ -525,6 +525,20 @@ static void paintWebView(WebKitWebView* webView, Frame* frame, Region dirtyRegio
     gc.restore();
 }
 
+void ChromeClient::invalidateWidgetRect(const IntRect& rect)
+{
+#if USE(ACCELERATED_COMPOSITING)
+    AcceleratedCompositingContext* acContext = m_webView->priv->acceleratedCompositingContext.get();
+    if (acContext->enabled()) {
+        acContext->scheduleRootLayerRepaint(rect);
+        return;
+    }
+#endif
+    gtk_widget_queue_draw_area(GTK_WIDGET(m_webView),
+                               rect.x(), rect.y(),
+                               rect.width(), rect.height());
+}
+
 void ChromeClient::performAllPendingScrolls()
 {
     if (!m_webView->priv->backingStore)
@@ -534,16 +548,13 @@ void ChromeClient::performAllPendingScrolls()
     for (size_t i = 0; i < m_rectsToScroll.size(); i++) {
         IntRect& scrollRect = m_rectsToScroll[i];
         m_webView->priv->backingStore->scroll(scrollRect, m_scrollOffsets[i]);
-        gtk_widget_queue_draw_area(GTK_WIDGET(m_webView),
-                                   scrollRect.x(), scrollRect.y(),
-                                   scrollRect.width(), scrollRect.height());
+        invalidateWidgetRect(scrollRect);
     }
 
     m_rectsToScroll.clear();
     m_scrollOffsets.clear();
 }
 
-
 void ChromeClient::paint(WebCore::Timer<ChromeClient>*)
 {
     static const double minimumFrameInterval = 1.0 / 60.0; // No more than 60 frames a second.
@@ -559,13 +570,10 @@ void ChromeClient::paint(WebCore::Timer<ChromeClient>*)
     if (!frame || !frame->contentRenderer() || !frame->view())
         return;
 
-    performAllPendingScrolls();
     frame->view()->updateLayoutAndStyleIfNeededRecursive();
+    performAllPendingScrolls();
     paintWebView(m_webView, frame, m_dirtyRegion);
 
-    const IntRect& rect = m_dirtyRegion.bounds();
-    gtk_widget_queue_draw_area(GTK_WIDGET(m_webView), rect.x(), rect.y(), rect.width(), rect.height());
-
     HashSet<GtkWidget*> children = m_webView->priv->children;
     HashSet<GtkWidget*>::const_iterator end = children.end();
     for (HashSet<GtkWidget*>::const_iterator current = children.begin(); current != end; ++current) {
@@ -575,6 +583,14 @@ void ChromeClient::paint(WebCore::Timer<ChromeClient>*)
         }
     }
 
+    const IntRect& rect = m_dirtyRegion.bounds();
+    invalidateWidgetRect(rect);
+
+#if USE(ACCELERATED_COMPOSITING)
+    m_webView->priv->acceleratedCompositingContext->syncLayersNow();
+    m_webView->priv->acceleratedCompositingContext->renderLayersToWindow(rect);
+#endif
+
     m_dirtyRegion = Region();
     m_lastDisplayTime = currentTime();
     m_repaintSoonSourceId = 0;
index 829b20b..8c7c892 100644 (file)
@@ -183,6 +183,8 @@ namespace WebKit {
         Vector<IntSize> m_scrollOffsets;
         double m_lastDisplayTime;
         unsigned int m_repaintSoonSourceId;
+
+        void invalidateWidgetRect(const IntRect&);
     };
 }
 
index 6b260c2..d91c3bb 100644 (file)
@@ -119,7 +119,8 @@ enum {
     PROP_ENABLE_FULLSCREEN,
     PROP_ENABLE_DNS_PREFETCHING,
     PROP_ENABLE_WEBGL,
-    PROP_ENABLE_WEB_AUDIO
+    PROP_ENABLE_WEB_AUDIO,
+    PROP_ENABLE_ACCELERATED_COMPOSITING
 };
 
 // Create a default user agent string
@@ -899,6 +900,23 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass)
                                                          _("Whether WebGL content should be rendered"),
                                                          FALSE,
                                                          flags));
+
+    /**
+    * WebKitWebSettings:enable-accelerated-compositing:
+    *
+    * Enable or disable support for accelerated compositing on pages. Accelerated
+    * compositing uses the GPU to render animations on pages smoothly and also allows
+    * proper rendering of 3D CSS transforms.
+    *
+    * Since: 1.7.5
+    */
+    g_object_class_install_property(gobject_class,
+                                    PROP_ENABLE_ACCELERATED_COMPOSITING,
+                                    g_param_spec_boolean("enable-accelerated-compositing",
+                                                         _("Enable accelerated compositing"),
+                                                         _("Whether accelerated compositing should be enabled"),
+                                                         FALSE,
+                                                         flags));
     /**
     * WebKitWebSettings:enable-webaudio:
     *
@@ -1107,6 +1125,9 @@ static void webkit_web_settings_set_property(GObject* object, guint prop_id, con
     case PROP_ENABLE_WEB_AUDIO:
         priv->enableWebAudio = g_value_get_boolean(value);
         break;
+    case PROP_ENABLE_ACCELERATED_COMPOSITING:
+        priv->enableAcceleratedCompositing = g_value_get_boolean(value);
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
         break;
@@ -1269,6 +1290,9 @@ static void webkit_web_settings_get_property(GObject* object, guint prop_id, GVa
     case PROP_ENABLE_WEB_AUDIO:
         g_value_set_boolean(value, priv->enableWebAudio);
         break;
+    case PROP_ENABLE_ACCELERATED_COMPOSITING:
+        g_value_set_boolean(value, priv->enableAcceleratedCompositing);
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
         break;
index 823c36e..d7d082e 100644 (file)
@@ -79,6 +79,7 @@ struct _WebKitWebSettingsPrivate {
     gboolean enableDNSPrefetching;
     gboolean enableWebgl;
     gboolean enableWebAudio;
+    gboolean enableAcceleratedCompositing;
 };
 
 WEBKIT_API void webkit_web_settings_add_extra_plugin_directory(WebKitWebView*, const gchar* directory);
index a512d55..c22461c 100644 (file)
@@ -648,6 +648,12 @@ static gboolean webkit_web_view_draw(GtkWidget* widget, cairo_t* cr)
     if (!gdk_cairo_get_clip_rectangle(cr, &clipRect))
         return FALSE;
 
+    WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv;
+#if USE(TEXTURE_MAPPER_GL)
+    if (priv->acceleratedCompositingContext->renderLayersToWindow(clipRect))
+        return FALSE;
+#endif
+
     cairo_rectangle_list_t* rectList = cairo_copy_clip_rectangle_list(cr);
     if (rectList->status || !rectList->num_rectangles) {
         cairo_rectangle_list_destroy(rectList);
@@ -656,8 +662,8 @@ static gboolean webkit_web_view_draw(GtkWidget* widget, cairo_t* cr)
 
     Vector<IntRect> rects;
     for (int i = 0; i < rectList->num_rectangles; i++) {
-        copyRectFromCairoSurfaceToContext(WEBKIT_WEB_VIEW(widget)->priv->backingStore->cairoSurface(),
-                                          cr, IntSize(), enclosingIntRect(FloatRect(rectList->rectangles[i])));
+        copyRectFromCairoSurfaceToContext(priv->backingStore->cairoSurface(), cr, IntSize(),
+                                          enclosingIntRect(FloatRect(rectList->rectangles[i])));
     }
     cairo_rectangle_list_destroy(rectList);
 
@@ -875,7 +881,7 @@ static void resizeWebViewFromAllocation(WebKitWebView* webView, GtkAllocation* a
     chromeClient->adjustmentWatcher()->updateAdjustmentsFromScrollbars();
 
 #if USE(ACCELERATED_COMPOSITING)
-    WEBKIT_WEB_VIEW(widget)->priv->acceleratedCompositingContext->resizeRootLayer(IntSize(allocation->width, allocation->height));
+    webView->priv->acceleratedCompositingContext->resizeRootLayer(IntSize(allocation->width, allocation->height));
 #endif
 }
 
@@ -965,6 +971,8 @@ static gboolean webkit_web_view_focus_out_event(GtkWidget* widget, GdkEventFocus
 
 static void webkit_web_view_realize(GtkWidget* widget)
 {
+    WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv;
+
     gtk_widget_set_realized(widget, TRUE);
 
     GtkAllocation allocation;
@@ -1003,6 +1011,10 @@ static void webkit_web_view_realize(GtkWidget* widget)
     attributes_mask |= GDK_WA_COLORMAP;
 #endif
     GdkWindow* window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask);
+
+#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL)
+    priv->hasNativeWindow = gdk_window_ensure_native(window);
+#endif
     gtk_widget_set_window(widget, window);
     gdk_window_set_user_data(window, widget);
 
@@ -1017,8 +1029,6 @@ static void webkit_web_view_realize(GtkWidget* widget)
     gtk_style_context_set_background(gtk_widget_get_style_context(widget), window);
 #endif
 
-    WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
-    WebKitWebViewPrivate* priv = webView->priv;
     gtk_im_context_set_client_window(priv->imContext.get(), window);
 }
 
@@ -3236,6 +3246,10 @@ static void webkit_web_view_update_settings(WebKitWebView* webView)
     coreSettings->setWebGLEnabled(settingsPrivate->enableWebgl);
 #endif
 
+#if USE(ACCELERATED_COMPOSITING)
+    coreSettings->setAcceleratedCompositingEnabled(settingsPrivate->enableAcceleratedCompositing);
+#endif
+
 #if ENABLE(WEB_AUDIO)
     coreSettings->setWebAudioEnabled(settingsPrivate->enableWebAudio);
 #endif
@@ -3368,6 +3382,11 @@ static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GPar
         settings->setWebGLEnabled(g_value_get_boolean(&value));
 #endif
 
+#if USE(ACCELERATED_COMPOSITING)
+    else if (name == g_intern_string("enable-accelerated-compositing"))
+        settings->setAcceleratedCompositingEnabled(g_value_get_boolean(&value));
+#endif
+
 #if ENABLE(WEB_AUDIO)
     else if (name == g_intern_string("enable-webaudio"))
         settings->setWebAudioEnabled(g_value_get_boolean(&value));
index b9d0b29..75ba14c 100644 (file)
@@ -44,6 +44,7 @@ extern "C" {
 typedef struct _WebKitWebViewPrivate WebKitWebViewPrivate;
 struct _WebKitWebViewPrivate {
     WebCore::Page* corePage;
+    bool hasNativeWindow;
     OwnPtr<WebCore::WidgetBackingStore> backingStore;
     GRefPtr<WebKitWebSettings> webSettings;
     GRefPtr<WebKitWebInspector> webInspector;
index 4ccc600..e2adfcb 100644 (file)
@@ -1,5 +1,26 @@
 2012-02-06  Martin Robinson  <mrobinson@igalia.com>
 
+        [GTK] Add TextureMapperGL implementation
+        https://bugs.webkit.org/show_bug.cgi?id=75308
+
+        Reviewed by Alejandro G. Castro.
+
+        Fix the WebKit2 + AC build for GTK+.
+
+        * GNUmakefile.am: Add some missing source files.
+        * UIProcess/DrawingAreaProxy.cpp:
+        (WebKit): Add USE(TILED_BACKING_STORE) to the guard.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didReceiveMessage): Ditto.
+        * WebProcess/WebPage/DrawingArea.h:
+        (DrawingArea): Ditto.
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit): Ditto.
+        * WebProcess/WebPage/DrawingAreaImpl.h:
+        (DrawingAreaImpl): Ditto.
+
+2012-02-06  Martin Robinson  <mrobinson@igalia.com>
+
         Fix some miscellaneous 'make dist' error for WebKitGTK+.
 
         * GNUmakefile.am: Do not distribute generated files.
index 660df9f..f8ef273 100644 (file)
@@ -109,6 +109,8 @@ webkit2_built_sources += \
        DerivedSources/WebKit2/DrawingAreaProxyMessages.h \
        DerivedSources/WebKit2/EventDispatcherMessageReceiver.cpp \
        DerivedSources/WebKit2/EventDispatcherMessages.h \
+       DerivedSources/WebKit2/LayerTreeHostProxyMessageReceiver.cpp \
+       DerivedSources/WebKit2/LayerTreeHostProxyMessages.h \
        DerivedSources/WebKit2/NPObjectMessageReceiverMessageReceiver.cpp \
        DerivedSources/WebKit2/NPObjectMessageReceiverMessages.h \
        DerivedSources/WebKit2/PluginControllerProxyMessageReceiver.cpp \
index aa25dd1..9bb9783 100644 (file)
@@ -69,9 +69,12 @@ WebCore::IntRect DrawingAreaProxy::contentsRect() const
     return IntRect(IntPoint::zero(), m_webPageProxy->viewSize());
 }
 
+#if USE(TILED_BACKING_STORE)
 void DrawingAreaProxy::didReceiveLayerTreeHostProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
 {
 }
 #endif
 
+#endif
+
 } // namespace WebKit
index b945ef0..efcaacf 100644 (file)
@@ -1533,7 +1533,7 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
         return;
     }
 
-#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
+#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) && USE(TILED_BACKING_STORE)
     if (messageID.is<CoreIPC::MessageClassLayerTreeHostProxy>()) {
         m_drawingArea->didReceiveLayerTreeHostProxyMessage(connection, messageID, arguments);
         return;
index aee77f5..377c900 100644 (file)
@@ -79,7 +79,7 @@ public:
 #if USE(ACCELERATED_COMPOSITING)
     virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0;
     virtual void scheduleCompositingLayerSync() = 0;
-#if USE(TEXTURE_MAPPER)
+#if USE(TEXTURE_MAPPER) && USE(TILED_BACKING_STORE)
     virtual void didReceiveLayerTreeHostMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) = 0;
 #endif
 #endif
index 3ad27e7..4cc1fe2 100644 (file)
@@ -667,7 +667,7 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
     m_displayTimer.stop();
 }
 
-#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
+#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) && USE(TILED_BACKING_STORE)
 void DrawingAreaImpl::didReceiveLayerTreeHostMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
 {
     if (m_layerTreeHost)
index 28c8ce6..bf86fcf 100644 (file)
@@ -70,7 +70,7 @@ private:
     virtual void scheduleChildWindowGeometryUpdate(const WindowGeometry&);
 #endif
 
-#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
+#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) && USE(TILED_BACKING_STORE)
     virtual void didReceiveLayerTreeHostMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 #endif
 
index 07ad8a2..c268dd9 100644 (file)
@@ -434,6 +434,10 @@ AC_ARG_WITH(accelerated_compositing,
             [], [with_accelerated_compositing="no"])
 AC_MSG_RESULT([$with_accelerated_compositing])
 
+if test "$with_accelerated_compositing" = "opengl" && test "$with_target" != "x11" ; then
+    AC_MSG_ERROR([OpenGL accelerated compositing is only available on X11 currently.])
+fi
+
 if test "$enable_webgl" = "yes" ||  test "$with_accelerated_compositing" = "opengl" ; then
     AC_CHECK_HEADERS([GL/gl.h], [], AC_MSG_ERROR([OpenGL header not found]))
     AC_CHECK_HEADERS([GL/glx.h], [], AC_MSG_ERROR([GLX header not found]))