| Differences between
and this patch
- ChangeLog +12 lines
Lines 1-3 ChangeLog_sec1
1
2012-12-21  Kondapally Kalyan  <kalyan.kondapally@intel.com>
2
3
        [EFL][WebGL] Implement EGL support with GLX.
4
        https://bugs.webkit.org/show_bug.cgi?id=105602
5
6
        Adds support for EGL with GLX backend. EGL support can be enabled during compile time
7
        by passing -DENABLE_EGL=ON as cmake config parameter.
8
9
        Reviewed by NOBODY (OOPS!).
10
11
        * Source/cmake/OptionsEfl.cmake:
12
1
2012-12-21  Sheriff Bot  <webkit.review.bot@gmail.com>
13
2012-12-21  Sheriff Bot  <webkit.review.bot@gmail.com>
2
14
3
        Unreviewed, rolling out r138338.
15
        Unreviewed, rolling out r138338.
- Source/WebCore/ChangeLog +73 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
1
2012-12-21  Kondapally Kalyan  <kalyan.kondapally@intel.com>
2
3
        [EFL][WebGL] Implement EGL support with GLX.
4
        https://bugs.webkit.org/show_bug.cgi?id=105602
5
6
        Adds support for EGL with GLX backend. EGL support can be enabled during compile time
7
        by passing -DENABLE_EGL=ON as cmake config parameter. This is disabled by default.
8
        Reviewed by NOBODY (OOPS!).
9
10
        No new tests (OOPS!).
11
12
        * PlatformEfl.cmake:
13
        * platform/graphics/opengl/GLDefs.h:
14
        (WebCore):
15
        * platform/graphics/opengl/GLPlatformContext.cpp:
16
        (WebCore):
17
        (WebCore::GLPlatformContext::createContext):
18
        (WebCore::GLPlatformContext::createOffScreenContext):
19
        (WebCore::GLPlatformContext::createCurrentContextWrapper):
20
        * platform/graphics/opengl/GLPlatformContext.h:
21
        * platform/graphics/opengl/GLPlatformSurface.cpp:
22
        (WebCore::GLPlatformSurface::createTransportSurface):
23
        * platform/graphics/surfaces/egl/EGLContext.cpp: Added.
24
        (WebCore):
25
        (WebCore::isRobustnessExtSupported):
26
        (WebCore::EGLCurrentContextWrapper::EGLCurrentContextWrapper):
27
        (WebCore::EGLCurrentContextWrapper::handle):
28
        (WebCore::EGLOffScreenContext::EGLOffScreenContext):
29
        (WebCore::EGLOffScreenContext::initialize):
30
        (WebCore::EGLOffScreenContext::~EGLOffScreenContext):
31
        (WebCore::EGLOffScreenContext::isCurrentContext):
32
        (WebCore::EGLOffScreenContext::platformMakeCurrent):
33
        (WebCore::EGLOffScreenContext::platformReleaseCurrent):
34
        (WebCore::EGLOffScreenContext::freeResources):
35
        (WebCore::EGLOffScreenContext::destroy):
36
        * platform/graphics/surfaces/egl/EGLContext.h:
37
        (WebCore):
38
        (EGLCurrentContextWrapper):
39
        (WebCore::EGLCurrentContextWrapper::~EGLCurrentContextWrapper):
40
        (EGLOffScreenContext):
41
        * platform/graphics/surfaces/egl/EGLSurface.cpp: Added.
42
        (WebCore):
43
        (WebCore::EGLTransportSurface::EGLTransportSurface):
44
        (WebCore::EGLTransportSurface::~EGLTransportSurface):
45
        (WebCore::EGLTransportSurface::configuration):
46
        (WebCore::EGLTransportSurface::swapBuffers):
47
        (WebCore::EGLTransportSurface::destroy):
48
        (WebCore::EGLTransportSurface::freeEGLResources):
49
        * platform/graphics/surfaces/egl/EGLSurface.h:
50
        (WebCore):
51
        (EGLTransportSurface):
52
        * platform/graphics/surfaces/glx/EGLXWindowResources.h: Added.
53
        (WebCore):
54
        (SharedEGLResources):
55
        (WebCore::SharedEGLResources::create):
56
        (WebCore::SharedEGLResources::nativeDisplay):
57
        (WebCore::SharedEGLResources::pBufferContextConfig):
58
        (WebCore::SharedEGLResources::surfaceContextConfig):
59
        (WebCore::SharedEGLResources::SharedEGLResources):
60
        (WebCore::SharedEGLResources::cleanup):
61
        (WebCore::SharedEGLResources::createConfig):
62
        (WebCore::SharedEGLResources::~SharedEGLResources):
63
        * platform/graphics/surfaces/glx/X11WindowResources.cpp:
64
        * platform/graphics/surfaces/glx/X11WindowResources.h:
65
        (WebCore):
66
        (DummySharedResources):
67
        (WebCore::DummySharedResources::create):
68
        (WebCore::DummySharedResources::nativeDisplay):
