Index: ui/gfx/gl/gl_surface_egl.cc |
diff --git a/ui/gfx/gl/gl_surface_egl.cc b/ui/gfx/gl/gl_surface_egl.cc |
index 6f6d630fc7ba1611a6efe8d50ab0375487eae049..11601299792963df8ede162bcda2ae6bb39dab89 100644 |
--- a/ui/gfx/gl/gl_surface_egl.cc |
+++ b/ui/gfx/gl/gl_surface_egl.cc |
@@ -173,7 +173,8 @@ EGLNativeDisplayType GLSurfaceEGL::GetNativeDisplay() { |
NativeViewGLSurfaceEGL::NativeViewGLSurfaceEGL(bool software, |
gfx::PluginWindowHandle window) |
: window_(window), |
- surface_(NULL) |
+ surface_(NULL), |
+ supports_post_sub_buffer_(false) |
{ |
software_ = software; |
} |
@@ -190,11 +191,18 @@ bool NativeViewGLSurfaceEGL::Initialize() { |
return false; |
} |
+ static const EGLint egl_window_attributes_sub_buffer[] = { |
+ EGL_POST_SUB_BUFFER_SUPPORTED_NV, EGL_TRUE, |
+ EGL_NONE |
+ }; |
+ |
// Create a surface for the native window. |
surface_ = eglCreateWindowSurface(GetDisplay(), |
GetConfig(), |
window_, |
- NULL); |
+ gfx::g_EGL_NV_post_sub_buffer ? |
+ egl_window_attributes_sub_buffer : |
+ NULL); |
if (!surface_) { |
LOG(ERROR) << "eglCreateWindowSurface failed with error " |
@@ -203,6 +211,13 @@ bool NativeViewGLSurfaceEGL::Initialize() { |
return false; |
} |
+ EGLint surfaceVal; |
+ EGLBoolean retVal = eglQuerySurface(GetDisplay(), |
apatrick_chromium
2011/11/10 19:33:16
Is it really the case that if you ask for a surfac
jonathan.backer
2011/11/10 21:00:25
I think so. I was inspired by some ChromeOS WM cod
|
+ surface_, |
+ EGL_POST_SUB_BUFFER_SUPPORTED_NV, |
+ &surfaceVal); |
+ supports_post_sub_buffer_ = (surfaceVal && retVal) == EGL_TRUE; |
+ |
return true; |
} |
@@ -247,6 +262,16 @@ EGLSurface NativeViewGLSurfaceEGL::GetHandle() { |
return surface_; |
} |
+bool NativeViewGLSurfaceEGL::SupportsPostSubBuffer() { |
+ return supports_post_sub_buffer_; |
+} |
+ |
+bool NativeViewGLSurfaceEGL::PostSubBuffer( |
+ int x, int y, int width, int height) { |
+ DCHECK(supports_post_sub_buffer_); |
+ return eglPostSubBufferNV(GetDisplay(), surface_, x, y, width, height); |
+} |
+ |
PbufferGLSurfaceEGL::PbufferGLSurfaceEGL(bool software, const gfx::Size& size) |
: size_(size), |
surface_(NULL) { |