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

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

Issue 749483002: Allow Windows to use system Vsync if only one window is swapping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Linux nit Created 5 years, 11 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 | ui/gl/gl_context_egl.h » ('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 "gpu/command_buffer/service/sync_point_manager.h" 16 #include "gpu/command_buffer/service/sync_point_manager.h"
17 #include "ui/gfx/vsync_provider.h" 17 #include "ui/gfx/vsync_provider.h"
18 #include "ui/gl/gl_implementation.h" 18 #include "ui/gl/gl_implementation.h"
19 #include "ui/gl/gl_switches.h" 19 #include "ui/gl/gl_switches.h"
20 20
21 #if defined(OS_WIN)
22 #include "ui/base/win/shell.h"
23 #endif
24
25 namespace content { 21 namespace content {
26 22
27 ImageTransportSurface::ImageTransportSurface() {} 23 ImageTransportSurface::ImageTransportSurface() {}
28 24
29 ImageTransportSurface::~ImageTransportSurface() {} 25 ImageTransportSurface::~ImageTransportSurface() {}
30 26
31 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( 27 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface(
32 GpuChannelManager* manager, 28 GpuChannelManager* manager,
33 GpuCommandBufferStub* stub, 29 GpuCommandBufferStub* stub,
34 const gfx::GLSurfaceHandle& handle) { 30 const gfx::GLSurfaceHandle& handle) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 126 }
131 127
132 bool ImageTransportHelper::MakeCurrent() { 128 bool ImageTransportHelper::MakeCurrent() {
133 gpu::gles2::GLES2Decoder* decoder = Decoder(); 129 gpu::gles2::GLES2Decoder* decoder = Decoder();
134 if (!decoder) 130 if (!decoder)
135 return false; 131 return false;
136 return decoder->MakeCurrent(); 132 return decoder->MakeCurrent();
137 } 133 }
138 134
139 void ImageTransportHelper::SetSwapInterval(gfx::GLContext* context) { 135 void ImageTransportHelper::SetSwapInterval(gfx::GLContext* context) {
140 #if defined(OS_WIN)
141 // If Aero Glass is enabled, then the renderer will handle ratelimiting and
142 // there's no tearing, so waiting for vsync is unnecessary.
143 if (ui::win::IsAeroGlassEnabled()) {
144 context->ForceSwapIntervalZero(true);
145 return;
146 }
147 #endif
148 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 136 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
149 switches::kDisableGpuVsync)) 137 switches::kDisableGpuVsync))
150 context->ForceSwapIntervalZero(true); 138 context->ForceSwapIntervalZero(true);
151 else 139 else
152 context->SetSwapInterval(1); 140 context->SetSwapInterval(1);
153 } 141 }
154 142
155 gpu::gles2::GLES2Decoder* ImageTransportHelper::Decoder() { 143 gpu::gles2::GLES2Decoder* ImageTransportHelper::Decoder() {
156 if (!stub_.get()) 144 if (!stub_.get())
157 return NULL; 145 return NULL;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { 267 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() {
280 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); 268 gfx::VSyncProvider* vsync_provider = GetVSyncProvider();
281 if (vsync_provider) { 269 if (vsync_provider) {
282 vsync_provider->GetVSyncParameters( 270 vsync_provider->GetVSyncParameters(
283 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, 271 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters,
284 helper_->AsWeakPtr())); 272 helper_->AsWeakPtr()));
285 } 273 }
286 } 274 }
287 275
288 } // namespace content 276 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/gl/gl_context_egl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698