diff --git a/gfx/angle/src/libANGLE/validationEGL.cpp b/gfx/angle/src/libANGLE/validationEGL.cpp index 523af638ec0d..b5c1703d0865 100644 --- a/gfx/angle/src/libANGLE/validationEGL.cpp +++ b/gfx/angle/src/libANGLE/validationEGL.cpp @@ -744,7 +744,7 @@ Error ValidateCreateContext(Display *display, Config *configuration, gl::Context { return EglBadConfig(); } - if (!(configuration->conformant & EGL_OPENGL_ES3_BIT_KHR)) + if (!(configuration->renderableType & EGL_OPENGL_ES3_BIT_KHR)) { return EglBadConfig(); } diff --git a/gfx/gl/GLDefs.h b/gfx/gl/GLDefs.h index ed09fc4326e2..7e38d6020548 100644 --- a/gfx/gl/GLDefs.h +++ b/gfx/gl/GLDefs.h @@ -53,6 +53,11 @@ #define LOCAL_EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE 0x320C #define LOCAL_EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE 0x320F +// EGL_ANGLE_experimental_present_path +#define LOCAL_EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE 0x33A4 +#define LOCAL_EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE 0x33A9 +#define LOCAL_EGL_EXPERIMENTAL_PRESENT_PATH_COPY_ANGLE 0x33AA + // EGL_ANGLE_direct3d_display #define LOCAL_EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ((EGLNativeDisplayType)-2) #define LOCAL_EGL_D3D11_ONLY_DISPLAY_ANGLE ((EGLNativeDisplayType)-3) diff --git a/gfx/gl/GLLibraryEGL.cpp b/gfx/gl/GLLibraryEGL.cpp index 300569fc00be..8164b0a69cbf 100644 --- a/gfx/gl/GLLibraryEGL.cpp +++ b/gfx/gl/GLLibraryEGL.cpp @@ -146,6 +146,35 @@ GetAndInitWARPDisplay(GLLibraryEGL& egl, void* displayType) return display; } +static EGLDisplay +GetAndInitDisplayForWebRender(GLLibraryEGL& egl, void* displayType) +{ + const EGLint attrib_list[] = { LOCAL_EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, + LOCAL_EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE, + LOCAL_EGL_PLATFORM_ANGLE_TYPE_ANGLE, + LOCAL_EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, + LOCAL_EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE, + LOCAL_EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE, + LOCAL_EGL_NONE }; + EGLDisplay display = egl.fGetPlatformDisplayEXT(LOCAL_EGL_PLATFORM_ANGLE_ANGLE, + displayType, + attrib_list); + + if (display == EGL_NO_DISPLAY) { + const EGLint err = egl.fGetError(); + if (err != LOCAL_EGL_SUCCESS) { + gfxCriticalError() << "Unexpected GL error: " << gfx::hexa(err); + MOZ_CRASH("GFX: Unexpected GL error."); + } + return EGL_NO_DISPLAY; + } + + if (!egl.fInitialize(display, nullptr, nullptr)) + return EGL_NO_DISPLAY; + + return display; +} + static bool IsAccelAngleSupported(const nsCOMPtr& gfxInfo, nsACString* const out_failureId) @@ -241,7 +270,7 @@ GetAndInitDisplayForAccelANGLE(GLLibraryEGL& egl, nsACString* const out_failureI EGLDisplay ret = 0; if (wr::RenderThread::IsInRenderThread()) { - return GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ONLY_DISPLAY_ANGLE); + return GetAndInitDisplayForWebRender(egl, EGL_DEFAULT_DISPLAY); } FeatureState& d3d11ANGLE = gfxConfig::GetFeature(Feature::D3D11_HW_ANGLE);