[WPE] Use libepoxy
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Jul 2017 13:58:46 +0000 (13:58 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Jul 2017 13:58:46 +0000 (13:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172104

Reviewed by Michael Catanzaro.

.:

* Source/cmake/FindLibEpoxy.cmake: Added.
* Source/cmake/OptionsWPE.cmake: Find libepoxy, don't search for
EGL or OpenGL ES anymore, and enable USE_LIBEPOXY by default.

Source/WebCore:

No new tests -- no changes in behavior.

Implement the proper libepoxy header inclusion for ports that enable it.

The library acts as a loading facility working on top of the system-provided
OpenGL and EGL libraries, with the headers providing a complete collection of
specification-defined OpenGL and EGL types, constants and entrypoints.

Support is added through the USE(LIBEPOXY) build guard. Note that this guard
isn't exclusive with USE(OPENGL), USE(OPENGL_ES_2) or USE(EGL), so the
USE(LIBEPOXY) condition is tested before those.

In case of OpenGL headers, the <epoxy/gl.h> header is included, and in
case of EGL headers, the <epoxy/egl.h> header. <epoxy/egl.h> includes
<epoxy/gl.h> on its own, so in some cases the inclusion of the latter is
omitted.

EpoxyShims.h header is added, doing a job similar to OpenGLESShims.h. The
EXT-suffixed GL entrypoints are redefined to the non-suffixed versions.
No suffixed constants are defined because those are defined by the libepoxy
headers to the well-known values.

* CMakeLists.txt:
* PlatformWPE.cmake:
* platform/graphics/ANGLEWebKitBridge.h:
* platform/graphics/EpoxyShims.h: Added.
* platform/graphics/GLContext.cpp:
(WebCore::initializeOpenGLShimsIfNeeded):
* platform/graphics/GraphicsContext3DPrivate.cpp:
* platform/graphics/PlatformDisplay.cpp:
* platform/graphics/cairo/CairoUtilities.cpp:
* platform/graphics/cairo/GraphicsContext3DCairo.cpp:
(WebCore::GraphicsContext3D::create):
* platform/graphics/cairo/ImageBufferCairo.cpp:
* platform/graphics/egl/GLContextEGL.cpp:
* platform/graphics/egl/GLContextEGLWPE.cpp:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
* platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
* platform/graphics/opengl/Extensions3DOpenGLES.cpp:
* platform/graphics/opengl/Extensions3DOpenGLES.h:
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
* platform/graphics/opengl/TemporaryOpenGLSetting.cpp:
* platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
* platform/graphics/wpe/PlatformDisplayWPE.cpp:

Source/WebKit2:

* PlatformWPE.cmake: Drop the EGL_INCLUDE_DIRS compilation flags.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
Include <epoxy/gl.h> when compiling with libepoxy usage enabled.

Tools:

* WebKitTestRunner/wpe/HeadlessViewBackend.h:
Include the <epoxy/egl.h> header, dropping the EGL and GLES2 inclusions.

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

29 files changed:
ChangeLog
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/PlatformWPE.cmake
Source/WebCore/platform/graphics/ANGLEWebKitBridge.h
Source/WebCore/platform/graphics/EpoxyShims.h [new file with mode: 0644]
Source/WebCore/platform/graphics/GLContext.cpp
Source/WebCore/platform/graphics/GraphicsContext3DPrivate.cpp
Source/WebCore/platform/graphics/PlatformDisplay.cpp
Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp
Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp
Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
Source/WebCore/platform/graphics/egl/GLContextEGL.cpp
Source/WebCore/platform/graphics/egl/GLContextEGLWPE.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp
Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h
Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
Source/WebCore/platform/graphics/opengl/TemporaryOpenGLSetting.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp
Source/WebCore/platform/graphics/wpe/PlatformDisplayWPE.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformWPE.cmake
Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp
Source/cmake/FindLibEpoxy.cmake [new file with mode: 0644]
Source/cmake/OptionsWPE.cmake
Tools/ChangeLog
Tools/WebKitTestRunner/wpe/HeadlessViewBackend.h

index 244d907..ee9a402 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2017-07-12  Zan Dobersek  <zdobersek@igalia.com>
+
+        [WPE] Use libepoxy
+        https://bugs.webkit.org/show_bug.cgi?id=172104
+
+        Reviewed by Michael Catanzaro.
+
+        * Source/cmake/FindLibEpoxy.cmake: Added.
+        * Source/cmake/OptionsWPE.cmake: Find libepoxy, don't search for
+        EGL or OpenGL ES anymore, and enable USE_LIBEPOXY by default.
+
 2017-07-11  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK][WPE] Enable FILE_LOCK and implement lockFile and unlockFile
index 3254cfe..33726a5 100644 (file)
@@ -3325,7 +3325,7 @@ if (ENABLE_GRAPHICS_CONTEXT_3D)
     # For platforms that want to use system-provided OpenGL (ES) / EGL headers,
     # these include directories, libraries or definitions need to be
     # added before the ANGLE directories.
-    if (USE_OPENGL)
+    if (USE_OPENGL AND NOT USE_LIBEPOXY)
         list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
             ${OPENGL_INCLUDE_DIRS}
         )
