Fix ENABLE_OPENGL=OFF builds
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Oct 2015 16:21:04 +0000 (16:21 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Oct 2015 16:21:04 +0000 (16:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146511

Patch by Emanuele Aina <emanuele.aina@collabora.com> on 2015-10-06
Reviewed by Darin Adler.

.:

* Source/cmake/OptionsGTK.cmake: Make ENABLE_WAYLAND_TARGET depend on
ENABLE_OPENGL due to EGL usage.

Source/WebCore:

* platform/graphics/texmap/BitmapTextureGL.h:
* platform/graphics/texmap/BitmapTextureGL.cpp:
* platform/graphics/texmap/TextureMapperGL.h:
* platform/graphics/texmap/TextureMapperGL.cpp:
* platform/graphics/texmap/TextureMapperShaderProgram.h:
* platform/graphics/texmap/TextureMapperShaderProgram.cpp:
Fix TEXTURE_MAPPER_GL vs. TEXTURE_MAPPER guards to make sure that
ENABLE_OPENGL=OFF only disables the GL-related parts.

Source/WebKit2:

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseRealize):
(webkitWebViewBaseDraw):
(webkitWebViewBaseDidRelaunchWebProcess):
Replace USE(TEXTURE_MAPPER_GL) with USE(TEXTURE_MAPPER) around
webkitWebViewRenderAcceleratedCompositingResults()
* UIProcess/DrawingAreaProxyImpl.cpp:
* UIProcess/DrawingAreaProxyImpl.h:
* WebProcess/WebPage/DrawingArea.cpp:
(WebKit::DrawingArea::DrawingArea):
* WebProcess/WebPage/DrawingArea.h:
* WebProcess/WebPage/LayerTreeHost.h:
Replace USE(TEXTURE_MAPPER_GL) with USE(TEXTURE_MAPPER) around
setNativeSurfaceHandleForCompositing().
* UIProcess/gtk/WebPreferencesGtk.cpp:
(WebKit::WebPreferences::platformInitializeStore):
Default to no AC if no GL support has been built.
* WebProcess/WebPage/DrawingArea.messages.in:
Replace USE(TEXTURE_MAPPER_GL) with USE(TEXTURE_MAPPER) around
SetNativeSurfaceHandleForCompositing.
* WebProcess/WebPage/DrawingAreaImpl.h:
* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode):
Replace USE(TEXTURE_MAPPER_GL) with USE(TEXTURE_MAPPER) around
setNativeSurfaceHandleForCompositing().
(WebKit::DrawingAreaImpl::setNativeSurfaceHandleForCompositing):
Force setAcceleratedCompositingEnabled() only if a LayerTreeHost
implementation is available, to avoid crashing when building without
any GL support.

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

20 files changed:
ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp
Source/WebCore/platform/graphics/texmap/BitmapTextureGL.h
Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperGL.h
Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp
Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
Source/WebKit2/WebProcess/WebPage/DrawingArea.h
Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
Source/cmake/OptionsGTK.cmake

index a5a4fdb..dbb3794 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2015-10-06  Emanuele Aina  <emanuele.aina@collabora.com>
+
+        Fix ENABLE_OPENGL=OFF builds
+        https://bugs.webkit.org/show_bug.cgi?id=146511
+
+        Reviewed by Darin Adler.
+
+        * Source/cmake/OptionsGTK.cmake: Make ENABLE_WAYLAND_TARGET depend on
+        ENABLE_OPENGL due to EGL usage.
+
 2015-10-01  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Convert focused-input-should-assist-on-touch.html into an automated test
