diff options
-rw-r--r-- | chrome/browser/gpu_data_manager.cc | 5 | ||||
-rw-r--r-- | content/common/gpu_info.cc | 49 | ||||
-rw-r--r-- | content/common/gpu_info.h | 8 |
3 files changed, 59 insertions, 3 deletions
diff --git a/chrome/browser/gpu_data_manager.cc b/chrome/browser/gpu_data_manager.cc index d62434a..1ef345b 100644 --- a/chrome/browser/gpu_data_manager.cc +++ b/chrome/browser/gpu_data_manager.cc @@ -74,10 +74,9 @@ void GpuDataManager::RequestCompleteGpuInfoIfNeeded() { void GpuDataManager::UpdateGpuInfo(const GPUInfo& gpu_info) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (gpu_info_.finalized) + if (!gpu_info_.Merge(gpu_info)) return; - gpu_info_ = gpu_info; - child_process_logging::SetGpuInfo(gpu_info); + child_process_logging::SetGpuInfo(gpu_info_); // Clear the flag to triger a re-computation of GpuFeatureFlags using the // updated GPU info. gpu_feature_flags_set_ = false; diff --git a/content/common/gpu_info.cc b/content/common/gpu_info.cc index 50e227e..6b4d0a7 100644 --- a/content/common/gpu_info.cc +++ b/content/common/gpu_info.cc @@ -12,3 +12,52 @@ GPUInfo::GPUInfo() } GPUInfo::~GPUInfo() { } + +bool GPUInfo::Merge(const GPUInfo& other) { + if (device_id != other.device_id || vendor_id != other.vendor_id) { + *this = other; + return true; + } + + bool changed = false; + if (!finalized) { + finalized = other.finalized; + initialization_time = other.initialization_time; + if (driver_vendor.empty() && !other.driver_vendor.empty()) { + driver_vendor = other.driver_vendor; + changed = true; + } + if (driver_version.empty() && !other.driver_version.empty()) { + driver_version = other.driver_version; + changed = true; + } + if (driver_date.empty() && !other.driver_date.empty()) { + driver_date = other.driver_date; + changed = true; + } + if (pixel_shader_version.empty()) + pixel_shader_version = other.pixel_shader_version; + if (vertex_shader_version.empty()) + vertex_shader_version = other.vertex_shader_version; + if (gl_version.empty()) + gl_version = other.gl_version; + if (gl_version_string.empty()) + gl_version_string = other.gl_version_string; + if (gl_vendor.empty()) + gl_vendor = other.gl_vendor; + if (gl_renderer.empty() && !other.gl_renderer.empty()) { + gl_renderer = other.gl_renderer; + changed = true; + } + if (gl_extensions.empty()) + gl_extensions = other.gl_extensions; + can_lose_context = other.can_lose_context; +#if defined(OS_WIN) + if (dx_diagnostics.values.size() == 0 && + dx_diagnostics.children.size() == 0) + dx_diagnostics = other.dx_diagnostics; +#endif + } + return changed; +} + diff --git a/content/common/gpu_info.h b/content/common/gpu_info.h index c014e09..402535e 100644 --- a/content/common/gpu_info.h +++ b/content/common/gpu_info.h @@ -20,6 +20,14 @@ struct GPUInfo { GPUInfo(); ~GPUInfo(); + // If it's the same GPU, i.e., device id and vendor id are the same, then + // copy over the fields that are not set yet and ignore the rest. + // If it's a different GPU, then reset and copy over everything. + // Return true if something changes that may affect blacklisting; currently + // they are device_id, vendor_id, driver_vendor, driver_version, driver_date, + // and gl_renderer. + bool Merge(const GPUInfo& other); + // Whether more GPUInfo fields might be collected in the future. bool finalized; |