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

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

Issue 1375663002: Show GpuMemoryBuffer feature in chrome://gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use IsNativeGpuMemoryBufferConfiguration 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/gpu_internals_ui.cc
diff --git a/content/browser/gpu/gpu_internals_ui.cc b/content/browser/gpu/gpu_internals_ui.cc
index c30afe09621e4dde6d2c4af7da5ec1ec8ce58289..dec8f71b6bf97488d5294d25de1fcfe3814c9296 100644
--- a/content/browser/gpu/gpu_internals_ui.cc
+++ b/content/browser/gpu/gpu_internals_ui.cc
@@ -19,6 +19,7 @@
#include "base/strings/stringprintf.h"
#include "base/sys_info.h"
#include "base/values.h"
+#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/grit/content_resources.h"
@@ -232,6 +233,69 @@ base::DictionaryValue* GpuInfoAsDictionaryValue() {
return info;
}
+const char* NativeBufferFormatToString(gfx::BufferFormat format) {
reveman 2015/10/27 23:20:36 nit: Remove "Native" prefix
vignatti (out of this project) 2015/10/28 14:17:28 Done.
+ switch (format) {
+ case gfx::BufferFormat::R_8:
+ return "R_8";
+ case gfx::BufferFormat::RGBA_4444:
+ return "RGBA_4444";
+ case gfx::BufferFormat::RGBA_8888:
+ return "RGBA_8888";
+ case gfx::BufferFormat::BGRA_8888:
+ return "BGRA_8888";
+ case gfx::BufferFormat::UYVY_422:
+ return "UYVY_422";
+ case gfx::BufferFormat::YUV_420_BIPLANAR:
+ return "YUV_420_BIPLANAR";
+ default:
reveman 2015/10/27 23:20:35 nit: remove default case, include all formats and
vignatti (out of this project) 2015/10/28 14:17:28 Done.
+ NOTREACHED();
+ return "";
+ }
+}
+
+const char* NativeBufferUsageToString(gfx::BufferUsage usage) {
reveman 2015/10/27 23:20:36 nit: Remove "Native" prefix
vignatti (out of this project) 2015/10/28 14:17:28 Done.
+ switch (usage) {
+ case gfx::BufferUsage::GPU_READ:
+ return "GPU_READ";
+ case gfx::BufferUsage::GPU_READ_WRITE:
+ return "GPU_READ_WRITE";
+ case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
+ return "GPU_READ_CPU_READ_WRITE";
+ case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
+ return "GPU_READ_CPU_READ_WRITE_PERSISTENT";
+ }
+}
reveman 2015/10/27 23:20:35 NOTREACHED(); return nullptr;
vignatti (out of this project) 2015/10/28 14:17:28 Done.
+
+base::DictionaryValue* GmbInfoAsDictionaryValue() {
reveman 2015/10/27 23:20:36 nit: Gmb -> GpuMemoryBuffer. please avoid the GMB
vignatti (out of this project) 2015/10/28 14:17:28 Done.
+ base::ListValue* gmb_info = new base::ListValue();
reveman 2015/10/27 23:20:36 nit: gmb -> gpu_memory_buffer
vignatti (out of this project) 2015/10/28 14:17:28 Done.
+ gmb_info->Append(NewDescriptionValuePair("Native Formats", "Usage"));
+
+ BrowserGpuMemoryBufferManager* gmb_manager =
reveman 2015/10/27 23:20:36 nit: gmb -> gpu_memory_buffer
vignatti (out of this project) 2015/10/28 14:17:28 Done.
+ BrowserGpuMemoryBufferManager::current();
+
+ 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};
reveman 2015/10/27 23:20:36 I don't think this code should assume that only th
+ const gfx::BufferUsage kNativeUsages[] = {
+ gfx::BufferUsage::GPU_READ, gfx::BufferUsage::GPU_READ_WRITE,
+ gfx::BufferUsage::GPU_READ_CPU_READ_WRITE,
+ gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT};
reveman 2015/10/27 23:20:35 can you use gfx::BufferUsage::LAST and gfx::Buffer
vignatti (out of this project) 2015/10/28 14:17:28 hmm with this the code became not so clear now, bu
+ for (auto& format : kNativeFormats) {
+ for (auto& usage : kNativeUsages) {
+ if (gmb_manager->IsNativeGpuMemoryBufferConfiguration(format, usage))
+ gmb_info->Append(NewDescriptionValuePair(
+ NativeBufferFormatToString(format),
+ NativeBufferUsageToString(usage)));
+ }
+ }
+
+ base::DictionaryValue* info = new base::DictionaryValue();
+ info->Set("gmb_info", gmb_info);
reveman 2015/10/27 23:20:35 gmb -> gpu_memory_buffer
vignatti (out of this project) 2015/10/28 14:17:29 Done.
+
+ return info;
+}
+
// This class receives javascript messages from the renderer.
// Note that the WebUI infrastructure runs on the UI thread, therefore all of
// this class's methods are expected to run on the UI thread.
@@ -409,6 +473,17 @@ void GpuMessageHandler::OnGpuInfoUpdate() {
// Send GPU Info to javascript.
web_ui()->CallJavascriptFunction("browserBridge.onGpuInfoUpdate",
*(gpu_info_val.get()));
+
+ // Get GpuMemoryBuffer Info.
+ scoped_ptr<base::DictionaryValue> gmb_info_val(GmbInfoAsDictionaryValue());
reveman 2015/10/27 23:20:36 gmb -> gpu_memory_buffer
+
+ // Add in blacklisting features
reveman 2015/10/27 23:20:36 blacklisting features?
vignatti (out of this project) 2015/10/28 14:17:29 Done.
+ base::DictionaryValue* gmb_status = new base::DictionaryValue;
reveman 2015/10/27 23:20:35 gmb -> gpu_memory_buffer
vignatti (out of this project) 2015/10/28 14:17:28 Done.
+ gmb_info_val->Set("gbmStatus", gmb_status);
reveman 2015/10/27 23:20:36 gmb -> gpu_memory_buffer
vignatti (out of this project) 2015/10/28 14:17:28 Done.
+
+ // Send GMB Info to javascript.
reveman 2015/10/27 23:20:36 gmb -> gpu_memory_buffer
vignatti (out of this project) 2015/10/28 14:17:29 Done.
+ web_ui()->CallJavascriptFunction("browserBridge.onGmbInfoUpdate",
+ *(gmb_info_val.get()));
reveman 2015/10/27 23:20:36 gmb -> gpu_memory_buffer
vignatti (out of this project) 2015/10/28 14:17:29 Done.
}
void GpuMessageHandler::OnGpuSwitched() {

Powered by Google App Engine
This is Rietveld 408576698