OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser_gpu_memory_buffer_manager.h" | 5 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 if (IsNativeGpuMemoryBufferFactoryConfigurationSupported(format, usage)) | 100 if (IsNativeGpuMemoryBufferFactoryConfigurationSupported(format, usage)) |
101 configurations.insert(std::make_pair(format, usage)); | 101 configurations.insert(std::make_pair(format, usage)); |
102 } | 102 } |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 #if defined(USE_OZONE) || defined(OS_MACOSX) | 106 #if defined(USE_OZONE) || defined(OS_MACOSX) |
107 // Disable native buffers only when using Mesa. | 107 // Disable native buffers only when using Mesa. |
108 bool force_native_gpu_read_write_formats = | 108 bool force_native_gpu_read_write_formats = |
109 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 109 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
110 switches::kUseGL) != gfx::kGLImplementationOSMesaName; | 110 switches::kUseGL) != gl::kGLImplementationOSMesaName; |
111 #else | 111 #else |
112 bool force_native_gpu_read_write_formats = false; | 112 bool force_native_gpu_read_write_formats = false; |
113 #endif | 113 #endif |
114 if (force_native_gpu_read_write_formats) { | 114 if (force_native_gpu_read_write_formats) { |
115 const gfx::BufferFormat kGPUReadWriteFormats[] = { | 115 const gfx::BufferFormat kGPUReadWriteFormats[] = { |
116 gfx::BufferFormat::BGR_565, gfx::BufferFormat::RGBA_8888, | 116 gfx::BufferFormat::BGR_565, gfx::BufferFormat::RGBA_8888, |
117 gfx::BufferFormat::RGBX_8888, gfx::BufferFormat::BGRA_8888, | 117 gfx::BufferFormat::RGBX_8888, gfx::BufferFormat::BGRA_8888, |
118 gfx::BufferFormat::BGRX_8888, gfx::BufferFormat::UYVY_422, | 118 gfx::BufferFormat::BGRX_8888, gfx::BufferFormat::UYVY_422, |
119 gfx::BufferFormat::YUV_420_BIPLANAR}; | 119 gfx::BufferFormat::YUV_420_BIPLANAR}; |
120 const gfx::BufferUsage kGPUReadWriteUsages[] = { | 120 const gfx::BufferUsage kGPUReadWriteUsages[] = { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 // static | 210 // static |
211 BrowserGpuMemoryBufferManager* BrowserGpuMemoryBufferManager::current() { | 211 BrowserGpuMemoryBufferManager* BrowserGpuMemoryBufferManager::current() { |
212 return g_gpu_memory_buffer_manager; | 212 return g_gpu_memory_buffer_manager; |
213 } | 213 } |
214 | 214 |
215 // static | 215 // static |
216 bool BrowserGpuMemoryBufferManager::IsNativeGpuMemoryBuffersEnabled() { | 216 bool BrowserGpuMemoryBufferManager::IsNativeGpuMemoryBuffersEnabled() { |
217 // Disable native buffers when using Mesa. | 217 // Disable native buffers when using Mesa. |
218 if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 218 if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
219 switches::kUseGL) == gfx::kGLImplementationOSMesaName) { | 219 switches::kUseGL) == gl::kGLImplementationOSMesaName) { |
220 return false; | 220 return false; |
221 } | 221 } |
222 | 222 |
223 #if defined(OS_MACOSX) | 223 #if defined(OS_MACOSX) |
224 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | 224 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
225 switches::kDisableNativeGpuMemoryBuffers); | 225 switches::kDisableNativeGpuMemoryBuffers); |
226 #else | 226 #else |
227 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 227 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
228 switches::kEnableNativeGpuMemoryBuffers); | 228 switches::kEnableNativeGpuMemoryBuffers); |
229 #endif | 229 #endif |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 : size(other.size), | 840 : size(other.size), |
841 type(other.type), | 841 type(other.type), |
842 format(other.format), | 842 format(other.format), |
843 usage(other.usage), | 843 usage(other.usage), |
844 gpu_host_id(other.gpu_host_id), | 844 gpu_host_id(other.gpu_host_id), |
845 buffer(std::move(other.buffer)) {} | 845 buffer(std::move(other.buffer)) {} |
846 | 846 |
847 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {} | 847 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {} |
848 | 848 |
849 } // namespace content | 849 } // namespace content |
OLD | NEW |