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

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

Issue 1375663002: Show GpuMemoryBuffer feature in chrome://gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix description Created 5 years, 3 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
« no previous file with comments | « content/browser/gpu/compositor_util.h ('k') | content/browser/resources/gpu/info_view.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « content/browser/gpu/compositor_util.h ('k') | content/browser/resources/gpu/info_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698