index 7dee072..dd66333 100644 (file)
@@ -1,3 +1,19 @@
+2015-10-06  Emanuele Aina  <emanuele.aina@collabora.com>
+
+        Fix ENABLE_OPENGL=OFF builds
+        https://bugs.webkit.org/show_bug.cgi?id=146511
+
+        Reviewed by Darin Adler.
+
+        * platform/graphics/texmap/BitmapTextureGL.h:
+        * platform/graphics/texmap/BitmapTextureGL.cpp:
+        * platform/graphics/texmap/TextureMapperGL.h:
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        * platform/graphics/texmap/TextureMapperShaderProgram.h:
+        * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
+        Fix TEXTURE_MAPPER_GL vs. TEXTURE_MAPPER guards to make sure that
+        ENABLE_OPENGL=OFF only disables the GL-related parts.
+
 2015-10-06  Alex Christensen  <achristensen@webkit.org>
 
         Fix Windows build after r190611.
index 0e52d7b..494d75e 100644 (file)
@@ -22,6 +22,8 @@
 #include "config.h"
 #include "BitmapTextureGL.h"
 
+#if USE(TEXTURE_MAPPER_GL)
+
 #include "Extensions3D.h"
 #include "FilterOperations.h"
 #include "GraphicsContext.h"
@@ -377,3 +379,5 @@ IntSize BitmapTextureGL::size() const
 }
 
 }; // namespace WebCore
+
+#endif // USE(TEXTURE_MAPPER_GL)
index 0e18809..d51379b 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef BitmapTextureGL_h
 #define BitmapTextureGL_h
 
+#if USE(TEXTURE_MAPPER_GL)
+
 #include "BitmapTexture.h"
 #include "FilterOperation.h"
 #include "GraphicsContext3D.h"
@@ -92,4 +94,6 @@ BitmapTextureGL* toBitmapTextureGL(BitmapTexture*);
 
 }
 
+#endif // USE(TEXTURE_MAPPER_GL)
+
 #endif // BitmapTextureGL_h
index 4c54805..1f9a41a 100644 (file)
@@ -22,6 +22,8 @@
 #include "config.h"
 #include "TextureMapperGL.h"
 
+#if USE(TEXTURE_MAPPER_GL)
+
 #include "BitmapTextureGL.h"
 #include "BitmapTexturePool.h"
 #include "Extensions3D.h"
@@ -52,8 +54,6 @@
 #define GL_UNPACK_SKIP_ROWS 0x0CF3
 #endif
 
-#if USE(TEXTURE_MAPPER)
-
 namespace WebCore {
 struct TextureMapperGLData {
     WTF_MAKE_FAST_ALLOCATED;
@@ -798,12 +798,11 @@ PassRefPtr<BitmapTexture> TextureMapperGL::createTexture()
     return adoptRef(texture);
 }
 
-#if USE(TEXTURE_MAPPER_GL)
 std::unique_ptr<TextureMapper> TextureMapper::platformCreateAccelerated()
 {
     return std::make_unique<TextureMapperGL>();
 }
-#endif
 
 };
-#endif
+
+#endif // USE(TEXTURE_MAPPER_GL)
index bd9bf55..b6edd12 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef TextureMapperGL_h
 #define TextureMapperGL_h
 
-#if USE(TEXTURE_MAPPER)
+#if USE(TEXTURE_MAPPER_GL)
 
 #include "FilterOperation.h"
 #include "FloatQuad.h"
@@ -138,6 +138,6 @@ private:
 
 } // namespace WebCore
 
-#endif // USE(TEXTURE_MAPPER)
+#endif // USE(TEXTURE_MAPPER_GL)
 
 #endif // TextureMapperGL_h
index 885fec7..4a6b4a8 100644 (file)
@@ -22,7 +22,8 @@
 #include "config.h"
 #include "TextureMapperShaderProgram.h"
 
-#if USE(TEXTURE_MAPPER)
+#if USE(TEXTURE_MAPPER_GL)
+
 #include "LengthFunctions.h"
 #include "Logging.h"
 #include "TextureMapperGL.h"
@@ -412,4 +413,4 @@ PassRefPtr<TextureMapperShaderProgram> TextureMapperShaderProgram::create(PassRe
 }
 
 }
