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

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

Issue 299443020: Disable Vsync when Aero Glass is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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/sync_point_manager.h" 15 #include "content/common/gpu/sync_point_manager.h"
16 #include "content/common/gpu/texture_image_transport_surface.h" 16 #include "content/common/gpu/texture_image_transport_surface.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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 154 }
151 155
152 bool ImageTransportHelper::MakeCurrent() { 156 bool ImageTransportHelper::MakeCurrent() {
153 gpu::gles2::GLES2Decoder* decoder = Decoder(); 157 gpu::gles2::GLES2Decoder* decoder = Decoder();
154 if (!decoder) 158 if (!decoder)
155 return false; 159 return false;
156 return decoder->MakeCurrent(); 160 return decoder->MakeCurrent();
157 } 161 }
158 162
159 void ImageTransportHelper::SetSwapInterval(gfx::GLContext* context) { 163 void ImageTransportHelper::SetSwapInterval(gfx::GLContext* context) {
164 #if defined(OS_WIN)
165 // If Aero Glass is enabled, then the renderer will handle ratelimiting and
166 // there's no tearing, so waiting for vsync is unnecessary.
167 if (ui::win::IsAeroGlassEnabled()) {
168 context->SetSwapInterval(0);
169 return;
170 }
171 #endif
160 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableGpuVsync)) 172 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableGpuVsync))
161 context->SetSwapInterval(0); 173 context->SetSwapInterval(0);
162 else 174 else
163 context->SetSwapInterval(1); 175 context->SetSwapInterval(1);
164 } 176 }
165 177
166 void ImageTransportHelper::Suspend() { 178 void ImageTransportHelper::Suspend() {
167 manager_->Send(new GpuHostMsg_AcceleratedSurfaceSuspend(stub_->surface_id())); 179 manager_->Send(new GpuHostMsg_AcceleratedSurfaceSuspend(stub_->surface_id()));
168 } 180 }
169 181
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { 302 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() {
291 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); 303 gfx::VSyncProvider* vsync_provider = GetVSyncProvider();
292 if (vsync_provider) { 304 if (vsync_provider) {
293 vsync_provider->GetVSyncParameters( 305 vsync_provider->GetVSyncParameters(
294 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, 306 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters,
295 helper_->AsWeakPtr())); 307 helper_->AsWeakPtr()));
296 } 308 }
297 } 309 }
298 310
299 } // namespace content 311 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698