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

Unified Diff: ui/gl/gl_surface_glx.cc

Issue 2277883003: gl: Disable SGI_video_sync by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: forward flag Created 4 years, 4 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
Index: ui/gl/gl_surface_glx.cc
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc
index 47d32319543a9c50e8129915fb4e92cad268623e..b73f7acde0936ff4f613a3ac9c06eaea064c2235 100644
--- a/ui/gl/gl_surface_glx.cc
+++ b/ui/gl/gl_surface_glx.cc
@@ -9,6 +9,7 @@ extern "C" {
}
#include <memory>
+#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/macros.h"
@@ -403,7 +404,9 @@ bool GLSurfaceGLX::InitializeOneOff() {
HasGLXExtension("GLX_OML_sync_control");
g_glx_get_msc_rate_oml_supported = g_glx_oml_sync_control_supported;
g_glx_sgi_video_sync_supported =
- HasGLXExtension("GLX_SGI_video_sync");
+ HasGLXExtension("GLX_SGI_video_sync") &&
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableSgiVideoSync);
if (!g_glx_get_msc_rate_oml_supported && g_glx_sgi_video_sync_supported)
SGIVideoSyncProviderThreadShim::display_ = gfx::OpenNewXDisplay();
@@ -500,10 +503,22 @@ bool NativeViewGLSurfaceGLX::Initialize(GLSurface::Format format) {
DCHECK(config_);
glx_window_ = glXCreateWindow(g_display, config_, window_, NULL);
- if (g_glx_oml_sync_control_supported)
+ if (g_glx_oml_sync_control_supported) {
vsync_provider_.reset(new OMLSyncControlVSyncProvider(glx_window_));
- else if (g_glx_sgi_video_sync_supported)
+ } else if (g_glx_sgi_video_sync_supported) {
vsync_provider_.reset(new SGIVideoSyncVSyncProvider(config_, glx_window_));
+ } else {
+ // Assume a refresh rate of 59.9 Hz, which will cause us to skip
+ // 1 frame every 10 seconds on a 60Hz monitor, but will prevent us
+ // from blocking the GPU service due to back pressure. This would still
+ // encounter backpressure on a <60Hz monitor, but hopefully that is
+ // not common.
+ const base::TimeTicks kDefaultTimebase;
+ const base::TimeDelta kDefaultInterval =
+ base::TimeDelta::FromSeconds(1) / 59.9;
+ vsync_provider_.reset(
+ new gfx::FixedVSyncProvider(kDefaultTimebase, kDefaultInterval));
+ }
return true;
}
« ui/gfx/vsync_provider.h ('K') | « ui/gfx/vsync_provider.cc ('k') | ui/gl/gl_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698