Index: webkitgtk-2.18.6/Source/WebKit/UIProcess/gtk/WaylandCompositor.cpp =================================================================== --- webkitgtk-2.18.6.orig/Source/WebKit/UIProcess/gtk/WaylandCompositor.cpp 2017-09-02 11:15:50.000000000 +0200 +++ webkitgtk-2.18.6/Source/WebKit/UIProcess/gtk/WaylandCompositor.cpp 2018-03-02 17:38:44.892586127 +0100 @@ -40,7 +40,9 @@ #if USE(OPENGL_ES_2) #include #include +#include #else +#include #include #endif @@ -374,11 +376,12 @@ bool WaylandCompositor::initializeEGL() { + const char* extensions = eglQueryString(PlatformDisplay::sharedDisplay().eglDisplay(), EGL_EXTENSIONS); + if (PlatformDisplay::sharedDisplay().eglCheckVersion(1, 5)) { eglCreateImage = reinterpret_cast(eglGetProcAddress("eglCreateImage")); eglDestroyImage = reinterpret_cast(eglGetProcAddress("eglDestroyImage")); } else { - const char* extensions = eglQueryString(PlatformDisplay::sharedDisplay().eglDisplay(), EGL_EXTENSIONS); if (GLContext::isExtensionSupported(extensions, "EGL_KHR_image_base")) { eglCreateImage = reinterpret_cast(eglGetProcAddress("eglCreateImageKHR")); eglDestroyImage = reinterpret_cast(eglGetProcAddress("eglDestroyImageKHR")); @@ -389,22 +392,13 @@ return false; } - glImageTargetTexture2D = reinterpret_cast(eglGetProcAddress("glEGLImageTargetTexture2DOES")); - if (!glImageTargetTexture2D) { - WTFLogAlways("WaylandCompositor requires glEGLImageTargetTexture2D."); - return false; - } - - eglQueryWaylandBuffer = reinterpret_cast(eglGetProcAddress("eglQueryWaylandBufferWL")); - if (!eglQueryWaylandBuffer) { - WTFLogAlways("WaylandCompositor requires eglQueryWaylandBuffer."); - return false; - } - + if (GLContext::isExtensionSupported(extensions, "EGL_WL_bind_wayland_display")) { eglBindWaylandDisplay = reinterpret_cast(eglGetProcAddress("eglBindWaylandDisplayWL")); eglUnbindWaylandDisplay = reinterpret_cast(eglGetProcAddress("eglUnbindWaylandDisplayWL")); - if (!eglBindWaylandDisplay || !eglUnbindWaylandDisplay) { - WTFLogAlways("WaylandCompositor requires eglBindWaylandDisplayWL and eglUnbindWaylandDisplayWL."); + eglQueryWaylandBuffer = reinterpret_cast(eglGetProcAddress("eglQueryWaylandBufferWL")); + } + if (!eglBindWaylandDisplay || !eglUnbindWaylandDisplay || !eglQueryWaylandBuffer) { + WTFLogAlways("WaylandCompositor requires eglBindWaylandDisplayWL, eglUnbindWaylandDisplayWL and eglQueryWaylandBuffer."); return false; } @@ -415,6 +409,19 @@ if (!m_eglContext->makeContextCurrent()) return false; +#if USE(OPENGL_ES_2) + std::unique_ptr glExtensions = std::make_unique(nullptr, false); +#else + std::unique_ptr glExtensions = std::make_unique(nullptr, GLContext::current()->version() >= 320); +#endif + if (glExtensions->supports("GL_OES_EGL_image") || glExtensions->supports("GL_OES_EGL_image_external")) + glImageTargetTexture2D = reinterpret_cast(eglGetProcAddress("glEGLImageTargetTexture2DOES")); + + if (!glImageTargetTexture2D) { + WTFLogAlways("WaylandCompositor requires glEGLImageTargetTexture2D."); + return false; + } + return true; }