-#endif
+#endif // USE(TEXTURE_MAPPER_GL)
index 43a6534..2038416 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef TextureMapperShaderProgram_h
 #define TextureMapperShaderProgram_h
 
-#if USE(TEXTURE_MAPPER)
+#if USE(TEXTURE_MAPPER_GL)
 #include "GraphicsContext3D.h"
 #include "TransformationMatrix.h"
 #include <wtf/HashMap.h>
@@ -96,6 +96,6 @@ private:
 };
 
 }
-#endif
+#endif // USE(TEXTURE_MAPPER_GL)
 
 #endif // TextureMapperShaderProgram_h
index 0761f3f..23fdb35 100644 (file)
@@ -1,3 +1,40 @@
+2015-10-06  Emanuele Aina  <emanuele.aina@collabora.com>
+
+        Fix ENABLE_OPENGL=OFF builds
+        https://bugs.webkit.org/show_bug.cgi?id=146511
+
+        Reviewed by Darin Adler.
+
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewBaseRealize):
+        (webkitWebViewBaseDraw):
+        (webkitWebViewBaseDidRelaunchWebProcess):
+        Replace USE(TEXTURE_MAPPER_GL) with USE(TEXTURE_MAPPER) around
+        webkitWebViewRenderAcceleratedCompositingResults()
+        * UIProcess/DrawingAreaProxyImpl.cpp:
+        * UIProcess/DrawingAreaProxyImpl.h:
+        * WebProcess/WebPage/DrawingArea.cpp:
+        (WebKit::DrawingArea::DrawingArea):
+        * WebProcess/WebPage/DrawingArea.h:
+        * WebProcess/WebPage/LayerTreeHost.h:
+        Replace USE(TEXTURE_MAPPER_GL) with USE(TEXTURE_MAPPER) around
+        setNativeSurfaceHandleForCompositing().
+        * UIProcess/gtk/WebPreferencesGtk.cpp:
+        (WebKit::WebPreferences::platformInitializeStore):
+        Default to no AC if no GL support has been built.
+        * WebProcess/WebPage/DrawingArea.messages.in:
+        Replace USE(TEXTURE_MAPPER_GL) with USE(TEXTURE_MAPPER) around
+        SetNativeSurfaceHandleForCompositing.
+        * WebProcess/WebPage/DrawingAreaImpl.h:
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode):
+        Replace USE(TEXTURE_MAPPER_GL) with USE(TEXTURE_MAPPER) around
+        setNativeSurfaceHandleForCompositing().
+        (WebKit::DrawingAreaImpl::setNativeSurfaceHandleForCompositing):
+        Force setAcceleratedCompositingEnabled() only if a LayerTreeHost
+        implementation is available, to avoid crashing when building without
+        any GL support.
+
 2015-10-06  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         URTBF after r190611.
index 687934a..dd4833f 100644 (file)
@@ -326,7 +326,7 @@ static void webkitWebViewBaseRealize(GtkWidget* widget)
     gtk_widget_set_window(widget, window);
     gdk_window_set_user_data(window, widget);
 
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW)
+#if USE(TEXTURE_MAPPER) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW)
     DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea());
     drawingArea->setNativeSurfaceHandleForCompositing(GDK_WINDOW_XID(window));
 #endif
@@ -472,7 +472,7 @@ static void webkitWebViewBaseConstructed(GObject* object)
     priv->authenticationDialog = 0;
 }
 
