diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-20 23:56:55 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-20 23:56:55 +0000 |
commit | a80f5ece3d46eeb0734cfca6c716d69e7ab7aaa2 (patch) | |
tree | e1b989fd7c67f745061a481692671b1331cffe02 /content/browser/gpu | |
parent | 56cbcc3ce45c1b68f9fbdbed6244bebe1f203403 (diff) | |
download | chromium_src-a80f5ece3d46eeb0734cfca6c716d69e7ab7aaa2.zip chromium_src-a80f5ece3d46eeb0734cfca6c716d69e7ab7aaa2.tar.gz chromium_src-a80f5ece3d46eeb0734cfca6c716d69e7ab7aaa2.tar.bz2 |
Move GPUInfo to content/public/common and put it into the content namespace.
BUG=98716
Review URL: http://codereview.chromium.org/8363007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106637 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/gpu')
-rw-r--r-- | content/browser/gpu/gpu_blacklist.cc | 6 | ||||
-rw-r--r-- | content/browser/gpu/gpu_blacklist.h | 9 | ||||
-rw-r--r-- | content/browser/gpu/gpu_blacklist_unittest.cc | 6 | ||||
-rw-r--r-- | content/browser/gpu/gpu_data_manager.cc | 78 | ||||
-rw-r--r-- | content/browser/gpu/gpu_data_manager.h | 17 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host.cc | 12 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host.h | 8 |
7 files changed, 106 insertions, 30 deletions
diff --git a/content/browser/gpu/gpu_blacklist.cc b/content/browser/gpu/gpu_blacklist.cc index c81bb48..98186cf 100644 --- a/content/browser/gpu/gpu_blacklist.cc +++ b/content/browser/gpu/gpu_blacklist.cc @@ -14,7 +14,7 @@ #include "base/sys_info.h" #include "base/values.h" #include "base/version.h" -#include "content/common/gpu/gpu_info.h" +#include "content/public/common/gpu_info.h" namespace { @@ -581,7 +581,7 @@ void GpuBlacklist::GpuBlacklistEntry::AddBrowserChannel( bool GpuBlacklist::GpuBlacklistEntry::Contains( OsType os_type, const Version& os_version, BrowserChannel channel, - const GPUInfo& gpu_info) const { + const content::GPUInfo& gpu_info) const { DCHECK(os_type != kOsAny); if (os_info_.get() != NULL && !os_info_->Contains(os_type, os_version)) return false; @@ -740,7 +740,7 @@ bool GpuBlacklist::LoadGpuBlacklist( GpuFeatureFlags GpuBlacklist::DetermineGpuFeatureFlags( GpuBlacklist::OsType os, Version* os_version, - const GPUInfo& gpu_info) { + const content::GPUInfo& gpu_info) { active_entries_.clear(); GpuFeatureFlags flags; diff --git a/content/browser/gpu/gpu_blacklist.h b/content/browser/gpu/gpu_blacklist.h index 9aa81a8..7ee77c2 100644 --- a/content/browser/gpu/gpu_blacklist.h +++ b/content/browser/gpu/gpu_blacklist.h @@ -18,12 +18,15 @@ #include "content/common/gpu/gpu_feature_flags.h" class Version; -struct GPUInfo; namespace base { class DictionaryValue; } +namespace content { +struct GPUInfo; +} + class CONTENT_EXPORT GpuBlacklist { public: enum OsType { @@ -57,7 +60,7 @@ class CONTENT_EXPORT GpuBlacklist { // current OS version. GpuFeatureFlags DetermineGpuFeatureFlags(OsType os, Version* os_version, - const GPUInfo& gpu_info); + const content::GPUInfo& gpu_info); // Collects the active entries that set the "feature" flag from the last // DetermineGpuFeatureFlags() call. This tells which entries are responsible @@ -212,7 +215,7 @@ class CONTENT_EXPORT GpuBlacklist { bool Contains(OsType os_type, const Version& os_version, BrowserChannel channel, - const GPUInfo& gpu_info) const; + const content::GPUInfo& gpu_info) const; // Returns the OsType. OsType GetOsType() const; diff --git a/content/browser/gpu/gpu_blacklist_unittest.cc b/content/browser/gpu/gpu_blacklist_unittest.cc index 29239f0..a598322 100644 --- a/content/browser/gpu/gpu_blacklist_unittest.cc +++ b/content/browser/gpu/gpu_blacklist_unittest.cc @@ -11,7 +11,7 @@ #include "base/path_service.h" #include "base/version.h" #include "content/browser/gpu/gpu_blacklist.h" -#include "content/common/gpu/gpu_info.h" +#include "content/public/common/gpu_info.h" #include "testing/gtest/include/gtest/gtest.h" class GpuBlacklistTest : public testing::Test { @@ -20,7 +20,7 @@ class GpuBlacklistTest : public testing::Test { virtual ~GpuBlacklistTest() { } - const GPUInfo& gpu_info() const { + const content::GPUInfo& gpu_info() const { return gpu_info_; } @@ -39,7 +39,7 @@ class GpuBlacklistTest : public testing::Test { } private: - GPUInfo gpu_info_; + content::GPUInfo gpu_info_; }; TEST_F(GpuBlacklistTest, CurrentBlacklistValidation) { diff --git a/content/browser/gpu/gpu_data_manager.cc b/content/browser/gpu/gpu_data_manager.cc index f9b8e3d..8bd3bbd 100644 --- a/content/browser/gpu/gpu_data_manager.cc +++ b/content/browser/gpu/gpu_data_manager.cc @@ -92,7 +92,7 @@ enum WinSubVersion { }; // Output DxDiagNode tree as nested array of {description,value} pairs -ListValue* DxDiagNodeToList(const DxDiagNode& node) { +ListValue* DxDiagNodeToList(const content::DxDiagNode& node) { ListValue* list = new ListValue(); for (std::map<std::string, std::string>::const_iterator it = node.values.begin(); @@ -101,7 +101,7 @@ ListValue* DxDiagNodeToList(const DxDiagNode& node) { list->Append(NewDescriptionValuePair(it->first, it->second)); } - for (std::map<std::string, DxDiagNode>::const_iterator it = + for (std::map<std::string, content::DxDiagNode>::const_iterator it = node.children.begin(); it != node.children.end(); ++it) { @@ -197,7 +197,7 @@ void GpuDataManager::Initialize() { // on UI thread later, and we skip the preliminary gpu info collection // in such situation. if (BrowserThread::CurrentlyOn(BrowserThread::FILE)) { - GPUInfo gpu_info; + content::GPUInfo gpu_info; gpu_info_collector::CollectPreliminaryGraphicsInfo(&gpu_info); UpdateGpuInfo(gpu_info); } @@ -232,10 +232,10 @@ void GpuDataManager::RequestCompleteGpuInfoIfNeeded() { new GpuMsg_CollectGraphicsInfo()); } -void GpuDataManager::UpdateGpuInfo(const GPUInfo& gpu_info) { +void GpuDataManager::UpdateGpuInfo(const content::GPUInfo& gpu_info) { { base::AutoLock auto_lock(gpu_info_lock_); - if (!gpu_info_.Merge(gpu_info)) + if (!Merge(&gpu_info_, gpu_info)) return; } @@ -249,7 +249,7 @@ void GpuDataManager::UpdateGpuInfo(const GPUInfo& gpu_info) { UpdateGpuFeatureFlags(); } -const GPUInfo& GpuDataManager::gpu_info() const { +const content::GPUInfo& GpuDataManager::gpu_info() const { base::AutoLock auto_lock(gpu_info_lock_); return gpu_info_; } @@ -515,7 +515,7 @@ void GpuDataManager::UpdateGpuBlacklist( void GpuDataManager::HandleGpuSwitch() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GPUInfo gpu_info; + content::GPUInfo gpu_info; gpu_info_collector::CollectVideoCardInfo(&gpu_info); LOG(INFO) << "Switching to use GPU: vendor_id = 0x" << base::StringPrintf("%04x", gpu_info.vendor_id) @@ -698,3 +698,67 @@ bool GpuDataManager::UseGLIsOSMesaOrAny() { user_flags_.use_gl() == gfx::kGLImplementationOSMesaName); } +bool GpuDataManager::Merge(content::GPUInfo* object, + const content::GPUInfo& other) { + if (object->device_id != other.device_id || + object->vendor_id != other.vendor_id) { + *object = other; + return true; + } + + bool changed = false; + if (!object->finalized) { + object->finalized = other.finalized; + object->initialization_time = other.initialization_time; + + if (object->driver_vendor.empty()) { + changed |= object->driver_vendor != other.driver_vendor; + object->driver_vendor = other.driver_vendor; + } + if (object->driver_version.empty()) { + changed |= object->driver_version != other.driver_version; + object->driver_version = other.driver_version; + } + if (object->driver_date.empty()) { + changed |= object->driver_date != other.driver_date; + object->driver_date = other.driver_date; + } + if (object->pixel_shader_version.empty()) { + changed |= object->pixel_shader_version != other.pixel_shader_version; + object->pixel_shader_version = other.pixel_shader_version; + } + if (object->vertex_shader_version.empty()) { + changed |= object->vertex_shader_version != other.vertex_shader_version; + object->vertex_shader_version = other.vertex_shader_version; + } + if (object->gl_version.empty()) { + changed |= object->gl_version != other.gl_version; + object->gl_version = other.gl_version; + } + if (object->gl_version_string.empty()) { + changed |= object->gl_version_string != other.gl_version_string; + object->gl_version_string = other.gl_version_string; + } + if (object->gl_vendor.empty()) { + changed |= object->gl_vendor != other.gl_vendor; + object->gl_vendor = other.gl_vendor; + } + if (object->gl_renderer.empty()) { + changed |= object->gl_renderer != other.gl_renderer; + object->gl_renderer = other.gl_renderer; + } + if (object->gl_extensions.empty()) { + changed |= object->gl_extensions != other.gl_extensions; + object->gl_extensions = other.gl_extensions; + } + object->can_lose_context = other.can_lose_context; +#if defined(OS_WIN) + if (object->dx_diagnostics.values.size() == 0 && + object->dx_diagnostics.children.size() == 0) { + object->dx_diagnostics = other.dx_diagnostics; + changed = true; + } +#endif + } + return changed; +} diff --git a/content/browser/gpu/gpu_data_manager.h b/content/browser/gpu/gpu_data_manager.h index bac847d..e92f716 100644 --- a/content/browser/gpu/gpu_data_manager.h +++ b/content/browser/gpu/gpu_data_manager.h @@ -17,7 +17,7 @@ #include "base/values.h" #include "content/common/content_export.h" #include "content/common/gpu/gpu_feature_flags.h" -#include "content/common/gpu/gpu_info.h" +#include "content/public/common/gpu_info.h" class CommandLine; class GpuBlacklist; @@ -31,9 +31,9 @@ class CONTENT_EXPORT GpuDataManager { void RequestCompleteGpuInfoIfNeeded(); // Only update if the current GPUInfo is not finalized. - void UpdateGpuInfo(const GPUInfo& gpu_info); + void UpdateGpuInfo(const content::GPUInfo& gpu_info); - const GPUInfo& gpu_info() const; + const content::GPUInfo& gpu_info() const; // Returns status of various GPU features. This is two parted: // { @@ -178,6 +178,15 @@ class CONTENT_EXPORT GpuDataManager { // If use-gl switch is osmesa or any, return true. bool UseGLIsOSMesaOrAny(); + // Merges the second GPUInfo object with the first. + // 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. + static bool Merge(content::GPUInfo* object, const content::GPUInfo& other); + bool complete_gpu_info_already_requested_; GpuFeatureFlags gpu_feature_flags_; @@ -185,7 +194,7 @@ class CONTENT_EXPORT GpuDataManager { UserFlags user_flags_; - GPUInfo gpu_info_; + content::GPUInfo gpu_info_; mutable base::Lock gpu_info_lock_; scoped_ptr<GpuBlacklist> gpu_blacklist_; diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index 54ccfd9..b3e05a9 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc @@ -350,7 +350,7 @@ void GpuProcessHost::EstablishGpuChannel( if (!GpuDataManager::GetInstance()->GpuAccessAllowed()) { EstablishChannelError( wrapped_callback.release(), IPC::ChannelHandle(), - base::kNullProcessHandle, GPUInfo()); + base::kNullProcessHandle, content::GPUInfo()); return; } @@ -359,7 +359,7 @@ void GpuProcessHost::EstablishGpuChannel( } else { EstablishChannelError( wrapped_callback.release(), IPC::ChannelHandle(), - base::kNullProcessHandle, GPUInfo()); + base::kNullProcessHandle, content::GPUInfo()); } } @@ -417,7 +417,7 @@ void GpuProcessHost::OnChannelEstablished( EstablishChannelError(callback.release(), IPC::ChannelHandle(), base::kNullProcessHandle, - GPUInfo()); + content::GPUInfo()); RouteOnUIThread(GpuHostMsg_OnLogMessage( logging::LOG_WARNING, "WARNING", @@ -452,7 +452,7 @@ void GpuProcessHost::OnDestroyCommandBuffer( #endif // defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) } -void GpuProcessHost::OnGraphicsInfoCollected(const GPUInfo& gpu_info) { +void GpuProcessHost::OnGraphicsInfoCollected(const content::GPUInfo& gpu_info) { GpuDataManager::GetInstance()->UpdateGpuInfo(gpu_info); } @@ -597,7 +597,7 @@ void GpuProcessHost::SendOutstandingReplies() { EstablishChannelError(callback.release(), IPC::ChannelHandle(), base::kNullProcessHandle, - GPUInfo()); + content::GPUInfo()); } } @@ -605,7 +605,7 @@ void GpuProcessHost::EstablishChannelError( EstablishChannelCallback* callback, const IPC::ChannelHandle& channel_handle, base::ProcessHandle renderer_process_for_gpu, - const GPUInfo& gpu_info) { + const content::GPUInfo& gpu_info) { scoped_ptr<EstablishChannelCallback> wrapped_callback(callback); wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info); } diff --git a/content/browser/gpu/gpu_process_host.h b/content/browser/gpu/gpu_process_host.h index b337176..9f2b520 100644 --- a/content/browser/gpu/gpu_process_host.h +++ b/content/browser/gpu/gpu_process_host.h @@ -14,8 +14,8 @@ #include "base/threading/non_thread_safe.h" #include "content/browser/browser_child_process_host.h" #include "content/common/content_export.h" -#include "content/common/gpu/gpu_info.h" #include "content/common/gpu/gpu_process_launch_causes.h" +#include "content/public/common/gpu_info.h" #include "ui/gfx/native_widget_types.h" struct GPUCreateCommandBufferConfig; @@ -60,7 +60,7 @@ class GpuProcessHost : public BrowserChildProcessHost, typedef Callback3<const IPC::ChannelHandle&, base::ProcessHandle, - const GPUInfo&>::Type + const content::GPUInfo&>::Type EstablishChannelCallback; // Tells the GPU process to create a new channel for communication with a @@ -99,7 +99,7 @@ class GpuProcessHost : public BrowserChildProcessHost, void OnCommandBufferCreated(const int32 route_id); void OnDestroyCommandBuffer( gfx::PluginWindowHandle window, int32 renderer_id, int32 render_view_id); - void OnGraphicsInfoCollected(const GPUInfo& gpu_info); + void OnGraphicsInfoCollected(const content::GPUInfo& gpu_info); bool LaunchGpuProcess(); @@ -108,7 +108,7 @@ class GpuProcessHost : public BrowserChildProcessHost, EstablishChannelCallback* callback, const IPC::ChannelHandle& channel_handle, base::ProcessHandle renderer_process_for_gpu, - const GPUInfo& gpu_info); + const content::GPUInfo& gpu_info); void CreateCommandBufferError(CreateCommandBufferCallback* callback, int32 route_id); |