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

Unified Diff: content/browser/gpu/browser_gpu_memory_buffer_manager.cc

Issue 1375663002: Show GpuMemoryBuffer feature in chrome://gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: display a matrix of formats and usages Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
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 1832ce5178c67a93111af9961b489f37987ee111..efc5068668db09d28055501bdf772c79db0f1b46 100644
--- a/content/browser/gpu/browser_gpu_memory_buffer_manager.cc
+++ b/content/browser/gpu/browser_gpu_memory_buffer_manager.cc
@@ -156,6 +156,44 @@ GpuMemoryBufferConfigurationSet GetNativeGpuMemoryBufferConfigurations() {
return configurations;
}
+// TODO(vignatti): extract the commonalities with function
+// GetNativeGpuMemoryBufferConfigurations.
+GpuMemoryBufferConfigurationList GetNativeGpuMemoryBufferEnabledSupported() {
+ GpuMemoryBufferConfigurationList 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
+
+ // Disable native buffers when using Mesa.
+ if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kUseGL) == gfx::kGLImplementationOSMesaName) {
+ enable_native_gpu_memory_buffers = false;
+ }
+
+ if (enable_native_gpu_memory_buffers) {
+ const gfx::BufferFormat kNativeFormats[] = {
+ gfx::BufferFormat::R_8, gfx::BufferFormat::RGBA_4444,
+ gfx::BufferFormat::RGBA_8888, gfx::BufferFormat::BGRA_8888,
+ gfx::BufferFormat::UYVY_422, gfx::BufferFormat::YUV_420_BIPLANAR};
+ const gfx::BufferUsage kNativeUsages[] = {gfx::BufferUsage::MAP,
+ gfx::BufferUsage::PERSISTENT_MAP};
+ for (auto& format : kNativeFormats) {
+ for (auto& usage : kNativeUsages) {
+ if (IsNativeGpuMemoryBufferFactoryConfigurationSupported(format, usage))
+ configurations.push_back(std::make_pair(format, usage));
+ }
+ }
+ }
+
+ return configurations;
+}
+
BrowserGpuMemoryBufferManager* g_gpu_memory_buffer_manager = nullptr;
} // namespace
@@ -203,6 +241,7 @@ BrowserGpuMemoryBufferManager::BrowserGpuMemoryBufferManager(
int gpu_client_id,
uint64_t gpu_client_tracing_id)
: native_configurations_(GetNativeGpuMemoryBufferConfigurations()),
+ native_enabled_and_supported_(GetNativeGpuMemoryBufferEnabledSupported()),
gpu_client_id_(gpu_client_id),
gpu_client_tracing_id_(gpu_client_tracing_id),
gpu_host_id_(0) {

Powered by Google App Engine
This is Rietveld 408576698