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

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

Issue 7618050: Improve GPU software rendering list histograms. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_data_manager.h" 5 #include "content/browser/gpu/gpu_data_manager.h"
6 6
7 #if defined(OS_MACOSX) 7 #if defined(OS_MACOSX)
8 #include <CoreGraphics/CGDisplayConfiguration.h> 8 #include <CoreGraphics/CGDisplayConfiguration.h>
9 #endif 9 #endif
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/sys_info.h"
16 #include "base/values.h"
17 #include "base/version.h"
15 #include "content/browser/browser_thread.h" 18 #include "content/browser/browser_thread.h"
16 #include "content/browser/gpu/gpu_blacklist.h" 19 #include "content/browser/gpu/gpu_blacklist.h"
17 #include "content/browser/gpu/gpu_process_host.h" 20 #include "content/browser/gpu/gpu_process_host.h"
18 #include "content/common/content_client.h" 21 #include "content/common/content_client.h"
19 #include "content/common/content_switches.h" 22 #include "content/common/content_switches.h"
20 #include "content/common/gpu/gpu_messages.h" 23 #include "content/common/gpu/gpu_messages.h"
21 #include "content/gpu/gpu_info_collector.h" 24 #include "content/gpu/gpu_info_collector.h"
22 #include "ui/gfx/gl/gl_implementation.h" 25 #include "ui/gfx/gl/gl_implementation.h"
23 #include "ui/gfx/gl/gl_switches.h" 26 #include "ui/gfx/gl/gl_switches.h"
24 27
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 it != node.children.end(); 75 it != node.children.end();
73 ++it) { 76 ++it) {
74 ListValue* sublist = DxDiagNodeToList(it->second); 77 ListValue* sublist = DxDiagNodeToList(it->second);
75 list->Append(NewDescriptionValuePair(it->first, sublist)); 78 list->Append(NewDescriptionValuePair(it->first, sublist));
76 } 79 }
77 return list; 80 return list;
78 } 81 }
79 82
80 #endif // OS_WIN 83 #endif // OS_WIN
81 84
85 std::string GetOSString() {
86 std::string rt;
87 #if defined(OS_CHROMEOS)
88 rt = "ChromeOS";
89 #elif defined(OS_WIN)
90 rt = "Win";
91 std::string version_str = base::SysInfo::OperatingSystemVersion();
92 size_t pos = version_str.find_first_not_of("0123456789.");
93 if (pos != std::string::npos)
94 version_str = version_str.substr(0, pos);
95 scoped_ptr<Version> os_version(Version::GetVersionFromString(version_str));
96 if (os_version.get() && os_version->components().size() >= 2) {
97 const std::vector<uint16>& version_numbers = os_version->components();
98 if (version_numbers[0] == 5)
99 rt += "XP";
100 else if (version_numbers[0] == 6 && version_numbers[1] == 0)
101 rt += "Vista";
102 else if (version_numbers[0] == 6 && version_numbers[1] == 1)
103 rt += "7";
104 }
105 #elif defined(OS_LINUX)
106 rt = "Linux";
107 #elif defined(OS_MACOSX)
108 rt = "Mac";
109 #else
110 rt = "UnknownOS";
111 #endif
112 return rt;
113 }
114
82 } // namespace anonymous 115 } // namespace anonymous
83 116
84 GpuDataManager::GpuDataManager() 117 GpuDataManager::GpuDataManager()
85 : complete_gpu_info_already_requested_(false) { 118 : complete_gpu_info_already_requested_(false) {
86 // Certain tests doesn't go through the browser startup path that 119 // Certain tests doesn't go through the browser startup path that
87 // initializes GpuDataManager on FILE thread; therefore, it is initialized 120 // initializes GpuDataManager on FILE thread; therefore, it is initialized
88 // on UI thread later, and we skip the preliminary gpu info collection 121 // on UI thread later, and we skip the preliminary gpu info collection
89 // in such situation. 122 // in such situation.
90 if (!BrowserThread::CurrentlyOn(BrowserThread::FILE)) 123 if (!BrowserThread::CurrentlyOn(BrowserThread::FILE))
91 return; 124 return;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 gpu_feature_flags_.set_flags(0); 387 gpu_feature_flags_.set_flags(0);
355 return; 388 return;
356 } 389 }
357 390
358 { 391 {
359 base::AutoLock auto_lock(gpu_info_lock_); 392 base::AutoLock auto_lock(gpu_info_lock_);
360 gpu_feature_flags_ = gpu_blacklist->DetermineGpuFeatureFlags( 393 gpu_feature_flags_ = gpu_blacklist->DetermineGpuFeatureFlags(
361 GpuBlacklist::kOsAny, NULL, gpu_info_); 394 GpuBlacklist::kOsAny, NULL, gpu_info_);
362 } 395 }
363 396
364 uint32 max_entry_id = gpu_blacklist->max_entry_id();
365 if (!gpu_feature_flags_.flags()) {
366 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry",
367 0, max_entry_id + 1);
368 return;
369 }
370
371 // Notify clients that GpuInfo state has changed 397 // Notify clients that GpuInfo state has changed
372 RunGpuInfoUpdateCallbacks(); 398 RunGpuInfoUpdateCallbacks();
373 399
374 // TODO(zmo): move histograming to GpuBlacklist::DetermineGpuFeatureFlags. 400 const GpuFeatureFlags::GpuFeatureType kGpuFeatures[] = {
375 std::vector<uint32> flag_entries; 401 GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas,
376 gpu_blacklist->GetGpuFeatureFlagEntries( 402 GpuFeatureFlags::kGpuFeatureAcceleratedCompositing,
377 GpuFeatureFlags::kGpuFeatureAll, flag_entries); 403 GpuFeatureFlags::kGpuFeatureWebgl
378 DCHECK_GT(flag_entries.size(), 0u); 404 };
379 for (size_t i = 0; i < flag_entries.size(); ++i) { 405 const size_t kNumFeatures =
406 sizeof(kGpuFeatures) / sizeof(GpuFeatureFlags::GpuFeatureType);
407
408 uint32 flags = gpu_feature_flags_.flags();
409 uint32 max_entry_id = gpu_blacklist->max_entry_id();
410 if (flags == 0) {
vangelis 2011/08/18 06:06:44 shouldn't you also include here the case where fla
Zhenyao Mo 2011/08/18 18:16:10 We have an entry which counts the number of use-ca
vangelis 2011/08/18 21:05:41 Why do we then just explicitly skip the multisampl
Zhenyao Mo 2011/08/18 23:47:18 Ah you are right. Fixed.
380 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry", 411 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry",
381 flag_entries[i], max_entry_id + 1); 412 0, max_entry_id + 1);
413 } else {
414 std::vector<uint32> flag_entries;
415 uint32 features = 0;
416 // We don't use GpuFeatureFlags::kGpuFeatureAll because we want to leave
417 // disabled multisampling out.
418 for (size_t i = 0; i < kNumFeatures; ++i)
419 features |= kGpuFeatures[i];
420 gpu_blacklist->GetGpuFeatureFlagEntries(
421 static_cast<GpuFeatureFlags::GpuFeatureType>(features), flag_entries);
422 DCHECK_GT(flag_entries.size(), 0u);
423 for (size_t i = 0; i < flag_entries.size(); ++i) {
424 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry",
425 flag_entries[i], max_entry_id + 1);
426 }
427 }
428
429 const std::string kOSString = GetOSString();
430 const std::string kGpuBlacklistFeatureHistogramNames[] = {
431 "GPU.BlacklistAccelerated2dCanvasTestResults" + kOSString,
432 "GPU.BlacklistAcceleratedCompositingTestResults" + kOSString,
433 "GPU.BlacklistWebglTestResults" + kOSString
434 };
435 for (size_t i = 0; i < kNumFeatures; ++i) {
436 // We can't use UMA_HISTOGRAM_ENUMERATION here because the same name is
437 // expected if the macro is used within a loop.
438 base::Histogram* histogram_pointer = base::LinearHistogram::FactoryGet(
439 kGpuBlacklistFeatureHistogramNames[i], 1, 2, 3,
440 base::Histogram::kUmaTargetedHistogramFlag);
441 histogram_pointer->Add(((flags & kGpuFeatures[i]) == 0) ? 0 : 1);
vangelis 2011/08/18 06:06:44 Could the expression above be simplified as (flags
Zhenyao Mo 2011/08/18 18:16:10 Done.
Zhenyao Mo 2011/08/18 20:12:28 The Windows try bot fails to compile because of th
382 } 442 }
383 } 443 }
384 444
385 GpuBlacklist* GpuDataManager::GetGpuBlacklist() { 445 GpuBlacklist* GpuDataManager::GetGpuBlacklist() {
386 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 446 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
387 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 447 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
388 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || 448 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) ||
389 browser_command_line.GetSwitchValueASCII( 449 browser_command_line.GetSwitchValueASCII(
390 switches::kUseGL) == gfx::kGLImplementationOSMesaName) 450 switches::kUseGL) == gfx::kGLImplementationOSMesaName)
391 return NULL; 451 return NULL;
392 // No need to return an empty blacklist. 452 // No need to return an empty blacklist.
393 if (gpu_blacklist_.get() != NULL && gpu_blacklist_->max_entry_id() == 0) 453 if (gpu_blacklist_.get() != NULL && gpu_blacklist_->max_entry_id() == 0)
394 return NULL; 454 return NULL;
395 return gpu_blacklist_.get(); 455 return gpu_blacklist_.get();
396 } 456 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698