| Index: ui/gl/gl_surface_egl.cc
|
| diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc
|
| index ae22a28419c53ef447145b2dc161cb699de5010c..2573e678736c99556a1d1789ac99c55fb28ac42f 100644
|
| --- a/ui/gl/gl_surface_egl.cc
|
| +++ b/ui/gl/gl_surface_egl.cc
|
| @@ -21,6 +21,10 @@ extern "C" {
|
| }
|
| #endif
|
|
|
| +#if defined(USE_NATIVE_SURFACE_LINUX)
|
| +#include "ui/base/linux/native_surface_linux_factory.h"
|
| +#endif
|
| +
|
| using ui::GetLastEGLErrorString;
|
|
|
| namespace gfx {
|
| @@ -146,7 +150,7 @@ bool GLSurfaceEGL::InitializeOneOff() {
|
|
|
| initialized = true;
|
|
|
| -#if defined(USE_X11) || defined(OS_ANDROID)
|
| +#if defined(USE_X11) || defined(OS_ANDROID) || defined(USE_NATIVE_SURFACE_LINUX)
|
| return true;
|
| #else
|
| g_software_native_display = EGL_SOFTWARE_DISPLAY_ANGLE;
|
| @@ -223,6 +227,7 @@ NativeViewGLSurfaceEGL::NativeViewGLSurfaceEGL(bool software,
|
| supports_post_sub_buffer_(false),
|
| config_(NULL) {
|
| software_ = software;
|
| +
|
| #if defined(OS_ANDROID)
|
| if (window)
|
| ANativeWindow_acquire(window);
|
| @@ -256,6 +261,11 @@ bool NativeViewGLSurfaceEGL::Initialize() {
|
| egl_window_attributes_sub_buffer :
|
| NULL);
|
|
|
| +#if defined(USE_NATIVE_SURFACE_LINUX)
|
| + eglSurfaceAttrib(GetDisplay(), surface_,
|
| + EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED);
|
| +#endif
|
| +
|
| if (!surface_) {
|
| LOG(ERROR) << "eglCreateWindowSurface failed with error "
|
| << GetLastEGLErrorString();
|
| @@ -394,6 +404,18 @@ bool NativeViewGLSurfaceEGL::Resize(const gfx::Size& size) {
|
| if (size == GetSize())
|
| return true;
|
|
|
| +#if defined(USE_NATIVE_SURFACE_LINUX)
|
| + ui::NativeSurfaceLinuxFactory *nslf =
|
| + ui::NativeSurfaceLinuxFactory::GetInstance();
|
| + if (!nslf->AcceleratedWidgetCanBeResized(window_)) {
|
| + LOG(ERROR) << "desired size for GL surface does not match native size";
|
| + LOG(ERROR) << "desired size: " << size.width() << "x" << size.height();
|
| + LOG(ERROR) << "native size: " << GetSize().width() << "x"
|
| + << GetSize().height();
|
| + return true;
|
| + }
|
| +#endif
|
| +
|
| GLContext* current_context = GLContext::GetCurrent();
|
| bool was_current = current_context && current_context->IsCurrent(this);
|
| if (was_current)
|
|
|