-#if USE(TEXTURE_MAPPER_GL)
+#if USE(TEXTURE_MAPPER)
 static bool webkitWebViewRenderAcceleratedCompositingResults(WebKitWebViewBase* webViewBase, DrawingAreaProxyImpl* drawingArea, cairo_t* cr, GdkRectangle* clipRect)
 {
     ASSERT(drawingArea);
@@ -518,7 +518,7 @@ static gboolean webkitWebViewBaseDraw(GtkWidget* widget, cairo_t* cr)
     if (!gdk_cairo_get_clip_rectangle(cr, &clipRect))
         return FALSE;
 
-#if USE(TEXTURE_MAPPER_GL)
+#if USE(TEXTURE_MAPPER)
     if (webkitWebViewRenderAcceleratedCompositingResults(webViewBase, drawingArea, cr, &clipRect))
         return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->draw(widget, cr);
 #endif
@@ -1369,7 +1369,7 @@ void webkitWebViewBaseDidRelaunchWebProcess(WebKitWebViewBase* webkitWebViewBase
     // Queue a resize to ensure the new DrawingAreaProxy is resized.
     gtk_widget_queue_resize_no_redraw(GTK_WIDGET(webkitWebViewBase));
 
-#if PLATFORM(X11)
+#if PLATFORM(X11) && USE(TEXTURE_MAPPER)
     if (PlatformDisplay::sharedDisplay().type() != PlatformDisplay::Type::X11)
         return;
 
@@ -1379,12 +1379,13 @@ void webkitWebViewBaseDidRelaunchWebProcess(WebKitWebViewBase* webkitWebViewBase
 #if USE(REDIRECTED_XCOMPOSITE_WINDOW)
     if (!priv->redirectedWindow)
         return;
-    drawingArea->setNativeSurfaceHandleForCompositing(priv->redirectedWindow->windowID());
+    uint64_t windowID = priv->redirectedWindow->windowID();
 #else
     if (!gtk_widget_get_realized(GTK_WIDGET(webkitWebViewBase)))
         return;
-    drawingArea->setNativeSurfaceHandleForCompositing(GDK_WINDOW_XID(gtk_widget_get_window(GTK_WIDGET(webkitWebViewBase))));
+    uint64_t windowID = GDK_WINDOW_XID(gtk_widget_get_window(GTK_WIDGET(webkitWebViewBase)));
 #endif
+    drawingArea->setNativeSurfaceHandleForCompositing(windowID);
 #else
     UNUSED_PARAM(webkitWebViewBase);
 #endif
index b04c450..8dce277 100644 (file)
@@ -300,7 +300,7 @@ void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(const LayerTreeContex
     m_webPageProxy.enterAcceleratedCompositingMode(layerTreeContext);
 }
 
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+#if USE(TEXTURE_MAPPER) && PLATFORM(GTK)
 void DrawingAreaProxyImpl::setNativeSurfaceHandleForCompositing(uint64_t handle)
 {
     m_webPageProxy.process().send(Messages::DrawingArea::SetNativeSurfaceHandleForCompositing(handle), m_webPageProxy.pageID());
index 6a052b2..defe28f 100644 (file)
@@ -48,7 +48,7 @@ public:
 
     bool hasReceivedFirstUpdate() const { return m_hasReceivedFirstUpdate; }
 
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+#if USE(TEXTURE_MAPPER) && PLATFORM(GTK)
     void setNativeSurfaceHandleForCompositing(uint64_t);
 #endif
 
index 17f18b3..aa77018 100644 (file)
@@ -43,6 +43,9 @@ void WebPreferences::platformInitializeStore()
         setPluginsEnabled(false);
     }
 #endif
+#if !ENABLE(OPEN_GL)
+    setAcceleratedCompositingEnabled(false);
+#endif
 }
 
 void WebPreferences::platformUpdateStringValueForKey(const String&, const String&)
index b9b8b6f..c103e3f 100644 (file)
@@ -76,7 +76,7 @@ std::unique_ptr<DrawingArea> DrawingArea::create(WebPage& webPage, const WebPage
 DrawingArea::DrawingArea(DrawingAreaType type, WebPage& webPage)
     : m_type(type)
     , m_webPage(webPage)
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+#if USE(TEXTURE_MAPPER) && PLATFORM(GTK)
     , m_nativeSurfaceHandleForCompositing(0)
 #endif
 {
index c048c76..be26010 100644 (file)
@@ -143,7 +143,7 @@ protected:
     DrawingAreaType m_type;
     WebPage& m_webPage;
 
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+#if USE(TEXTURE_MAPPER) && PLATFORM(GTK)
     uint64_t m_nativeSurfaceHandleForCompositing;
 #endif
 
@@ -168,7 +168,7 @@ private:
     virtual void addTransactionCallbackID(uint64_t callbackID) { ASSERT_NOT_REACHED(); }
 #endif
 
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+#if USE(TEXTURE_MAPPER) && PLATFORM(GTK)
     virtual void setNativeSurfaceHandleForCompositing(uint64_t) = 0;
 #endif
 };
index 84c6722..8d9793c 100644 (file)
@@ -40,7 +40,7 @@ messages -> DrawingArea {
     AddTransactionCallbackID(uint64_t callbackID)
 #endif
 
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+#if USE(TEXTURE_MAPPER) && PLATFORM(GTK)
     SetNativeSurfaceHandleForCompositing(uint64_t handle)
 #endif
 }
index 1afcd62..8701559 100644 (file)
@@ -468,7 +468,7 @@ void DrawingAreaImpl::enterAcceleratedCompositingMode(GraphicsLayer* graphicsLay
     ASSERT(!m_layerTreeHost);
 
     m_layerTreeHost = LayerTreeHost::create(&m_webPage);
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+#if USE(TEXTURE_MAPPER) && PLATFORM(GTK)
     if (m_nativeSurfaceHandleForCompositing)
         m_layerTreeHost->setNativeSurfaceHandleForCompositing(m_nativeSurfaceHandleForCompositing);
 #endif
@@ -687,14 +687,15 @@ void DrawingAreaImpl::attachViewOverlayGraphicsLayer(WebCore::Frame* frame, WebC
     m_layerTreeHost->setViewOverlayRootLayer(viewOverlayRootLayer);
 }
 
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+#if USE(TEXTURE_MAPPER) && PLATFORM(GTK)
 void DrawingAreaImpl::setNativeSurfaceHandleForCompositing(uint64_t handle)
 {
     m_nativeSurfaceHandleForCompositing = handle;
-    m_webPage.corePage()->settings().setAcceleratedCompositingEnabled(true);
 
-    if (m_layerTreeHost)
+    if (m_layerTreeHost) {
+        m_webPage.corePage()->settings().setAcceleratedCompositingEnabled(true);
         m_layerTreeHost->setNativeSurfaceHandleForCompositing(handle);
+    }
 }
 #endif
 
index 8f5939e..130cd26 100644 (file)
@@ -70,7 +70,7 @@ private:
 
     virtual void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) override;
 
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+#if USE(TEXTURE_MAPPER) && PLATFORM(GTK)
     virtual void setNativeSurfaceHandleForCompositing(uint64_t) override;
 #endif
 
index 5407126..7126d83 100644 (file)
@@ -92,7 +92,7 @@ public:
     virtual void scheduleAnimation() = 0;
 #endif
 
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+#if USE(TEXTURE_MAPPER) && PLATFORM(GTK)
     virtual void setNativeSurfaceHandleForCompositing(uint64_t) = 0;
 #endif
 
index 1f8a972..92ef4b9 100644 (file)
@@ -95,6 +95,7 @@ WEBKIT_OPTION_DEPEND(USE_REDIRECTED_XCOMPOSITE_WINDOW ENABLE_X11_TARGET)
 WEBKIT_OPTION_DEPEND(USE_GSTREAMER_GL ENABLE_OPENGL)
 WEBKIT_OPTION_DEPEND(USE_GSTREAMER_GL ENABLE_VIDEO)
 WEBKIT_OPTION_DEPEND(USE_GSTREAMER_MPEGTS ENABLE_VIDEO)
+WEBKIT_OPTION_DEPEND(ENABLE_WAYLAND_TARGET ENABLE_OPENGL)
 
 SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE})
 if (DEVELOPER_MODE)