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

Unified Diff: content/browser/gpu/browser_gpu_memory_buffer_manager.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/gpu/browser_gpu_memory_buffer_manager.h ('k') | content/browser/gpu/compositor_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/browser_gpu_memory_buffer_manager.cc
diff --git a/content/browser/gpu/browser_gpu_memory_buffer_manager.cc b/content/browser/gpu/browser_gpu_memory_buffer_manager.cc
index b7f36b6ad85a95f6a03decacd67e224e21f6a01d..7a5921a2db629d317be0ad1d94f31d88252452f0 100644
--- a/content/browser/gpu/browser_gpu_memory_buffer_manager.cc
+++ b/content/browser/gpu/browser_gpu_memory_buffer_manager.cc
@@ -101,30 +101,8 @@ bool IsNativeGpuMemoryBufferFactoryConfigurationSupported(
GpuMemoryBufferConfigurationSet GetNativeGpuMemoryBufferConfigurations() {
GpuMemoryBufferConfigurationSet configurations;
-#if defined(OS_MACOSX)
- bool enable_native_gpu_memory_buffers =
- !base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableNativeGpuMemoryBuffers);
-#else
- bool enable_native_gpu_memory_buffers =
- base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableNativeGpuMemoryBuffers);
-#endif
-
-#if defined(USE_OZONE) || defined(OS_MACOSX)
- bool force_native_gpu_read_write_formats = true;
-#else
- bool force_native_gpu_read_write_formats = false;
-#endif
- // Disable native buffers when using Mesa.
- if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kUseGL) == gfx::kGLImplementationOSMesaName) {
- enable_native_gpu_memory_buffers = false;
- force_native_gpu_read_write_formats = false;
- }
-
- if (enable_native_gpu_memory_buffers) {
+ if (BrowserGpuMemoryBufferManager::IsNativeGpuMemoryBuffersEnabled()) {
const gfx::BufferFormat kNativeFormats[] = {
gfx::BufferFormat::R_8, gfx::BufferFormat::RGBA_4444,
gfx::BufferFormat::RGBA_8888, gfx::BufferFormat::BGRA_8888,
@@ -141,6 +119,14 @@ GpuMemoryBufferConfigurationSet GetNativeGpuMemoryBufferConfigurations() {
}
}
+#if defined(USE_OZONE) || defined(OS_MACOSX)
+ // Disable native buffers only when using Mesa.
+ bool force_native_gpu_read_write_formats =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kUseGL) != gfx::kGLImplementationOSMesaName;
+#else
+ bool force_native_gpu_read_write_formats = false;
+#endif
if (force_native_gpu_read_write_formats) {
const gfx::BufferFormat kGPUReadWriteFormats[] = {
gfx::BufferFormat::RGBA_8888, gfx::BufferFormat::RGBX_8888,
@@ -223,6 +209,23 @@ BrowserGpuMemoryBufferManager* BrowserGpuMemoryBufferManager::current() {
}
// static
+bool BrowserGpuMemoryBufferManager::IsNativeGpuMemoryBuffersEnabled() {
+ // Disable native buffers when using Mesa.
+ if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kUseGL) == gfx::kGLImplementationOSMesaName) {
+ return false;
+ }
+
+#if defined(OS_MACOSX)
+ return !base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableNativeGpuMemoryBuffers);
+#else
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableNativeGpuMemoryBuffers);
+#endif
+}
+
+// static
uint32 BrowserGpuMemoryBufferManager::GetImageTextureTarget(
gfx::BufferFormat format,
gfx::BufferUsage usage) {
« no previous file with comments | « content/browser/gpu/browser_gpu_memory_buffer_manager.h ('k') | content/browser/gpu/compositor_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698