From d1c97282f2b25190092d3b18593d114bcc3a5aa2 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 4 Mar 2020 14:00:44 +0100 Subject: [PATCH] Request EGL in GLFW window creation (flutter/engine#16924) Skia expects an EGL context, but GLFW was defaulting to non-EGL, which causes eglGetCurrentDisplay to fail--since the context wasn't made current via EGL--with new versions of libglvnd. (It may have worked only by accident with previous versions). Fixes https://github.com/flutter/flutter/issues/47954 --- engine/src/flutter/shell/platform/glfw/flutter_glfw.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc b/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc index a38cb60ae8..da1176f4f0 100644 --- a/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc +++ b/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc @@ -139,6 +139,9 @@ static FlutterDesktopWindowControllerState* GetSavedWindowState( static UniqueGLFWwindowPtr CreateShareWindowForWindow(GLFWwindow* window) { glfwWindowHint(GLFW_DECORATED, GLFW_FALSE); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); +#if defined(__linux__) + glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API); +#endif GLFWwindow* share_window = glfwCreateWindow(1, 1, "", NULL, window); glfwDefaultWindowHints(); return UniqueGLFWwindowPtr(share_window, glfwDestroyWindow); @@ -561,6 +564,9 @@ FlutterDesktopWindowControllerRef FlutterDesktopCreateWindow( if (window_properties.prevent_resize) { glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); } +#if defined(__linux__) + glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API); +#endif state->window = UniqueGLFWwindowPtr( glfwCreateWindow(window_properties.width, window_properties.height, window_properties.title, NULL, NULL),