Changeset 269841 in webkit


Ignore:
Timestamp:
Nov 16, 2020 2:05:32 AM (3 years ago)
Author:
zandobersek@gmail.com
Message:

PlatformDisplayLibWPE: use eglGetPlatformDisplay when possible
https://bugs.webkit.org/show_bug.cgi?id=218941

Reviewed by Carlos Garcia Campos.

Use the existing wpe_renderer_backend_egl API to detect any desired
EGL platform that should be used to retrieve the global EGLDisplay
object. If such a platform is specified, the eglGetPlatformDisplay
entrypoing from the EGL_EXT_platform_base extension should be used
to retrieve the corresponding EGLDisplay.

If the API or the extension is not available, or if the EGLDisplay is
not retrieved this way, we fall back to eglGetDisplay.

  • platform/graphics/libwpe/PlatformDisplayLibWPE.cpp:

(WebCore::PlatformDisplayLibWPE::initialize):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r269840 r269841  
     12020-11-16  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        PlatformDisplayLibWPE: use eglGetPlatformDisplay when possible
     4        https://bugs.webkit.org/show_bug.cgi?id=218941
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Use the existing wpe_renderer_backend_egl API to detect any desired
     9        EGL platform that should be used to retrieve the global EGLDisplay
     10        object. If such a platform is specified, the eglGetPlatformDisplay
     11        entrypoing from the EGL_EXT_platform_base extension should be used
     12        to retrieve the corresponding EGLDisplay.
     13
     14        If the API or the extension is not available, or if the EGLDisplay is
     15        not retrieved this way, we fall back to eglGetDisplay.
     16
     17        * platform/graphics/libwpe/PlatformDisplayLibWPE.cpp:
     18        (WebCore::PlatformDisplayLibWPE::initialize):
     19
    1202020-11-10  Sergio Villar Senin  <svillar@igalia.com>
    221
  • trunk/Source/WebCore/platform/graphics/libwpe/PlatformDisplayLibWPE.cpp

    r251122 r269841  
    4747#include <wpe/wpe-egl.h>
    4848
     49#ifndef EGL_EXT_platform_base
     50#define EGL_EXT_platform_base 1
     51typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
     52#endif
     53
    4954namespace WebCore {
    5055
     
    7176    m_backend = wpe_renderer_backend_egl_create(hostFd);
    7277
    73     m_eglDisplay = eglGetDisplay(wpe_renderer_backend_egl_get_native_display(m_backend));
     78    EGLNativeDisplayType eglNativeDisplay = wpe_renderer_backend_egl_get_native_display(m_backend);
     79
     80#if WPE_CHECK_VERSION(1, 1, 0)
     81    uint32_t eglPlatform = wpe_renderer_backend_egl_get_platform(m_backend);
     82    if (eglPlatform) {
     83        using GetPlatformDisplayType = PFNEGLGETPLATFORMDISPLAYEXTPROC;
     84        GetPlatformDisplayType getPlatformDisplay =
     85            [] {
     86                const char* extensions = eglQueryString(nullptr, EGL_EXTENSIONS);
     87                if (GLContext::isExtensionSupported(extensions, "EGL_EXT_platform_base")
     88                    || GLContext::isExtensionSupported(extensions, "EGL_KHR_platform_base"))
     89                    return reinterpret_cast<GetPlatformDisplayType>(eglGetProcAddress("eglGetPlatformDisplay"));
     90                return GetPlatformDisplayType(nullptr);
     91            }();
     92
     93        if (getPlatformDisplay)
     94            m_eglDisplay = getPlatformDisplay(eglPlatform, eglNativeDisplay, nullptr);
     95    }
     96#endif
     97
     98    if (m_eglDisplay == EGL_NO_DISPLAY)
     99        m_eglDisplay = eglGetDisplay(eglNativeDisplay);
    74100    if (m_eglDisplay == EGL_NO_DISPLAY) {
    75101        WTFLogAlways("PlatformDisplayLibWPE: could not create the EGL display: %s.", GLContextEGL::lastErrorString());
Note: See TracChangeset for help on using the changeset viewer.