@@ -3333,7 +3333,7 @@ if (ENABLE_GRAPHICS_CONTEXT_3D)
             ${OPENGL_LIBRARIES}
         )
         add_definitions(${OPENGL_DEFINITIONS})
-    elseif (USE_OPENGL_ES_2)
+    elseif (USE_OPENGL_ES_2 AND NOT USE_LIBEPOXY)
         list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
             ${OPENGLES2_INCLUDE_DIRS}
         )
@@ -3343,7 +3343,7 @@ if (ENABLE_GRAPHICS_CONTEXT_3D)
         add_definitions(${OPENGLES2_DEFINITIONS})
     endif ()
 
-    if (USE_EGL)
+    if (USE_EGL AND NOT USE_LIBEPOXY)
         list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
             ${EGL_INCLUDE_DIRS}
         )
@@ -3353,6 +3353,15 @@ if (ENABLE_GRAPHICS_CONTEXT_3D)
         add_definitions(${EGL_DEFINITIONS})
     endif ()
 
+    if (USE_LIBEPOXY)
+        list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
+            ${LIBEPOXY_INCLUDE_DIRS}
+        )
+        list(APPEND WebCore_LIBRARIES
+            ${LIBEPOXY_LIBRARIES}
+        )
+    endif ()
+
     list(APPEND WebCore_INCLUDE_DIRECTORIES
         "${ANGLE_FORWARDING_HEADERS_DIR}"
         "${WEBCORE_DIR}/platform/graphics/gpu"
index d48e05d..bd8d19d 100644 (file)
@@ -1,3 +1,55 @@
+2017-07-12  Zan Dobersek  <zdobersek@igalia.com>
+
+        [WPE] Use libepoxy
+        https://bugs.webkit.org/show_bug.cgi?id=172104
+
+        Reviewed by Michael Catanzaro.
+
+        No new tests -- no changes in behavior.
+
+        Implement the proper libepoxy header inclusion for ports that enable it.
+
+        The library acts as a loading facility working on top of the system-provided
+        OpenGL and EGL libraries, with the headers providing a complete collection of
+        specification-defined OpenGL and EGL types, constants and entrypoints.
+
+        Support is added through the USE(LIBEPOXY) build guard. Note that this guard
+        isn't exclusive with USE(OPENGL), USE(OPENGL_ES_2) or USE(EGL), so the
+        USE(LIBEPOXY) condition is tested before those.
+
+        In case of OpenGL headers, the <epoxy/gl.h> header is included, and in
+        case of EGL headers, the <epoxy/egl.h> header. <epoxy/egl.h> includes
+        <epoxy/gl.h> on its own, so in some cases the inclusion of the latter is
+        omitted.
+
+        EpoxyShims.h header is added, doing a job similar to OpenGLESShims.h. The
+        EXT-suffixed GL entrypoints are redefined to the non-suffixed versions.
+        No suffixed constants are defined because those are defined by the libepoxy
+        headers to the well-known values.
+
+        * CMakeLists.txt:
+        * PlatformWPE.cmake:
+        * platform/graphics/ANGLEWebKitBridge.h:
+        * platform/graphics/EpoxyShims.h: Added.
+        * platform/graphics/GLContext.cpp:
+        (WebCore::initializeOpenGLShimsIfNeeded):
+        * platform/graphics/GraphicsContext3DPrivate.cpp:
+        * platform/graphics/PlatformDisplay.cpp:
+        * platform/graphics/cairo/CairoUtilities.cpp:
+        * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
+        (WebCore::GraphicsContext3D::create):
+        * platform/graphics/cairo/ImageBufferCairo.cpp:
+        * platform/graphics/egl/GLContextEGL.cpp:
+        * platform/graphics/egl/GLContextEGLWPE.cpp:
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
+        * platform/graphics/opengl/Extensions3DOpenGLES.cpp:
+        * platform/graphics/opengl/Extensions3DOpenGLES.h:
+        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+        * platform/graphics/opengl/TemporaryOpenGLSetting.cpp:
+        * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
+        * platform/graphics/wpe/PlatformDisplayWPE.cpp:
+
 2017-07-12  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         ImageDecoder: Gifs with infinite animation only play once very often
index 8fde49a..d4f2efb 100644 (file)
@@ -161,7 +161,6 @@ set(WebCore_USER_AGENT_SCRIPTS_DEPENDENCIES ${WEBCORE_DIR}/platform/wpe/RenderTh
 
 list(APPEND WebCore_LIBRARIES
     ${CAIRO_LIBRARIES}
-    ${EGL_LIBRARIES}
     ${GLIB_GIO_LIBRARIES}
     ${GLIB_GMODULE_LIBRARIES}
     ${GLIB_GOBJECT_LIBRARIES}
@@ -179,7 +178,6 @@ list(APPEND WebCore_LIBRARIES
 
 list(APPEND WebCore_INCLUDE_DIRECTORIES
     ${CAIRO_INCLUDE_DIRS}
-    ${EGL_INCLUDE_DIRS}
     ${GIO_UNIX_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
     ${GNUTLS_INCLUDE_DIRS}
index 02fe3b0..53a2b90 100644 (file)
 #ifndef ANGLEWebKitBridge_h
 #define ANGLEWebKitBridge_h
 
+#if USE(LIBEPOXY)
+// libepoxy headers have to be included before <ANGLE/ShaderLang.h> in order to avoid
+// picking up khrplatform.h inclusion that's done in ANGLE.
+#include <epoxy/gl.h>
+#endif
+
 #include <ANGLE/ShaderLang.h>
 #include <wtf/text/WTFString.h>
 
@@ -36,7 +42,9 @@
 #elif PLATFORM(WIN)
 #include "OpenGLESShims.h"
 #elif PLATFORM(GTK) || PLATFORM(WPE)
-#if USE(OPENGL_ES_2)
+#if USE(LIBEPOXY)
+// <epoxy/gl.h> already included above.
+#elif USE(OPENGL_ES_2)
 #include <GLES2/gl2.h>
 #else
 #include "OpenGLShims.h"
diff --git a/Source/WebCore/platform/graphics/EpoxyShims.h b/Source/WebCore/platform/graphics/EpoxyShims.h
new file mode 100644 (file)
index 0000000..8dae291
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <epoxy/gl.h>
+
+// Undefine the OpenGL EXT entrypoints and instead define them to the non-extension
+// variants. This mirrors OpenGLESShims.h, but the un-definition has to be done first
+// due to epoxy headers already being included.
+
+// Unlike OpenGLESShims.h, we don't define specific constants since those are already
+// provided by the libepoxy headers, and their values are the same regardless of the
+// ARB, EXT or OES suffix.
+
+#undef glBindFramebufferEXT
+#define glBindFramebufferEXT glBindFramebuffer
+
+#undef glFramebufferTexture2DEXT
+#define glFramebufferTexture2DEXT glFramebufferTexture2D
+
+#undef glBindRenderbufferEXT
+#define glBindRenderbufferEXT glBindRenderbuffer
+
+#undef glRenderbufferStorageEXT
+#define glRenderbufferStorageEXT glRenderbufferStorage
+
+#undef glFramebufferRenderbufferEXT
+#define glFramebufferRenderbufferEXT glFramebufferRenderbuffer
+
+#undef glCheckFramebufferStatusEXT
+#define glCheckFramebufferStatusEXT glCheckFramebufferStatus
+
+#undef glDeleteFramebuffersEXT
+#define glDeleteFramebuffersEXT glDeleteFramebuffers
+
+#undef glDeleteRenderbuffersEXT
+#define glDeleteRenderbuffersEXT glDeleteRenderbuffers
+
+#undef glGenRenderbuffersEXT
+#define glGenRenderbuffersEXT glGenRenderbuffers
+
+#undef glGenFramebuffersEXT
+#define glGenFramebuffersEXT glGenFramebuffers
+
+#undef glGetFramebufferAttachmentParameterivEXT
+#define glGetFramebufferAttachmentParameterivEXT glGetFramebufferAttachmentParameteriv
+
+#undef glGetRenderbufferParameterivEXT
+#define glGetRenderbufferParameterivEXT glGetRenderbufferParameteriv
+
+#undef glIsRenderbufferEXT
+#define glIsRenderbufferEXT glIsRenderbuffer
+
+#undef glIsFramebufferEXT
+#define glIsFramebufferEXT glIsFramebuffer
+
+#undef glGenerateMipmapEXT
+#define glGenerateMipmapEXT glGenerateMipmap
index c15bec5..33c9723 100644 (file)
@@ -26,7 +26,9 @@
 #include "GLContextEGL.h"
 #endif
 
-#if USE(OPENGL_ES_2)
+#if USE(LIBEPOXY)
+#include <epoxy/gl.h>
+#elif USE(OPENGL_ES_2)
 #define GL_GLEXT_PROTOTYPES 1
 #include <GLES2/gl2.h>
 #include <GLES3/gl3.h>
@@ -62,7 +64,7 @@ inline ThreadGlobalGLContext* currentContext()
 
 static bool initializeOpenGLShimsIfNeeded()
 {
-#if USE(OPENGL_ES_2)
+#if USE(OPENGL_ES_2) || USE(LIBEPOXY)
     return true;
 #else
     static bool initialized = false;
index fc76465..79bf86c 100644 (file)
@@ -26,7 +26,9 @@
 #include <wtf/StdLibExtras.h>
 
 
-#if USE(OPENGL_ES_2)
+#if USE(LIBEPOXY)
+#include <epoxy/gl.h>
+#elif USE(OPENGL_ES_2)
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
 #else
index 1b71954..e571b7c 100644 (file)
 #endif
 
 #if USE(EGL)
+#if USE(LIBEPOXY)
+#include <epoxy/egl.h>
+#else
 #include <EGL/egl.h>
+#endif
 #include <wtf/HashSet.h>
 #include <wtf/NeverDestroyed.h>
 #endif
index 86c561c..4022fdc 100644 (file)
@@ -43,6 +43,9 @@
 #include <wtf/Vector.h>
 
 #if ENABLE(ACCELERATED_2D_CANVAS)
+#if USE(EGL) && USE(LIBEPOXY)
+#include <epoxy/egl.h>
+#endif
 #include <cairo-gl.h>
 #endif
 
index ce48a68..0a4fedc 100644 (file)
 #include <ANGLE/ShaderLang.h>
 #endif
 
+#if USE(LIBEPOXY)
+#include <epoxy/gl.h>
+#elif USE(OPENGL)
+#include "OpenGLShims.h"
+#endif
+
 #if USE(OPENGL_ES_2)
 #include "Extensions3DOpenGLES.h"
 #else
 #include "Extensions3DOpenGL.h"
-#include "OpenGLShims.h"
 #endif
 
 #if USE(TEXTURE_MAPPER)
@@ -69,7 +74,7 @@ RefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3DAttributes
     static bool initialized = false;
     static bool success = true;
     if (!initialized) {
-#if !USE(OPENGL_ES_2)
+#if !USE(OPENGL_ES_2) && !USE(LIBEPOXY)
         success = initializeOpenGLShims();
 #endif
         initialized = true;
index 69a53aa..1a51cf5 100644 (file)
 #if ENABLE(ACCELERATED_2D_CANVAS)
 #include "GLContext.h"
 #include "TextureMapperGL.h"
+
+#if USE(EGL) && USE(LIBEPOXY)
+#include <epoxy/egl.h>
+#endif
 #include <cairo-gl.h>
 
 #if USE(OPENGL_ES_2)
index 055e30b..c9f8c4d 100644 (file)
 
 #include "GraphicsContext3D.h"
 #include "PlatformDisplay.h"
+
+#if USE(LIBEPOXY)
+#include <epoxy/egl.h>
+#else
 #include <EGL/egl.h>
+#endif
 
 #if USE(CAIRO)
 #include <cairo.h>
 #endif
 
-#if USE(OPENGL_ES_2)
+#if USE(LIBEPOXY)
+#include <epoxy/gl.h>
+#elif USE(OPENGL_ES2)
 #define GL_GLEXT_PROTOTYPES 1
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
index 2980d28..b4a6725 100644 (file)
 // FIXME: For now default to the GBM EGL platform, but this should really be
 // somehow deducible from the build configuration.
 #define __GBM__ 1
+#if USE(LIBEPOXY)
+#include <epoxy/egl.h>
+#else
 #include <EGL/egl.h>
+#endif
 #include <wpe/renderer-backend-egl.h>
 
 namespace WebCore {
index be52152..575d358 100644 (file)
 #endif
 
 #include <gst/app/gstappsink.h>
+
+#if USE(LIBEPOXY)
+// Include the <epoxy/gl.h> header before <gst/gl/gl.h>.
+#include <epoxy/gl.h>
+#endif
+
 #define GST_USE_UNSTABLE_API
 #include <gst/gl/gl.h>
 #undef GST_USE_UNSTABLE_API
@@ -70,9 +76,7 @@
 #endif
 
 #if USE(EGL)
-#if !PLATFORM(WPE)
 #include "GLContextEGL.h"
-#endif
 #include <gst/gl/egl/gstgldisplay_egl.h>
 #endif
 
index 4fcd709..92bde6f 100644 (file)
@@ -36,7 +36,9 @@
 #include <OpenGLES/ES2/glext.h>
 #include <OpenGLES/ES3/gl.h>
 #else
-#if USE(OPENGL_ES_2)
+#if USE(LIBEPOXY)
+#include "EpoxyShims.h"
+#elif USE(OPENGL_ES_2)
 #include "OpenGLESShims.h"
 #define GL_GLEXT_PROTOTYPES 1
 #include <GLES2/gl2.h>
index 958e093..6fa83cd 100644 (file)
 #if ENABLE(GRAPHICS_CONTEXT_3D)
 #include "GraphicsContext3D.h"
 #include "NotImplemented.h"
+
+#if USE(LIBEPOXY)
+#include <epoxy/egl.h>
+#else
 #include <EGL/egl.h>
+#endif
 
 namespace WebCore {
 
index 7e48bf6..8c493c0 100644 (file)
 
 #if USE(OPENGL_ES_2)
 
+#if USE(LIBEPOXY)
+#include <epoxy/gl.h>
+#else
 #define GL_GLEXT_PROTOTYPES 1
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
+#endif
 
 #ifndef GL_EXT_robustness
 /* reuse GL_NO_ERROR */
index 192c2b3..d807d45 100644 (file)
@@ -64,7 +64,9 @@
 #define GL_RGBA32F_ARB                      0x8814
 #define GL_RGB32F_ARB                       0x8815
 #else
-#if USE(OPENGL_ES_2)
+#if USE(LIBEPOXY)
+#include "EpoxyShims.h"
+#elif USE(OPENGL_ES_2)
 #include "OpenGLESShims.h"
 #elif PLATFORM(MAC)
 #define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
index eac31e7..f11db41 100644 (file)
@@ -29,7 +29,9 @@
 #if ENABLE(GRAPHICS_CONTEXT_3D)
 #include "TemporaryOpenGLSetting.h"
 
-#if USE(OPENGL_ES_2)
+#if USE(LIBEPOXY)
+#include "EpoxyShims.h"
+#elif USE(OPENGL_ES_2)
 #define GL_GLEXT_PROTOTYPES 1
 #include <GLES2/gl2.h>
 #include "OpenGLESShims.h"
index 7b53691..f7a154e 100644 (file)
@@ -22,7 +22,9 @@
 
 #if ENABLE(GRAPHICS_CONTEXT_3D) && USE(TEXTURE_MAPPER)
 
-#if USE(OPENGL_ES_2)
+#if USE(LIBEPOXY)
+#include <epoxy/gl.h>
+#elif USE(OPENGL_ES_2)
 #define GL_GLEXT_PROTOTYPES 1
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
index 702eb82..ef861d8 100644 (file)
 // FIXME: For now default to the GBM EGL platform, but this should really be
 // somehow deducible from the build configuration.
 #define __GBM__ 1
+#if USE(LIBEPOXY)
+#include <epoxy/egl.h>
+#else
 #include <EGL/egl.h>
+#endif
 #include <wpe/renderer-backend-egl.h>
 
 namespace WebCore {
index 658f618..95b15b1 100644 (file)
@@ -1,3 +1,14 @@
+2017-07-12  Zan Dobersek  <zdobersek@igalia.com>
+
+        [WPE] Use libepoxy
+        https://bugs.webkit.org/show_bug.cgi?id=172104
+
+        Reviewed by Michael Catanzaro.
+
+        * PlatformWPE.cmake: Drop the EGL_INCLUDE_DIRS compilation flags.
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
+        Include <epoxy/gl.h> when compiling with libepoxy usage enabled.
+
 2017-07-12  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Web Automation: upstream safaridriver's JavaScript atom implementations
index f501a35..43de59c 100644 (file)
@@ -413,7 +413,6 @@ list(APPEND WebKit2_INCLUDE_DIRECTORIES
     "${WTF_DIR}/wtf/gobject"
     "${WTF_DIR}"
     ${CAIRO_INCLUDE_DIRS}
-    ${EGL_INCLUDE_DIRS}
     ${FREETYPE2_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
     ${GSTREAMER_INCLUDE_DIRS}
index e8ee942..555914b 100644 (file)
@@ -34,7 +34,9 @@
 #include <WebCore/TransformationMatrix.h>
 #include <wtf/SetForScope.h>
 
-#if USE(OPENGL_ES_2)
+#if USE(LIBEPOXY)
+#include <epoxy/gl.h>
+#elif USE(OPENGL_ES_2)
 #include <GLES2/gl2.h>
 #else
 #include <GL/gl.h>
diff --git a/Source/cmake/FindLibEpoxy.cmake b/Source/cmake/FindLibEpoxy.cmake
new file mode 100644 (file)
index 0000000..b9db4e9
--- /dev/null
@@ -0,0 +1,46 @@
+# - Try to find libepoxy.
+# Once done, this will define
+#
+#  LIBEPOXY_INCLUDE_DIRS - the libtasn1 include directories
+#  LIBEPOXY_LIBRARIES - the libtasn1 libraries.
+#
+# Copyright (C) 2017 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(PC_LIBEPOXY QUIET epoxy)
+
+find_path(LIBEPOXY_INCLUDE_DIRS
+    NAMES epoxy/gl.h
+    PATHS ${PC_LIBEPOXY_INCLUDEDIR} ${PC_LIBEPOXY_INCLUDE_DIRS}
+)
+
+find_library(LIBEPOXY_LIBRARIES
+    NAMES epoxy
+    PATHS ${PC_LIBEPOXY_LIBDIR} ${PC_LIBEPOXY_LIBRARY_DIRS}
+)
+
+mark_as_advanced(LIBEPOXY_INCLUDE_DIRS LIBEPOXY_LIBRARIES)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBEPOXY REQUIRED_VARS LIBEPOXY_INCLUDE_DIRS LIBEPOXY_LIBRARIES)
index d363046..5aeaddf 100644 (file)
@@ -75,6 +75,7 @@ find_package(Fontconfig 2.8.0 REQUIRED)
 find_package(Freetype2 2.4.2 REQUIRED)
 find_package(HarfBuzz 0.9.18 REQUIRED)
 find_package(JPEG REQUIRED)
+find_package(LibEpoxy REQUIRED)
 find_package(LibGcrypt 1.6.0 REQUIRED)
 find_package(LibSoup 2.42.0 REQUIRED)
 find_package(LibXml2 2.8.0 REQUIRED)
@@ -83,9 +84,6 @@ find_package(PNG REQUIRED)
 find_package(Sqlite REQUIRED)
 find_package(WebP REQUIRED)
 
-find_package(OpenGLES2 REQUIRED)
-find_package(EGL REQUIRED)
-
 find_package(WPEBackend REQUIRED)
 
 set(USE_CAIRO ON)
@@ -137,6 +135,7 @@ add_definitions(-DDATA_DIR="${CMAKE_INSTALL_DATADIR}")
 
 set(USE_UDIS86 1)
 
+SET_AND_EXPOSE_TO_BUILD(USE_LIBEPOXY TRUE)
 SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES_2 TRUE)
 SET_AND_EXPOSE_TO_BUILD(USE_EGL TRUE)
 
index d75cf1e..838823d 100644 (file)
@@ -1,5 +1,15 @@
 2017-07-12  Zan Dobersek  <zdobersek@igalia.com>
 
+        [WPE] Use libepoxy
+        https://bugs.webkit.org/show_bug.cgi?id=172104
+
+        Reviewed by Michael Catanzaro.
+
+        * WebKitTestRunner/wpe/HeadlessViewBackend.h:
+        Include the <epoxy/egl.h> header, dropping the EGL and GLES2 inclusions.
+
+2017-07-12  Zan Dobersek  <zdobersek@igalia.com>
+
         [GTK][WPE] Align Jhbuild patches for GStreamer packages
         https://bugs.webkit.org/show_bug.cgi?id=174363
 
index 6218612..a1be489 100644 (file)
 
 #pragma once
 
+// This include order is necessary to enforce the GBM EGL platform.
 #include <gbm.h>
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
+#include <epoxy/egl.h>
+
 #include <cairo.h>
 #include <glib.h>
 #include <unordered_map>