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

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

Issue 708483003: 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') | ui/gl/gl_surface.cc » ('J')
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
26 namespace content { 22 namespace content {
27 23
28 ImageTransportSurface::ImageTransportSurface() {} 24 ImageTransportSurface::ImageTransportSurface() {}
29 25
30 ImageTransportSurface::~ImageTransportSurface() {} 26 ImageTransportSurface::~ImageTransportSurface() {}
31 27
32 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( 28 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface(
33 GpuChannelManager* manager, 29 GpuChannelManager* manager,
34 GpuCommandBufferStub* stub, 30 GpuCommandBufferStub* stub,
35 const gfx::GLSurfaceHandle& handle) { 31 const gfx::GLSurfaceHandle& handle) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 142 }
147 143
148 bool ImageTransportHelper::MakeCurrent() { 144 bool ImageTransportHelper::MakeCurrent() {
149 gpu::gles2::GLES2Decoder* decoder = Decoder(); 145 gpu::gles2::GLES2Decoder* decoder = Decoder();
150 if (!decoder) 146 if (!decoder)
151 return false; 147 return false;
152 return decoder->MakeCurrent(); 148 return decoder->MakeCurrent();
153 } 149 }
154 150
155 void ImageTransportHelper::SetSwapInterval(gfx::GLContext* context) { 151 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
164 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableGpuVsync)) 152 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableGpuVsync))
165 context->SetSwapInterval(0); 153 context->SetSwapInterval(0);
166 else 154 else
167 context->SetSwapInterval(1); 155 context->SetSwapInterval(1);
168 } 156 }
169 157
170 gpu::GpuScheduler* ImageTransportHelper::Scheduler() { 158 gpu::GpuScheduler* ImageTransportHelper::Scheduler() {
171 if (!stub_.get()) 159 if (!stub_.get())
172 return NULL; 160 return NULL;
173 return stub_->scheduler(); 161 return stub_->scheduler();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { 285 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() {
298 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); 286 gfx::VSyncProvider* vsync_provider = GetVSyncProvider();
299 if (vsync_provider) { 287 if (vsync_provider) {
300 vsync_provider->GetVSyncParameters( 288 vsync_provider->GetVSyncParameters(
301 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, 289 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters,
302 helper_->AsWeakPtr())); 290 helper_->AsWeakPtr()));
303 } 291 }
304 } 292 }
305 293
306 } // namespace content 294 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/gl/gl_context_egl.cc » ('j') | ui/gl/gl_surface.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698