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

Side by Side Diff: content/browser/gpu/gpu_internals_ui.cc

Issue 1637423004: Show Compositor information in chrome://gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add Compositor Information section Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gpu_internals_ui.h" 5 #include "content/browser/gpu/gpu_internals_ui.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 return "SCANOUT"; 295 return "SCANOUT";
296 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: 296 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
297 return "GPU_READ_CPU_READ_WRITE"; 297 return "GPU_READ_CPU_READ_WRITE";
298 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: 298 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
299 return "GPU_READ_CPU_READ_WRITE_PERSISTENT"; 299 return "GPU_READ_CPU_READ_WRITE_PERSISTENT";
300 } 300 }
301 NOTREACHED(); 301 NOTREACHED();
302 return nullptr; 302 return nullptr;
303 } 303 }
304 304
305 base::DictionaryValue* GpuMemoryBufferInfoAsDictionaryValue() { 305 base::ListValue* CompositorInfo() {
306 base::ListValue* compositor_info = new base::ListValue();
307
308 // Add Tile Update Mode.
309 std::string tile_update_mode;
310 if (BrowserGpuMemoryBufferManager::IsNativeGpuMemoryBuffersEnabled()) {
reveman 2016/01/29 19:49:07 Don't include this here. This information is alrea
dshwang 2016/01/29 19:58:40 Done.
311 tile_update_mode = "Native, ";
312 } else {
313 tile_update_mode = "Software, ";
314 }
315 if (IsZeroCopyUploadEnabled()) {
316 tile_update_mode += "Zero-copy";
317 } else {
318 tile_update_mode += "One-copy";
319 }
320 compositor_info->Append(
321 NewDescriptionValuePair("Tile Update Mode", tile_update_mode));
322
323 // Add Partial Raster
324 compositor_info->Append(NewDescriptionValuePair(
325 "Partial Raster", IsPartialRasterEnabled() ? "Enabled" : "Disabled"));
326 return compositor_info;
327 }
328
329 base::ListValue* GpuMemoryBufferInfo() {
306 base::ListValue* gpu_memory_buffer_info = new base::ListValue(); 330 base::ListValue* gpu_memory_buffer_info = new base::ListValue();
307 331
308 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager = 332 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager =
309 BrowserGpuMemoryBufferManager::current(); 333 BrowserGpuMemoryBufferManager::current();
310 334
311 for (size_t format = 0; 335 for (size_t format = 0;
312 format < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; format++) { 336 format < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; format++) {
313 std::string native_usage_support; 337 std::string native_usage_support;
314 for (size_t usage = 0; 338 for (size_t usage = 0;
315 usage < static_cast<size_t>(gfx::BufferUsage::LAST) + 1; usage++) { 339 usage < static_cast<size_t>(gfx::BufferUsage::LAST) + 1; usage++) {
316 if (gpu_memory_buffer_manager->IsNativeGpuMemoryBufferConfiguration( 340 if (gpu_memory_buffer_manager->IsNativeGpuMemoryBufferConfiguration(
317 static_cast<gfx::BufferFormat>(format), 341 static_cast<gfx::BufferFormat>(format),
318 static_cast<gfx::BufferUsage>(usage))) 342 static_cast<gfx::BufferUsage>(usage)))
319 native_usage_support = base::StringPrintf( 343 native_usage_support = base::StringPrintf(
320 "%s%s %s", native_usage_support.c_str(), 344 "%s%s %s", native_usage_support.c_str(),
321 native_usage_support.empty() ? "" : ",", 345 native_usage_support.empty() ? "" : ",",
322 BufferUsageToString(static_cast<gfx::BufferUsage>(usage))); 346 BufferUsageToString(static_cast<gfx::BufferUsage>(usage)));
323 } 347 }
324 if (native_usage_support.empty()) 348 if (native_usage_support.empty())
325 native_usage_support = base::StringPrintf("Software only"); 349 native_usage_support = base::StringPrintf("Software only");
326 350
327 gpu_memory_buffer_info->Append(NewDescriptionValuePair( 351 gpu_memory_buffer_info->Append(NewDescriptionValuePair(
328 BufferFormatToString(static_cast<gfx::BufferFormat>(format)), 352 BufferFormatToString(static_cast<gfx::BufferFormat>(format)),
329 native_usage_support)); 353 native_usage_support));
330 } 354 }
331 355 return gpu_memory_buffer_info;
332 base::DictionaryValue* info = new base::DictionaryValue();
333 info->Set("gpu_memory_buffer_info", gpu_memory_buffer_info);
334
335 return info;
336 } 356 }
337 357
338 // This class receives javascript messages from the renderer. 358 // This class receives javascript messages from the renderer.
339 // Note that the WebUI infrastructure runs on the UI thread, therefore all of 359 // Note that the WebUI infrastructure runs on the UI thread, therefore all of
340 // this class's methods are expected to run on the UI thread. 360 // this class's methods are expected to run on the UI thread.
341 class GpuMessageHandler 361 class GpuMessageHandler
342 : public WebUIMessageHandler, 362 : public WebUIMessageHandler,
343 public base::SupportsWeakPtr<GpuMessageHandler>, 363 public base::SupportsWeakPtr<GpuMessageHandler>,
344 public GpuDataManagerObserver, 364 public GpuDataManagerObserver,
345 public ui::GpuSwitchingObserver { 365 public ui::GpuSwitchingObserver {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 521
502 // Add in blacklisting features 522 // Add in blacklisting features
503 base::DictionaryValue* feature_status = new base::DictionaryValue; 523 base::DictionaryValue* feature_status = new base::DictionaryValue;
504 feature_status->Set("featureStatus", GetFeatureStatus()); 524 feature_status->Set("featureStatus", GetFeatureStatus());
505 feature_status->Set("problems", GetProblems()); 525 feature_status->Set("problems", GetProblems());
506 base::ListValue* workarounds = new base::ListValue(); 526 base::ListValue* workarounds = new base::ListValue();
507 for (const std::string& workaround : GetDriverBugWorkarounds()) 527 for (const std::string& workaround : GetDriverBugWorkarounds())
508 workarounds->AppendString(workaround); 528 workarounds->AppendString(workaround);
509 feature_status->Set("workarounds", workarounds); 529 feature_status->Set("workarounds", workarounds);
510 gpu_info_val->Set("featureStatus", feature_status); 530 gpu_info_val->Set("featureStatus", feature_status);
531 gpu_info_val->Set("compositorInfo", CompositorInfo());
532 gpu_info_val->Set("gpuMemoryBufferInfo", GpuMemoryBufferInfo());
511 533
512 // Send GPU Info to javascript. 534 // Send GPU Info to javascript.
513 web_ui()->CallJavascriptFunction("browserBridge.onGpuInfoUpdate", 535 web_ui()->CallJavascriptFunction("browserBridge.onGpuInfoUpdate",
514 *(gpu_info_val.get())); 536 *(gpu_info_val.get()));
515
516 // Get GpuMemoryBuffer Info.
517 scoped_ptr<base::DictionaryValue> gpu_memory_buffer_info_val(
518 GpuMemoryBufferInfoAsDictionaryValue());
519
520 // Send GpuMemoryBuffer Info to javascript.
521 web_ui()->CallJavascriptFunction("browserBridge.onGpuMemoryBufferInfoUpdate",
522 *(gpu_memory_buffer_info_val.get()));
523 } 537 }
524 538
525 void GpuMessageHandler::OnGpuSwitched() { 539 void GpuMessageHandler::OnGpuSwitched() {
526 GpuDataManagerImpl::GetInstance()->RequestCompleteGpuInfoIfNeeded(); 540 GpuDataManagerImpl::GetInstance()->RequestCompleteGpuInfoIfNeeded();
527 } 541 }
528 542
529 } // namespace 543 } // namespace
530 544
531 545
532 //////////////////////////////////////////////////////////////////////////////// 546 ////////////////////////////////////////////////////////////////////////////////
533 // 547 //
534 // GpuInternalsUI 548 // GpuInternalsUI
535 // 549 //
536 //////////////////////////////////////////////////////////////////////////////// 550 ////////////////////////////////////////////////////////////////////////////////
537 551
538 GpuInternalsUI::GpuInternalsUI(WebUI* web_ui) 552 GpuInternalsUI::GpuInternalsUI(WebUI* web_ui)
539 : WebUIController(web_ui) { 553 : WebUIController(web_ui) {
540 web_ui->AddMessageHandler(new GpuMessageHandler()); 554 web_ui->AddMessageHandler(new GpuMessageHandler());
541 555
542 // Set up the chrome://gpu/ source. 556 // Set up the chrome://gpu/ source.
543 BrowserContext* browser_context = 557 BrowserContext* browser_context =
544 web_ui->GetWebContents()->GetBrowserContext(); 558 web_ui->GetWebContents()->GetBrowserContext();
545 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource()); 559 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource());
546 } 560 }
547 561
548 } // namespace content 562 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698