Changeset 207616 in webkit


Ignore:
Timestamp:
Oct 20, 2016 6:18:09 AM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Prefer eglGetPlatformDisplay to eglGetDisplay
https://bugs.webkit.org/show_bug.cgi?id=163333

Patch by Adam Jackson <ajax@redhat.com> on 2016-10-20
Reviewed by Carlos Garcia Campos.

eglGetDisplay forces the implementation to guess what kind of void* it's been handed. Different implementations
do different things, in particular glvnd and Mesa behave differently. Fortunately there exists API to tell EGL
what kind of display it is, so let's use it.

  • platform/graphics/wayland/PlatformDisplayWayland.cpp:

(WebCore::PlatformDisplayWayland::initialize):

  • platform/graphics/x11/PlatformDisplayX11.cpp:

(WebCore::PlatformDisplayX11::initializeEGLDisplay):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r207615 r207616  
     12016-10-20  Adam Jackson  <ajax@redhat.com>
     2
     3        Prefer eglGetPlatformDisplay to eglGetDisplay
     4        https://bugs.webkit.org/show_bug.cgi?id=163333
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        eglGetDisplay forces the implementation to guess what kind of void* it's been handed. Different implementations
     9        do different things, in particular glvnd and Mesa behave differently. Fortunately there exists API to tell EGL
     10        what kind of display it is, so let's use it.
     11
     12        * platform/graphics/wayland/PlatformDisplayWayland.cpp:
     13        (WebCore::PlatformDisplayWayland::initialize):
     14        * platform/graphics/x11/PlatformDisplayX11.cpp:
     15        (WebCore::PlatformDisplayX11::initializeEGLDisplay):
     16
    1172016-10-20  Carlos Garcia Campos  <cgarcia@igalia.com>
    218
  • trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp

    r207615 r207616  
    3535#include <wayland-egl.h>
    3636#include <EGL/egl.h>
     37#include <EGL/eglext.h>
    3738#include <wtf/Assertions.h>
    3839
     
    6667    wl_display_roundtrip(m_display);
    6768
    68     m_eglDisplay = eglGetDisplay(m_display);
     69    const char* extensions = eglQueryString(nullptr, EGL_EXTENSIONS);
     70    if (GLContext::isExtensionSupported(extensions, "EGL_KHR_platform_base")) {
     71        if (auto* getPlatformDisplay = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplay")))
     72            m_eglDisplay = getPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR, m_display, nullptr);
     73    } else if (GLContext::isExtensionSupported(extensions, "EGL_EXT_platform_base")) {
     74        if (auto* getPlatformDisplay = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplayEXT")))
     75            m_eglDisplay = getPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR, m_display, nullptr);
     76    } else
     77        m_eglDisplay = eglGetDisplay(m_display);
     78
    6979    PlatformDisplay::initializeEGLDisplay();
    7080}
  • trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp

    r207615 r207616  
    3838#if USE(EGL)
    3939#include <EGL/egl.h>
     40#include <EGL/eglext.h>
    4041#endif
    4142
     
    6566void PlatformDisplayX11::initializeEGLDisplay()
    6667{
    67     m_eglDisplay = eglGetDisplay(m_display);
     68    const char* extensions = eglQueryString(nullptr, EGL_EXTENSIONS);
     69    if (GLContext::isExtensionSupported(extensions, "EGL_KHR_platform_base")) {
     70        if (auto* getPlatformDisplay = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplay")))
     71            m_eglDisplay = getPlatformDisplay(EGL_PLATFORM_X11_KHR, m_display, nullptr);
     72    } else if (GLContext::isExtensionSupported(extensions, "EGL_EXT_platform_base")) {
     73        if (auto* getPlatformDisplay = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplayEXT")))
     74            m_eglDisplay = getPlatformDisplay(EGL_PLATFORM_X11_KHR, m_display, nullptr);
     75    } else
     76        m_eglDisplay = eglGetDisplay(m_display);
     77
    6878    PlatformDisplay::initializeEGLDisplay();
    6979}
Note: See TracChangeset for help on using the changeset viewer.