Changeset 228272 in webkit
- Timestamp:
- Feb 8, 2018 6:05:13 AM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r228264 r228272 1 2018-02-08 Miguel Gomez <magomez@igalia.com> 2 3 [GTK] WaylandCompositor misusing eglGetProcAddress 4 https://bugs.webkit.org/show_bug.cgi?id=182490 5 6 Reviewed by Michael Catanzaro. 7 8 Check that the appropriate extensions are available before calling eglGetProcAddress, as even 9 getting a non null value from it, the functionality can be disabled at runtime. 10 11 * UIProcess/gtk/WaylandCompositor.cpp: 12 (WebKit::WaylandCompositor::initializeEGL): 13 1 14 2018-02-08 Frederic Wang <fwang@igalia.com> 2 15 -
trunk/Source/WebKit/UIProcess/gtk/WaylandCompositor.cpp
r222422 r228272 41 41 #include <GLES2/gl2.h> 42 42 #include <GLES2/gl2ext.h> 43 #include <WebCore/Extensions3DOpenGLES.h> 43 44 #else 45 #include <WebCore/Extensions3DOpenGL.h> 44 46 #include <WebCore/OpenGLShims.h> 45 47 #endif … … 374 376 bool WaylandCompositor::initializeEGL() 375 377 { 378 const char* extensions = eglQueryString(PlatformDisplay::sharedDisplay().eglDisplay(), EGL_EXTENSIONS); 379 376 380 if (PlatformDisplay::sharedDisplay().eglCheckVersion(1, 5)) { 377 381 eglCreateImage = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImage")); 378 382 eglDestroyImage = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImage")); 379 383 } else { 380 const char* extensions = eglQueryString(PlatformDisplay::sharedDisplay().eglDisplay(), EGL_EXTENSIONS);381 384 if (GLContext::isExtensionSupported(extensions, "EGL_KHR_image_base")) { 382 385 eglCreateImage = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR")); … … 389 392 } 390 393 391 glImageTargetTexture2D = reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES")); 394 if (GLContext::isExtensionSupported(extensions, "EGL_WL_bind_wayland_display")) { 395 eglBindWaylandDisplay = reinterpret_cast<PFNEGLBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglBindWaylandDisplayWL")); 396 eglUnbindWaylandDisplay = reinterpret_cast<PFNEGLUNBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglUnbindWaylandDisplayWL")); 397 eglQueryWaylandBuffer = reinterpret_cast<PFNEGLQUERYWAYLANDBUFFERWL>(eglGetProcAddress("eglQueryWaylandBufferWL")); 398 } 399 if (!eglBindWaylandDisplay || !eglUnbindWaylandDisplay || !eglQueryWaylandBuffer) { 400 WTFLogAlways("WaylandCompositor requires eglBindWaylandDisplayWL, eglUnbindWaylandDisplayWL and eglQueryWaylandBuffer."); 401 return false; 402 } 403 404 m_eglContext = GLContext::createOffscreenContext(); 405 if (!m_eglContext) 406 return false; 407 408 if (!m_eglContext->makeContextCurrent()) 409 return false; 410 411 #if USE(OPENGL_ES_2) 412 std::unique_ptr<Extensions3DOpenGLES> glExtensions = std::make_unique<Extensions3DOpenGLES>(nullptr, false); 413 #else 414 std::unique_ptr<Extensions3DOpenGL> glExtensions = std::make_unique<Extensions3DOpenGL>(nullptr, GLContext::current()->version() >= 320); 415 #endif 416 if (glExtensions->supports("GL_OES_EGL_image") || glExtensions->supports("GL_OES_EGL_image_external")) 417 glImageTargetTexture2D = reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES")); 418 392 419 if (!glImageTargetTexture2D) { 393 420 WTFLogAlways("WaylandCompositor requires glEGLImageTargetTexture2D."); 394 421 return false; 395 422 } 396 397 eglQueryWaylandBuffer = reinterpret_cast<PFNEGLQUERYWAYLANDBUFFERWL>(eglGetProcAddress("eglQueryWaylandBufferWL"));398 if (!eglQueryWaylandBuffer) {399 WTFLogAlways("WaylandCompositor requires eglQueryWaylandBuffer.");400 return false;401 }402 403 eglBindWaylandDisplay = reinterpret_cast<PFNEGLBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglBindWaylandDisplayWL"));404 eglUnbindWaylandDisplay = reinterpret_cast<PFNEGLUNBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglUnbindWaylandDisplayWL"));405 if (!eglBindWaylandDisplay || !eglUnbindWaylandDisplay) {406 WTFLogAlways("WaylandCompositor requires eglBindWaylandDisplayWL and eglUnbindWaylandDisplayWL.");407 return false;408 }409 410 m_eglContext = GLContext::createOffscreenContext();411 if (!m_eglContext)412 return false;413 414 if (!m_eglContext->makeContextCurrent())415 return false;416 423 417 424 return true;
Note: See TracChangeset
for help on using the changeset viewer.