diff options
author | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-23 20:53:33 +0000 |
---|---|---|
committer | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-23 20:53:33 +0000 |
commit | 9508d978e70415d4d06bebdf2c36595d1931ccfa (patch) | |
tree | 9410df0c852e435262b5682ff991a18964dfc742 /content | |
parent | 61c6f418f05f36b466fcf295c962fb5f2f470c3a (diff) | |
download | chromium_src-9508d978e70415d4d06bebdf2c36595d1931ccfa.zip chromium_src-9508d978e70415d4d06bebdf2c36595d1931ccfa.tar.gz chromium_src-9508d978e70415d4d06bebdf2c36595d1931ccfa.tar.bz2 |
Be smarter than simple copy when we try to update GPUInfo: i.e., if the graphics card changed, we reset the info; otherwise, only fill in the originally unset fields instead of of overwriting everything. The reason is that the newly collected information may not always be more comprehensive then the previous ones.
With this CL, we can remove the duplicate information collection in preliminary GPUInfo collection and full GPUInfo collection. Also, this prepares us to handle dual GPUs and dymanic GPU switching situations.
BUG=none
TEST=bots green
Review URL: http://codereview.chromium.org/6726028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79175 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/common/gpu_info.cc | 49 | ||||
-rw-r--r-- | content/common/gpu_info.h | 8 |
2 files changed, 57 insertions, 0 deletions
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; |