[WPE] libepoxy headers can use EGL_CAST, which might not be defined by eglplatform.h
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Jul 2017 14:24:38 +0000 (14:24 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Jul 2017 14:24:38 +0000 (14:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174780

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Newer versions of libepoxy provide EGL definitions that already use the EGL_CAST macro.
We'd like to compile on systems where the eglplatform.h header doesn't yet provide
that macro that was added only recently (e.g. it's available in Mesa 17.1, but not
before).

To address that, the EpoxyEGL.h header is added that first includes the libepoxy's EGL
header and then provides the EGL_CAST definition in case the eglplatform.h header doesn't.
This header should be included in place of <epoxy/egl.h> (which is included in this new
header).

The EpoxyEGL.h and EpoxyShims.h headers are also moved under the platform/graphics/epoxy/
directory, with the new directory added to the list of inclusion paths for WPE.

* PlatformWPE.cmake:
* platform/graphics/PlatformDisplay.cpp:
* platform/graphics/cairo/CairoUtilities.cpp:
* platform/graphics/cairo/ImageBufferCairo.cpp:
* platform/graphics/egl/GLContextEGL.cpp:
* platform/graphics/egl/GLContextEGLWPE.cpp:
* platform/graphics/epoxy/EpoxyEGL.h: Added.
* platform/graphics/epoxy/EpoxyShims.h: Renamed from Source/WebCore/platform/graphics/EpoxyShims.h.
* platform/graphics/opengl/Extensions3DOpenGLES.cpp:
* platform/graphics/wpe/PlatformDisplayWPE.cpp:

Tools:

* WebKitTestRunner/wpe/HeadlessViewBackend.cpp:
Manually define the EGL_CAST macro to the C++ version that uses static_cast<>
in case the eglplatform.h header doesn't provide that macro. This replicates
the work in WebCore's EpoxyEGL.h header, but we can't include that header here.

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

13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/PlatformWPE.cmake
Source/WebCore/platform/graphics/PlatformDisplay.cpp
Source/WebCore/platform/graphics/cairo/CairoUtilities.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/epoxy/EpoxyEGL.h [new file with mode: 0644]
Source/WebCore/platform/graphics/epoxy/EpoxyShims.h [moved from Source/WebCore/platform/graphics/EpoxyShims.h with 100% similarity]
Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp
Source/WebCore/platform/graphics/wpe/PlatformDisplayWPE.cpp
Tools/ChangeLog
Tools/WebKitTestRunner/wpe/HeadlessViewBackend.cpp

index 0080e7506970e2e3fc07af740238702f5daba8b4..07d9f254d3679a3216034bf83b162937f2f2e9fa 100644 (file)
@@ -1,3 +1,34 @@
+2017-07-24  Zan Dobersek  <zdobersek@igalia.com>
+
+        [WPE] libepoxy headers can use EGL_CAST, which might not be defined by eglplatform.h
+        https://bugs.webkit.org/show_bug.cgi?id=174780
+
+        Reviewed by Carlos Garcia Campos.
+
+        Newer versions of libepoxy provide EGL definitions that already use the EGL_CAST macro.
+        We'd like to compile on systems where the eglplatform.h header doesn't yet provide
+        that macro that was added only recently (e.g. it's available in Mesa 17.1, but not
+        before).
+
+        To address that, the EpoxyEGL.h header is added that first includes the libepoxy's EGL
+        header and then provides the EGL_CAST definition in case the eglplatform.h header doesn't.
+        This header should be included in place of <epoxy/egl.h> (which is included in this new
+        header).
+
+        The EpoxyEGL.h and EpoxyShims.h headers are also moved under the platform/graphics/epoxy/
+        directory, with the new directory added to the list of inclusion paths for WPE.
+
+        * PlatformWPE.cmake:
+        * platform/graphics/PlatformDisplay.cpp:
+        * platform/graphics/cairo/CairoUtilities.cpp:
+        * platform/graphics/cairo/ImageBufferCairo.cpp:
+        * platform/graphics/egl/GLContextEGL.cpp:
+        * platform/graphics/egl/GLContextEGLWPE.cpp:
+        * platform/graphics/epoxy/EpoxyEGL.h: Added.
+        * platform/graphics/epoxy/EpoxyShims.h: Renamed from Source/WebCore/platform/graphics/EpoxyShims.h.
+        * platform/graphics/opengl/Extensions3DOpenGLES.cpp:
+        * platform/graphics/wpe/PlatformDisplayWPE.cpp:
+
 2017-07-24  Zan Dobersek  <zdobersek@igalia.com>
 
         [CoordinatedGraphics] Remove unused GLDefs.h header
index 73e25bac0d20adc409f6d553d48316e6e3dc81aa..de4a63db2636003bdb974090a1d4f1125bf90749 100644 (file)
@@ -33,6 +33,7 @@ list(APPEND WebCore_INCLUDE_DIRECTORIES
     "${THIRDPARTY_DIR}/ANGLE/"
     "${THIRDPARTY_DIR}/ANGLE/include/KHR"
     "${WEBCORE_DIR}/platform/graphics/egl"
+    "${WEBCORE_DIR}/platform/graphics/epoxy"
     "${WEBCORE_DIR}/platform/graphics/glx"
     "${WEBCORE_DIR}/platform/graphics/gstreamer"
     "${WEBCORE_DIR}/platform/graphics/opengl"
index e571b7c06852c1ef8718a9abbc10dd109bf5b161..59898d6c9ceb7a15f0e475bf1186125f0d830946 100644 (file)
@@ -60,7 +60,7 @@
 
 #if USE(EGL)
 #if USE(LIBEPOXY)
-#include <epoxy/egl.h>
+#include "EpoxyEGL.h"
 #else
 #include <EGL/egl.h>
 #endif
index 4022fdcb2c44b2fcbf59f777ea12a189db93b104..63c0bddbc6fdd3db508e7e9af4ced5ccb9e2fd2c 100644 (file)
@@ -44,7 +44,7 @@
 
 #if ENABLE(ACCELERATED_2D_CANVAS)
 #if USE(EGL) && USE(LIBEPOXY)
-#include <epoxy/egl.h>
+#include "EpoxyEGL.h"
 #endif
 #include <cairo-gl.h>
 #endif
index f04c5a56af67ebc63716c8faea678ba3f53e26c7..8c161884d1c6967e90bbd13ecd7e20354ddbf2ee 100644 (file)
@@ -52,7 +52,7 @@
 #include "TextureMapperGL.h"
 
 #if USE(EGL) && USE(LIBEPOXY)
-#include <epoxy/egl.h>
+#include "EpoxyEGL.h"
 #endif
 #include <cairo-gl.h>
 
index 6edca980bf3bcd09bd157b7aea1216f0c10d444c..1ba179b463f442b1398d0bfff51a94fa9d3aeb8c 100644 (file)
@@ -25,7 +25,7 @@
 #include "PlatformDisplay.h"
 
 #if USE(LIBEPOXY)
-#include <epoxy/egl.h>
+#include "EpoxyEGL.h"
 #else
 #include <EGL/egl.h>
 #endif
index b4a6725801f62cf0dba8c6a7c20dab3b798b7323..184c3e3f41947b78a0fa59c78602d901fa02615d 100644 (file)
@@ -26,7 +26,7 @@
 // somehow deducible from the build configuration.
 #define __GBM__ 1
 #if USE(LIBEPOXY)
-#include <epoxy/egl.h>
+#include "EpoxyEGL.h"
 #else
 #include <EGL/egl.h>
 #endif
diff --git a/Source/WebCore/platform/graphics/epoxy/EpoxyEGL.h b/Source/WebCore/platform/graphics/epoxy/EpoxyEGL.h
new file mode 100644 (file)
index 0000000..b7a4b0a
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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/egl.h>
+
+// Provide the EGL_CAST macro in case the eglplatform.h header doesn't define it already.
+#ifndef EGL_CAST
+#if defined(__cplusplus)
+#define EGL_CAST(type, value) (static_cast<type>(value))
+#else
+#define EGL_CAST(type, value) ((type) (value))
+#endif
+#endif
index 6fa83cd2454775e508a25a5be5136cd869990243..f3e9ea91c55013c592de9cb4bfdd5b7083d6fd73 100644 (file)
@@ -35,7 +35,7 @@
 #include "NotImplemented.h"
 
 #if USE(LIBEPOXY)
-#include <epoxy/egl.h>
+#include "EpoxyEGL.h"
 #else
 #include <EGL/egl.h>
 #endif
index ef861d8eb4cef05fdcc8b0504d34c760a8bfc76c..8c349c1d5b9250c45c9b1f6e6e625e409c7440be 100644 (file)
@@ -33,7 +33,7 @@
 // somehow deducible from the build configuration.
 #define __GBM__ 1
 #if USE(LIBEPOXY)
-#include <epoxy/egl.h>
+#include "EpoxyEGL.h"
 #else
 #include <EGL/egl.h>
 #endif
index 2b555168d60adbcf2a3a17f12abc0b042de25ad6..8f9f7c820c8e3e37f5867af324e9276b68125f33 100644 (file)
@@ -1,3 +1,15 @@
+2017-07-24  Zan Dobersek  <zdobersek@igalia.com>
+
+        [WPE] libepoxy headers can use EGL_CAST, which might not be defined by eglplatform.h
+        https://bugs.webkit.org/show_bug.cgi?id=174780
+
+        Reviewed by Carlos Garcia Campos.
+
+        * WebKitTestRunner/wpe/HeadlessViewBackend.cpp:
+        Manually define the EGL_CAST macro to the C++ version that uses static_cast<>
+        in case the eglplatform.h header doesn't provide that macro. This replicates
+        the work in WebCore's EpoxyEGL.h header, but we can't include that header here.
+
 2017-07-22  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS WK2] Remove _WKDraggableElementInfo and fold PositionInformationTests into WKRequestActivatedElementInfo
index 2fd806ff4e7be84a4be8d1457336277eb5790e63..068ca30885f008fcfd96dd879b8a5d1f92f9cbd3 100644 (file)
 #include <unistd.h>
 #include <wtf/glib/RunLoopSourcePriority.h>
 
+// Manually provide the EGL_CAST C++ definition in case eglplatform.h doesn't provide it.
+#ifndef EGL_CAST
+#define EGL_CAST(type, value) (static_cast<type>(value))
+#endif
+
 // FIXME: Deploy good practices and clean up GBM resources at process exit.
 static EGLDisplay getEGLDisplay()
 {