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

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

Issue 75723004: Disable Vsync when Aero Glass is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 161 }
158 162
159 bool ImageTransportHelper::MakeCurrent() { 163 bool ImageTransportHelper::MakeCurrent() {
160 gpu::gles2::GLES2Decoder* decoder = Decoder(); 164 gpu::gles2::GLES2Decoder* decoder = Decoder();
161 if (!decoder) 165 if (!decoder)
162 return false; 166 return false;
163 return decoder->MakeCurrent(); 167 return decoder->MakeCurrent();
164 } 168 }
165 169
166 void ImageTransportHelper::SetSwapInterval(gfx::GLContext* context) { 170 void ImageTransportHelper::SetSwapInterval(gfx::GLContext* context) {
171 #if defined(OS_WIN)
172 // If Aero Glass is enabled, then the renderer will handle ratelimiting and
173 // there's no tearing, so waiting for vsync is unnecessary.
174 if (ui::win::IsAeroGlassEnabled()) {
175 context->SetSwapInterval(0);
176 return;
177 }
178 #endif
167 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableGpuVsync)) 179 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableGpuVsync))
168 context->SetSwapInterval(0); 180 context->SetSwapInterval(0);
169 else 181 else
170 context->SetSwapInterval(1); 182 context->SetSwapInterval(1);
171 } 183 }
172 184
173 void ImageTransportHelper::Suspend() { 185 void ImageTransportHelper::Suspend() {
174 manager_->Send(new GpuHostMsg_AcceleratedSurfaceSuspend(stub_->surface_id())); 186 manager_->Send(new GpuHostMsg_AcceleratedSurfaceSuspend(stub_->surface_id()));
175 } 187 }
176 188
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { 375 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() {
364 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); 376 gfx::VSyncProvider* vsync_provider = GetVSyncProvider();
365 if (vsync_provider) { 377 if (vsync_provider) {
366 vsync_provider->GetVSyncParameters( 378 vsync_provider->GetVSyncParameters(
367 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, 379 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters,
368 helper_->AsWeakPtr())); 380 helper_->AsWeakPtr()));
369 } 381 }
370 } 382 }
371 383
372 } // namespace content 384 } // 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