Commit 811534f3 authored by Zhenyao Mo's avatar Zhenyao Mo Committed by Chromium LUCI CQ

Compute the correct info for hardware GPU for about:gpu

The way we compute feature status and problems identified depends
on a few global states for example, if gpu compositing is enabled
at the time when we do the computing.

So currently when we compute the info for hardware gpu, if we
already fallback to SwiftShader, then the global states may
have changed.

This is not what we want. We want to capture a state of info
where we were still using GPU acceleration.

So the fix here is that we also cache these global states for the
later computing.

BUG=1154047
TEST=manual
R=kbr@chromium.org

Change-Id: Ie9abedafe28a36f635bbe8bff183ba52495f4404
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2594315
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#838987}
parent 8d6eb653
...@@ -90,6 +90,7 @@ gpu::GpuFeatureStatus SafeGetFeatureStatus( ...@@ -90,6 +90,7 @@ gpu::GpuFeatureStatus SafeGetFeatureStatus(
const GpuFeatureData GetGpuFeatureData( const GpuFeatureData GetGpuFeatureData(
const gpu::GpuFeatureInfo& gpu_feature_info, const gpu::GpuFeatureInfo& gpu_feature_info,
size_t index, size_t index,
bool is_gpu_compositing_disabled,
bool* eof) { bool* eof) {
const base::CommandLine& command_line = const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess(); *base::CommandLine::ForCurrentProcess();
...@@ -110,7 +111,7 @@ const GpuFeatureData GetGpuFeatureData( ...@@ -110,7 +111,7 @@ const GpuFeatureData GetGpuFeatureData(
// if GPU compositing is disabled. // if GPU compositing is disabled.
SafeGetFeatureStatus(gpu_feature_info, SafeGetFeatureStatus(gpu_feature_info,
gpu::GPU_FEATURE_TYPE_ACCELERATED_GL), gpu::GPU_FEATURE_TYPE_ACCELERATED_GL),
GpuDataManagerImpl::GetInstance()->IsGpuCompositingDisabled(), is_gpu_compositing_disabled,
DisableInfo::Problem( DisableInfo::Problem(
"Gpu compositing has been disabled, either via blocklist, about:flags " "Gpu compositing has been disabled, either via blocklist, about:flags "
"or the command line. The browser will fall back to software " "or the command line. The browser will fall back to software "
...@@ -206,19 +207,27 @@ std::unique_ptr<base::DictionaryValue> GetFeatureStatusImpl( ...@@ -206,19 +207,27 @@ std::unique_ptr<base::DictionaryValue> GetFeatureStatusImpl(
GpuFeatureInfoType type) { GpuFeatureInfoType type) {
GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
std::string gpu_access_blocked_reason; std::string gpu_access_blocked_reason;
bool gpu_access_blocked = bool gpu_access_blocked;
!manager->GpuAccessAllowed(&gpu_access_blocked_reason); gpu::GpuFeatureInfo gpu_feature_info;
const gpu::GpuFeatureInfo gpu_feature_info = bool is_gpu_compositing_disabled;
type == GpuFeatureInfoType::kCurrent if (type == GpuFeatureInfoType::kCurrent) {
? manager->GetGpuFeatureInfo() gpu_access_blocked = !manager->GpuAccessAllowed(&gpu_access_blocked_reason);
: manager->GetGpuFeatureInfoForHardwareGpu(); gpu_feature_info = manager->GetGpuFeatureInfo();
is_gpu_compositing_disabled = manager->IsGpuCompositingDisabled();
} else {
gpu_access_blocked =
!manager->GpuAccessAllowedForHardwareGpu(&gpu_access_blocked_reason);
gpu_feature_info = manager->GetGpuFeatureInfoForHardwareGpu();
is_gpu_compositing_disabled =
manager->IsGpuCompositingDisabledForHardwareGpu();
}
auto feature_status_dict = std::make_unique<base::DictionaryValue>(); auto feature_status_dict = std::make_unique<base::DictionaryValue>();
bool eof = false; bool eof = false;
for (size_t i = 0; !eof; ++i) { for (size_t i = 0; !eof; ++i) {
const GpuFeatureData gpu_feature_data = const GpuFeatureData gpu_feature_data = GetGpuFeatureData(
GetGpuFeatureData(gpu_feature_info, i, &eof); gpu_feature_info, i, is_gpu_compositing_disabled, &eof);
std::string status; std::string status;
// Features undergoing a finch controlled roll out. // Features undergoing a finch controlled roll out.
if (gpu_feature_data.name == "skia_renderer" || if (gpu_feature_data.name == "skia_renderer" ||
...@@ -239,7 +248,7 @@ std::unique_ptr<base::DictionaryValue> GetFeatureStatusImpl( ...@@ -239,7 +248,7 @@ std::unique_ptr<base::DictionaryValue> GetFeatureStatusImpl(
status = "enabled"; status = "enabled";
if ((gpu_feature_data.name == "webgl" || if ((gpu_feature_data.name == "webgl" ||
gpu_feature_data.name == "webgl2") && gpu_feature_data.name == "webgl2") &&
manager->IsGpuCompositingDisabled()) is_gpu_compositing_disabled)
status += "_readback"; status += "_readback";
if (gpu_feature_data.name == "rasterization") { if (gpu_feature_data.name == "rasterization") {
const base::CommandLine& command_line = const base::CommandLine& command_line =
...@@ -269,12 +278,20 @@ std::unique_ptr<base::DictionaryValue> GetFeatureStatusImpl( ...@@ -269,12 +278,20 @@ std::unique_ptr<base::DictionaryValue> GetFeatureStatusImpl(
std::unique_ptr<base::ListValue> GetProblemsImpl(GpuFeatureInfoType type) { std::unique_ptr<base::ListValue> GetProblemsImpl(GpuFeatureInfoType type) {
GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
std::string gpu_access_blocked_reason; std::string gpu_access_blocked_reason;
bool gpu_access_blocked = bool gpu_access_blocked;
!manager->GpuAccessAllowed(&gpu_access_blocked_reason); gpu::GpuFeatureInfo gpu_feature_info;
const gpu::GpuFeatureInfo gpu_feature_info = bool is_gpu_compositing_disabled;
type == GpuFeatureInfoType::kCurrent if (type == GpuFeatureInfoType::kCurrent) {
? manager->GetGpuFeatureInfo() gpu_access_blocked = !manager->GpuAccessAllowed(&gpu_access_blocked_reason);
: manager->GetGpuFeatureInfoForHardwareGpu(); gpu_feature_info = manager->GetGpuFeatureInfo();
is_gpu_compositing_disabled = manager->IsGpuCompositingDisabled();
} else {
gpu_access_blocked =
!manager->GpuAccessAllowedForHardwareGpu(&gpu_access_blocked_reason);
gpu_feature_info = manager->GetGpuFeatureInfoForHardwareGpu();
is_gpu_compositing_disabled =
manager->IsGpuCompositingDisabledForHardwareGpu();
}
auto problem_list = std::make_unique<base::ListValue>(); auto problem_list = std::make_unique<base::ListValue>();
if (!gpu_feature_info.applied_gpu_blocklist_entries.empty()) { if (!gpu_feature_info.applied_gpu_blocklist_entries.empty()) {
...@@ -303,8 +320,8 @@ std::unique_ptr<base::ListValue> GetProblemsImpl(GpuFeatureInfoType type) { ...@@ -303,8 +320,8 @@ std::unique_ptr<base::ListValue> GetProblemsImpl(GpuFeatureInfoType type) {
bool eof = false; bool eof = false;
for (size_t i = 0; !eof; ++i) { for (size_t i = 0; !eof; ++i) {
const GpuFeatureData gpu_feature_data = const GpuFeatureData gpu_feature_data = GetGpuFeatureData(
GetGpuFeatureData(gpu_feature_info, i, &eof); gpu_feature_info, i, is_gpu_compositing_disabled, &eof);
if (gpu_feature_data.disabled && if (gpu_feature_data.disabled &&
gpu_feature_data.disabled_info.is_problem) { gpu_feature_data.disabled_info.is_problem) {
auto problem = std::make_unique<base::DictionaryValue>(); auto problem = std::make_unique<base::DictionaryValue>();
......
...@@ -267,6 +267,16 @@ gpu::GpuFeatureInfo GpuDataManagerImpl::GetGpuFeatureInfoForHardwareGpu() ...@@ -267,6 +267,16 @@ gpu::GpuFeatureInfo GpuDataManagerImpl::GetGpuFeatureInfoForHardwareGpu()
return private_->GetGpuFeatureInfoForHardwareGpu(); return private_->GetGpuFeatureInfoForHardwareGpu();
} }
bool GpuDataManagerImpl::GpuAccessAllowedForHardwareGpu(std::string* reason) {
base::AutoLock auto_lock(lock_);
return private_->GpuAccessAllowedForHardwareGpu(reason);
}
bool GpuDataManagerImpl::IsGpuCompositingDisabledForHardwareGpu() const {
base::AutoLock auto_lock(lock_);
return private_->IsGpuCompositingDisabledForHardwareGpu();
}
gfx::GpuExtraInfo GpuDataManagerImpl::GetGpuExtraInfo() const { gfx::GpuExtraInfo GpuDataManagerImpl::GetGpuExtraInfo() const {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
return private_->GetGpuExtraInfo(); return private_->GetGpuExtraInfo();
......
...@@ -113,8 +113,13 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager, ...@@ -113,8 +113,13 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager,
gpu::GpuFeatureInfo GetGpuFeatureInfo() const; gpu::GpuFeatureInfo GetGpuFeatureInfo() const;
// The following functions for cached GPUInfo and GpuFeatureInfo from the
// hardware GPU even if currently Chrome has fallen back to SwiftShader.
// Such info are displayed in about:gpu for diagostic purpose.
gpu::GPUInfo GetGPUInfoForHardwareGpu() const; gpu::GPUInfo GetGPUInfoForHardwareGpu() const;
gpu::GpuFeatureInfo GetGpuFeatureInfoForHardwareGpu() const; gpu::GpuFeatureInfo GetGpuFeatureInfoForHardwareGpu() const;
bool GpuAccessAllowedForHardwareGpu(std::string* reason);
bool IsGpuCompositingDisabledForHardwareGpu() const;
gfx::GpuExtraInfo GetGpuExtraInfo() const; gfx::GpuExtraInfo GetGpuExtraInfo() const;
......
...@@ -616,6 +616,13 @@ bool GpuDataManagerImplPrivate::GpuAccessAllowed(std::string* reason) const { ...@@ -616,6 +616,13 @@ bool GpuDataManagerImplPrivate::GpuAccessAllowed(std::string* reason) const {
} }
} }
bool GpuDataManagerImplPrivate::GpuAccessAllowedForHardwareGpu(
std::string* reason) const {
if (reason)
*reason = gpu_access_blocked_reason_for_hardware_gpu_;
return gpu_access_allowed_for_hardware_gpu_;
}
bool GpuDataManagerImplPrivate::GpuProcessStartAllowed() const { bool GpuDataManagerImplPrivate::GpuProcessStartAllowed() const {
return gpu_mode_ != gpu::GpuMode::DISABLED; return gpu_mode_ != gpu::GpuMode::DISABLED;
} }
...@@ -1072,6 +1079,9 @@ void GpuDataManagerImplPrivate::UpdateGpuFeatureInfo( ...@@ -1072,6 +1079,9 @@ void GpuDataManagerImplPrivate::UpdateGpuFeatureInfo(
} else { } else {
gpu_feature_info_for_hardware_gpu_ = gpu_feature_info_; gpu_feature_info_for_hardware_gpu_ = gpu_feature_info_;
} }
is_gpu_compositing_disabled_for_hardware_gpu_ = IsGpuCompositingDisabled();
gpu_access_allowed_for_hardware_gpu_ =
GpuAccessAllowed(&gpu_access_blocked_reason_for_hardware_gpu_);
} }
if (update_histograms_) { if (update_histograms_) {
UpdateFeatureStats(gpu_feature_info_); UpdateFeatureStats(gpu_feature_info_);
...@@ -1103,6 +1113,10 @@ bool GpuDataManagerImplPrivate::IsGpuCompositingDisabled() const { ...@@ -1103,6 +1113,10 @@ bool GpuDataManagerImplPrivate::IsGpuCompositingDisabled() const {
return disable_gpu_compositing_ || !HardwareAccelerationEnabled(); return disable_gpu_compositing_ || !HardwareAccelerationEnabled();
} }
bool GpuDataManagerImplPrivate::IsGpuCompositingDisabledForHardwareGpu() const {
return is_gpu_compositing_disabled_for_hardware_gpu_;
}
void GpuDataManagerImplPrivate::SetGpuCompositingDisabled() { void GpuDataManagerImplPrivate::SetGpuCompositingDisabled() {
if (!IsGpuCompositingDisabled()) { if (!IsGpuCompositingDisabled()) {
disable_gpu_compositing_ = true; disable_gpu_compositing_ = true;
......
...@@ -43,6 +43,7 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate { ...@@ -43,6 +43,7 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
gpu::GPUInfo GetGPUInfo() const; gpu::GPUInfo GetGPUInfo() const;
gpu::GPUInfo GetGPUInfoForHardwareGpu() const; gpu::GPUInfo GetGPUInfoForHardwareGpu() const;
bool GpuAccessAllowed(std::string* reason) const; bool GpuAccessAllowed(std::string* reason) const;
bool GpuAccessAllowedForHardwareGpu(std::string* reason) const;
bool GpuProcessStartAllowed() const; bool GpuProcessStartAllowed() const;
void RequestDxdiagDx12VulkanGpuInfoIfNeeded(GpuInfoRequest request, void RequestDxdiagDx12VulkanGpuInfoIfNeeded(GpuInfoRequest request,
bool delayed); bool delayed);
...@@ -87,6 +88,7 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate { ...@@ -87,6 +88,7 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
gfx::GpuExtraInfo GetGpuExtraInfo() const; gfx::GpuExtraInfo GetGpuExtraInfo() const;
bool IsGpuCompositingDisabled() const; bool IsGpuCompositingDisabled() const;
bool IsGpuCompositingDisabledForHardwareGpu() const;
void SetGpuCompositingDisabled(); void SetGpuCompositingDisabled();
...@@ -223,6 +225,9 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate { ...@@ -223,6 +225,9 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
// pure software (in the viz case). // pure software (in the viz case).
gpu::GpuFeatureInfo gpu_feature_info_for_hardware_gpu_; gpu::GpuFeatureInfo gpu_feature_info_for_hardware_gpu_;
gpu::GPUInfo gpu_info_for_hardware_gpu_; gpu::GPUInfo gpu_info_for_hardware_gpu_;
bool is_gpu_compositing_disabled_for_hardware_gpu_ = false;
bool gpu_access_allowed_for_hardware_gpu_ = true;
std::string gpu_access_blocked_reason_for_hardware_gpu_;
gfx::GpuExtraInfo gpu_extra_info_; gfx::GpuExtraInfo gpu_extra_info_;
......
<html>
<head>
<script type="text/javascript">
function onLoad() {
window.domAutomationController.reset = function() {
window.domAutomationController._loaded = false;
window.domAutomationController._succeeded = false;
window.domAutomationController._finished = false;
window.requestAnimationFrame(succeed);
};
window.domAutomationController.send("LOADED");
}
function succeed() {
window.domAutomationController.send("SUCCESS");
}
</script>
</head>
<body onload="onLoad()">
Simple page.
</body>
</html>
...@@ -51,6 +51,24 @@ harness_script = r""" ...@@ -51,6 +51,24 @@ harness_script = r"""
console.log("Harness injected."); console.log("Harness injected.");
""" """
feature_query_script = """
function GetFeatureStatus(feature_name, for_hardware_gpu) {
let query_result;
if (for_hardware_gpu) {
query_result = document.querySelector(
'.feature-status-for-hardware-gpu-list');
} else {
query_result = document.querySelector('.feature-status-list');
}
for (let i=0; i < query_result.childElementCount; i++) {
let feature_status = query_result.children[i].textContent.split(': ');
if (feature_status.length == 2 && feature_status[0] == feature_name)
return feature_status[1];
}
return "";
}
"""
class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest): class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
...@@ -78,7 +96,6 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -78,7 +96,6 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
default_args = super(ContextLostIntegrationTest, default_args = super(ContextLostIntegrationTest,
cls).GenerateBrowserArgs(additional_args) cls).GenerateBrowserArgs(additional_args)
default_args.extend([ default_args.extend([
cba.DISABLE_GPU_PROCESS_CRASH_LIMIT,
# Required to call crashGpuProcess. # Required to call crashGpuProcess.
cba.ENABLE_GPU_BENCHMARKING, cba.ENABLE_GPU_BENCHMARKING,
# Disable: # Disable:
...@@ -122,7 +139,8 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -122,7 +139,8 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
('ContextLost_MacWebGLMultisamplingHighPowerSwitchLosesContext', ('ContextLost_MacWebGLMultisamplingHighPowerSwitchLosesContext',
'webgl2-multisampling-high-power-switch-loses-context.html'), 'webgl2-multisampling-high-power-switch-loses-context.html'),
('ContextLost_MacWebGLPreserveDBHighPowerSwitchLosesContext', ('ContextLost_MacWebGLPreserveDBHighPowerSwitchLosesContext',
'webgl2-preserve-db-high-power-switch-loses-context.html')) 'webgl2-preserve-db-high-power-switch-loses-context.html'),
('GpuCrash_InfoForHardwareGpu', 'simple.html'))
for t in tests: for t in tests:
yield (t[0], t[1], ('_' + t[0])) yield (t[0], t[1], ('_' + t[0]))
...@@ -227,6 +245,16 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -227,6 +245,16 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
tab.action_runner.WaitForJavaScriptCondition( tab.action_runner.WaitForJavaScriptCondition(
'window.domAutomationController._loaded') 'window.domAutomationController._loaded')
def _GetWebGLFeatureStatus(self, for_hardware_gpu):
tab = self.tab.browser.tabs.New()
tab.Navigate('chrome:gpu',
script_to_evaluate_on_commit=feature_query_script)
tab.WaitForJavaScriptCondition('window.gpuPagePopulated', timeout=10)
status = (tab.EvaluateJavaScript('GetFeatureStatus("WebGL", %s)' %
('true' if for_hardware_gpu else 'false')))
tab.Close()
return status
def _WaitForTabAndCheckCompletion(self): def _WaitForTabAndCheckCompletion(self):
tab = self.tab tab = self.tab
completed = _WaitForPageToFinish(tab) completed = _WaitForPageToFinish(tab)
...@@ -446,6 +474,33 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -446,6 +474,33 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
self._WaitForTabAndCheckCompletion() self._WaitForTabAndCheckCompletion()
self._CheckCrashCount(tab, 0) self._CheckCrashCount(tab, 0)
def _GpuCrash_InfoForHardwareGpu(self, test_path):
# Ensure that info displayed in chrome:gpu for hardware gpu is correct,
# after gpu process crashes three times and falls back to SwiftShader.
self.RestartBrowserIfNecessaryWithArgs(
[cba.DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS])
self._NavigateAndWaitForLoad(test_path)
# Check WebGL status at browser startup.
webgl_status = self._GetWebGLFeatureStatus(False)
if webgl_status != 'Hardware accelerated':
self.fail('WebGL should be hardware accelerated initially, but got %s' %
webgl_status)
webgl_status_for_hardware_gpu = self._GetWebGLFeatureStatus(True)
if webgl_status_for_hardware_gpu != '':
self.fail('Feature status for hardware gpu should not be displayed '
'initially')
# Check WebGL status after three GPU crashes - fallback to SwiftShader.
self._KillGPUProcess(3, True)
webgl_status = self._GetWebGLFeatureStatus(False)
if webgl_status != 'Software only, hardware acceleration unavailable':
self.fail('WebGL should be software only with SwiftShader, but got %s' %
webgl_status)
webgl_status_for_hardware_gpu = self._GetWebGLFeatureStatus(True)
if webgl_status_for_hardware_gpu != 'Hardware accelerated':
self.fail('WebGL status for hardware gpu should be "accelerated", '
'but got %s' % webgl_status_for_hardware_gpu)
self._RestartBrowser('must restart after tests that kill the GPU process')
@classmethod @classmethod
def GetPlatformTags(cls, browser): def GetPlatformTags(cls, browser):
tags = super(ContextLostIntegrationTest, cls).GetPlatformTags(browser) tags = super(ContextLostIntegrationTest, cls).GetPlatformTags(browser)
......
...@@ -128,3 +128,8 @@ crbug.com/1105308 [ fuchsia ] GpuNormalTermination_NewWebGLNotBlocked [ Skip ] ...@@ -128,3 +128,8 @@ crbug.com/1105308 [ fuchsia ] GpuNormalTermination_NewWebGLNotBlocked [ Skip ]
# Flakily not getting WebGL blocked on context loss # Flakily not getting WebGL blocked on context loss
crbug.com/1143774 [ chromeos chromeos-board-kevin ] ContextLost_WebGLUnblockedAfterUserInitiatedReload [ RetryOnFailure ] crbug.com/1143774 [ chromeos chromeos-board-kevin ] ContextLost_WebGLUnblockedAfterUserInitiatedReload [ RetryOnFailure ]
# GPU process fallback isn't supported on certain platforms.
crbug.com/1154047 [ chromeos ] GpuCrash_InfoForHardwareGpu [ Skip ]
crbug.com/1154047 [ android ] GpuCrash_InfoForHardwareGpu [ Skip ]
crbug.com/1154047 [ fuchsia ] GpuCrash_InfoForHardwareGpu [ Skip ]
...@@ -350,6 +350,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line, ...@@ -350,6 +350,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
<< "on Linux"; << "on Linux";
return false; return false;
#else #else
SaveHardwareGpuInfoAndGpuFeatureInfo();
gl::init::ShutdownGL(true); gl::init::ShutdownGL(true);
gl_initialized = false; gl_initialized = false;
#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) #endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
...@@ -437,6 +438,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line, ...@@ -437,6 +438,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
<< "on Linux"; << "on Linux";
return false; return false;
#else #else
SaveHardwareGpuInfoAndGpuFeatureInfo();
gl::init::ShutdownGL(true); gl::init::ShutdownGL(true);
watchdog_thread_ = nullptr; watchdog_thread_ = nullptr;
watchdog_init.SetGpuWatchdogPtr(nullptr); watchdog_init.SetGpuWatchdogPtr(nullptr);
...@@ -693,6 +695,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line, ...@@ -693,6 +695,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
command_line, gpu_feature_info_, command_line, gpu_feature_info_,
gpu_preferences_.disable_software_rasterizer, false); gpu_preferences_.disable_software_rasterizer, false);
if (gl_use_swiftshader_) { if (gl_use_swiftshader_) {
SaveHardwareGpuInfoAndGpuFeatureInfo();
gl::init::ShutdownGL(true); gl::init::ShutdownGL(true);
if (!gl::init::InitializeGLNoExtensionsOneOff(/*init_bindings*/ true)) { if (!gl::init::InitializeGLNoExtensionsOneOff(/*init_bindings*/ true)) {
VLOG(1) << "gl::init::InitializeGLNoExtensionsOneOff failed " VLOG(1) << "gl::init::InitializeGLNoExtensionsOneOff failed "
...@@ -731,6 +734,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line, ...@@ -731,6 +734,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
command_line, gpu_feature_info_, command_line, gpu_feature_info_,
gpu_preferences_.disable_software_rasterizer, false); gpu_preferences_.disable_software_rasterizer, false);
if (gl_use_swiftshader_) { if (gl_use_swiftshader_) {
SaveHardwareGpuInfoAndGpuFeatureInfo();
gl::init::ShutdownGL(true); gl::init::ShutdownGL(true);
if (!gl::init::InitializeGLNoExtensionsOneOff(/*init_bindings*/ true)) { if (!gl::init::InitializeGLNoExtensionsOneOff(/*init_bindings*/ true)) {
VLOG(1) << "gl::init::InitializeGLNoExtensionsOneOff failed " VLOG(1) << "gl::init::InitializeGLNoExtensionsOneOff failed "
...@@ -768,10 +772,13 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line, ...@@ -768,10 +772,13 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
} }
#endif // OS_ANDROID #endif // OS_ANDROID
void GpuInit::AdjustInfoToSwiftShader() { void GpuInit::SaveHardwareGpuInfoAndGpuFeatureInfo() {
gpu_info_for_hardware_gpu_ = gpu_info_; gpu_info_for_hardware_gpu_ = gpu_info_;
gpu_info_.passthrough_cmd_decoder = false;
gpu_feature_info_for_hardware_gpu_ = gpu_feature_info_; gpu_feature_info_for_hardware_gpu_ = gpu_feature_info_;
}
void GpuInit::AdjustInfoToSwiftShader() {
gpu_info_.passthrough_cmd_decoder = false;
gpu_feature_info_ = ComputeGpuFeatureInfoForSwiftShader(); gpu_feature_info_ = ComputeGpuFeatureInfoForSwiftShader();
CollectContextGraphicsInfo(&gpu_info_); CollectContextGraphicsInfo(&gpu_info_);
......
...@@ -108,6 +108,7 @@ class GPU_IPC_SERVICE_EXPORT GpuInit { ...@@ -108,6 +108,7 @@ class GPU_IPC_SERVICE_EXPORT GpuInit {
std::unique_ptr<VulkanImplementation> vulkan_implementation_; std::unique_ptr<VulkanImplementation> vulkan_implementation_;
#endif #endif
void SaveHardwareGpuInfoAndGpuFeatureInfo();
void AdjustInfoToSwiftShader(); void AdjustInfoToSwiftShader();
DISALLOW_COPY_AND_ASSIGN(GpuInit); DISALLOW_COPY_AND_ASSIGN(GpuInit);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment