| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_impl_private.h" | 5 #include "content/browser/gpu/gpu_data_manager_impl_private.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 return; | 527 return; |
| 528 } | 528 } |
| 529 | 529 |
| 530 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 530 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 531 if (command_line->HasSwitch(switches::kSkipGpuDataLoading)) { | 531 if (command_line->HasSwitch(switches::kSkipGpuDataLoading)) { |
| 532 RunPostInitTasks(); | 532 RunPostInitTasks(); |
| 533 return; | 533 return; |
| 534 } | 534 } |
| 535 | 535 |
| 536 gpu::GPUInfo gpu_info; | 536 gpu::GPUInfo gpu_info; |
| 537 const bool force_osmesa = | 537 const char* softwareGLImplementationName = |
| 538 gl::GetGLImplementationName(gl::GetSoftwareGLImplementation()); |
| 539 const bool force_software_gl = |
| 538 (command_line->GetSwitchValueASCII(switches::kUseGL) == | 540 (command_line->GetSwitchValueASCII(switches::kUseGL) == |
| 539 gl::kGLImplementationOSMesaName) || | 541 softwareGLImplementationName) || |
| 540 command_line->HasSwitch(switches::kOverrideUseGLWithOSMesaForTests); | 542 command_line->HasSwitch(switches::kOverrideUseSoftwareGLForTests); |
| 541 if (force_osmesa) { | 543 if (force_software_gl) { |
| 542 // If using the OSMesa GL implementation, use fake vendor and device ids to | 544 // If using the OSMesa GL implementation, use fake vendor and device ids to |
| 543 // make sure it never gets blacklisted. This is better than simply | 545 // make sure it never gets blacklisted. This is better than simply |
| 544 // cancelling GPUInfo gathering as it allows us to proceed with loading the | 546 // cancelling GPUInfo gathering as it allows us to proceed with loading the |
| 545 // blacklist below which may have non-device specific entries we want to | 547 // blacklist below which may have non-device specific entries we want to |
| 546 // apply anyways (e.g., OS version blacklisting). | 548 // apply anyways (e.g., OS version blacklisting). |
| 547 gpu_info.gpu.vendor_id = 0xffff; | 549 gpu_info.gpu.vendor_id = 0xffff; |
| 548 gpu_info.gpu.device_id = 0xffff; | 550 gpu_info.gpu.device_id = 0xffff; |
| 549 | 551 |
| 550 // Also declare the driver_vendor to be osmesa to be able to specify | 552 // Also declare the driver_vendor to be <software GL> to be able to |
| 551 // exceptions based on driver_vendor==osmesa for some blacklist rules. | 553 // specify exceptions based on driver_vendor==<software GL> for some |
| 552 gpu_info.driver_vendor = gl::kGLImplementationOSMesaName; | 554 // blacklist rules. |
| 555 gpu_info.driver_vendor = softwareGLImplementationName; |
| 553 | 556 |
| 554 // We are not going to call CollectBasicGraphicsInfo. | 557 // We are not going to call CollectBasicGraphicsInfo. |
| 555 // So mark it as collected. | 558 // So mark it as collected. |
| 556 gpu_info.basic_info_state = gpu::kCollectInfoSuccess; | 559 gpu_info.basic_info_state = gpu::kCollectInfoSuccess; |
| 557 } else { | 560 } else { |
| 558 // Skip collecting the basic driver info if SetGpuInfo() is already called. | 561 // Skip collecting the basic driver info if SetGpuInfo() is already called. |
| 559 if (IsCompleteGpuInfoAvailable()) { | 562 if (IsCompleteGpuInfoAvailable()) { |
| 560 gpu_info = gpu_info_; | 563 gpu_info = gpu_info_; |
| 561 } else { | 564 } else { |
| 562 TRACE_EVENT0("startup", | 565 TRACE_EVENT0("startup", |
| (...skipping 24 matching lines...) Expand all Loading... |
| 587 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) { | 590 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) { |
| 588 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure; | 591 gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure; |
| 589 #if defined(OS_WIN) | 592 #if defined(OS_WIN) |
| 590 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure; | 593 gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure; |
| 591 #endif // OS_WIN | 594 #endif // OS_WIN |
| 592 } | 595 } |
| 593 #endif // ARCH_CPU_X86_FAMILY | 596 #endif // ARCH_CPU_X86_FAMILY |
| 594 | 597 |
| 595 std::string gpu_blacklist_string; | 598 std::string gpu_blacklist_string; |
| 596 std::string gpu_driver_bug_list_string; | 599 std::string gpu_driver_bug_list_string; |
| 597 if (!force_osmesa && | 600 if (!force_software_gl && |
| 598 !command_line->HasSwitch(switches::kIgnoreGpuBlacklist) && | 601 !command_line->HasSwitch(switches::kIgnoreGpuBlacklist) && |
| 599 !command_line->HasSwitch(switches::kUseGpuInTests)) { | 602 !command_line->HasSwitch(switches::kUseGpuInTests)) { |
| 600 gpu_blacklist_string = gpu::kSoftwareRenderingListJson; | 603 gpu_blacklist_string = gpu::kSoftwareRenderingListJson; |
| 601 } | 604 } |
| 602 if (!force_osmesa && | 605 if (!force_software_gl && |
| 603 !command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { | 606 !command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { |
| 604 gpu_driver_bug_list_string = gpu::kGpuDriverBugListJson; | 607 gpu_driver_bug_list_string = gpu::kGpuDriverBugListJson; |
| 605 } | 608 } |
| 606 InitializeImpl(gpu_blacklist_string, | 609 InitializeImpl(gpu_blacklist_string, |
| 607 gpu_driver_bug_list_string, | 610 gpu_driver_bug_list_string, |
| 608 gpu_info); | 611 gpu_info); |
| 609 | 612 |
| 610 if (in_process_gpu_) { | 613 if (in_process_gpu_) { |
| 611 command_line->AppendSwitch(switches::kDisableGpuWatchdog); | 614 command_line->AppendSwitch(switches::kDisableGpuWatchdog); |
| 612 AppendGpuCommandLine(command_line, nullptr); | 615 AppendGpuCommandLine(command_line, nullptr); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 command_line->AppendSwitch(switches::kDisableDirectComposition); | 736 command_line->AppendSwitch(switches::kDisableDirectComposition); |
| 734 } | 737 } |
| 735 if (use_swiftshader_) { | 738 if (use_swiftshader_) { |
| 736 command_line->AppendSwitchASCII( | 739 command_line->AppendSwitchASCII( |
| 737 switches::kUseGL, gl::kGLImplementationSwiftShaderForWebGLName); | 740 switches::kUseGL, gl::kGLImplementationSwiftShaderForWebGLName); |
| 738 } else if ((IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL) || | 741 } else if ((IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL) || |
| 739 IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING) || | 742 IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING) || |
| 740 IsFeatureBlacklisted( | 743 IsFeatureBlacklisted( |
| 741 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) && | 744 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) && |
| 742 (use_gl == "any")) { | 745 (use_gl == "any")) { |
| 743 command_line->AppendSwitchASCII(switches::kUseGL, | 746 command_line->AppendSwitchASCII( |
| 744 gl::kGLImplementationOSMesaName); | 747 switches::kUseGL, |
| 748 gl::GetGLImplementationName(gl::GetSoftwareGLImplementation())); |
| 745 } else if (!use_gl.empty()) { | 749 } else if (!use_gl.empty()) { |
| 746 command_line->AppendSwitchASCII(switches::kUseGL, use_gl); | 750 command_line->AppendSwitchASCII(switches::kUseGL, use_gl); |
| 747 } | 751 } |
| 748 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) | 752 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) |
| 749 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "true"); | 753 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "true"); |
| 750 else | 754 else |
| 751 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false"); | 755 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false"); |
| 752 | 756 |
| 753 if (!swiftshader_path_.empty()) { | 757 if (!swiftshader_path_.empty()) { |
| 754 command_line->AppendSwitchPath(switches::kSwiftShaderPath, | 758 command_line->AppendSwitchPath(switches::kSwiftShaderPath, |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1358 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
| 1355 #if defined(OS_WIN) | 1359 #if defined(OS_WIN) |
| 1356 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1360 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
| 1357 #endif | 1361 #endif |
| 1358 complete_gpu_info_already_requested_ = true; | 1362 complete_gpu_info_already_requested_ = true; |
| 1359 // Some observers might be waiting. | 1363 // Some observers might be waiting. |
| 1360 NotifyGpuInfoUpdate(); | 1364 NotifyGpuInfoUpdate(); |
| 1361 } | 1365 } |
| 1362 | 1366 |
| 1363 } // namespace content | 1367 } // namespace content |
| OLD | NEW |