Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1111)

Unified Diff: ui/gfx/gl/gl_surface_egl.cc

Issue 8512005: Plumb through EGL_NV_post_sub_buffer and GLX_MESA_copy_sub_buffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "" Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698