69
        (WebCore::DummySharedResources::pBufferContextConfig):
70
        (WebCore::DummySharedResources::surfaceContextConfig):
71
        (WebCore::DummySharedResources::DummySharedResources):
72
        (WebCore::DummySharedResources::~DummySharedResources):
73
1
2012-12-21  Brady Eidson  <beidson@apple.com>
74
2012-12-21  Brady Eidson  <beidson@apple.com>
2
75
3
        Update localizable strings as a followup to http://trac.webkit.org/changeset/138387
76
        Update localizable strings as a followup to http://trac.webkit.org/changeset/138387
- Source/WebCore/PlatformEfl.cmake -2 / +28 lines
Lines 265-270 if (WTF_USE_3D_GRAPHICS) Source/WebCore/PlatformEfl.cmake_sec1
265
        "${WEBCORE_DIR}/platform/graphics/surfaces/glx"
265
        "${WEBCORE_DIR}/platform/graphics/surfaces/glx"
266
        "${WEBCORE_DIR}/platform/graphics/texmap"
266
        "${WEBCORE_DIR}/platform/graphics/texmap"
267
    )
267
    )
268
269
    if (WTF_USE_EGL)
270
        list(APPEND WebCore_INCLUDE_DIRECTORIES
271
            ${EGL_INCLUDE_DIR}
272
            "${WEBCORE_DIR}/platform/graphics/surfaces/egl"
273
    )
274
    endif ()
275
268
    list(APPEND WebCore_SOURCES
276
    list(APPEND WebCore_SOURCES
269
        platform/graphics/OpenGLShims.cpp
277
        platform/graphics/OpenGLShims.cpp
270
        platform/graphics/cairo/DrawingBufferCairo.cpp
278
        platform/graphics/cairo/DrawingBufferCairo.cpp
Lines 277-294 if (WTF_USE_3D_GRAPHICS) Source/WebCore/PlatformEfl.cmake_sec2
277
        platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
285
        platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
278
        platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
286
        platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
279
        platform/graphics/surfaces/GraphicsSurface.cpp
287
        platform/graphics/surfaces/GraphicsSurface.cpp
280
        platform/graphics/surfaces/glx/GLXSurface.cpp
281
        platform/graphics/surfaces/glx/GLXContext.cpp
282
        platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp
288
        platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp
283
        platform/graphics/surfaces/glx/X11WindowResources.cpp
289
        platform/graphics/surfaces/glx/X11WindowResources.cpp
284
        platform/graphics/texmap/TextureMapperGL.cpp
290
        platform/graphics/texmap/TextureMapperGL.cpp
285
        platform/graphics/texmap/TextureMapperShaderManager.cpp
291
        platform/graphics/texmap/TextureMapperShaderManager.cpp
286
    )
292
    )
293
294
    if (WTF_USE_EGL)
295
        list(APPEND WebCore_SOURCES
296
            platform/graphics/surfaces/egl/EGLSurface.cpp
297
            platform/graphics/surfaces/egl/EGLContext.cpp
298
        )
299
    endif ()
300
301
    if (WTF_USE_GLX)
302
        list(APPEND WebCore_SOURCES
303
            platform/graphics/surfaces/glx/GLXSurface.cpp
304
            platform/graphics/surfaces/glx/GLXContext.cpp
305
        )
306
    endif ()
307
287
    list(APPEND WebCore_LIBRARIES
308
    list(APPEND WebCore_LIBRARIES
288
        ${X11_X11_LIB}
309
        ${X11_X11_LIB}
289
        ${X11_Xcomposite_LIB}
310
        ${X11_Xcomposite_LIB}
290
        ${X11_Xrender_LIB}
311
        ${X11_Xrender_LIB}
291
    )
312
    )
313
    if (WTF_USE_EGL)
314
        list(APPEND WebCore_LIBRARIES
315
            ${EGL_LIBRARY}
316
        )
317
    endif ()
