Title: [219819] trunk
Revision
219819
Author
[email protected]
Date
2017-07-24 07:24:38 -0700 (Mon, 24 Jul 2017)

Log Message

[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.

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.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (219818 => 219819)


--- trunk/Source/WebCore/ChangeLog	2017-07-24 13:50:05 UTC (rev 219818)
+++ trunk/Source/WebCore/ChangeLog	2017-07-24 14:24:38 UTC (rev 219819)
@@ -1,5 +1,36 @@
 2017-07-24  Zan Dobersek  <[email protected]>
 
+        [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  <[email protected]>
+
         [CoordinatedGraphics] Remove unused GLDefs.h header
         https://bugs.webkit.org/show_bug.cgi?id=174712
 

Modified: trunk/Source/WebCore/PlatformWPE.cmake (219818 => 219819)


--- trunk/Source/WebCore/PlatformWPE.cmake	2017-07-24 13:50:05 UTC (rev 219818)
+++ trunk/Source/WebCore/PlatformWPE.cmake	2017-07-24 14:24:38 UTC (rev 219819)
@@ -33,6 +33,7 @@
     "${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"

Deleted: trunk/Source/WebCore/platform/graphics/EpoxyShims.h (219818 => 219819)


--- trunk/Source/WebCore/platform/graphics/EpoxyShims.h	2017-07-24 13:50:05 UTC (rev 219818)
+++ trunk/Source/WebCore/platform/graphics/EpoxyShims.h	2017-07-24 14:24:38 UTC (rev 219819)
@@ -1,81 +0,0 @@
-/*
- * 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

Modified: trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp (219818 => 219819)


--- trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp	2017-07-24 13:50:05 UTC (rev 219818)
+++ trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp	2017-07-24 14:24:38 UTC (rev 219819)
@@ -60,7 +60,7 @@
 
 #if USE(EGL)
 #if USE(LIBEPOXY)
-#include <epoxy/egl.h>
+#include "EpoxyEGL.h"
 #else
 #include <EGL/egl.h>
 #endif

Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp (219818 => 219819)


--- trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp	2017-07-24 13:50:05 UTC (rev 219818)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp	2017-07-24 14:24:38 UTC (rev 219819)
@@ -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

Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp (219818 => 219819)


--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp	2017-07-24 13:50:05 UTC (rev 219818)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp	2017-07-24 14:24:38 UTC (rev 219819)
@@ -52,7 +52,7 @@
 #include "TextureMapperGL.h"
 
 #if USE(EGL) && USE(LIBEPOXY)
-#include <epoxy/egl.h>
+#include "EpoxyEGL.h"
 #endif
 #include <cairo-gl.h>
 

Modified: trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp (219818 => 219819)


--- trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp	2017-07-24 13:50:05 UTC (rev 219818)
+++ trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp	2017-07-24 14:24:38 UTC (rev 219819)
@@ -25,7 +25,7 @@
 #include "PlatformDisplay.h"
 
 #if USE(LIBEPOXY)
-#include <epoxy/egl.h>
+#include "EpoxyEGL.h"
 #else
 #include <EGL/egl.h>
 #endif

Modified: trunk/Source/WebCore/platform/graphics/egl/GLContextEGLWPE.cpp (219818 => 219819)


--- trunk/Source/WebCore/platform/graphics/egl/GLContextEGLWPE.cpp	2017-07-24 13:50:05 UTC (rev 219818)
+++ trunk/Source/WebCore/platform/graphics/egl/GLContextEGLWPE.cpp	2017-07-24 14:24:38 UTC (rev 219819)
@@ -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

Added: trunk/Source/WebCore/platform/graphics/epoxy/EpoxyEGL.h (0 => 219819)


--- trunk/Source/WebCore/platform/graphics/epoxy/EpoxyEGL.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/epoxy/EpoxyEGL.h	2017-07-24 14:24:38 UTC (rev 219819)
@@ -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

Added: trunk/Source/WebCore/platform/graphics/epoxy/EpoxyShims.h (0 => 219819)


--- trunk/Source/WebCore/platform/graphics/epoxy/EpoxyShims.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/epoxy/EpoxyShims.h	2017-07-24 14:24:38 UTC (rev 219819)
@@ -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

Modified: trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp (219818 => 219819)


--- trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp	2017-07-24 13:50:05 UTC (rev 219818)
+++ trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp	2017-07-24 14:24:38 UTC (rev 219819)
@@ -35,7 +35,7 @@
 #include "NotImplemented.h"
 
 #if USE(LIBEPOXY)
-#include <epoxy/egl.h>
+#include "EpoxyEGL.h"
 #else
 #include <EGL/egl.h>
 #endif

Modified: trunk/Source/WebCore/platform/graphics/wpe/PlatformDisplayWPE.cpp (219818 => 219819)


--- trunk/Source/WebCore/platform/graphics/wpe/PlatformDisplayWPE.cpp	2017-07-24 13:50:05 UTC (rev 219818)
+++ trunk/Source/WebCore/platform/graphics/wpe/PlatformDisplayWPE.cpp	2017-07-24 14:24:38 UTC (rev 219819)
@@ -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

Modified: trunk/Tools/ChangeLog (219818 => 219819)


--- trunk/Tools/ChangeLog	2017-07-24 13:50:05 UTC (rev 219818)
+++ trunk/Tools/ChangeLog	2017-07-24 14:24:38 UTC (rev 219819)
@@ -1,3 +1,15 @@
+2017-07-24  Zan Dobersek  <[email protected]>
+
+        [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  <[email protected]>
 
         [iOS WK2] Remove _WKDraggableElementInfo and fold PositionInformationTests into WKRequestActivatedElementInfo

Modified: trunk/Tools/WebKitTestRunner/wpe/HeadlessViewBackend.cpp (219818 => 219819)


--- trunk/Tools/WebKitTestRunner/wpe/HeadlessViewBackend.cpp	2017-07-24 13:50:05 UTC (rev 219818)
+++ trunk/Tools/WebKitTestRunner/wpe/HeadlessViewBackend.cpp	2017-07-24 14:24:38 UTC (rev 219819)
@@ -31,6 +31,11 @@
 #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()
 {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to