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

Unified Diff: ui/gl/gl_surface_glx.cc

Issue 296003010: gpu/linux: create a child window to control resize and avoid flashes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months 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/gl/gl_surface_glx.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_surface_glx.cc
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc
index 16fd7501bd3f245c76fa98ce3d6882c60e87b6a4..7e6dfaab6bd9513fd10d4cddbce6c655d8d08d55 100644
--- a/ui/gl/gl_surface_glx.cc
+++ b/ui/gl/gl_surface_glx.cc
@@ -391,11 +391,12 @@ GLSurfaceGLX::~GLSurfaceGLX() {}
NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window)
: parent_window_(window),
+ window_(0),
config_(NULL) {
}
gfx::AcceleratedWidget NativeViewGLSurfaceGLX::GetDrawableHandle() const {
- return parent_window_;
+ return window_;
}
bool NativeViewGLSurfaceGLX::Initialize() {
@@ -406,8 +407,25 @@ bool NativeViewGLSurfaceGLX::Initialize() {
return false;
}
size_ = gfx::Size(attributes.width, attributes.height);
-
- gfx::AcceleratedWidget window_for_vsync = parent_window_;
+ // Create a child window, with a CopyFromParent visual (to avoid inducing
+ // extra blits in the driver), that we can resize exactly in Resize(),
+ // correctly ordered with GL, so that we don't have invalid transient states.
+ // See https://crbug.com/326995.
+ window_ = XCreateWindow(g_display,
+ parent_window_,
+ 0,
+ 0,
+ size_.width(),
+ size_.height(),
+ 0,
+ CopyFromParent,
+ InputOutput,
+ CopyFromParent,
+ 0,
+ NULL);
+ XMapWindow(g_display, window_);
ccameron 2014/05/23 09:09:06 Looking back at https://chromiumcodereview.appspot
+
+ gfx::AcceleratedWidget window_for_vsync = window_;
if (g_glx_oml_sync_control_supported)
vsync_provider_.reset(new OMLSyncControlVSyncProvider(window_for_vsync));
@@ -418,10 +436,17 @@ bool NativeViewGLSurfaceGLX::Initialize() {
}
void NativeViewGLSurfaceGLX::Destroy() {
+ if (window_) {
+ XDestroyWindow(g_display, window_);
+ XFlush(g_display);
+ }
}
bool NativeViewGLSurfaceGLX::Resize(const gfx::Size& size) {
size_ = size;
+ glXWaitGL();
+ XResizeWindow(g_display, window_, size.width(), size.height());
+ glXWaitX();
return true;
}
@@ -467,10 +492,10 @@ void* NativeViewGLSurfaceGLX::GetConfig() {
XWindowAttributes attributes;
if (!XGetWindowAttributes(
g_display,
- parent_window_,
+ window_,
&attributes)) {
LOG(ERROR) << "XGetWindowAttributes failed for window " <<
- parent_window_ << ".";
+ window_ << ".";
return NULL;
}
@@ -524,6 +549,7 @@ VSyncProvider* NativeViewGLSurfaceGLX::GetVSyncProvider() {
NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX()
: parent_window_(0),
+ window_(0),
config_(NULL) {
}
« no previous file with comments | « ui/gl/gl_surface_glx.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698