292
endif ()
318
endif ()
293
319
294
add_definitions(-DDATA_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}")
320
add_definitions(-DDATA_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}")
- Source/WebCore/platform/graphics/opengl/GLDefs.h +16 lines
Lines 42-47 Source/WebCore/platform/graphics/opengl/GLDefs.h_sec1
42
#include <GL/glx.h>
42
#include <GL/glx.h>
43
#endif
43
#endif
44
44
45
#if USE(EGL)
46
#define EGL_EGLEXT_PROTOTYPES 1
47
#include <EGL/egl.h>
48
#include <EGL/eglext.h>
49
#endif
50
45
namespace WebCore {
51
namespace WebCore {
46
52
47
typedef uint32_t PlatformBufferHandle;
53
typedef uint32_t PlatformBufferHandle;
Lines 51-56 typedef GLXContext PlatformContext; Source/WebCore/platform/graphics/opengl/GLDefs.h_sec2
51
typedef Display* PlatformDisplay;
57
typedef Display* PlatformDisplay;
52
typedef GLXFBConfig PlatformSurfaceConfig;
58
typedef GLXFBConfig PlatformSurfaceConfig;
53
typedef GLXDrawable PlatformDrawable;
59
typedef GLXDrawable PlatformDrawable;
60
#elif USE(EGL)
61
#if USE(OPENGL_ES_2)
62
static const EGLenum eglApi = EGL_OPENGL_ES_API;
63
#else
64
static const EGLenum eglApi = EGL_OPENGL_API;
65
#endif
66
typedef EGLContext PlatformContext;
67
typedef EGLDisplay PlatformDisplay;
68
typedef EGLConfig PlatformSurfaceConfig;
69
typedef EGLSurface PlatformDrawable;
54
#else
70
#else
55
typedef void* PlatformContext;
71
typedef void* PlatformContext;
56
typedef void* PlatformDisplay;
72
typedef void* PlatformDisplay;
- Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp -6 / +21 lines
Lines 32-42 Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp_sec1
32
#include "GLXContext.h"
32
#include "GLXContext.h"
33
#endif
33
#endif
34
34
35
#if USE(EGL)
36
#include "EGLContext.h"
37
#endif
38
35
#include "NotImplemented.h"
39
#include "NotImplemented.h"
36
40
37
namespace WebCore {
41
namespace WebCore {
38
42
39
static PFNGLGETGRAPHICSRESETSTATUSARBPROC glGetGraphicsResetStatusARB = 0;
43
static PFNGLGETGRAPHICSRESETSTATUSARBPROC glGetGraphicsResetStatusARB = 0;
44
40
static GLPlatformContext* m_currentContext = 0;
45
static GLPlatformContext* m_currentContext = 0;
41
46
42
PassOwnPtr<GLPlatformContext> GLPlatformContext::createContext(GraphicsContext3D::RenderStyle renderStyle)
47
PassOwnPtr<GLPlatformContext> GLPlatformContext::createContext(GraphicsContext3D::RenderStyle renderStyle)
Lines 44-54 PassOwnPtr<GLPlatformContext> GLPlatformContext::createContext(GraphicsContext3D Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp_sec2
44
    if (!initializeOpenGLShims())
49
    if (!initializeOpenGLShims())
45
        return nullptr;
50
        return nullptr;
46
51
47
    if (!glGetGraphicsResetStatusARB) {
48
#if USE(GLX)
52
#if USE(GLX)
53
    if (!glGetGraphicsResetStatusARB) {
49
        glGetGraphicsResetStatusARB = reinterpret_cast<PFNGLGETGRAPHICSRESETSTATUSARBPROC>(glXGetProcAddressARB(reinterpret_cast<const GLubyte*>("glGetGraphicsResetStatusARB")));
54
        glGetGraphicsResetStatusARB = reinterpret_cast<PFNGLGETGRAPHICSRESETSTATUSARBPROC>(glXGetProcAddressARB(reinterpret_cast<const GLubyte*>("glGetGraphicsResetStatusARB")));
50
#endif
51
    }
55
    }
56
#endif
52
57
53
    switch (renderStyle) {
58
    switch (renderStyle) {
54
    case GraphicsContext3D::RenderOffscreen:
59
    case GraphicsContext3D::RenderOffscreen:
Lines 70-77 PassOwnPtr<GLPlatformContext> GLPlatformContext::createContext(GraphicsContext3D Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp_sec3
70
PassOwnPtr<GLPlatformContext> GLPlatformContext::createOffScreenContext()
75
PassOwnPtr<GLPlatformContext> GLPlatformContext::createOffScreenContext()
71
{
76
{
72
#if USE(GLX)
77
#if USE(GLX)
73
    OwnPtr<GLPlatformContext> glxContext = adoptPtr(new GLXOffScreenContext());
78
    OwnPtr<GLPlatformContext> context = adoptPtr(new GLXOffScreenContext());
74
    return glxContext.release();
79
    return context.release();
80
#endif
81
82
#if USE(EGL)
83
    OwnPtr<GLPlatformContext> context = adoptPtr(new EGLOffScreenContext());
84
    return context.release();
75
#endif
85
#endif
76
86
77
    return nullptr;
87
    return nullptr;
Lines 80-87 PassOwnPtr<GLPlatformContext> GLPlatformContext::createOffScreenContext() Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp_sec4
80
PassOwnPtr<GLPlatformContext> GLPlatformContext::createCurrentContextWrapper()
90
PassOwnPtr<GLPlatformContext> GLPlatformContext::createCurrentContextWrapper()
81
{
91
{
82
#if USE(GLX)
92
#if USE(GLX)
83
    OwnPtr<GLPlatformContext> glxContext = adoptPtr(new GLXCurrentContextWrapper());
93
    OwnPtr<GLPlatformContext> context = adoptPtr(new GLXCurrentContextWrapper());
84
    return glxContext.release();
94
    return context.release();
95
#endif
96
97
#if USE(EGL)
98
    OwnPtr<GLPlatformContext> context = adoptPtr(new EGLCurrentContextWrapper());
99
    return context.release();
85
#endif
100
#endif
86
101
87
    return nullptr;
102
    return nullptr;
- Source/WebCore/platform/graphics/opengl/GLPlatformContext.h -1 / +1 lines
Lines 64-70 public: Source/WebCore/platform/graphics/opengl/GLPlatformContext.h_sec1
64
    // Doesn't have any effect if this is not the current Context.
64
    // Doesn't have any effect if this is not the current Context.
65
    void releaseCurrent();
65
    void releaseCurrent();
66
66
67
    PlatformContext handle() const;
67
    virtual PlatformContext handle() const;
68
68
69
    virtual bool isCurrentContext() const;
69
    virtual bool isCurrentContext() const;
70
70
- Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp -2 / +11 lines
Lines 32-37 Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp_sec1
32
#include "GLXSurface.h"
32
#include "GLXSurface.h"
33
#endif
33
#endif
34
34
35
#if USE(EGL)
36
#include "EGLSurface.h"
37
#endif
38
35
#include "NotImplemented.h"
39
#include "NotImplemented.h"
36
40
37
namespace WebCore {
41
namespace WebCore {
Lines 50-59 PassOwnPtr<GLPlatformSurface> GLPlatformSurface::createOffscreenSurface() Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp_sec2
50
54
51
PassOwnPtr<GLPlatformSurface> GLPlatformSurface::createTransportSurface()
55
PassOwnPtr<GLPlatformSurface> GLPlatformSurface::createTransportSurface()
52
{
56
{
53
#if USE(GLX) && USE(GRAPHICS_SURFACE)
57
#if USE(GRAPHICS_SURFACE)
58
#if USE(GLX)
54
    OwnPtr<GLPlatformSurface> surface = adoptPtr(new GLXTransportSurface());
59
    OwnPtr<GLPlatformSurface> surface = adoptPtr(new GLXTransportSurface());
60
#endif
61
#if USE(EGL)
62
    OwnPtr<GLPlatformSurface> surface = adoptPtr(new EGLTransportSurface());
63
#endif
55
64
56
    if (surface->handle())
65
    if (surface && surface->handle() && surface->drawable())
57
        return surface.release();
66
        return surface.release();
58
#endif
67
#endif
59
68
- Source/WebCore/platform/graphics/surfaces/egl/EGLContext.cpp +188 lines
Line 0 Source/WebCore/platform/graphics/surfaces/egl/EGLContext.cpp_sec1
1
/*
2
 * Copyright (C) 2012 Intel Corporation. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "config.h"
27
#include "EGLContext.h"
28
29
#if USE(ACCELERATED_COMPOSITING) && USE(EGL)
30
31
#include <string>
32
33
#if HAVE(GLX)
34
#include <GL/glx.h>
35
#endif
36
37
namespace WebCore {
38
39
static const EGLint contextAttributes[] = {
40
#if USE(OPENGL_ES_2)
41
    EGL_CONTEXT_CLIENT_VERSION, 2,
42
#endif
43
    EGL_NONE
44
};
45
46
static const EGLint contextRobustnessAttributes[] = {
47
#if USE(OPENGL_ES_2)
48
    EGL_CONTEXT_CLIENT_VERSION, 2,
49
#endif
50
    EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT,
51
    EGL_LOSE_CONTEXT_ON_RESET_EXT,
52
    EGL_NONE
53
};
54
55
static bool isRobustnessExtSupported(EGLDisplay display)
56
{
57
    static bool queryDone = false;
58
    static bool isEGLEXTsupported = false;
59
60
    if (!queryDone) {
61
        queryDone = true;
62
63
        const char* extensions = eglQueryString(display, EGL_EXTENSIONS);
64
        if (extensions) {
65
            std::string foundExtensions(extensions);
66
            foundExtensions += " ";
67
            std::string extName("EGL_EXT_create_context_robustness ");
68
            isEGLEXTsupported = foundExtensions.find(extName) != std::string::npos;
69
        }
70
    }
71
72
    return isEGLEXTsupported;
73
}
74
75
EGLCurrentContextWrapper::EGLCurrentContextWrapper()
76
    : GLPlatformContext()
77
{
78
}
79
80
// FixMe: This is a temporary workaround till we are able to build evas with EGL support
81
PlatformContext EGLCurrentContextWrapper::handle() const
82
{
83
    return glXGetCurrentContext();
84
}
85
86
EGLOffScreenContext::EGLOffScreenContext()
87
    : GLPlatformContext()
88
    , m_display(0)
89
{
90
}
91
92
bool EGLOffScreenContext::initialize(GLPlatformSurface* surface)
93
{
94
    if (!surface)
95
        return false;
96
97
    // set current rendering API
98
    EGLBoolean eglResult = eglBindAPI(eglApi);
99
100
    if (eglResult != EGL_TRUE) {
101
        LOG_ERROR("failed to set EGL API(%d).\n", eglGetError());
102
        return false;
103
    }
104
105
    m_display = surface->sharedDisplay();
106
107
    if (!m_display)
108
        return false;
109
110
    EGLConfig config = surface->configuration();
111
112
    if (!config)
113
        return false;
114
115
    if (config) {
116
117
        if (isRobustnessExtSupported(m_display))
118
            m_contextHandle = eglCreateContext(m_display, config, EGL_NO_CONTEXT, contextRobustnessAttributes);
119
120
        if (!m_contextHandle && m_contextHandle != EGL_NO_CONTEXT)
121
            m_resetLostContext = true;
122
        else
123
            m_contextHandle = eglCreateContext(m_display, config, EGL_NO_CONTEXT, contextAttributes);
124
125
        if (m_contextHandle && m_contextHandle != EGL_NO_CONTEXT)
126
            return true;
127
    }
128
129
    return false;
130
}
131
132
EGLOffScreenContext::~EGLOffScreenContext()
133
{
134
}
135
136
bool EGLOffScreenContext::isCurrentContext() const
137
{
138
    return m_contextHandle == eglGetCurrentContext();
139
}
140
141
bool EGLOffScreenContext::platformMakeCurrent(GLPlatformSurface* surface)
142
{
143
    // set current rendering API
144
    EGLBoolean eglResult = eglBindAPI(eglApi);
145
146
    if (eglResult != EGL_TRUE) {
147
        LOG_ERROR("failed to set EGL API(%d).\n", eglGetError());
148
        return false;
149
    }
150
151
    if (!eglMakeCurrent(m_display, surface->drawable(), surface->drawable(), m_contextHandle)) {
152
        LOG_ERROR("failed to make context current.(%d).\n", eglGetError());
153
154
        if (m_resetLostContext && eglGetError() == EGL_CONTEXT_LOST) {
155
            LOG_ERROR("Lost current context.\n");
156
            m_contextLost = true;
157
        }
158
159
        return false;
160
    }
161
162
    return true;
163
}
164
165
void EGLOffScreenContext::platformReleaseCurrent()
166
{
167
    eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
168
}
169
170
void EGLOffScreenContext::freeResources()
171
{
172
    if (m_contextHandle)
173
        eglDestroyContext(m_display, m_contextHandle);
174
175
    m_contextHandle = 0;
176
    m_display = 0;
177
}
178
179
void EGLOffScreenContext::destroy()
180
{
181
    GLPlatformContext::destroy();
182
    freeResources();
183
}
184
185
}
186
187
#endif
188
- Source/WebCore/platform/graphics/surfaces/egl/EGLContext.h +70 lines
Line 0 Source/WebCore/platform/graphics/surfaces/egl/EGLContext.h_sec1
1
/*
2
 * Copyright (C) 2012 Intel Corporation. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#ifndef EGLContext_h
27
#define EGLContext_h
28
29
#if USE(ACCELERATED_COMPOSITING) && USE(EGL)
30
31
#include "GLPlatformContext.h"
32
33
#include <glx/EGLXWindowResources.h>
34
35
namespace WebCore {
36
37
class EGLCurrentContextWrapper : public GLPlatformContext {
38
    WTF_MAKE_NONCOPYABLE(EGLCurrentContextWrapper);
39
40
public:
41
    EGLCurrentContextWrapper();
42
    PlatformContext handle() const;
43
    virtual ~EGLCurrentContextWrapper() { }
44
45
protected:
46
    RefPtr<SharedEGLResources> m_nativeResources;
47
};
48
49
class EGLOffScreenContext : public GLPlatformContext {
50
    WTF_MAKE_NONCOPYABLE(EGLOffScreenContext);
51
52
public:
53
    EGLOffScreenContext();
54
    virtual ~EGLOffScreenContext();
55
    bool initialize(GLPlatformSurface*);
56
    bool platformMakeCurrent(GLPlatformSurface*);
57
    void platformReleaseCurrent();
58
    void destroy();
59
    bool isCurrentContext() const;
60
61
private:
62
    void freeResources();
63
    EGLDisplay m_display;
64
};
65
66
}
67
68
#endif // GLXCURRENTCONTEXWRAPPER_H
69
70
#endif
- Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp +119 lines
Line 0 Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp_sec1
1
/*
2
 * Copyright (C) 2012 Intel Corporation. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "config.h"
27
#include "EGLSurface.h"
28
29
#if USE(ACCELERATED_COMPOSITING) && USE(EGL) && USE(GRAPHICS_SURFACE)
30
31
#include "NotImplemented.h"
32
33
namespace WebCore {
34
35
EGLTransportSurface::EGLTransportSurface()
36
    : X11OffScreenWindow()
37
{
38
    if (m_sharedDisplay == EGL_NO_DISPLAY) {
39
        LOG_ERROR("No valid hardware display found. \n");
40
        return;
41
    }
42
43
    if (!configuration()) {
44
        destroy();
45
        return;
46
    }
47
48
    createOffscreenWindow();
49
50
    if (!m_bufferHandle) {
51
        LOG_ERROR("Failed to create XWindow. \n");
52
        destroy();
53
        return;
54
    }
55
56
    m_drawable = eglCreateWindowSurface(m_sharedResources->nativeDisplay(), configuration(), (EGLNativeWindowType)m_bufferHandle, 0);
57
58
    if (m_drawable == EGL_NO_SURFACE) {
59
        LOG_ERROR("Failed to create EGL surface. \n");
60
        destroy();
61
    }
62
}
63
64
EGLTransportSurface::~EGLTransportSurface()
65
{
66
}
67
68
PlatformSurfaceConfig EGLTransportSurface::configuration()
69
{
70
    return m_sharedResources->surfaceContextConfig();
71
}
72
73
void EGLTransportSurface::swapBuffers()
74
{
75
    if (!m_drawable)
76
        return;
77
78
    EGLBoolean eglResult = eglBindAPI(eglApi);
79
80
    if (eglResult != EGL_TRUE) {
81
        LOG_ERROR("failed to set EGL API(%d).\n", eglGetError());
82
        destroy();
83
    }
84
85
    // post EGL surface to window
86
    eglResult = eglSwapBuffers(sharedDisplay(), m_drawable);
87
88
    if (eglResult != EGL_TRUE) {
89
        LOG_ERROR("failed to SwapBuffers(%d).\n", eglGetError());
90
        destroy();
91
    }
92
}
93
94
void EGLTransportSurface::destroy()
95
{
96
    destroyWindow();
97
    freeEGLResources();
98
}
99
100
void EGLTransportSurface::freeEGLResources()
101
{
102
    if (m_drawable == EGL_NO_SURFACE)
103
        return;
104
105
    EGLBoolean eglResult = eglBindAPI(eglApi);
106
107
    if (eglResult != EGL_TRUE) {
108
        LOG_ERROR("failed to set EGL API(%d).\n", eglGetError());
109
        return;
110
    }
111
112
113
    eglDestroySurface(sharedDisplay(), m_drawable);
114
    m_drawable = EGL_NO_SURFACE;
115
}
116
117
}
118
119
#endif
- Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.h +55 lines
Line 0 Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.h_sec1
1
/*
2
 * Copyright (C) 2012 Intel Corporation. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#ifndef EGLSurface_h
27
#define EGLSurface_h
28
29
#if USE(ACCELERATED_COMPOSITING) && USE(EGL) && USE(GRAPHICS_SURFACE)
30
31
#include <glx/EGLXWindowResources.h>
32
#include <wtf/Noncopyable.h>
33
#include <wtf/RefCounted.h>
34
35
namespace WebCore {
36
37
class EGLTransportSurface : public X11OffScreenWindow {
38
    WTF_MAKE_NONCOPYABLE(EGLTransportSurface);
39
40
public:
41
    EGLTransportSurface();
42
    virtual ~EGLTransportSurface();
43
    PlatformSurfaceConfig configuration();
44
    void swapBuffers();
45
    void destroy();
46
47
private:
48
    void freeEGLResources();
49
};
50
51
}
52
53
#endif
54
55
#endif
- Source/WebCore/platform/graphics/surfaces/glx/EGLXWindowResources.h +242 lines
Line 0 Source/WebCore/platform/graphics/surfaces/glx/EGLXWindowResources.h_sec1
1
/*
2
 * Copyright (C) 2012 Intel Corporation. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#ifndef EGLXWindowResources_h
27
#define EGLXWindowResources_h
28
29
#include "X11WindowResources.h"
30
31
#if USE(ACCELERATED_COMPOSITING) && USE(EGL)
32
33
#include <opengl/GLDefs.h>
34
35
namespace WebCore {
36
37
class SharedEGLResources : public SharedX11Resources {
38
39
public:
40
    static PassRefPtr<SharedEGLResources> create()
41
    {
42
        if (!m_staticSharedResource)
43
            m_staticSharedResource = new SharedEGLResources();
44
        else
45
            m_staticSharedResource->ref();
46
47
        return adoptRef(m_staticSharedResource);
48
    }
49
50
    PlatformDisplay nativeDisplay()
51
    {
52
        if (m_eglDisplay == EGL_NO_DISPLAY) {
53
            int maj, min;
54
            EGLBoolean eglResult;
55
56
            m_eglDisplay = eglGetDisplay((EGLNativeDisplayType) SharedX11Resources::x11Display());
57
58
            if (m_eglDisplay == EGL_NO_DISPLAY) {
59
                LOG_ERROR("EGLDisplay Initialization failed");
60
                return m_eglDisplay;
61
            }
62
63
            eglResult = eglInitialize(m_eglDisplay, &maj, &min);
64
65
            if (eglResult != EGL_TRUE) {
66
                LOG_ERROR("EGLInitialization failed");
67
                cleanup();
68
                return m_eglDisplay;
69
            }
70
71
            eglResult = eglBindAPI(eglApi);
72
73
            if (eglResult != EGL_TRUE) {
74
                LOG_ERROR("failed to set EGL API(%d).\n", eglGetError());
75
                cleanup();
76
            }
77
        }
78
79
        return m_eglDisplay;
80
    }
81
82
    virtual EGLConfig pBufferContextConfig()
83
    {
84
        if (!m_pbufferfbConfig) {
85
            EGLint attributeList[] = {
86
#if USE(OPENGL_ES_2)
87
                EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
88
#else
89
                EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
90
#endif
91
                EGL_RED_SIZE, 8,
92
                EGL_GREEN_SIZE, 8,
93
                EGL_BLUE_SIZE, 8,
94
                EGL_STENCIL_SIZE, 8,
95
                EGL_ALPHA_SIZE, 8,
96
                EGL_SURFACE_TYPE, EGL_PIXMAP_BIT,
97
                EGL_NONE
98
            };
99
            m_pbufferfbConfig = createConfig(attributeList);
100
        }
101
        return m_pbufferfbConfig;
102
    }
103
104
    virtual EGLConfig surfaceContextConfig()
105
    {
106
        if (!m_surfaceContextfbConfig) {
107
            EGLint attributeList[] = {
108
                EGL_LEVEL, 0,
109
#if USE(OPENGL_ES_2)
110
                EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
111
#else
112
                EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
113
#endif
114
                EGL_RED_SIZE, 8,
115
                EGL_GREEN_SIZE, 8,
116
                EGL_BLUE_SIZE, 8,
117
                EGL_STENCIL_SIZE, 8,
118
                EGL_ALPHA_SIZE, 8,
119
                EGL_DEPTH_SIZE, 8,
120
                EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
121
                EGL_NONE
122
            };
123
            m_surfaceContextfbConfig = createConfig(attributeList);
124
        }
125
126
        return m_surfaceContextfbConfig;
127
    }
128
129
private:
130
    SharedEGLResources()
131
        : SharedX11Resources()
132
    {
133
        m_eglDisplay = EGL_NO_DISPLAY;
134
        m_surfaceContextfbConfig = 0;
135
        m_pbufferfbConfig = 0;
136
    }
137
138
    void cleanup()
139
    {
140
        eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
141
        eglTerminate(m_eglDisplay);
142
        m_eglDisplay = EGL_NO_DISPLAY;
143
    }
144
145
    EGLConfig createConfig(const int attributes[])
146
    {
147
        if (m_eglDisplay == EGL_NO_DISPLAY) {
148
            // Try to initialize Display if already not done.
149
            nativeDisplay();
150
151
            if (m_eglDisplay == EGL_NO_DISPLAY)
152
                return 0;
153
        }
154
155
        int numConfigs;
156
        EGLConfig rightConfig = 0;
157
158
        // Choose config
159
        if (!eglChooseConfig(m_eglDisplay, attributes, &rightConfig, 1, &numConfigs)) {
160
            LOG_ERROR("Failed to get supported configirations.");
161
            cleanup();
162
        }
163
164
        if (numConfigs != 1) {
165
            LOG_ERROR("EGLChooseConfig didn't return exactly one config but (%d).\n", numConfigs);
166
            cleanup();
167
        }
168
169
        VisualID visualId = 0;
170
        EGLint eglValue = 0;
171
172
        // See if EGL provided a valid VisualID:
173
        eglGetConfigAttrib(m_eglDisplay, rightConfig, EGL_NATIVE_VISUAL_ID, &eglValue);
174
        visualId = (VisualID)eglValue;
175
        if (visualId) {
176
            // EGL has suggested a visual id, so get the rest of the visual info for that id:
177
            XVisualInfo visualInfoTemplate;
178
            memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
179
            visualInfoTemplate.visualid = visualId;
180
181
            XVisualInfo *chosenVisualInfo;
182
            int matchingCount = 0;
183
            chosenVisualInfo = XGetVisualInfo(x11Display(), VisualIDMask, &visualInfoTemplate, &matchingCount);
184
            if (chosenVisualInfo) {
185
#if USE(GRAPHICS_SURFACE)
186
                if (m_supportsXRenderExtension) {
187
                    XRenderPictFormat* format = XRenderFindVisualFormat(x11Display(), chosenVisualInfo->visual);
188
                    if (format && format->direct.alphaMask > 0)
189
                        m_VisualInfo = chosenVisualInfo;
190
                }
191
#endif
192
                if (!m_VisualInfo && chosenVisualInfo->depth == 32)
193
                    m_VisualInfo = chosenVisualInfo;
194
            }
195
196
            if (!m_VisualInfo) {
197
                XVisualInfo visualInfoTemplate;
198
                memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
199
                XVisualInfo *matchingVisuals;
200
                int matchingCount = 0;
201
202
                visualInfoTemplate.depth = chosenVisualInfo->depth;
203
                matchingVisuals = XGetVisualInfo(x11Display(), VisualDepthMask, &visualInfoTemplate, &matchingCount);
204
205
                if (matchingVisuals) {
206
                    m_VisualInfo = &matchingVisuals[0];
207
                    XFree(matchingVisuals);
208
                }
209
            }
210
        }
211
212
        if (!m_VisualInfo) {
213
            LOG_ERROR("Failed to get Visual Info.");
214
            cleanup();
215
        }
216
217
        return rightConfig;
218
    }
219
220
    virtual ~SharedEGLResources()
221
    {
222
        if (m_eglDisplay == EGL_NO_DISPLAY)
223
            return;
224
225
        if (m_surfaceContextfbConfig)
226
            m_surfaceContextfbConfig = 0;
227
228
        eglTerminate(m_eglDisplay);
229
        m_eglDisplay = EGL_NO_DISPLAY;
230
    }
231
232
protected:
233
    EGLDisplay m_eglDisplay;
234
    EGLConfig m_pbufferfbConfig;
235
    EGLConfig m_surfaceContextfbConfig;
236
};
237
238
}
239
240
#endif
241
242
#endif
- Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.cpp +6 lines
Lines 28-34 Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.cpp_sec1
28
28
29
#if USE(ACCELERATED_COMPOSITING)
29
#if USE(ACCELERATED_COMPOSITING)
30
30
31
#if USE(GLX)
31
#include "GLXWindowResources.h"
32
#include "GLXWindowResources.h"
33
#endif
34
35
#if USE(EGL)
36
#include "EGLXWindowResources.h"
37
#endif
32
38
33
namespace WebCore {
39
namespace WebCore {
34
40
- Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.h +44 lines
Lines 40-47 Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.h_sec1
40
40
41
namespace WebCore {
41
namespace WebCore {
42
42
43
#if USE(GLX)
43
class SharedGLXResources;
44
class SharedGLXResources;
44
typedef SharedGLXResources PlatformSharedResources;
45
typedef SharedGLXResources PlatformSharedResources;
46
#elif USE(EGL)
47
class SharedEGLResources;
48
typedef SharedEGLResources PlatformSharedResources;
49
#else
50
class DummySharedResources;
51
typedef DummySharedResources PlatformSharedResources;
52
#endif
45
53
46
class SharedX11Resources : public WTF::RefCountedBase {
54
class SharedX11Resources : public WTF::RefCountedBase {
47
    WTF_MAKE_NONCOPYABLE(SharedX11Resources);
55
    WTF_MAKE_NONCOPYABLE(SharedX11Resources);
Lines 147-152 protected: Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.h_sec2
147
    XVisualInfo* m_VisualInfo;
155
    XVisualInfo* m_VisualInfo;
148
};
156
};
149
157
158
// Dummy Implementation to avoid ifdefs
159
class DummySharedResources : public SharedX11Resources {
160
    WTF_MAKE_NONCOPYABLE(DummySharedResources);
161
162
public:
163
    static PassRefPtr<DummySharedResources> create()
164
    {
165
        return 0;
166
    }
167
168
    PlatformDisplay nativeDisplay()
169
    {
170
        return 0;
171
    }
172
173
    virtual PlatformSurfaceConfig pBufferContextConfig()
174
    {
175
        return 0;
176
    }
177
178
    virtual PlatformSurfaceConfig surfaceContextConfig()
179
    {
180
        return 0;
181
    }
182
183
private:
184
    DummySharedResources()
185
        : SharedX11Resources()
186
    {
187
    }
188
189
    virtual ~DummySharedResources()
190
    {
191
    }
192
};
193
150
class X11OffScreenWindow : public GLPlatformSurface {
194
class X11OffScreenWindow : public GLPlatformSurface {
151
    WTF_MAKE_NONCOPYABLE(X11OffScreenWindow);
195
    WTF_MAKE_NONCOPYABLE(X11OffScreenWindow);
152
196
- Source/cmake/OptionsEfl.cmake -4 / +17 lines
Lines 175-186 if (ENABLE_WEBGL OR WTF_USE_TILED_BACKING_STORE) Source/cmake/OptionsEfl.cmake_sec1
175
175
176
    if (OPENGLX_FOUND)
176
    if (OPENGLX_FOUND)
177
        add_definitions(-DHAVE_GLX)
177
        add_definitions(-DHAVE_GLX)
178
        add_definitions(-DWTF_USE_GLX=1)
178
    endif ()
179
180
    option(ENABLE_EGL ON)
179
181
180
        if (X11_Xcomposite_FOUND AND X11_Xrender_FOUND)
182
    if (ENABLE_EGL)
181
           set(USE_GRAPHICS_SURFACE 1)
183
        find_package(EGL REQUIRED)
182
        endif ()
183
    endif ()
184
    endif ()
185
186
    if (EGL_FOUND)
187
        set(WTF_USE_EGL 1)
188
        add_definitions(-DWTF_USE_EGL=1)
189
     elseif (OPENGLX_FOUND)
190
         set(WTF_USE_GLX 1)
191
         add_definitions(-DWTF_USE_GLX=1)
192
    endif ()
193
194
     if ((OPENGLX_FOUND OR EGL_FOUND) AND X11_Xcomposite_FOUND AND X11_Xrender_FOUND)
195
         set(USE_GRAPHICS_SURFACE 1)
196
     endif ()
184
endif ()
197
endif ()
185
198
186
if (ENABLE_INSPECTOR)
199
if (ENABLE_INSPECTOR)

Return to Bug 105602