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

Side by Side Diff: content/common/gpu/image_transport_surface.cc

Issue 710393003: Revert of Allow Windows to use system Vsync for a single window each swap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/gl/gl_context_egl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/image_transport_surface.h" 5 #include "content/common/gpu/image_transport_surface.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "content/common/gpu/gpu_channel.h" 11 #include "content/common/gpu/gpu_channel.h"
12 #include "content/common/gpu/gpu_channel_manager.h" 12 #include "content/common/gpu/gpu_channel_manager.h"
13 #include "content/common/gpu/gpu_command_buffer_stub.h" 13 #include "content/common/gpu/gpu_command_buffer_stub.h"
14 #include "content/common/gpu/gpu_messages.h" 14 #include "content/common/gpu/gpu_messages.h"
15 #include "content/common/gpu/null_transport_surface.h" 15 #include "content/common/gpu/null_transport_surface.h"
16 #include "content/common/gpu/sync_point_manager.h" 16 #include "content/common/gpu/sync_point_manager.h"
17 #include "gpu/command_buffer/service/gpu_scheduler.h" 17 #include "gpu/command_buffer/service/gpu_scheduler.h"
18 #include "ui/gfx/vsync_provider.h" 18 #include "ui/gfx/vsync_provider.h"
19 #include "ui/gl/gl_implementation.h" 19 #include "ui/gl/gl_implementation.h"
20 #include "ui/gl/gl_switches.h" 20 #include "ui/gl/gl_switches.h"
21 21
22 #if defined(OS_WIN)
23 #include "ui/base/win/shell.h"
24 #endif
25
22 namespace content { 26 namespace content {
23 27
24 ImageTransportSurface::ImageTransportSurface() {} 28 ImageTransportSurface::ImageTransportSurface() {}
25 29
26 ImageTransportSurface::~ImageTransportSurface() {} 30 ImageTransportSurface::~ImageTransportSurface() {}
27 31
28 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( 32 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface(
29 GpuChannelManager* manager, 33 GpuChannelManager* manager,
30 GpuCommandBufferStub* stub, 34 GpuCommandBufferStub* stub,
31 const gfx::GLSurfaceHandle& handle) { 35 const gfx::GLSurfaceHandle& handle) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 146 }
143 147
144 bool ImageTransportHelper::MakeCurrent() { 148 bool ImageTransportHelper::MakeCurrent() {
145 gpu::gles2::GLES2Decoder* decoder = Decoder(); 149 gpu::gles2::GLES2Decoder* decoder = Decoder();
146 if (!decoder) 150 if (!decoder)
147 return false; 151 return false;
148 return decoder->MakeCurrent(); 152 return decoder->MakeCurrent();
149 } 153 }
150 154
151 void ImageTransportHelper::SetSwapInterval(gfx::GLContext* context) { 155 void ImageTransportHelper::SetSwapInterval(gfx::GLContext* context) {
156 #if defined(OS_WIN)
157 // If Aero Glass is enabled, then the renderer will handle ratelimiting and
158 // there's no tearing, so waiting for vsync is unnecessary.
159 if (ui::win::IsAeroGlassEnabled()) {
160 context->SetSwapInterval(0);
161 return;
162 }
163 #endif
152 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableGpuVsync)) 164 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableGpuVsync))
153 context->SetSwapInterval(0); 165 context->SetSwapInterval(0);
154 else 166 else
155 context->SetSwapInterval(1); 167 context->SetSwapInterval(1);
156 } 168 }
157 169
158 gpu::GpuScheduler* ImageTransportHelper::Scheduler() { 170 gpu::GpuScheduler* ImageTransportHelper::Scheduler() {
159 if (!stub_.get()) 171 if (!stub_.get())
160 return NULL; 172 return NULL;
161 return stub_->scheduler(); 173 return stub_->scheduler();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { 297 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() {
286 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); 298 gfx::VSyncProvider* vsync_provider = GetVSyncProvider();
287 if (vsync_provider) { 299 if (vsync_provider) {
288 vsync_provider->GetVSyncParameters( 300 vsync_provider->GetVSyncParameters(
289 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, 301 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters,
290 helper_->AsWeakPtr())); 302 helper_->AsWeakPtr()));
291 } 303 }
292 } 304 }
293 305
294 } // namespace content 306 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/gl/gl_context_egl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698