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

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
« no previous file with comments | « ui/gfx/gl/gl_surface_egl.h ('k') | ui/gfx/gl/gl_surface_glx.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8301bc407997507c45d08a60d19a4d710b720b48 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(),
+ surface_,
+ EGL_POST_SUB_BUFFER_SUPPORTED_NV,
+ &surfaceVal);
+ supports_post_sub_buffer_ = (surfaceVal && retVal) == EGL_TRUE;
+
return true;
}
@@ -247,6 +262,21 @@ 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_);
+ if (!eglPostSubBufferNV(GetDisplay(), surface_, x, y, width, height)) {
+ VLOG(1) << "eglPostSubBufferNV failed with error "
+ << GetLastEGLErrorString();
+ return false;
+ }
+ return true;
+}
+
PbufferGLSurfaceEGL::PbufferGLSurfaceEGL(bool software, const gfx::Size& size)
: size_(size),
surface_(NULL) {
« no previous file with comments | « ui/gfx/gl/gl_surface_egl.h ('k') | ui/gfx/gl/gl_surface_glx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698