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

Side by Side Diff: content/browser/gpu/compositor_util.cc

Issue 1421293006: Mac: Use GpuMemoryBuffers by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable when native GMBs are disabled Created 5 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
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/browser/gpu/compositor_util.h" 5 #include "content/browser/gpu/compositor_util.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/sys_info.h" 11 #include "base/sys_info.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "cc/base/math_util.h" 13 #include "cc/base/math_util.h"
14 #include "cc/base/switches.h" 14 #include "cc/base/switches.h"
15 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
15 #include "content/browser/gpu/gpu_data_manager_impl.h" 16 #include "content/browser/gpu/gpu_data_manager_impl.h"
16 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
17 #include "gpu/config/gpu_feature_type.h" 18 #include "gpu/config/gpu_feature_type.h"
18 19
19 namespace content { 20 namespace content {
20 21
21 namespace { 22 namespace {
22 23
23 static bool IsGpuRasterizationBlacklisted() { 24 static bool IsGpuRasterizationBlacklisted() {
24 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); 25 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // Zero copy currently doesn't take advantage of partial raster. 213 // Zero copy currently doesn't take advantage of partial raster.
213 if (IsZeroCopyUploadEnabled()) 214 if (IsZeroCopyUploadEnabled())
214 return false; 215 return false;
215 const auto& command_line = *base::CommandLine::ForCurrentProcess(); 216 const auto& command_line = *base::CommandLine::ForCurrentProcess();
216 return command_line.HasSwitch(switches::kEnablePartialRaster); 217 return command_line.HasSwitch(switches::kEnablePartialRaster);
217 } 218 }
218 219
219 bool IsGpuMemoryBufferCompositorResourcesEnabled() { 220 bool IsGpuMemoryBufferCompositorResourcesEnabled() {
220 const base::CommandLine& command_line = 221 const base::CommandLine& command_line =
221 *base::CommandLine::ForCurrentProcess(); 222 *base::CommandLine::ForCurrentProcess();
222 return command_line.HasSwitch( 223 if (command_line.HasSwitch(
223 switches::kEnableGpuMemoryBufferCompositorResources); 224 switches::kEnableGpuMemoryBufferCompositorResources)) {
225 return true;
226 }
227 if (command_line.HasSwitch(
228 switches::kDisableGpuMemoryBufferCompositorResources)) {
229 return false;
230 }
231
232 // Native GPU memory buffers are required.
233 if (!BrowserGpuMemoryBufferManager::IsNativeGpuMemoryBuffersEnabled())
234 return false;
235
236 // GPU rasterization does not support GL_TEXTURE_RECTANGLE_ARB, which is
237 // required by GpuMemoryBuffers on Mac.
238 // http://crbug.com/551072
239 if (IsForceGpuRasterizationEnabled() || IsGpuRasterizationEnabled())
240 return false;
241
242 #if defined(OS_MACOSX)
243 return true;
244 #else
245 return false;
246 #endif
224 } 247 }
225 248
226 bool IsGpuRasterizationEnabled() { 249 bool IsGpuRasterizationEnabled() {
227 const base::CommandLine& command_line = 250 const base::CommandLine& command_line =
228 *base::CommandLine::ForCurrentProcess(); 251 *base::CommandLine::ForCurrentProcess();
229 252
230 if (command_line.HasSwitch(switches::kDisableGpuRasterization)) 253 if (command_line.HasSwitch(switches::kDisableGpuRasterization))
231 return false; 254 return false;
232 else if (command_line.HasSwitch(switches::kEnableGpuRasterization)) 255 else if (command_line.HasSwitch(switches::kEnableGpuRasterization))
233 return true; 256 return true;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 411 }
389 } 412 }
390 return problem_list; 413 return problem_list;
391 } 414 }
392 415
393 std::vector<std::string> GetDriverBugWorkarounds() { 416 std::vector<std::string> GetDriverBugWorkarounds() {
394 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(); 417 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds();
395 } 418 }
396 419
397 } // namespace content 420 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/browser_gpu_memory_buffer_manager.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698