summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorkbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-03 18:16:59 +0000
committerkbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-03 18:16:59 +0000
commitf0caa592fdee3d319592a444d3200b9159893df1 (patch)
treeaccd4733ab7c8f0c0525559595e955c965059154 /ui
parente51e335a72660f824e851513fc0e14441f989024 (diff)
downloadchromium_src-f0caa592fdee3d319592a444d3200b9159893df1.zip
chromium_src-f0caa592fdee3d319592a444d3200b9159893df1.tar.gz
chromium_src-f0caa592fdee3d319592a444d3200b9159893df1.tar.bz2
Only enable vsync if a compositing window manager is not in use. This
restores performance and latency on Linux to previous levels before the bug fix enabling vsync for the first time. Tested manually both with and without Compiz enabled and verified the detection logic works. BUG=81333 TEST=none Review URL: http://codereview.chromium.org/6911030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83921 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/gfx/gl/gl_context_linux.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/ui/gfx/gl/gl_context_linux.cc b/ui/gfx/gl/gl_context_linux.cc
index 36f0e8a..bf0b75e 100644
--- a/ui/gfx/gl/gl_context_linux.cc
+++ b/ui/gfx/gl/gl_context_linux.cc
@@ -37,6 +37,19 @@ Display* GetXDisplayHelper() {
return display;
}
+bool IsCompositingWindowManagerActive(Display* display) {
+ // The X macro "None" has been undefined by gl_bindings.h.
+ const int kNone = 0;
+ static Atom net_wm_cm_s0 = kNone;
+ if (net_wm_cm_s0 == kNone) {
+ net_wm_cm_s0 = XInternAtom(display, "_NET_WM_CM_S0", True);
+ }
+ if (net_wm_cm_s0 == kNone) {
+ return false;
+ }
+ return XGetSelectionOwner(display, net_wm_cm_s0) != kNone;
+}
+
} // namespace
namespace gfx {
@@ -335,7 +348,13 @@ void ViewGLContext::SetSwapInterval(int interval) {
DCHECK(IsCurrent());
if (HasExtension("GLX_EXT_swap_control") && glXSwapIntervalEXT) {
Display* display = GetXDisplayHelper();
- glXSwapIntervalEXT(display, window_, interval);
+ // Only enable vsync if we aren't using a compositing window
+ // manager. At the moment, compositing window managers don't
+ // respect this setting anyway (tearing still occurs) and it
+ // dramatically increases latency.
+ if (!IsCompositingWindowManagerActive(display)) {
+ glXSwapIntervalEXT(display, window_, interval);
+ }
}
}