Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / content / browser / gpu / gpu_data_manager_impl_private.cc
blob1362375f77ec7f2a7e5af1156eb8e2db4f859407
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/browser/gpu/gpu_data_manager_impl_private.h"
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h"
11 #include "base/metrics/histogram.h"
12 #include "base/metrics/sparse_histogram.h"
13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/stringprintf.h"
15 #include "base/sys_info.h"
16 #include "base/trace_event/trace_event.h"
17 #include "base/version.h"
18 #include "cc/base/switches.h"
19 #include "content/browser/gpu/gpu_process_host.h"
20 #include "content/common/gpu/gpu_messages.h"
21 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/gpu_data_manager_observer.h"
23 #include "content/public/common/content_client.h"
24 #include "content/public/common/content_constants.h"
25 #include "content/public/common/content_switches.h"
26 #include "content/public/common/web_preferences.h"
27 #include "gpu/command_buffer/service/gpu_switches.h"
28 #include "gpu/config/gpu_control_list_jsons.h"
29 #include "gpu/config/gpu_driver_bug_workaround_type.h"
30 #include "gpu/config/gpu_feature_type.h"
31 #include "gpu/config/gpu_info_collector.h"
32 #include "gpu/config/gpu_util.h"
33 #include "ui/base/ui_base_switches.h"
34 #include "ui/gl/gl_implementation.h"
35 #include "ui/gl/gl_switches.h"
36 #include "ui/gl/gpu_switching_manager.h"
38 #if defined(OS_MACOSX)
39 #include <ApplicationServices/ApplicationServices.h>
40 #endif // OS_MACOSX
41 #if defined(OS_WIN)
42 #include "base/win/windows_version.h"
43 #endif // OS_WIN
44 #if defined(OS_ANDROID)
45 #include "ui/gfx/android/device_display_info.h"
46 #endif // OS_ANDROID
48 namespace content {
50 namespace {
52 enum GpuFeatureStatus {
53 kGpuFeatureEnabled = 0,
54 kGpuFeatureBlacklisted = 1,
55 kGpuFeatureDisabled = 2, // disabled by user but not blacklisted
56 kGpuFeatureNumStatus
59 #if defined(OS_WIN)
61 enum WinSubVersion {
62 kWinOthers = 0,
63 kWinXP,
64 kWinVista,
65 kWin7,
66 kWin8,
67 kNumWinSubVersions
70 int GetGpuBlacklistHistogramValueWin(GpuFeatureStatus status) {
71 static WinSubVersion sub_version = kNumWinSubVersions;
72 if (sub_version == kNumWinSubVersions) {
73 sub_version = kWinOthers;
74 std::string version_str = base::SysInfo::OperatingSystemVersion();
75 size_t pos = version_str.find_first_not_of("0123456789.");
76 if (pos != std::string::npos)
77 version_str = version_str.substr(0, pos);
78 Version os_version(version_str);
79 if (os_version.IsValid() && os_version.components().size() >= 2) {
80 const std::vector<uint32_t>& version_numbers = os_version.components();
81 if (version_numbers[0] == 5)
82 sub_version = kWinXP;
83 else if (version_numbers[0] == 6 && version_numbers[1] == 0)
84 sub_version = kWinVista;
85 else if (version_numbers[0] == 6 && version_numbers[1] == 1)
86 sub_version = kWin7;
87 else if (version_numbers[0] == 6 && version_numbers[1] == 2)
88 sub_version = kWin8;
91 int entry_index = static_cast<int>(sub_version) * kGpuFeatureNumStatus;
92 switch (status) {
93 case kGpuFeatureEnabled:
94 break;
95 case kGpuFeatureBlacklisted:
96 entry_index++;
97 break;
98 case kGpuFeatureDisabled:
99 entry_index += 2;
100 break;
102 return entry_index;
104 #endif // OS_WIN
106 // Send UMA histograms about the enabled features and GPU properties.
107 void UpdateStats(const gpu::GPUInfo& gpu_info,
108 const gpu::GpuBlacklist* blacklist,
109 const std::set<int>& blacklisted_features) {
110 uint32 max_entry_id = blacklist->max_entry_id();
111 if (max_entry_id == 0) {
112 // GPU Blacklist was not loaded. No need to go further.
113 return;
116 const base::CommandLine& command_line =
117 *base::CommandLine::ForCurrentProcess();
118 bool disabled = false;
120 // Use entry 0 to capture the total number of times that data
121 // was recorded in this histogram in order to have a convenient
122 // denominator to compute blacklist percentages for the rest of the
123 // entries.
124 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry",
125 0, max_entry_id + 1);
127 if (blacklisted_features.size() != 0) {
128 std::vector<uint32> flag_entries;
129 blacklist->GetDecisionEntries(&flag_entries, disabled);
130 DCHECK_GT(flag_entries.size(), 0u);
131 for (size_t i = 0; i < flag_entries.size(); ++i) {
132 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry",
133 flag_entries[i], max_entry_id + 1);
137 // This counts how many users are affected by a disabled entry - this allows
138 // us to understand the impact of an entry before enable it.
139 std::vector<uint32> flag_disabled_entries;
140 disabled = true;
141 blacklist->GetDecisionEntries(&flag_disabled_entries, disabled);
142 for (uint32 disabled_entry : flag_disabled_entries) {
143 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerDisabledEntry",
144 disabled_entry, max_entry_id + 1);
147 const gpu::GpuFeatureType kGpuFeatures[] = {
148 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS,
149 gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING, gpu::GPU_FEATURE_TYPE_WEBGL};
150 const std::string kGpuBlacklistFeatureHistogramNames[] = {
151 "GPU.BlacklistFeatureTestResults.Accelerated2dCanvas",
152 "GPU.BlacklistFeatureTestResults.GpuCompositing",
153 "GPU.BlacklistFeatureTestResults.Webgl", };
154 const bool kGpuFeatureUserFlags[] = {
155 command_line.HasSwitch(switches::kDisableAccelerated2dCanvas),
156 command_line.HasSwitch(switches::kDisableGpu),
157 command_line.HasSwitch(switches::kDisableExperimentalWebGL), };
158 #if defined(OS_WIN)
159 const std::string kGpuBlacklistFeatureHistogramNamesWin[] = {
160 "GPU.BlacklistFeatureTestResultsWindows.Accelerated2dCanvas",
161 "GPU.BlacklistFeatureTestResultsWindows.GpuCompositing",
162 "GPU.BlacklistFeatureTestResultsWindows.Webgl", };
163 #endif
164 const size_t kNumFeatures =
165 sizeof(kGpuFeatures) / sizeof(gpu::GpuFeatureType);
166 for (size_t i = 0; i < kNumFeatures; ++i) {
167 // We can't use UMA_HISTOGRAM_ENUMERATION here because the same name is
168 // expected if the macro is used within a loop.
169 GpuFeatureStatus value = kGpuFeatureEnabled;
170 if (blacklisted_features.count(kGpuFeatures[i]))
171 value = kGpuFeatureBlacklisted;
172 else if (kGpuFeatureUserFlags[i])
173 value = kGpuFeatureDisabled;
174 base::HistogramBase* histogram_pointer = base::LinearHistogram::FactoryGet(
175 kGpuBlacklistFeatureHistogramNames[i],
176 1, kGpuFeatureNumStatus, kGpuFeatureNumStatus + 1,
177 base::HistogramBase::kUmaTargetedHistogramFlag);
178 histogram_pointer->Add(value);
179 #if defined(OS_WIN)
180 histogram_pointer = base::LinearHistogram::FactoryGet(
181 kGpuBlacklistFeatureHistogramNamesWin[i],
182 1, kNumWinSubVersions * kGpuFeatureNumStatus,
183 kNumWinSubVersions * kGpuFeatureNumStatus + 1,
184 base::HistogramBase::kUmaTargetedHistogramFlag);
185 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value));
186 #endif
189 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.GLResetNotificationStrategy",
190 gpu_info.gl_reset_notification_strategy);
193 // Combine the integers into a string, seperated by ','.
194 std::string IntSetToString(const std::set<int>& list) {
195 std::string rt;
196 for (std::set<int>::const_iterator it = list.begin();
197 it != list.end(); ++it) {
198 if (!rt.empty())
199 rt += ",";
200 rt += base::IntToString(*it);
202 return rt;
205 #if defined(OS_MACOSX)
206 void DisplayReconfigCallback(CGDirectDisplayID display,
207 CGDisplayChangeSummaryFlags flags,
208 void* gpu_data_manager) {
209 if (flags == kCGDisplayBeginConfigurationFlag)
210 return; // This call contains no information about the display change
212 GpuDataManagerImpl* manager =
213 reinterpret_cast<GpuDataManagerImpl*>(gpu_data_manager);
214 DCHECK(manager);
216 // Display change.
217 bool display_changed = false;
218 uint32_t displayCount;
219 CGGetActiveDisplayList(0, NULL, &displayCount);
220 if (displayCount != manager->GetDisplayCount()) {
221 manager->SetDisplayCount(displayCount);
222 display_changed = true;
225 // Gpu change.
226 bool gpu_changed = false;
227 if (flags & kCGDisplayAddFlag) {
228 uint32 vendor_id, device_id;
229 if (gpu::CollectGpuID(&vendor_id, &device_id) == gpu::kCollectInfoSuccess) {
230 gpu_changed = manager->UpdateActiveGpu(vendor_id, device_id);
234 if (display_changed || gpu_changed)
235 manager->HandleGpuSwitch();
237 #endif // OS_MACOSX
239 // Block all domains' use of 3D APIs for this many milliseconds if
240 // approaching a threshold where system stability might be compromised.
241 const int64 kBlockAllDomainsMs = 10000;
242 const int kNumResetsWithinDuration = 1;
244 // Enums for UMA histograms.
245 enum BlockStatusHistogram {
246 BLOCK_STATUS_NOT_BLOCKED,
247 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED,
248 BLOCK_STATUS_ALL_DOMAINS_BLOCKED,
249 BLOCK_STATUS_MAX
252 } // namespace anonymous
254 void GpuDataManagerImplPrivate::InitializeForTesting(
255 const std::string& gpu_blacklist_json,
256 const gpu::GPUInfo& gpu_info) {
257 // This function is for testing only, so disable histograms.
258 update_histograms_ = false;
260 // Prevent all further initialization.
261 finalized_ = true;
263 InitializeImpl(gpu_blacklist_json, std::string(), gpu_info);
266 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const {
267 #if defined(OS_CHROMEOS)
268 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING &&
269 base::CommandLine::ForCurrentProcess()->HasSwitch(
270 switches::kDisablePanelFitting)) {
271 return true;
273 #endif // OS_CHROMEOS
274 if (use_swiftshader_ || ShouldUseWarp()) {
275 // Skia's software rendering is probably more efficient than going through
276 // software emulation of the GPU, so use that.
277 if (feature == gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)
278 return true;
279 return false;
282 return (blacklisted_features_.count(feature) == 1);
285 bool GpuDataManagerImplPrivate::IsDriverBugWorkaroundActive(int feature) const {
286 return (gpu_driver_bugs_.count(feature) == 1);
289 size_t GpuDataManagerImplPrivate::GetBlacklistedFeatureCount() const {
290 if (use_swiftshader_ || ShouldUseWarp())
291 return 1;
292 return blacklisted_features_.size();
295 void GpuDataManagerImplPrivate::SetDisplayCount(unsigned int display_count) {
296 display_count_ = display_count;
299 unsigned int GpuDataManagerImplPrivate::GetDisplayCount() const {
300 return display_count_;
303 gpu::GPUInfo GpuDataManagerImplPrivate::GetGPUInfo() const {
304 return gpu_info_;
307 void GpuDataManagerImplPrivate::GetGpuProcessHandles(
308 const GpuDataManager::GetGpuProcessHandlesCallback& callback) const {
309 GpuProcessHost::GetProcessHandles(callback);
312 bool GpuDataManagerImplPrivate::GpuAccessAllowed(
313 std::string* reason) const {
314 if (use_swiftshader_ || ShouldUseWarp())
315 return true;
317 if (!gpu_process_accessible_) {
318 if (reason) {
319 *reason = "GPU process launch failed.";
321 return false;
324 if (card_blacklisted_) {
325 if (reason) {
326 *reason = "GPU access is disabled ";
327 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
328 if (command_line->HasSwitch(switches::kDisableGpu))
329 *reason += "through commandline switch --disable-gpu.";
330 else
331 *reason += "in chrome://settings.";
333 return false;
336 // We only need to block GPU process if more features are disallowed other
337 // than those in the preliminary gpu feature flags because the latter work
338 // through renderer commandline switches.
339 std::set<int> features = preliminary_blacklisted_features_;
340 gpu::MergeFeatureSets(&features, blacklisted_features_);
341 if (features.size() > preliminary_blacklisted_features_.size()) {
342 if (reason) {
343 *reason = "Features are disabled upon full but not preliminary GPU info.";
345 return false;
348 if (blacklisted_features_.size() == gpu::NUMBER_OF_GPU_FEATURE_TYPES) {
349 // On Linux, we use cached GL strings to make blacklist decsions at browser
350 // startup time. We need to launch the GPU process to validate these
351 // strings even if all features are blacklisted. If all GPU features are
352 // disabled, the GPU process will only initialize GL bindings, create a GL
353 // context, and collect full GPU info.
354 #if !defined(OS_LINUX)
355 if (reason) {
356 *reason = "All GPU features are blacklisted.";
358 return false;
359 #endif
362 return true;
365 void GpuDataManagerImplPrivate::RequestCompleteGpuInfoIfNeeded() {
366 if (complete_gpu_info_already_requested_ || IsCompleteGpuInfoAvailable())
367 return;
368 complete_gpu_info_already_requested_ = true;
370 GpuProcessHost::SendOnIO(
371 #if defined(OS_WIN)
372 GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED,
373 #else
374 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
375 #endif
376 CAUSE_FOR_GPU_LAUNCH_GPUDATAMANAGER_REQUESTCOMPLETEGPUINFOIFNEEDED,
377 new GpuMsg_CollectGraphicsInfo());
380 bool GpuDataManagerImplPrivate::IsEssentialGpuInfoAvailable() const {
381 if (gpu_info_.basic_info_state == gpu::kCollectInfoNone ||
382 gpu_info_.context_info_state == gpu::kCollectInfoNone) {
383 return false;
385 return true;
388 bool GpuDataManagerImplPrivate::IsCompleteGpuInfoAvailable() const {
389 #if defined(OS_WIN)
390 if (gpu_info_.dx_diagnostics_info_state == gpu::kCollectInfoNone)
391 return false;
392 #endif
393 return IsEssentialGpuInfoAvailable();
396 void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate() const {
397 GpuProcessHost::SendOnIO(
398 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
399 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH,
400 new GpuMsg_GetVideoMemoryUsageStats());
403 bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const {
404 return use_swiftshader_;
407 void GpuDataManagerImplPrivate::RegisterSwiftShaderPath(
408 const base::FilePath& path) {
409 swiftshader_path_ = path;
410 EnableSwiftShaderIfNecessary();
413 bool GpuDataManagerImplPrivate::ShouldUseWarp() const {
414 return use_warp_ ||
415 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp);
418 void GpuDataManagerImplPrivate::AddObserver(GpuDataManagerObserver* observer) {
419 GpuDataManagerImpl::UnlockedSession session(owner_);
420 observer_list_->AddObserver(observer);
423 void GpuDataManagerImplPrivate::RemoveObserver(
424 GpuDataManagerObserver* observer) {
425 GpuDataManagerImpl::UnlockedSession session(owner_);
426 observer_list_->RemoveObserver(observer);
429 void GpuDataManagerImplPrivate::UnblockDomainFrom3DAPIs(const GURL& url) {
430 // This method must do two things:
432 // 1. If the specific domain is blocked, then unblock it.
434 // 2. Reset our notion of how many GPU resets have occurred recently.
435 // This is necessary even if the specific domain was blocked.
436 // Otherwise, if we call Are3DAPIsBlocked with the same domain right
437 // after unblocking it, it will probably still be blocked because of
438 // the recent GPU reset caused by that domain.
440 // These policies could be refined, but at a certain point the behavior
441 // will become difficult to explain.
442 std::string domain = GetDomainFromURL(url);
444 blocked_domains_.erase(domain);
445 timestamps_of_gpu_resets_.clear();
448 void GpuDataManagerImplPrivate::DisableGpuWatchdog() {
449 GpuProcessHost::SendOnIO(
450 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
451 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH,
452 new GpuMsg_DisableWatchdog);
455 void GpuDataManagerImplPrivate::SetGLStrings(const std::string& gl_vendor,
456 const std::string& gl_renderer,
457 const std::string& gl_version) {
458 if (gl_vendor.empty() && gl_renderer.empty() && gl_version.empty())
459 return;
461 // If GPUInfo already got GL strings, do nothing. This is for the rare
462 // situation where GPU process collected GL strings before this call.
463 if (!gpu_info_.gl_vendor.empty() ||
464 !gpu_info_.gl_renderer.empty() ||
465 !gpu_info_.gl_version.empty())
466 return;
468 gpu::GPUInfo gpu_info = gpu_info_;
470 gpu_info.gl_vendor = gl_vendor;
471 gpu_info.gl_renderer = gl_renderer;
472 gpu_info.gl_version = gl_version;
474 gpu::CollectDriverInfoGL(&gpu_info);
476 UpdateGpuInfo(gpu_info);
477 UpdateGpuSwitchingManager(gpu_info);
478 UpdatePreliminaryBlacklistedFeatures();
481 void GpuDataManagerImplPrivate::GetGLStrings(std::string* gl_vendor,
482 std::string* gl_renderer,
483 std::string* gl_version) {
484 DCHECK(gl_vendor && gl_renderer && gl_version);
486 *gl_vendor = gpu_info_.gl_vendor;
487 *gl_renderer = gpu_info_.gl_renderer;
488 *gl_version = gpu_info_.gl_version;
491 void GpuDataManagerImplPrivate::Initialize() {
492 TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize");
493 if (finalized_) {
494 DVLOG(0) << "GpuDataManagerImpl marked as finalized; skipping Initialize";
495 return;
498 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
499 if (command_line->HasSwitch(switches::kSkipGpuDataLoading))
500 return;
502 gpu::GPUInfo gpu_info;
503 if (command_line->GetSwitchValueASCII(
504 switches::kUseGL) == gfx::kGLImplementationOSMesaName) {
505 // If using the OSMesa GL implementation, use fake vendor and device ids to
506 // make sure it never gets blacklisted. This is better than simply
507 // cancelling GPUInfo gathering as it allows us to proceed with loading the
508 // blacklist below which may have non-device specific entries we want to
509 // apply anyways (e.g., OS version blacklisting).
510 gpu_info.gpu.vendor_id = 0xffff;
511 gpu_info.gpu.device_id = 0xffff;
513 // Also declare the driver_vendor to be osmesa to be able to specify
514 // exceptions based on driver_vendor==osmesa for some blacklist rules.
515 gpu_info.driver_vendor = gfx::kGLImplementationOSMesaName;
516 } else {
517 TRACE_EVENT0("startup",
518 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo");
519 gpu::CollectBasicGraphicsInfo(&gpu_info);
521 #if defined(ARCH_CPU_X86_FAMILY)
522 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) {
523 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure;
524 #if defined(OS_WIN)
525 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure;
526 #endif // OS_WIN
528 #endif // ARCH_CPU_X86_FAMILY
530 std::string gpu_blacklist_string;
531 std::string gpu_driver_bug_list_string;
532 if (!command_line->HasSwitch(switches::kIgnoreGpuBlacklist) &&
533 !command_line->HasSwitch(switches::kUseGpuInTests)) {
534 gpu_blacklist_string = gpu::kSoftwareRenderingListJson;
536 if (!command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) {
537 gpu_driver_bug_list_string = gpu::kGpuDriverBugListJson;
539 InitializeImpl(gpu_blacklist_string,
540 gpu_driver_bug_list_string,
541 gpu_info);
543 if (command_line->HasSwitch(switches::kSingleProcess) ||
544 command_line->HasSwitch(switches::kInProcessGPU)) {
545 command_line->AppendSwitch(switches::kDisableGpuWatchdog);
546 AppendGpuCommandLine(command_line);
550 void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() {
551 GetContentClient()->SetGpuInfo(gpu_info_);
553 if (gpu_blacklist_) {
554 std::set<int> features = gpu_blacklist_->MakeDecision(
555 gpu::GpuControlList::kOsAny, std::string(), gpu_info_);
556 if (update_histograms_)
557 UpdateStats(gpu_info_, gpu_blacklist_.get(), features);
559 UpdateBlacklistedFeatures(features);
561 if (gpu_driver_bug_list_) {
562 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision(
563 gpu::GpuControlList::kOsAny, std::string(), gpu_info_);
565 gpu::GpuDriverBugList::AppendWorkaroundsFromCommandLine(
566 &gpu_driver_bugs_, *base::CommandLine::ForCurrentProcess());
568 // We have to update GpuFeatureType before notify all the observers.
569 NotifyGpuInfoUpdate();
572 void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) {
573 // No further update of gpu_info if falling back to SwiftShader.
574 if (use_swiftshader_ || ShouldUseWarp())
575 return;
577 bool was_info_available = IsCompleteGpuInfoAvailable();
578 gpu::MergeGPUInfo(&gpu_info_, gpu_info);
579 if (IsCompleteGpuInfoAvailable()) {
580 complete_gpu_info_already_requested_ = true;
581 } else if (was_info_available) {
582 // Allow future requests to go through properly.
583 complete_gpu_info_already_requested_ = false;
586 UpdateGpuInfoHelper();
589 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats(
590 const GPUVideoMemoryUsageStats& video_memory_usage_stats) {
591 GpuDataManagerImpl::UnlockedSession session(owner_);
592 observer_list_->Notify(FROM_HERE,
593 &GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate,
594 video_memory_usage_stats);
597 void GpuDataManagerImplPrivate::AppendRendererCommandLine(
598 base::CommandLine* command_line) const {
599 DCHECK(command_line);
601 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) &&
602 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode))
603 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
604 #if defined(ENABLE_WEBRTC)
605 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) &&
606 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding))
607 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding);
608 #endif
610 #if defined(USE_AURA)
611 if (!CanUseGpuBrowserCompositor())
612 command_line->AppendSwitch(switches::kDisableGpuCompositing);
613 #endif
616 void GpuDataManagerImplPrivate::AppendGpuCommandLine(
617 base::CommandLine* command_line) const {
618 DCHECK(command_line);
620 std::string use_gl =
621 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
622 switches::kUseGL);
623 base::FilePath swiftshader_path =
624 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
625 switches::kSwiftShaderPath);
626 if (gpu_driver_bugs_.find(gpu::DISABLE_D3D11) != gpu_driver_bugs_.end())
627 command_line->AppendSwitch(switches::kDisableD3D11);
628 if (use_swiftshader_) {
629 command_line->AppendSwitchASCII(switches::kUseGL, "swiftshader");
630 if (swiftshader_path.empty())
631 swiftshader_path = swiftshader_path_;
632 } else if ((IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL) ||
633 IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING) ||
634 IsFeatureBlacklisted(
635 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) &&
636 (use_gl == "any")) {
637 command_line->AppendSwitchASCII(
638 switches::kUseGL, gfx::kGLImplementationOSMesaName);
639 } else if (!use_gl.empty()) {
640 command_line->AppendSwitchASCII(switches::kUseGL, use_gl);
642 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus())
643 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "true");
644 else
645 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false");
647 if (!swiftshader_path.empty()) {
648 command_line->AppendSwitchPath(switches::kSwiftShaderPath,
649 swiftshader_path);
652 if (!gpu_driver_bugs_.empty()) {
653 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds,
654 IntSetToString(gpu_driver_bugs_));
657 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) &&
658 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) {
659 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
661 #if defined(ENABLE_WEBRTC)
662 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) &&
663 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) {
664 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding);
666 #endif
668 // Pass GPU and driver information to GPU process. We try to avoid full GPU
669 // info collection at GPU process startup, but we need gpu vendor_id,
670 // device_id, driver_vendor, driver_version for deciding whether we need to
671 // collect full info (on Linux) and for crash reporting purpose.
672 command_line->AppendSwitchASCII(switches::kGpuVendorID,
673 base::StringPrintf("0x%04x", gpu_info_.gpu.vendor_id));
674 command_line->AppendSwitchASCII(switches::kGpuDeviceID,
675 base::StringPrintf("0x%04x", gpu_info_.gpu.device_id));
676 command_line->AppendSwitchASCII(switches::kGpuDriverVendor,
677 gpu_info_.driver_vendor);
678 command_line->AppendSwitchASCII(switches::kGpuDriverVersion,
679 gpu_info_.driver_version);
681 if (ShouldUseWarp())
682 command_line->AppendSwitch(switches::kUseWarp);
685 void GpuDataManagerImplPrivate::AppendPluginCommandLine(
686 base::CommandLine* command_line) const {
687 DCHECK(command_line);
689 #if defined(OS_MACOSX)
690 // TODO(jbauman): Add proper blacklist support for core animation plugins so
691 // special-casing this video card won't be necessary. See
692 // http://crbug.com/134015
693 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) {
694 if (!command_line->HasSwitch(
695 switches::kDisableCoreAnimationPlugins))
696 command_line->AppendSwitch(
697 switches::kDisableCoreAnimationPlugins);
699 #endif
702 void GpuDataManagerImplPrivate::UpdateRendererWebPrefs(
703 WebPreferences* prefs) const {
704 DCHECK(prefs);
706 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)) {
707 prefs->experimental_webgl_enabled = false;
708 prefs->pepper_3d_enabled = false;
710 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH3D))
711 prefs->flash_3d_enabled = false;
712 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D)) {
713 prefs->flash_stage3d_enabled = false;
714 prefs->flash_stage3d_baseline_enabled = false;
716 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE))
717 prefs->flash_stage3d_baseline_enabled = false;
718 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS))
719 prefs->accelerated_2d_canvas_enabled = false;
720 // TODO(senorblanco): The renderer shouldn't have an extra setting
721 // for this, but should rely on extension availability.
722 // Note that |gl_multisampling_enabled| only affects the decoder's
723 // default framebuffer allocation, which does not support
724 // multisampled_render_to_texture, only msaa with explicit resolve.
725 if (IsDriverBugWorkaroundActive(
726 gpu::DISABLE_CHROMIUM_FRAMEBUFFER_MULTISAMPLE) ||
727 (IsDriverBugWorkaroundActive(gpu::DISABLE_MULTIMONITOR_MULTISAMPLING) &&
728 display_count_ > 1))
729 prefs->gl_multisampling_enabled = false;
731 #if defined(USE_AURA)
732 if (!CanUseGpuBrowserCompositor()) {
733 prefs->accelerated_2d_canvas_enabled = false;
734 prefs->pepper_3d_enabled = false;
736 #endif
738 if (!IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) &&
739 !base::CommandLine::ForCurrentProcess()->HasSwitch(
740 switches::kDisableAcceleratedVideoDecode)) {
741 prefs->pepper_accelerated_video_decode_enabled = true;
745 void GpuDataManagerImplPrivate::DisableHardwareAcceleration() {
746 card_blacklisted_ = true;
748 for (int i = 0; i < gpu::NUMBER_OF_GPU_FEATURE_TYPES; ++i)
749 blacklisted_features_.insert(i);
751 EnableWarpIfNecessary();
752 EnableSwiftShaderIfNecessary();
753 NotifyGpuInfoUpdate();
756 std::string GpuDataManagerImplPrivate::GetBlacklistVersion() const {
757 if (gpu_blacklist_)
758 return gpu_blacklist_->version();
759 return "0";
762 std::string GpuDataManagerImplPrivate::GetDriverBugListVersion() const {
763 if (gpu_driver_bug_list_)
764 return gpu_driver_bug_list_->version();
765 return "0";
768 void GpuDataManagerImplPrivate::GetBlacklistReasons(
769 base::ListValue* reasons) const {
770 if (gpu_blacklist_)
771 gpu_blacklist_->GetReasons(reasons, "disabledFeatures");
772 if (gpu_driver_bug_list_)
773 gpu_driver_bug_list_->GetReasons(reasons, "workarounds");
776 std::vector<std::string>
777 GpuDataManagerImplPrivate::GetDriverBugWorkarounds() const {
778 std::vector<std::string> workarounds;
779 for (std::set<int>::const_iterator it = gpu_driver_bugs_.begin();
780 it != gpu_driver_bugs_.end(); ++it) {
781 workarounds.push_back(
782 gpu::GpuDriverBugWorkaroundTypeToString(
783 static_cast<gpu::GpuDriverBugWorkaroundType>(*it)));
785 return workarounds;
788 void GpuDataManagerImplPrivate::AddLogMessage(
789 int level, const std::string& header, const std::string& message) {
790 log_messages_.push_back(LogMessage(level, header, message));
793 void GpuDataManagerImplPrivate::ProcessCrashed(
794 base::TerminationStatus exit_code) {
795 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
796 // Unretained is ok, because it's posted to UI thread, the thread
797 // where the singleton GpuDataManagerImpl lives until the end.
798 BrowserThread::PostTask(
799 BrowserThread::UI,
800 FROM_HERE,
801 base::Bind(&GpuDataManagerImpl::ProcessCrashed,
802 base::Unretained(owner_),
803 exit_code));
804 return;
807 gpu_info_.process_crash_count = GpuProcessHost::gpu_crash_count();
808 GpuDataManagerImpl::UnlockedSession session(owner_);
809 observer_list_->Notify(
810 FROM_HERE, &GpuDataManagerObserver::OnGpuProcessCrashed, exit_code);
814 base::ListValue* GpuDataManagerImplPrivate::GetLogMessages() const {
815 base::ListValue* value = new base::ListValue;
816 for (size_t ii = 0; ii < log_messages_.size(); ++ii) {
817 base::DictionaryValue* dict = new base::DictionaryValue();
818 dict->SetInteger("level", log_messages_[ii].level);
819 dict->SetString("header", log_messages_[ii].header);
820 dict->SetString("message", log_messages_[ii].message);
821 value->Append(dict);
823 return value;
826 void GpuDataManagerImplPrivate::HandleGpuSwitch() {
827 GpuDataManagerImpl::UnlockedSession session(owner_);
828 // Notify observers in the browser process.
829 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched();
830 // Pass the notification to the GPU process to notify observers there.
831 GpuProcessHost::SendOnIO(
832 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
833 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH,
834 new GpuMsg_GpuSwitched);
837 bool GpuDataManagerImplPrivate::UpdateActiveGpu(
838 uint32 vendor_id, uint32 device_id) {
839 if (gpu_info_.gpu.vendor_id == vendor_id &&
840 gpu_info_.gpu.device_id == device_id) {
841 // The primary GPU is active.
842 if (gpu_info_.gpu.active)
843 return false;
844 gpu_info_.gpu.active = true;
845 for (size_t ii = 0; ii < gpu_info_.secondary_gpus.size(); ++ii)
846 gpu_info_.secondary_gpus[ii].active = false;
847 } else {
848 // A secondary GPU is active.
849 for (size_t ii = 0; ii < gpu_info_.secondary_gpus.size(); ++ii) {
850 if (gpu_info_.secondary_gpus[ii].vendor_id == vendor_id &&
851 gpu_info_.secondary_gpus[ii].device_id == device_id) {
852 if (gpu_info_.secondary_gpus[ii].active)
853 return false;
854 gpu_info_.secondary_gpus[ii].active = true;
855 } else {
856 gpu_info_.secondary_gpus[ii].active = false;
859 gpu_info_.gpu.active = false;
861 UpdateGpuInfoHelper();
862 return true;
865 bool GpuDataManagerImplPrivate::CanUseGpuBrowserCompositor() const {
866 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
867 switches::kDisableGpuCompositing))
868 return false;
869 if (ShouldUseWarp())
870 return true;
871 if (ShouldUseSwiftShader())
872 return false;
873 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING))
874 return false;
875 return true;
878 void GpuDataManagerImplPrivate::BlockDomainFrom3DAPIs(
879 const GURL& url, GpuDataManagerImpl::DomainGuilt guilt) {
880 BlockDomainFrom3DAPIsAtTime(url, guilt, base::Time::Now());
883 bool GpuDataManagerImplPrivate::Are3DAPIsBlocked(const GURL& url,
884 int render_process_id,
885 int render_view_id,
886 ThreeDAPIType requester) {
887 bool blocked = Are3DAPIsBlockedAtTime(url, base::Time::Now()) !=
888 GpuDataManagerImpl::DOMAIN_BLOCK_STATUS_NOT_BLOCKED;
889 if (blocked) {
890 // Unretained is ok, because it's posted to UI thread, the thread
891 // where the singleton GpuDataManagerImpl lives until the end.
892 BrowserThread::PostTask(
893 BrowserThread::UI, FROM_HERE,
894 base::Bind(&GpuDataManagerImpl::Notify3DAPIBlocked,
895 base::Unretained(owner_), url, render_process_id,
896 render_view_id, requester));
899 return blocked;
902 void GpuDataManagerImplPrivate::DisableDomainBlockingFor3DAPIsForTesting() {
903 domain_blocking_enabled_ = false;
906 // static
907 GpuDataManagerImplPrivate* GpuDataManagerImplPrivate::Create(
908 GpuDataManagerImpl* owner) {
909 return new GpuDataManagerImplPrivate(owner);
912 GpuDataManagerImplPrivate::GpuDataManagerImplPrivate(
913 GpuDataManagerImpl* owner)
914 : complete_gpu_info_already_requested_(false),
915 observer_list_(new GpuDataManagerObserverList),
916 use_swiftshader_(false),
917 use_warp_(false),
918 card_blacklisted_(false),
919 update_histograms_(true),
920 window_count_(0),
921 domain_blocking_enabled_(true),
922 owner_(owner),
923 display_count_(0),
924 gpu_process_accessible_(true),
925 finalized_(false) {
926 DCHECK(owner_);
927 const base::CommandLine* command_line =
928 base::CommandLine::ForCurrentProcess();
929 if (command_line->HasSwitch(switches::kDisableGpu))
930 DisableHardwareAcceleration();
932 #if defined(OS_MACOSX)
933 CGGetActiveDisplayList (0, NULL, &display_count_);
934 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_);
935 #endif // OS_MACOSX
937 // For testing only.
938 if (command_line->HasSwitch(switches::kDisableDomainBlockingFor3DAPIs)) {
939 domain_blocking_enabled_ = false;
943 GpuDataManagerImplPrivate::~GpuDataManagerImplPrivate() {
944 #if defined(OS_MACOSX)
945 CGDisplayRemoveReconfigurationCallback(DisplayReconfigCallback, owner_);
946 #endif
949 void GpuDataManagerImplPrivate::InitializeImpl(
950 const std::string& gpu_blacklist_json,
951 const std::string& gpu_driver_bug_list_json,
952 const gpu::GPUInfo& gpu_info) {
953 const bool log_gpu_control_list_decisions =
954 base::CommandLine::ForCurrentProcess()->HasSwitch(
955 switches::kLogGpuControlListDecisions);
957 if (!gpu_blacklist_json.empty()) {
958 gpu_blacklist_.reset(gpu::GpuBlacklist::Create());
959 if (log_gpu_control_list_decisions)
960 gpu_blacklist_->enable_control_list_logging("gpu_blacklist");
961 bool success = gpu_blacklist_->LoadList(
962 gpu_blacklist_json, gpu::GpuControlList::kCurrentOsOnly);
963 DCHECK(success);
965 if (!gpu_driver_bug_list_json.empty()) {
966 gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create());
967 if (log_gpu_control_list_decisions)
968 gpu_driver_bug_list_->enable_control_list_logging("gpu_driver_bug_list");
969 bool success = gpu_driver_bug_list_->LoadList(
970 gpu_driver_bug_list_json, gpu::GpuControlList::kCurrentOsOnly);
971 DCHECK(success);
974 gpu_info_ = gpu_info;
975 UpdateGpuInfo(gpu_info);
976 UpdateGpuSwitchingManager(gpu_info);
977 UpdatePreliminaryBlacklistedFeatures();
980 void GpuDataManagerImplPrivate::UpdateBlacklistedFeatures(
981 const std::set<int>& features) {
982 blacklisted_features_ = features;
984 // Force disable using the GPU for these features, even if they would
985 // otherwise be allowed.
986 if (card_blacklisted_) {
987 blacklisted_features_.insert(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING);
988 blacklisted_features_.insert(gpu::GPU_FEATURE_TYPE_WEBGL);
991 EnableWarpIfNecessary();
992 EnableSwiftShaderIfNecessary();
995 void GpuDataManagerImplPrivate::UpdatePreliminaryBlacklistedFeatures() {
996 preliminary_blacklisted_features_ = blacklisted_features_;
999 void GpuDataManagerImplPrivate::UpdateGpuSwitchingManager(
1000 const gpu::GPUInfo& gpu_info) {
1001 ui::GpuSwitchingManager::GetInstance()->SetGpuCount(
1002 gpu_info.secondary_gpus.size() + 1);
1004 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) {
1005 if (gpu_driver_bugs_.count(gpu::FORCE_DISCRETE_GPU) == 1)
1006 ui::GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu();
1007 else if (gpu_driver_bugs_.count(gpu::FORCE_INTEGRATED_GPU) == 1)
1008 ui::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu();
1012 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() {
1013 observer_list_->Notify(FROM_HERE, &GpuDataManagerObserver::OnGpuInfoUpdate);
1016 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() {
1017 if (ShouldUseWarp())
1018 return;
1020 if (!GpuAccessAllowed(NULL) ||
1021 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) {
1022 if (!swiftshader_path_.empty() &&
1023 !base::CommandLine::ForCurrentProcess()->HasSwitch(
1024 switches::kDisableSoftwareRasterizer))
1025 use_swiftshader_ = true;
1029 void GpuDataManagerImplPrivate::EnableWarpIfNecessary() {
1030 #if defined(OS_WIN)
1031 if (use_warp_)
1032 return;
1033 // We should only use WARP if we are unable to use the regular GPU for
1034 // compositing, and if we in Metro mode.
1035 use_warp_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
1036 switches::kViewerConnect) &&
1037 !CanUseGpuBrowserCompositor();
1038 #endif
1041 void GpuDataManagerImplPrivate::ForceWarpModeForTesting() {
1042 use_warp_ = true;
1045 std::string GpuDataManagerImplPrivate::GetDomainFromURL(
1046 const GURL& url) const {
1047 // For the moment, we just use the host, or its IP address, as the
1048 // entry in the set, rather than trying to figure out the top-level
1049 // domain. This does mean that a.foo.com and b.foo.com will be
1050 // treated independently in the blocking of a given domain, but it
1051 // would require a third-party library to reliably figure out the
1052 // top-level domain from a URL.
1053 if (!url.has_host()) {
1054 return std::string();
1057 return url.host();
1060 void GpuDataManagerImplPrivate::BlockDomainFrom3DAPIsAtTime(
1061 const GURL& url,
1062 GpuDataManagerImpl::DomainGuilt guilt,
1063 base::Time at_time) {
1064 if (!domain_blocking_enabled_)
1065 return;
1067 std::string domain = GetDomainFromURL(url);
1069 DomainBlockEntry& entry = blocked_domains_[domain];
1070 entry.last_guilt = guilt;
1071 timestamps_of_gpu_resets_.push_back(at_time);
1074 GpuDataManagerImpl::DomainBlockStatus
1075 GpuDataManagerImplPrivate::Are3DAPIsBlockedAtTime(
1076 const GURL& url, base::Time at_time) const {
1077 if (!domain_blocking_enabled_)
1078 return GpuDataManagerImpl::DOMAIN_BLOCK_STATUS_NOT_BLOCKED;
1080 // Note: adjusting the policies in this code will almost certainly
1081 // require adjusting the associated unit tests.
1082 std::string domain = GetDomainFromURL(url);
1084 DomainBlockMap::const_iterator iter = blocked_domains_.find(domain);
1085 if (iter != blocked_domains_.end()) {
1086 // Err on the side of caution, and assume that if a particular
1087 // domain shows up in the block map, it's there for a good
1088 // reason and don't let its presence there automatically expire.
1090 UMA_HISTOGRAM_ENUMERATION("GPU.BlockStatusForClient3DAPIs",
1091 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED,
1092 BLOCK_STATUS_MAX);
1094 return GpuDataManagerImpl::DOMAIN_BLOCK_STATUS_BLOCKED;
1097 // Look at the timestamps of the recent GPU resets to see if there are
1098 // enough within the threshold which would cause us to blacklist all
1099 // domains. This doesn't need to be overly precise -- if time goes
1100 // backward due to a system clock adjustment, that's fine.
1102 // TODO(kbr): make this pay attention to the TDR thresholds in the
1103 // Windows registry, but make sure it continues to be testable.
1105 std::list<base::Time>::iterator iter = timestamps_of_gpu_resets_.begin();
1106 int num_resets_within_timeframe = 0;
1107 while (iter != timestamps_of_gpu_resets_.end()) {
1108 base::Time time = *iter;
1109 base::TimeDelta delta_t = at_time - time;
1111 // If this entry has "expired", just remove it.
1112 if (delta_t.InMilliseconds() > kBlockAllDomainsMs) {
1113 iter = timestamps_of_gpu_resets_.erase(iter);
1114 continue;
1117 ++num_resets_within_timeframe;
1118 ++iter;
1121 if (num_resets_within_timeframe >= kNumResetsWithinDuration) {
1122 UMA_HISTOGRAM_ENUMERATION("GPU.BlockStatusForClient3DAPIs",
1123 BLOCK_STATUS_ALL_DOMAINS_BLOCKED,
1124 BLOCK_STATUS_MAX);
1126 return GpuDataManagerImpl::DOMAIN_BLOCK_STATUS_ALL_DOMAINS_BLOCKED;
1130 UMA_HISTOGRAM_ENUMERATION("GPU.BlockStatusForClient3DAPIs",
1131 BLOCK_STATUS_NOT_BLOCKED,
1132 BLOCK_STATUS_MAX);
1134 return GpuDataManagerImpl::DOMAIN_BLOCK_STATUS_NOT_BLOCKED;
1137 int64 GpuDataManagerImplPrivate::GetBlockAllDomainsDurationInMs() const {
1138 return kBlockAllDomainsMs;
1141 void GpuDataManagerImplPrivate::Notify3DAPIBlocked(const GURL& url,
1142 int render_process_id,
1143 int render_view_id,
1144 ThreeDAPIType requester) {
1145 GpuDataManagerImpl::UnlockedSession session(owner_);
1146 observer_list_->Notify(FROM_HERE, &GpuDataManagerObserver::DidBlock3DAPIs,
1147 url, render_process_id, render_view_id, requester);
1150 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() {
1151 gpu_process_accessible_ = false;
1152 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure;
1153 #if defined(OS_WIN)
1154 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure;
1155 #endif
1156 complete_gpu_info_already_requested_ = true;
1157 // Some observers might be waiting.
1158 NotifyGpuInfoUpdate();
1161 } // namespace content