summaryrefslogtreecommitdiffstats
path: root/content/common/gpu_info.cc
diff options
context:
space:
mode:
authorzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-23 20:53:33 +0000
committerzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-23 20:53:33 +0000
commit9508d978e70415d4d06bebdf2c36595d1931ccfa (patch)
tree9410df0c852e435262b5682ff991a18964dfc742 /content/common/gpu_info.cc
parent61c6f418f05f36b466fcf295c962fb5f2f470c3a (diff)
downloadchromium_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/common/gpu_info.cc')
-rw-r--r--content/common/gpu_info.cc49
1 files changed, 49 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;
+}
+