<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[183868] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/183868">183868</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-06 09:06:30 -0700 (Wed, 06 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[EGL] Move EGLDisplay handling to PlatformDisplay and remove PlatformDisplay definition from GLDefs.h
https://bugs.webkit.org/show_bug.cgi?id=144685

Reviewed by Martin Robinson.

The EGL display is also initialized in multiple places, and could
be unified in PlatformDisplay. Remove the PlatformDisplay
definition from platform/graphics/opengl/GLDefs.h to avoid conflicts.

* platform/graphics/PlatformDisplay.cpp:
(WebCore::PlatformDisplay::PlatformDisplay): Initialize m_eglDisplay.
(WebCore::PlatformDisplay::~PlatformDisplay): Call terminateEGLDisplay().
(WebCore::PlatformDisplay::eglDisplay): Lazy intialize the EGL
display and return it.
(WebCore::PlatformDisplay::initializeEGLDisplay):
(WebCore::PlatformDisplay::terminateEGLDisplay):
* platform/graphics/PlatformDisplay.h:
* platform/graphics/egl/GLContextEGL.cpp:
(WebCore::sharedEGLDisplay): Use PlatformDisplay::eglDisplay().
* platform/graphics/opengl/GLDefs.h: Remove unneeded definitions.
* platform/graphics/opengl/GLPlatformSurface.cpp:
(WebCore::GLPlatformSurface::GLPlatformSurface): Remove
m_sharedDisplay member, PlatformDisplay::sharedDisplay() can be used instead.
(WebCore::GLPlatformSurface::sharedDisplay): Deleted.
* platform/graphics/opengl/GLPlatformSurface.h:
* platform/graphics/surfaces/egl/EGLConfigSelector.h: Use
EGLDisplay instead of PlatformDisplay.
* platform/graphics/surfaces/egl/EGLContext.cpp:
(WebCore::EGLOffScreenContext::initialize): Use PlatformDisplay::eglDisplay().
* platform/graphics/surfaces/egl/EGLHelper.cpp: Remove the
EGLDisplayConnection clas and use PlatformDisplay instead.
(WebCore::EGLHelper::eglDisplay):
(WebCore::EGLHelper::currentDisplay):
(WebCore::EGLDisplayConnection::EGLDisplayConnection): Deleted.
(WebCore::EGLDisplayConnection::~EGLDisplayConnection): Deleted.
(WebCore::EGLDisplayConnection::display): Deleted.
(WebCore::EGLDisplayConnection::terminate): Deleted.
* platform/graphics/surfaces/egl/EGLHelper.h:
* platform/graphics/surfaces/egl/EGLSurface.cpp:
(WebCore::EGLTransportSurface::EGLTransportSurface): Use EGLHelper::eglDisplay().
(WebCore::EGLTransportSurface::destroy): Ditto.
(WebCore::EGLOffScreenSurface::EGLOffScreenSurface): Ditto.
(WebCore::EGLOffScreenSurface::destroy): Ditto.
* platform/graphics/surfaces/egl/EGLXSurface.cpp:
(WebCore::EGLWindowTransportSurface::EGLWindowTransportSurface):
Use PlatformDisplay::eglDisplay().
(WebCore::EGLWindowTransportSurface::swapBuffers): Ditto.
(WebCore::EGLPixmapSurface::EGLPixmapSurface): Ditto.
* platform/graphics/surfaces/glx/GLXContext.cpp:
(WebCore::GLXOffScreenContext::initialize): Use X11Helper::nativeDisplay().
* platform/graphics/surfaces/glx/GLXSurface.cpp:
(WebCore::GLXTransportSurface::GLXTransportSurface): Do not use m_sharedDisplay.
(WebCore::GLXOffScreenSurface::initialize): Ditto.
* platform/graphics/wayland/PlatformDisplayWayland.cpp:
(WebCore::PlatformDisplayWayland::PlatformDisplayWayland): Call
PlatformDisplay::initializeEGLDisplay() to insialize the EGL display.
* platform/graphics/wayland/PlatformDisplayWayland.h:
* platform/graphics/x11/PlatformDisplayX11.cpp:
(WebCore::PlatformDisplayX11::initializeEGLDisplay): Override
PlatformDisplay::initializeEGLDisplay() to initialize the
m_eglDisplay member.
* platform/graphics/x11/PlatformDisplayX11.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsPlatformDisplaycpp">trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsPlatformDisplayh">trunk/Source/WebCore/platform/graphics/PlatformDisplay.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicseglGLContextEGLcpp">trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglGLDefsh">trunk/Source/WebCore/platform/graphics/opengl/GLDefs.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglGLPlatformSurfacecpp">trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglGLPlatformSurfaceh">trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicssurfaceseglEGLConfigSelectorh">trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLConfigSelector.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicssurfaceseglEGLContextcpp">trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLContext.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicssurfaceseglEGLHelpercpp">trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLHelper.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicssurfaceseglEGLHelperh">trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLHelper.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicssurfaceseglEGLSurfacecpp">trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicssurfaceseglEGLXSurfacecpp">trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLXSurface.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicssurfacesglxGLXContextcpp">trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicssurfacesglxGLXSurfacecpp">trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicswaylandPlatformDisplayWaylandcpp">trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicswaylandPlatformDisplayWaylandh">trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsx11PlatformDisplayX11cpp">trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsx11PlatformDisplayX11h">trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/ChangeLog        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -1,3 +1,68 @@
</span><ins>+2015-05-06  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [EGL] Move EGLDisplay handling to PlatformDisplay and remove PlatformDisplay definition from GLDefs.h
+        https://bugs.webkit.org/show_bug.cgi?id=144685
+
+        Reviewed by Martin Robinson.
+
+        The EGL display is also initialized in multiple places, and could
+        be unified in PlatformDisplay. Remove the PlatformDisplay
+        definition from platform/graphics/opengl/GLDefs.h to avoid conflicts.
+
+        * platform/graphics/PlatformDisplay.cpp:
+        (WebCore::PlatformDisplay::PlatformDisplay): Initialize m_eglDisplay.
+        (WebCore::PlatformDisplay::~PlatformDisplay): Call terminateEGLDisplay().
+        (WebCore::PlatformDisplay::eglDisplay): Lazy intialize the EGL
+        display and return it.
+        (WebCore::PlatformDisplay::initializeEGLDisplay):
+        (WebCore::PlatformDisplay::terminateEGLDisplay):
+        * platform/graphics/PlatformDisplay.h:
+        * platform/graphics/egl/GLContextEGL.cpp:
+        (WebCore::sharedEGLDisplay): Use PlatformDisplay::eglDisplay().
+        * platform/graphics/opengl/GLDefs.h: Remove unneeded definitions.
+        * platform/graphics/opengl/GLPlatformSurface.cpp:
+        (WebCore::GLPlatformSurface::GLPlatformSurface): Remove
+        m_sharedDisplay member, PlatformDisplay::sharedDisplay() can be used instead.
+        (WebCore::GLPlatformSurface::sharedDisplay): Deleted.
+        * platform/graphics/opengl/GLPlatformSurface.h:
+        * platform/graphics/surfaces/egl/EGLConfigSelector.h: Use
+        EGLDisplay instead of PlatformDisplay.
+        * platform/graphics/surfaces/egl/EGLContext.cpp:
+        (WebCore::EGLOffScreenContext::initialize): Use PlatformDisplay::eglDisplay().
+        * platform/graphics/surfaces/egl/EGLHelper.cpp: Remove the
+        EGLDisplayConnection clas and use PlatformDisplay instead.
+        (WebCore::EGLHelper::eglDisplay):
+        (WebCore::EGLHelper::currentDisplay):
+        (WebCore::EGLDisplayConnection::EGLDisplayConnection): Deleted.
+        (WebCore::EGLDisplayConnection::~EGLDisplayConnection): Deleted.
+        (WebCore::EGLDisplayConnection::display): Deleted.
+        (WebCore::EGLDisplayConnection::terminate): Deleted.
+        * platform/graphics/surfaces/egl/EGLHelper.h:
+        * platform/graphics/surfaces/egl/EGLSurface.cpp:
+        (WebCore::EGLTransportSurface::EGLTransportSurface): Use EGLHelper::eglDisplay().
+        (WebCore::EGLTransportSurface::destroy): Ditto.
+        (WebCore::EGLOffScreenSurface::EGLOffScreenSurface): Ditto.
+        (WebCore::EGLOffScreenSurface::destroy): Ditto.
+        * platform/graphics/surfaces/egl/EGLXSurface.cpp:
+        (WebCore::EGLWindowTransportSurface::EGLWindowTransportSurface):
+        Use PlatformDisplay::eglDisplay().
+        (WebCore::EGLWindowTransportSurface::swapBuffers): Ditto.
+        (WebCore::EGLPixmapSurface::EGLPixmapSurface): Ditto.
+        * platform/graphics/surfaces/glx/GLXContext.cpp:
+        (WebCore::GLXOffScreenContext::initialize): Use X11Helper::nativeDisplay().
+        * platform/graphics/surfaces/glx/GLXSurface.cpp:
+        (WebCore::GLXTransportSurface::GLXTransportSurface): Do not use m_sharedDisplay.
+        (WebCore::GLXOffScreenSurface::initialize): Ditto.
+        * platform/graphics/wayland/PlatformDisplayWayland.cpp:
+        (WebCore::PlatformDisplayWayland::PlatformDisplayWayland): Call
+        PlatformDisplay::initializeEGLDisplay() to insialize the EGL display.
+        * platform/graphics/wayland/PlatformDisplayWayland.h:
+        * platform/graphics/x11/PlatformDisplayX11.cpp:
+        (WebCore::PlatformDisplayX11::initializeEGLDisplay): Override
+        PlatformDisplay::initializeEGLDisplay() to initialize the
+        m_eglDisplay member.
+        * platform/graphics/x11/PlatformDisplayX11.h:
+
</ins><span class="cx"> 2015-05-06  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: DOMStorage exception and issue with sessionStorage
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsPlatformDisplaycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -45,6 +45,10 @@
</span><span class="cx"> #include &lt;Ecore_X.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if USE(EGL)
+#include &lt;EGL/egl.h&gt;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;PlatformDisplay&gt; PlatformDisplay::createPlatformDisplay()
</span><span class="lines">@@ -85,4 +89,63 @@
</span><span class="cx">     return *display;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+PlatformDisplay::PlatformDisplay()
+#if USE(EGL)
+    : m_eglDisplay(EGL_NO_DISPLAY)
+#endif
+{
+}
+
+PlatformDisplay::~PlatformDisplay()
+{
+#if USE(EGL)
+    terminateEGLDisplay();
+#endif
+}
+
+#if USE(EGL)
+EGLDisplay PlatformDisplay::eglDisplay() const
+{
+    if (!m_eglDisplayInitialized)
+        const_cast&lt;PlatformDisplay*&gt;(this)-&gt;initializeEGLDisplay();
+    return m_eglDisplay;
+}
+
+void PlatformDisplay::initializeEGLDisplay()
+{
+    m_eglDisplayInitialized = true;
+
+    if (m_eglDisplay == EGL_NO_DISPLAY) {
+        m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+        if (m_eglDisplay == EGL_NO_DISPLAY)
+            return;
+    }
+
+    if (eglInitialize(m_eglDisplay, 0, 0) == EGL_FALSE) {
+        LOG_ERROR(&quot;EGLDisplay Initialization failed.&quot;);
+        terminateEGLDisplay();
+        return;
+    }
+
+#if USE(OPENGL_ES_2)
+    static const EGLenum eglAPIVersion = EGL_OPENGL_ES_API;
+#else
+    static const EGLenum eglAPIVersion = EGL_OPENGL_API;
+#endif
+    if (eglBindAPI(eglAPIVersion) == EGL_FALSE) {
+        LOG_ERROR(&quot;Failed to set EGL API(%d).&quot;, eglGetError());
+        terminateEGLDisplay();
+        return;
+    }
+}
+
+void PlatformDisplay::terminateEGLDisplay()
+{
+    if (m_eglDisplay == EGL_NO_DISPLAY)
+        return;
+    eglTerminate(m_eglDisplay);
+    m_eglDisplay = EGL_NO_DISPLAY;
+}
+#endif // USE(EGL)
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsPlatformDisplayh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/PlatformDisplay.h (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/PlatformDisplay.h        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/PlatformDisplay.h        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -29,13 +29,17 @@
</span><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><span class="cx"> #include &lt;wtf/TypeCasts.h&gt;
</span><span class="cx"> 
</span><ins>+#if USE(EGL)
+typedef void *EGLDisplay;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class PlatformDisplay {
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(PlatformDisplay); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     static PlatformDisplay&amp; sharedDisplay();
</span><del>-    virtual ~PlatformDisplay() = default;
</del><ins>+    virtual ~PlatformDisplay();
</ins><span class="cx"> 
</span><span class="cx">     enum class Type {
</span><span class="cx"> #if PLATFORM(X11)
</span><span class="lines">@@ -48,11 +52,27 @@
</span><span class="cx"> 
</span><span class="cx">     virtual Type type() const = 0;
</span><span class="cx"> 
</span><ins>+#if USE(EGL)
+    EGLDisplay eglDisplay() const;
+#endif
+
</ins><span class="cx"> protected:
</span><del>-    PlatformDisplay() = default;
</del><ins>+    PlatformDisplay();
</ins><span class="cx"> 
</span><ins>+#if USE(EGL)
+    virtual void initializeEGLDisplay();
+
+    EGLDisplay m_eglDisplay;
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     static std::unique_ptr&lt;PlatformDisplay&gt; createPlatformDisplay();
</span><ins>+
+#if USE(EGL)
+    void terminateEGLDisplay();
+
+    bool m_eglDisplayInitialized { false };
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicseglGLContextEGLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> #if USE(EGL)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;GraphicsContext3D.h&quot;
</span><ins>+#include &quot;PlatformDisplay.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> #if USE(CAIRO)
</span><span class="cx"> #include &lt;cairo.h&gt;
</span><span class="lines">@@ -38,10 +39,6 @@
</span><span class="cx"> #include &quot;PlatformDisplayX11.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if PLATFORM(WAYLAND)
-#include &quot;PlatformDisplayWayland.h&quot;
-#endif
-
</del><span class="cx"> #if ENABLE(ACCELERATED_2D_CANVAS)
</span><span class="cx"> // cairo-gl.h includes some definitions from GLX that conflict with
</span><span class="cx"> // the ones provided by us. Since GLContextEGL doesn't use any GLX
</span><span class="lines">@@ -52,34 +49,9 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static EGLDisplay gSharedEGLDisplay = EGL_NO_DISPLAY;
-
-#if USE(OPENGL_ES_2)
-static const EGLenum gGLAPI = EGL_OPENGL_ES_API;
-#else
-static const EGLenum gGLAPI = EGL_OPENGL_API;
-#endif
-
</del><span class="cx"> static EGLDisplay sharedEGLDisplay()
</span><span class="cx"> {
</span><del>-    static bool initialized = false;
-    if (!initialized) {
-        initialized = true;
-
-#if PLATFORM(WAYLAND)
-        if (is&lt;PlatformDisplayWayland&gt;(PlatformDisplay::sharedDisplay()))
-            gSharedEGLDisplay = eglGetDisplay(downcast&lt;PlatformDisplayWayland&gt;(PlatformDisplay::sharedDisplay()).native());
-        else // Note that this branch continutes outside this #if-guarded segment.
-#endif
-#if PLATFORM(X11)
-            gSharedEGLDisplay = eglGetDisplay(downcast&lt;PlatformDisplayX11&gt;(PlatformDisplay::sharedDisplay()).native());
-#else
-            gSharedEGLDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
-#endif
-        if (gSharedEGLDisplay != EGL_NO_DISPLAY &amp;&amp; (!eglInitialize(gSharedEGLDisplay, 0, 0) || !eglBindAPI(gGLAPI)))
-            gSharedEGLDisplay = EGL_NO_DISPLAY;
-    }
-    return gSharedEGLDisplay;
</del><ins>+    return PlatformDisplay::sharedDisplay().eglDisplay();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static const EGLint gContextAttributes[] = {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglGLDefsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/GLDefs.h (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/GLDefs.h        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/opengl/GLDefs.h        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -57,22 +57,14 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(GLX)
</span><span class="cx"> typedef GLXContext PlatformContext;
</span><del>-typedef Display* PlatformDisplay;
</del><span class="cx"> typedef GLXFBConfig PlatformSurfaceConfig;
</span><span class="cx"> typedef GLXDrawable PlatformDrawable;
</span><span class="cx"> #elif USE(EGL)
</span><del>-#if USE(OPENGL_ES_2)
-static const EGLenum eglAPIVersion = EGL_OPENGL_ES_API;
-#else
-static const EGLenum eglAPIVersion = EGL_OPENGL_API;
-#endif
</del><span class="cx"> typedef EGLContext PlatformContext;
</span><del>-typedef EGLDisplay PlatformDisplay;
</del><span class="cx"> typedef EGLConfig PlatformSurfaceConfig;
</span><span class="cx"> typedef EGLSurface PlatformDrawable;
</span><span class="cx"> #else
</span><span class="cx"> typedef void* PlatformContext;
</span><del>-typedef void* PlatformDisplay;
</del><span class="cx"> typedef void* PlatformSurfaceConfig;
</span><span class="cx"> typedef void* PlatformDrawable;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglGLPlatformSurfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -61,8 +61,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> GLPlatformSurface::GLPlatformSurface(SurfaceAttributes)
</span><del>-    : m_sharedDisplay(0)
-    , m_drawable(0)
</del><ins>+    : m_drawable(0)
</ins><span class="cx">     , m_bufferHandle(0)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -88,11 +87,6 @@
</span><span class="cx">     return m_rect;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PlatformDisplay GLPlatformSurface::sharedDisplay() const
-{
-    return m_sharedDisplay;
-}
-
</del><span class="cx"> PlatformSurfaceConfig GLPlatformSurface::configuration()
</span><span class="cx"> {
</span><span class="cx">     return 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglGLPlatformSurfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -59,8 +59,6 @@
</span><span class="cx"> 
</span><span class="cx">     PlatformDrawable drawable() const;
</span><span class="cx"> 
</span><del>-    PlatformDisplay sharedDisplay() const;
-
</del><span class="cx">     virtual SurfaceAttributes attributes() const;
</span><span class="cx"> 
</span><span class="cx">     virtual void swapBuffers();
</span><span class="lines">@@ -84,7 +82,6 @@
</span><span class="cx"> protected:
</span><span class="cx">     GLPlatformSurface(SurfaceAttributes);
</span><span class="cx"> 
</span><del>-    PlatformDisplay m_sharedDisplay;
</del><span class="cx">     PlatformDrawable m_drawable;
</span><span class="cx">     PlatformBufferHandle m_bufferHandle;
</span><span class="cx">     IntRect m_rect;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicssurfaceseglEGLConfigSelectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLConfigSelector.h (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLConfigSelector.h        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLConfigSelector.h        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx">     EGLConfig m_pixmapFBConfig;
</span><span class="cx">     EGLConfig m_surfaceContextFBConfig;
</span><span class="cx">     unsigned m_attributes : 3;
</span><del>-    PlatformDisplay m_sharedDisplay;
</del><ins>+    EGLDisplay m_sharedDisplay;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicssurfaceseglEGLContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLContext.cpp (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLContext.cpp        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLContext.cpp        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(EGL)
</span><span class="cx"> 
</span><ins>+#include &quot;PlatformDisplay.h&quot;
</ins><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -72,12 +73,7 @@
</span><span class="cx">     if (!surface)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (!eglBindAPI(eglAPIVersion)) {
-        LOG_ERROR(&quot;Failed to set EGL API(%d).&quot;, eglGetError());
-        return false;
-    }
-
-    m_display = surface-&gt;sharedDisplay();
</del><ins>+    m_display = PlatformDisplay::sharedDisplay().eglDisplay();
</ins><span class="cx">     if (!m_display)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicssurfaceseglEGLHelpercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLHelper.cpp (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLHelper.cpp        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLHelper.cpp        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -28,89 +28,22 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(EGL)
</span><span class="cx"> 
</span><ins>+#include &quot;PlatformDisplay.h&quot;
</ins><span class="cx"> #include &lt;opengl/GLPlatformContext.h&gt;
</span><span class="cx"> 
</span><del>-#if PLATFORM(X11)
-#include &quot;X11Helper.h&quot;
-#endif
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-#if PLATFORM(X11)
-typedef X11Helper NativeWrapper;
-typedef Display NativeSharedDisplay;
-#else
-typedef void NativeSharedDisplay;
-#endif
-
</del><span class="cx"> static PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR = 0;
</span><span class="cx"> static PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR = 0;
</span><span class="cx"> static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC eglImageTargetTexture2DOES = 0;
</span><span class="cx"> 
</span><del>-struct EGLDisplayConnection {
-
-    EGLDisplayConnection(NativeSharedDisplay* display = 0)
-    {
-        if (display)
-            m_eglDisplay = eglGetDisplay(reinterpret_cast&lt;EGLNativeDisplayType&gt;(display));
-        else
-            m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
-
-        if (m_eglDisplay == EGL_NO_DISPLAY) {
-            LOG_ERROR(&quot;EGLDisplay Initialization failed.&quot;);
-            return;
-        }
-
-        EGLBoolean success;
-        success = eglInitialize(m_eglDisplay, 0, 0);
-
-        if (success != EGL_TRUE) {
-            LOG_ERROR(&quot;EGLInitialization failed.&quot;);
-            terminate();
-            return;
-        }
-
-        success = eglBindAPI(eglAPIVersion);
-
-        if (success != EGL_TRUE) {
-            LOG_ERROR(&quot;Failed to set EGL API(%d).&quot;, eglGetError());
-            terminate();
-            return;
-        }
-    }
-
-    ~EGLDisplayConnection()
-    {
-        terminate();
-    }
-
-    EGLDisplay display() { return m_eglDisplay; }
-
-private:
-    void terminate()
-    {
-        if (m_eglDisplay == EGL_NO_DISPLAY)
-            return;
-
-        eglTerminate(m_eglDisplay);
-        m_eglDisplay = EGL_NO_DISPLAY;
-    }
-
-    EGLDisplay m_eglDisplay;
-};
-
-PlatformDisplay EGLHelper::eglDisplay()
</del><ins>+EGLDisplay EGLHelper::eglDisplay()
</ins><span class="cx"> {
</span><del>-    // Display connection will only be broken at program shutdown.
-#if PLATFORM(X11)
-    static EGLDisplayConnection displayConnection(NativeWrapper::nativeDisplay());
-#else
-    static EGLDisplayConnection displayConnection;
-#endif
-    return displayConnection.display();
</del><ins>+    PlatformDisplay::sharedDisplay().eglDisplay();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-PlatformDisplay EGLHelper::currentDisplay()
</del><ins>+EGLDisplay EGLHelper::currentDisplay()
</ins><span class="cx"> {
</span><span class="cx">     EGLDisplay display = eglGetCurrentDisplay();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicssurfaceseglEGLHelperh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLHelper.h (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLHelper.h        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLHelper.h        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -34,8 +34,8 @@
</span><span class="cx"> 
</span><span class="cx"> class EGLHelper {
</span><span class="cx"> public:
</span><del>-    static PlatformDisplay eglDisplay();
-    static PlatformDisplay currentDisplay();
</del><ins>+    static EGLDisplay eglDisplay();
+    static EGLDisplay currentDisplay();
</ins><span class="cx">     static void resolveEGLBindings();
</span><span class="cx">     static void createEGLImage(EGLImageKHR*, GLenum, const EGLClientBuffer, const EGLint* = 0);
</span><span class="cx">     static void destroyEGLImage(const EGLImageKHR);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicssurfaceseglEGLSurfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -75,9 +75,7 @@
</span><span class="cx"> EGLTransportSurface::EGLTransportSurface(const IntSize&amp; size, SurfaceAttributes attributes)
</span><span class="cx">     : GLTransportSurface(size, attributes)
</span><span class="cx"> {
</span><del>-    m_sharedDisplay = EGLHelper::eglDisplay();
-
-    if (m_sharedDisplay == EGL_NO_DISPLAY)
</del><ins>+    if (EGLHelper::eglDisplay() == EGL_NO_DISPLAY)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_configSelector = std::make_unique&lt;EGLConfigSelector&gt;(attributes);
</span><span class="lines">@@ -94,13 +92,13 @@
</span><span class="cx"> 
</span><span class="cx"> void EGLTransportSurface::destroy()
</span><span class="cx"> {
</span><del>-    if (m_drawable == EGL_NO_SURFACE || m_sharedDisplay == EGL_NO_DISPLAY)
</del><ins>+    if (m_drawable == EGL_NO_SURFACE || EGLHelper::eglDisplay() == EGL_NO_DISPLAY)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     GLTransportSurface::destroy();
</span><span class="cx"> 
</span><span class="cx">     if (m_drawable) {
</span><del>-        eglDestroySurface(m_sharedDisplay, m_drawable);
</del><ins>+        eglDestroySurface(EGLHelper::eglDisplay(), m_drawable);
</ins><span class="cx">         m_drawable = EGL_NO_SURFACE;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -125,9 +123,7 @@
</span><span class="cx"> EGLOffScreenSurface::EGLOffScreenSurface(SurfaceAttributes surfaceAttributes)
</span><span class="cx">     : GLPlatformSurface(surfaceAttributes)
</span><span class="cx"> {
</span><del>-    m_sharedDisplay = EGLHelper::eglDisplay();
-
-    if (m_sharedDisplay == EGL_NO_DISPLAY)
</del><ins>+    if (EGLHelper::eglDisplay() == EGL_NO_DISPLAY)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_configSelector = std::make_unique&lt;EGLConfigSelector&gt;(surfaceAttributes);
</span><span class="lines">@@ -149,11 +145,11 @@
</span><span class="cx"> 
</span><span class="cx"> void EGLOffScreenSurface::destroy()
</span><span class="cx"> {
</span><del>-    if (m_sharedDisplay == EGL_NO_DISPLAY || m_drawable == EGL_NO_SURFACE)
</del><ins>+    if (EGLHelper::eglDisplay() == EGL_NO_DISPLAY || m_drawable == EGL_NO_SURFACE)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (m_drawable) {
</span><del>-        eglDestroySurface(m_sharedDisplay, m_drawable);
</del><ins>+        eglDestroySurface(EGLHelper::eglDisplay(), m_drawable);
</ins><span class="cx">         m_drawable = EGL_NO_SURFACE;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicssurfaceseglEGLXSurfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLXSurface.cpp (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLXSurface.cpp        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLXSurface.cpp        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;EGLConfigSelector.h&quot;
</span><span class="cx"> #include &quot;EGLHelper.h&quot;
</span><span class="cx"> #include &quot;GLPlatformContext.h&quot;
</span><ins>+#include &quot;PlatformDisplay.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -59,7 +60,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_drawable = eglCreateWindowSurface(m_sharedDisplay, m_configSelector-&gt;surfaceContextConfig(), static_cast&lt;EGLNativeWindowType&gt;(m_bufferHandle), 0);
</del><ins>+    m_drawable = eglCreateWindowSurface(PlatformDisplay::sharedDisplay().eglDisplay(), m_configSelector-&gt;surfaceContextConfig(), static_cast&lt;EGLNativeWindowType&gt;(m_bufferHandle), 0);
</ins><span class="cx"> 
</span><span class="cx">     if (m_drawable == EGL_NO_SURFACE) {
</span><span class="cx">         LOG_ERROR(&quot;Failed to create EGL surface(%d).&quot;, eglGetError());
</span><span class="lines">@@ -73,7 +74,7 @@
</span><span class="cx"> 
</span><span class="cx"> void EGLWindowTransportSurface::swapBuffers()
</span><span class="cx"> {
</span><del>-    if (!eglSwapBuffers(m_sharedDisplay, m_drawable))
</del><ins>+    if (!eglSwapBuffers(PlatformDisplay::sharedDisplay().eglDisplay(), m_drawable))
</ins><span class="cx">         LOG_ERROR(&quot;Failed to SwapBuffers(%d).&quot;, eglGetError());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -116,7 +117,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_drawable = eglCreatePixmapSurface(m_sharedDisplay, config, static_cast&lt;EGLNativePixmapType&gt;(m_bufferHandle), 0);
</del><ins>+    m_drawable = eglCreatePixmapSurface(PlatformDisplay::sharedDisplay().eglDisplay(), config, static_cast&lt;EGLNativePixmapType&gt;(m_bufferHandle), 0);
</ins><span class="cx"> 
</span><span class="cx">     if (m_drawable == EGL_NO_SURFACE) {
</span><span class="cx">         LOG_ERROR(&quot;Failed to create EGL surface(%d).&quot;, eglGetError());
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicssurfacesglxGLXContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.cpp (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.cpp        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.cpp        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx">     if (!surface)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    Display* x11Display = surface-&gt;sharedDisplay();
</del><ins>+    Display* x11Display = X11Helper::nativeDisplay();
</ins><span class="cx">     if (!x11Display)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool GLXOffScreenContext::platformMakeCurrent(GLPlatformSurface* surface)
</span><span class="cx"> {
</span><del>-    return glXMakeCurrent(surface-&gt;sharedDisplay(), surface-&gt;drawable(), m_contextHandle);
</del><ins>+    return glXMakeCurrent(X11Helper::nativeDisplay(), surface-&gt;drawable(), m_contextHandle);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GLXOffScreenContext::platformReleaseCurrent()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicssurfacesglxGLXSurfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -64,7 +64,6 @@
</span><span class="cx"> GLXTransportSurface::GLXTransportSurface(const IntSize&amp; size, SurfaceAttributes attributes)
</span><span class="cx">     : GLTransportSurface(size, attributes)
</span><span class="cx"> {
</span><del>-    m_sharedDisplay = X11Helper::nativeDisplay();
</del><span class="cx">     attributes |= GLPlatformSurface::DoubleBuffered;
</span><span class="cx">     m_configSelector = std::make_unique&lt;GLXConfigSelector&gt;(attributes);
</span><span class="cx">     std::unique_ptr&lt;XVisualInfo, X11Deleter&gt; visInfo(m_configSelector-&gt;visualInfo(m_configSelector-&gt;surfaceContextConfig()));
</span><span class="lines">@@ -98,7 +97,7 @@
</span><span class="cx">     GLTransportSurface::setGeometry(newRect);
</span><span class="cx">     X11Helper::resizeWindow(newRect, m_drawable);
</span><span class="cx">     // Force resize of GL surface after window resize.
</span><del>-    glXSwapBuffers(sharedDisplay(), m_drawable);
</del><ins>+    glXSwapBuffers(X11Helper::nativeDisplay(), m_drawable);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GLXTransportSurface::swapBuffers()
</span><span class="lines">@@ -106,7 +105,7 @@
</span><span class="cx">     if (!m_drawable)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    glXSwapBuffers(sharedDisplay(), m_drawable);
</del><ins>+    glXSwapBuffers(X11Helper::nativeDisplay(), m_drawable);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GLXTransportSurface::destroy()
</span><span class="lines">@@ -141,8 +140,6 @@
</span><span class="cx"> 
</span><span class="cx"> void GLXOffScreenSurface::initialize(SurfaceAttributes attributes)
</span><span class="cx"> {
</span><del>-    m_sharedDisplay = X11Helper::nativeDisplay();
-
</del><span class="cx">     m_configSelector = std::make_unique&lt;GLXConfigSelector&gt;(attributes);
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;XVisualInfo, X11Deleter&gt; visualInfo(m_configSelector-&gt;visualInfo(m_configSelector-&gt;pixmapContextConfig()));
</span><span class="lines">@@ -153,7 +150,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_glxPixmap = glXCreateGLXPixmap(m_sharedDisplay, visualInfo.get(), m_pixmap);
</del><ins>+    m_glxPixmap = glXCreateGLXPixmap(X11Helper::nativeDisplay(), visualInfo.get(), m_pixmap);
</ins><span class="cx"> 
</span><span class="cx">     if (!m_glxPixmap) {
</span><span class="cx">         destroy();
</span><span class="lines">@@ -175,7 +172,7 @@
</span><span class="cx"> 
</span><span class="cx"> void GLXOffScreenSurface::freeResources()
</span><span class="cx"> {
</span><del>-    Display* display = sharedDisplay();
</del><ins>+    Display* display = X11Helper::nativeDisplay();
</ins><span class="cx"> 
</span><span class="cx">     if (!display)
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicswaylandPlatformDisplayWaylandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -87,21 +87,10 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     m_eglDisplay = eglGetDisplay(m_display);
</span><del>-    if (m_eglDisplay == EGL_NO_DISPLAY) {
-        g_warning(&quot;PlatformDisplayWayland initialization: failed to acquire EGL display.&quot;);
</del><ins>+    PlatformDisplay::initializeEGLDisplay();
+    if (m_eglDisplay == EGL_NO_DISPLAY)
</ins><span class="cx">         return;
</span><del>-    }
</del><span class="cx"> 
</span><del>-    if (eglInitialize(m_eglDisplay, 0, 0) == EGL_FALSE) {
-        g_warning(&quot;PlatformDisplayWayland initialization: failed to initialize the EGL display.&quot;);
-        return;
-    }
-
-    if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_FALSE) {
-        g_warning(&quot;PlatformDisplayWayland initialization: failed to set EGL_OPENGL_ES_API as the rendering API.&quot;);
-        return;
-    }
-
</del><span class="cx">     EGLint numberOfConfigs;
</span><span class="cx">     if (!eglChooseConfig(m_eglDisplay, configAttributes, &amp;m_eglConfig, 1, &amp;numberOfConfigs) || numberOfConfigs != 1) {
</span><span class="cx">         g_warning(&quot;PlatformDisplayWayland initialization: failed to find the desired EGL configuration.&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicswaylandPlatformDisplayWaylandh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.h (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.h        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.h        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -47,7 +47,6 @@
</span><span class="cx">     virtual ~PlatformDisplayWayland();
</span><span class="cx"> 
</span><span class="cx">     struct wl_display* native() const { return m_display; }
</span><del>-    EGLDisplay eglDisplay() const { return m_eglDisplay; }
</del><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;WaylandSurface&gt; createSurface(const IntSize&amp;, int widgetID);
</span><span class="cx"> 
</span><span class="lines">@@ -68,7 +67,6 @@
</span><span class="cx">     struct wl_compositor* m_compositor;
</span><span class="cx">     struct wl_webkitgtk* m_webkitgtk;
</span><span class="cx"> 
</span><del>-    EGLDisplay m_eglDisplay;
</del><span class="cx">     EGLConfig m_eglConfig;
</span><span class="cx">     bool m_eglConfigChosen;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsx11PlatformDisplayX11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -29,6 +29,10 @@
</span><span class="cx"> #if PLATFORM(X11)
</span><span class="cx"> #include &lt;X11/Xlib.h&gt;
</span><span class="cx"> 
</span><ins>+#if USE(EGL)
+#include &lt;EGL/egl.h&gt;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> PlatformDisplayX11::PlatformDisplayX11()
</span><span class="lines">@@ -49,6 +53,14 @@
</span><span class="cx">         XCloseDisplay(m_display);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if USE(EGL)
+void PlatformDisplayX11::initializeEGLDisplay()
+{
+    m_eglDisplay = eglGetDisplay(m_display);
+    PlatformDisplay::initializeEGLDisplay();
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(X11)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsx11PlatformDisplayX11h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h (183867 => 183868)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h        2015-05-06 12:55:20 UTC (rev 183867)
+++ trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h        2015-05-06 16:06:30 UTC (rev 183868)
</span><span class="lines">@@ -45,6 +45,10 @@
</span><span class="cx"> private:
</span><span class="cx">     virtual Type type() const override { return PlatformDisplay::Type::X11; }
</span><span class="cx"> 
</span><ins>+#if USE(EGL)
+    void initializeEGLDisplay() override;
+#endif
+
</ins><span class="cx">     Display* m_display;
</span><span class="cx">     bool m_ownedDisplay;
</span><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>