Chromium Code Reviews| Index: content/browser/gpu/compositor_util.cc |
| diff --git a/content/browser/gpu/compositor_util.cc b/content/browser/gpu/compositor_util.cc |
| index 216d1da24b6c3facb393e0787fe4f765132f16d9..5a0e20c6989d166c2dffc2912e1add0f67458365 100644 |
| --- a/content/browser/gpu/compositor_util.cc |
| +++ b/content/browser/gpu/compositor_util.cc |
| @@ -12,6 +12,7 @@ |
| #include "build/build_config.h" |
| #include "cc/base/math_util.h" |
| #include "cc/base/switches.h" |
| +#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
| #include "content/browser/gpu/gpu_data_manager_impl.h" |
| #include "content/public/common/content_switches.h" |
| #include "gpu/config/gpu_feature_type.h" |
| @@ -30,6 +31,7 @@ const char* kGpuCompositingFeatureName = "gpu_compositing"; |
| const char* kWebGLFeatureName = "webgl"; |
| const char* kRasterizationFeatureName = "rasterization"; |
| const char* kMultipleRasterThreadsFeatureName = "multiple_raster_threads"; |
| +const char* kGpuMemoryBufferFeatureName = "gpu_memory_buffer"; |
| const int kMinRasterThreads = 1; |
| const int kMaxRasterThreads = 4; |
| @@ -150,6 +152,14 @@ const GpuFeatureInfo GetGpuFeatureInfo(size_t index, bool* eof) { |
| "Raster is using a single thread.", |
| false |
| }, |
| + { |
| + kGpuMemoryBufferFeatureName, |
| + false, |
| + !IsNativeGpuMemoryBufferEnabled(), |
| + "GpuMemoryByffer is using the fall back path through shared memory" |
| + " instead the hardware backed one.", |
|
reveman
2015/09/29 11:58:02
This is not completely true. Just because native G
|
| + true |
| + }, |
| }; |
| DCHECK(index < arraysize(kGpuFeatureInfo)); |
| *eof = (index == arraysize(kGpuFeatureInfo) - 1); |
| @@ -208,6 +218,21 @@ bool IsZeroCopyUploadEnabled() { |
| #endif |
| } |
| +bool IsNativeGpuMemoryBufferEnabled() { |
| + const auto& command_line = *base::CommandLine::ForCurrentProcess(); |
| + bool enabled = |
| + command_line.HasSwitch(switches::kEnableNativeGpuMemoryBuffers); |
| + BrowserGpuMemoryBufferManager* gmb_manager = |
| + BrowserGpuMemoryBufferManager::current(); |
| + |
| + // We need buffer mapping configuration to proper support native GMB. |
|
reveman
2015/09/29 11:58:02
That's why this gets messy and I don't think it's
|
| + enabled &= gmb_manager->IsGpuMemoryBufferConfigurationSupported( |
| + gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::MAP) | |
| + gmb_manager->IsGpuMemoryBufferConfigurationSupported( |
| + gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::PERSISTENT_MAP); |
| + return enabled; |
| +} |
| + |
| bool IsPersistentGpuMemoryBufferEnabled() { |
| // Zero copy currently doesn't take advantage of persistent buffers. |
| if (IsZeroCopyUploadEnabled()) |
| @@ -321,6 +346,13 @@ base::DictionaryValue* GetFeatureStatus() { |
| if (IsForceGpuRasterizationEnabled()) |
| status += "_force"; |
| } |
| + if (gpu_feature_info.name == kGpuMemoryBufferFeatureName) { |
| + status += "_native"; |
| + if (IsZeroCopyUploadEnabled()) |
| + status += "_zero_copy"; |
| + else |
| + status += "_one_copy"; |
| + } |
| if (gpu_feature_info.name == kMultipleRasterThreadsFeatureName) { |
| const base::CommandLine& command_line = |
| *base::CommandLine::ForCurrentProcess(); |