Changeset 219391 in webkit


Ignore:
Timestamp:
Jul 12, 2017 6:58:46 AM (7 years ago)
Author:
zandobersek@gmail.com
Message:

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

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.

Location:
trunk
Files:
2 added
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r219384 r219391  
     12017-07-12  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [WPE] Use libepoxy
     4        https://bugs.webkit.org/show_bug.cgi?id=172104
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        * Source/cmake/FindLibEpoxy.cmake: Added.
     9        * Source/cmake/OptionsWPE.cmake: Find libepoxy, don't search for
     10        EGL or OpenGL ES anymore, and enable USE_LIBEPOXY by default.
     11
    1122017-07-11  Carlos Garcia Campos  <cgarcia@igalia.com>
    213
  • trunk/Source/WebCore/CMakeLists.txt

    r219379 r219391  
    33263326    # these include directories, libraries or definitions need to be
    33273327    # added before the ANGLE directories.
    3328     if (USE_OPENGL)
     3328    if (USE_OPENGL AND NOT USE_LIBEPOXY)
    33293329        list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
    33303330            ${OPENGL_INCLUDE_DIRS}
     
    33343334        )
    33353335        add_definitions(${OPENGL_DEFINITIONS})
    3336     elseif (USE_OPENGL_ES_2)
     3336    elseif (USE_OPENGL_ES_2 AND NOT USE_LIBEPOXY)
    33373337        list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
    33383338            ${OPENGLES2_INCLUDE_DIRS}
     
    33443344    endif ()
    33453345
    3346     if (USE_EGL)
     3346    if (USE_EGL AND NOT USE_LIBEPOXY)
    33473347        list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
    33483348            ${EGL_INCLUDE_DIRS}
     
    33523352        )
    33533353        add_definitions(${EGL_DEFINITIONS})
     3354    endif ()
     3355
     3356    if (USE_LIBEPOXY)
     3357        list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
     3358            ${LIBEPOXY_INCLUDE_DIRS}
     3359        )
     3360        list(APPEND WebCore_LIBRARIES
     3361            ${LIBEPOXY_LIBRARIES}
     3362        )
    33543363    endif ()
    33553364
  • trunk/Source/WebCore/ChangeLog

    r219389 r219391  
     12017-07-12  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [WPE] Use libepoxy
     4        https://bugs.webkit.org/show_bug.cgi?id=172104
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        No new tests -- no changes in behavior.
     9
     10        Implement the proper libepoxy header inclusion for ports that enable it.
     11
     12        The library acts as a loading facility working on top of the system-provided
     13        OpenGL and EGL libraries, with the headers providing a complete collection of
     14        specification-defined OpenGL and EGL types, constants and entrypoints.
     15
     16        Support is added through the USE(LIBEPOXY) build guard. Note that this guard
     17        isn't exclusive with USE(OPENGL), USE(OPENGL_ES_2) or USE(EGL), so the
     18        USE(LIBEPOXY) condition is tested before those.
     19
     20        In case of OpenGL headers, the <epoxy/gl.h> header is included, and in
     21        case of EGL headers, the <epoxy/egl.h> header. <epoxy/egl.h> includes
     22        <epoxy/gl.h> on its own, so in some cases the inclusion of the latter is
     23        omitted.
     24
     25        EpoxyShims.h header is added, doing a job similar to OpenGLESShims.h. The
     26        EXT-suffixed GL entrypoints are redefined to the non-suffixed versions.
     27        No suffixed constants are defined because those are defined by the libepoxy
     28        headers to the well-known values.
     29
     30        * CMakeLists.txt:
     31        * PlatformWPE.cmake:
     32        * platform/graphics/ANGLEWebKitBridge.h:
     33        * platform/graphics/EpoxyShims.h: Added.
     34        * platform/graphics/GLContext.cpp:
     35        (WebCore::initializeOpenGLShimsIfNeeded):
     36        * platform/graphics/GraphicsContext3DPrivate.cpp:
     37        * platform/graphics/PlatformDisplay.cpp:
     38        * platform/graphics/cairo/CairoUtilities.cpp:
     39        * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
     40        (WebCore::GraphicsContext3D::create):
     41        * platform/graphics/cairo/ImageBufferCairo.cpp:
     42        * platform/graphics/egl/GLContextEGL.cpp:
     43        * platform/graphics/egl/GLContextEGLWPE.cpp:
     44        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
     45        * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
     46        * platform/graphics/opengl/Extensions3DOpenGLES.cpp:
     47        * platform/graphics/opengl/Extensions3DOpenGLES.h:
     48        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
     49        * platform/graphics/opengl/TemporaryOpenGLSetting.cpp:
     50        * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
     51        * platform/graphics/wpe/PlatformDisplayWPE.cpp:
     52
    1532017-07-12  Carlos Garcia Campos  <cgarcia@igalia.com>
    254
  • trunk/Source/WebCore/PlatformWPE.cmake

    r219384 r219391  
    162162list(APPEND WebCore_LIBRARIES
    163163    ${CAIRO_LIBRARIES}
    164     ${EGL_LIBRARIES}
    165164    ${GLIB_GIO_LIBRARIES}
    166165    ${GLIB_GMODULE_LIBRARIES}
     
    180179list(APPEND WebCore_INCLUDE_DIRECTORIES
    181180    ${CAIRO_INCLUDE_DIRS}
    182     ${EGL_INCLUDE_DIRS}
    183181    ${GIO_UNIX_INCLUDE_DIRS}
    184182    ${GLIB_INCLUDE_DIRS}
  • trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h

    r218799 r219391  
    2727#define ANGLEWebKitBridge_h
    2828
     29#if USE(LIBEPOXY)
     30// libepoxy headers have to be included before <ANGLE/ShaderLang.h> in order to avoid
     31// picking up khrplatform.h inclusion that's done in ANGLE.
     32#include <epoxy/gl.h>
     33#endif
     34
    2935#include <ANGLE/ShaderLang.h>
    3036#include <wtf/text/WTFString.h>
     
    3743#include "OpenGLESShims.h"
    3844#elif PLATFORM(GTK) || PLATFORM(WPE)
    39 #if USE(OPENGL_ES_2)
     45#if USE(LIBEPOXY)
     46// <epoxy/gl.h> already included above.
     47#elif USE(OPENGL_ES_2)
    4048#include <GLES2/gl2.h>
    4149#else
  • trunk/Source/WebCore/platform/graphics/GLContext.cpp

    r216497 r219391  
    2727#endif
    2828
    29 #if USE(OPENGL_ES_2)
     29#if USE(LIBEPOXY)
     30#include <epoxy/gl.h>
     31#elif USE(OPENGL_ES_2)
    3032#define GL_GLEXT_PROTOTYPES 1
    3133#include <GLES2/gl2.h>
     
    6365static bool initializeOpenGLShimsIfNeeded()
    6466{
    65 #if USE(OPENGL_ES_2)
     67#if USE(OPENGL_ES_2) || USE(LIBEPOXY)
    6668    return true;
    6769#else
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3DPrivate.cpp

    r211681 r219391  
    2727
    2828
    29 #if USE(OPENGL_ES_2)
     29#if USE(LIBEPOXY)
     30#include <epoxy/gl.h>
     31#elif USE(OPENGL_ES_2)
    3032#include <GLES2/gl2.h>
    3133#include <GLES2/gl2ext.h>
  • trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp

    r216497 r219391  
    6060
    6161#if USE(EGL)
     62#if USE(LIBEPOXY)
     63#include <epoxy/egl.h>
     64#else
    6265#include <EGL/egl.h>
     66#endif
    6367#include <wtf/HashSet.h>
    6468#include <wtf/NeverDestroyed.h>
  • trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp

    r217553 r219391  
    4444
    4545#if ENABLE(ACCELERATED_2D_CANVAS)
     46#if USE(EGL) && USE(LIBEPOXY)
     47#include <epoxy/egl.h>
     48#endif
    4649#include <cairo-gl.h>
    4750#endif
  • trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp

    r217298 r219391  
    4848#endif
    4949
     50#if USE(LIBEPOXY)
     51#include <epoxy/gl.h>
     52#elif USE(OPENGL)
     53#include "OpenGLShims.h"
     54#endif
     55
    5056#if USE(OPENGL_ES_2)
    5157#include "Extensions3DOpenGLES.h"
    5258#else
    5359#include "Extensions3DOpenGL.h"
    54 #include "OpenGLShims.h"
    5560#endif
    5661
     
    7075    static bool success = true;
    7176    if (!initialized) {
    72 #if !USE(OPENGL_ES_2)
     77#if !USE(OPENGL_ES_2) && !USE(LIBEPOXY)
    7378        success = initializeOpenGLShims();
    7479#endif
  • trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp

    r218170 r219391  
    5151#include "GLContext.h"
    5252#include "TextureMapperGL.h"
     53
     54#if USE(EGL) && USE(LIBEPOXY)
     55#include <epoxy/egl.h>
     56#endif
    5357#include <cairo-gl.h>
    5458
  • trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp

    r217208 r219391  
    2424#include "GraphicsContext3D.h"
    2525#include "PlatformDisplay.h"
     26
     27#if USE(LIBEPOXY)
     28#include <epoxy/egl.h>
     29#else
    2630#include <EGL/egl.h>
     31#endif
    2732
    2833#if USE(CAIRO)
     
    3035#endif
    3136
    32 #if USE(OPENGL_ES_2)
     37#if USE(LIBEPOXY)
     38#include <epoxy/gl.h>
     39#elif USE(OPENGL_ES2)
    3340#define GL_GLEXT_PROTOTYPES 1
    3441#include <GLES2/gl2.h>
  • trunk/Source/WebCore/platform/graphics/egl/GLContextEGLWPE.cpp

    r217208 r219391  
    2626// somehow deducible from the build configuration.
    2727#define __GBM__ 1
     28#if USE(LIBEPOXY)
     29#include <epoxy/egl.h>
     30#else
    2831#include <EGL/egl.h>
     32#endif
    2933#include <wpe/renderer-backend-egl.h>
    3034
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp

    r218832 r219391  
    6060
    6161#include <gst/app/gstappsink.h>
     62
     63#if USE(LIBEPOXY)
     64// Include the <epoxy/gl.h> header before <gst/gl/gl.h>.
     65#include <epoxy/gl.h>
     66#endif
     67
    6268#define GST_USE_UNSTABLE_API
    6369#include <gst/gl/gl.h>
     
    7177
    7278#if USE(EGL)
    73 #if !PLATFORM(WPE)
    7479#include "GLContextEGL.h"
    75 #endif
    7680#include <gst/gl/egl/gstgldisplay_egl.h>
    7781#endif
  • trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp

    r215585 r219391  
    3737#include <OpenGLES/ES3/gl.h>
    3838#else
    39 #if USE(OPENGL_ES_2)
     39#if USE(LIBEPOXY)
     40#include "EpoxyShims.h"
     41#elif USE(OPENGL_ES_2)
    4042#include "OpenGLESShims.h"
    4143#define GL_GLEXT_PROTOTYPES 1
  • trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp

    r208040 r219391  
    3434#include "GraphicsContext3D.h"
    3535#include "NotImplemented.h"
     36
     37#if USE(LIBEPOXY)
     38#include <epoxy/egl.h>
     39#else
    3640#include <EGL/egl.h>
     41#endif
    3742
    3843namespace WebCore {
  • trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h

    r215585 r219391  
    3131#if USE(OPENGL_ES_2)
    3232
     33#if USE(LIBEPOXY)
     34#include <epoxy/gl.h>
     35#else
    3336#define GL_GLEXT_PROTOTYPES 1
    3437#include <GLES2/gl2.h>
    3538#include <GLES2/gl2ext.h>
     39#endif
    3640
    3741#ifndef GL_EXT_robustness
  • trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp

    r217298 r219391  
    6565#define GL_RGB32F_ARB                       0x8815
    6666#else
    67 #if USE(OPENGL_ES_2)
     67#if USE(LIBEPOXY)
     68#include "EpoxyShims.h"
     69#elif USE(OPENGL_ES_2)
    6870#include "OpenGLESShims.h"
    6971#elif PLATFORM(MAC)
  • trunk/Source/WebCore/platform/graphics/opengl/TemporaryOpenGLSetting.cpp

    r215585 r219391  
    3030#include "TemporaryOpenGLSetting.h"
    3131
    32 #if USE(OPENGL_ES_2)
     32#if USE(LIBEPOXY)
     33#include "EpoxyShims.h"
     34#elif USE(OPENGL_ES_2)
    3335#define GL_GLEXT_PROTOTYPES 1
    3436#include <GLES2/gl2.h>
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp

    r218170 r219391  
    2323#if ENABLE(GRAPHICS_CONTEXT_3D) && USE(TEXTURE_MAPPER)
    2424
    25 #if USE(OPENGL_ES_2)
     25#if USE(LIBEPOXY)
     26#include <epoxy/gl.h>
     27#elif USE(OPENGL_ES_2)
    2628#define GL_GLEXT_PROTOTYPES 1
    2729#include <GLES2/gl2.h>
  • trunk/Source/WebCore/platform/graphics/wpe/PlatformDisplayWPE.cpp

    r217208 r219391  
    3333// somehow deducible from the build configuration.
    3434#define __GBM__ 1
     35#if USE(LIBEPOXY)
     36#include <epoxy/egl.h>
     37#else
    3538#include <EGL/egl.h>
     39#endif
    3640#include <wpe/renderer-backend-egl.h>
    3741
  • trunk/Source/WebKit2/ChangeLog

    r219388 r219391  
     12017-07-12  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [WPE] Use libepoxy
     4        https://bugs.webkit.org/show_bug.cgi?id=172104
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        * PlatformWPE.cmake: Drop the EGL_INCLUDE_DIRS compilation flags.
     9        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
     10        Include <epoxy/gl.h> when compiling with libepoxy usage enabled.
     11
    1122017-07-12  Carlos Garcia Campos  <cgarcia@igalia.com>
    213
  • trunk/Source/WebKit2/PlatformWPE.cmake

    r219295 r219391  
    414414    "${WTF_DIR}"
    415415    ${CAIRO_INCLUDE_DIRS}
    416     ${EGL_INCLUDE_DIRS}
    417416    ${FREETYPE2_INCLUDE_DIRS}
    418417    ${GLIB_INCLUDE_DIRS}
  • trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp

    r219067 r219391  
    3535#include <wtf/SetForScope.h>
    3636
    37 #if USE(OPENGL_ES_2)
     37#if USE(LIBEPOXY)
     38#include <epoxy/gl.h>
     39#elif USE(OPENGL_ES_2)
    3840#include <GLES2/gl2.h>
    3941#else
  • trunk/Source/cmake/OptionsWPE.cmake

    r218740 r219391  
    7676find_package(HarfBuzz 0.9.18 REQUIRED)
    7777find_package(JPEG REQUIRED)
     78find_package(LibEpoxy REQUIRED)
    7879find_package(LibGcrypt 1.6.0 REQUIRED)
    7980find_package(LibSoup 2.42.0 REQUIRED)
     
    8384find_package(Sqlite REQUIRED)
    8485find_package(WebP REQUIRED)
    85 
    86 find_package(OpenGLES2 REQUIRED)
    87 find_package(EGL REQUIRED)
    8886
    8987find_package(WPEBackend REQUIRED)
     
    138136set(USE_UDIS86 1)
    139137
     138SET_AND_EXPOSE_TO_BUILD(USE_LIBEPOXY TRUE)
    140139SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES_2 TRUE)
    141140SET_AND_EXPOSE_TO_BUILD(USE_EGL TRUE)
  • trunk/Tools/ChangeLog

    r219390 r219391  
     12017-07-12  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [WPE] Use libepoxy
     4        https://bugs.webkit.org/show_bug.cgi?id=172104
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        * WebKitTestRunner/wpe/HeadlessViewBackend.h:
     9        Include the <epoxy/egl.h> header, dropping the EGL and GLES2 inclusions.
     10
    1112017-07-12  Zan Dobersek  <zdobersek@igalia.com>
    212
  • trunk/Tools/WebKitTestRunner/wpe/HeadlessViewBackend.h

    r216497 r219391  
    2626#pragma once
    2727
     28// This include order is necessary to enforce the GBM EGL platform.
    2829#include <gbm.h>
    29 #include <EGL/egl.h>
    30 #include <EGL/eglext.h>
    31 #include <GLES2/gl2.h>
    32 #include <GLES2/gl2ext.h>
     30#include <epoxy/egl.h>
     31
    3332#include <cairo.h>
    3433#include <glib.h>
Note: See TracChangeset for help on using the changeset viewer.