Index: ui/gl/gl_surface_egl.cc |
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc |
index e29910c2b6178016aa194c8748a9c2a9dc031270..b4898ac4b0345073d2d5524778e7b721000f5e0a 100644 |
--- a/ui/gl/gl_surface_egl.cc |
+++ b/ui/gl/gl_surface_egl.cc |
@@ -32,6 +32,11 @@ |
#endif |
#if defined(USE_X11) && !defined(OS_CHROMEOS) |
+extern "C" { |
+#include <X11/Xlib.h> |
+#define Status int |
+} |
+#include "ui/base/x/x11_util_internal.h" |
#include "ui/gfx/x/x11_switches.h" |
#endif |
@@ -70,6 +75,11 @@ |
#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E |
#endif /* EGL_ANGLE_platform_angle_opengl */ |
+#ifndef EGL_ANGLE_x11_visual |
+#define EGL_ANGLE_x11_visual 1 |
+#define EGL_X11_VISUAL_ID_ANGLE 0x33A3 |
+#endif /* EGL_ANGLE_x11_visual */ |
+ |
using ui::GetLastEGLErrorString; |
namespace gfx { |
@@ -143,6 +153,13 @@ EGLDisplay GetPlatformANGLEDisplay(EGLNativeDisplayType native_display, |
display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE); |
} |
+#if defined(USE_X11) && !defined(OS_CHROMEOS) |
+ Visual* visual; |
+ ui::ChooseVisualForWindow(&visual, nullptr); |
+ display_attribs.push_back(EGL_X11_VISUAL_ID_ANGLE); |
+ display_attribs.push_back((EGLint)visual->visualid); |
+#endif |
+ |
display_attribs.push_back(EGL_NONE); |
return eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, |