diff options
author | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 20:05:47 +0000 |
---|---|---|
committer | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 20:05:47 +0000 |
commit | 6cc8ece6614023a11359a3504bcf76104ba6ba61 (patch) | |
tree | 95cd3ec77cfe989c121fd98f2fa31fbde3eec6ae /content | |
parent | b3b9b508b81bd690d4f8ec1cdc4b53d7e6db08a1 (diff) | |
download | chromium_src-6cc8ece6614023a11359a3504bcf76104ba6ba61.zip chromium_src-6cc8ece6614023a11359a3504bcf76104ba6ba61.tar.gz chromium_src-6cc8ece6614023a11359a3504bcf76104ba6ba61.tar.bz2 |
Refactoring GPUInfo: 1) remove the level field; instead, having a finalized field indicating if more info might be collected. 2) change version data from uint32 to string.
Refactoring GpuDataManager: 1) remove GpuFeatureAllowed() because we expose un-filtered flags through GpuFeatureFlags(). 2) disallow launch GPU process to collect gpu info if accelerated_compositing is not allowed.
BUG=none
TEST=unittest
Review URL: http://codereview.chromium.org/6672004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78080 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/gpu_blacklist.cc | 3 | ||||
-rw-r--r-- | content/browser/gpu_blacklist_unittest.cc | 1 | ||||
-rw-r--r-- | content/common/gpu_info.cc | 18 | ||||
-rw-r--r-- | content/common/gpu_info.h | 37 | ||||
-rw-r--r-- | content/common/gpu_info_unittest.cc | 8 | ||||
-rw-r--r-- | content/common/gpu_messages.h | 8 | ||||
-rw-r--r-- | content/gpu/gpu_info_collector.cc | 17 | ||||
-rw-r--r-- | content/gpu/gpu_info_collector_linux.cc | 4 | ||||
-rw-r--r-- | content/gpu/gpu_info_collector_mac.mm | 4 | ||||
-rw-r--r-- | content/gpu/gpu_info_collector_unittest.cc | 49 | ||||
-rw-r--r-- | content/gpu/gpu_info_collector_win.cc | 26 | ||||
-rw-r--r-- | content/gpu/gpu_info_unittest_win.cc | 6 | ||||
-rw-r--r-- | content/gpu/gpu_thread.cc | 21 | ||||
-rw-r--r-- | content/gpu/gpu_thread.h | 5 |
14 files changed, 82 insertions, 125 deletions
diff --git a/content/browser/gpu_blacklist.cc b/content/browser/gpu_blacklist.cc index 1724c5f..03c90b2 100644 --- a/content/browser/gpu_blacklist.cc +++ b/content/browser/gpu_blacklist.cc @@ -631,9 +631,6 @@ GpuFeatureFlags GpuBlacklist::DetermineGpuFeatureFlags( const GPUInfo& gpu_info) { active_entries_.clear(); GpuFeatureFlags flags; - // No need to go through blacklist entries if GPUInfo isn't available. - if (gpu_info.level == GPUInfo::kUninitialized) - return flags; if (os == kOsAny) os = GetOsType(); diff --git a/content/browser/gpu_blacklist_unittest.cc b/content/browser/gpu_blacklist_unittest.cc index 0394a06..4a4c1ea 100644 --- a/content/browser/gpu_blacklist_unittest.cc +++ b/content/browser/gpu_blacklist_unittest.cc @@ -31,7 +31,6 @@ class GpuBlacklistTest : public testing::Test { gpu_info_.driver_vendor = "NVIDIA"; gpu_info_.driver_version = "1.6.18"; gpu_info_.driver_date = "7-14-2009"; - gpu_info_.level = GPUInfo::kComplete; } void TearDown() { diff --git a/content/common/gpu_info.cc b/content/common/gpu_info.cc index 55ecdbc..691917d 100644 --- a/content/common/gpu_info.cc +++ b/content/common/gpu_info.cc @@ -5,22 +5,8 @@ #include "content/common/gpu_info.h" GPUInfo::GPUInfo() - : level(kUninitialized), + : finalized(false), vendor_id(0), device_id(0), - driver_vendor(""), - driver_version(""), - driver_date(""), - pixel_shader_version(0), - vertex_shader_version(0), - gl_version(0), - gl_version_string(""), - gl_vendor(""), - gl_renderer(""), - gl_extensions(""), - can_lose_context(false), - collection_error(false) { -} - -GPUInfo::~GPUInfo() { + can_lose_context(false) { } diff --git a/content/common/gpu_info.h b/content/common/gpu_info.h index b571682..28edd31 100644 --- a/content/common/gpu_info.h +++ b/content/common/gpu_info.h @@ -18,19 +18,9 @@ struct GPUInfo { GPUInfo(); - ~GPUInfo(); - enum Level { - kUninitialized, - kPreliminary, - kPartial, - kCompleting, - kComplete, - }; - - // Whether this GPUInfo has been partially or fully initialized with - // information. - Level level; + // Whether more GPUInfo fields might be collected in the future. + bool finalized; // The amount of time taken to get from the process starting to the message // loop being pumped. @@ -52,23 +42,15 @@ struct GPUInfo { // The date of the graphics driver currently installed. std::string driver_date; - // The version of the pixel/fragment shader used by the gpu. Major version in - // the second lowest 8 bits, minor in the lowest 8 bits, eg version 2.5 would - // be 0x00000205. - uint32 pixel_shader_version; + // The version of the pixel/fragment shader used by the gpu. + std::string pixel_shader_version; - // The version of the vertex shader used by the gpu. Major version in the - // second lowest 8 bits, minor in the lowest 8 bits, eg version 2.5 would be - // 0x00000205. - uint32 vertex_shader_version; + // The version of the vertex shader used by the gpu. + std::string vertex_shader_version; // The version of OpenGL we are using. - // Major version in the second lowest 8 bits, minor in the lowest 8 bits, - // eg version 2.5 would be 0x00000205. - // Returns 0 if we're not using OpenGL, say because we're going through - // D3D instead. // TODO(zmo): should be able to tell if it's GL or GLES. - uint32 gl_version; + std::string gl_version; // The GL_VERSION string. "" if we are not using OpenGL. std::string gl_version_string; @@ -86,11 +68,6 @@ struct GPUInfo { // semantics are available. bool can_lose_context; - // True if there was an error at any stage of collecting GPUInfo data. - // If there was an error, then the GPUInfo fields may be incomplete or set - // to default values such as 0 or empty string. - bool collection_error; - #if defined(OS_WIN) // The information returned by the DirectX Diagnostics Tool. DxDiagNode dx_diagnostics; diff --git a/content/common/gpu_info_unittest.cc b/content/common/gpu_info_unittest.cc index 8e99e37..34f0ee6 100644 --- a/content/common/gpu_info_unittest.cc +++ b/content/common/gpu_info_unittest.cc @@ -8,16 +8,16 @@ // Test that an empty GPUInfo has valid members TEST(GPUInfoBasicTest, EmptyGPUInfo) { GPUInfo gpu_info; - EXPECT_EQ(gpu_info.level, GPUInfo::kUninitialized); + EXPECT_EQ(gpu_info.finalized, false); EXPECT_EQ(gpu_info.initialization_time.ToInternalValue(), 0); EXPECT_EQ(gpu_info.vendor_id, 0u); EXPECT_EQ(gpu_info.device_id, 0u); EXPECT_EQ(gpu_info.driver_vendor, ""); EXPECT_EQ(gpu_info.driver_version, ""); EXPECT_EQ(gpu_info.driver_date, ""); - EXPECT_EQ(gpu_info.pixel_shader_version, 0u); - EXPECT_EQ(gpu_info.vertex_shader_version, 0u); - EXPECT_EQ(gpu_info.gl_version, 0u); + EXPECT_EQ(gpu_info.pixel_shader_version, ""); + EXPECT_EQ(gpu_info.vertex_shader_version, ""); + EXPECT_EQ(gpu_info.gl_version, ""); EXPECT_EQ(gpu_info.gl_version_string, ""); EXPECT_EQ(gpu_info.gl_vendor, ""); EXPECT_EQ(gpu_info.gl_renderer, ""); diff --git a/content/common/gpu_messages.h b/content/common/gpu_messages.h index 558f6b3..a5731c8 100644 --- a/content/common/gpu_messages.h +++ b/content/common/gpu_messages.h @@ -88,10 +88,8 @@ IPC_STRUCT_TRAITS_BEGIN(DxDiagNode) IPC_STRUCT_TRAITS_MEMBER(children) IPC_STRUCT_TRAITS_END() -IPC_ENUM_TRAITS(GPUInfo::Level) - IPC_STRUCT_TRAITS_BEGIN(GPUInfo) - IPC_STRUCT_TRAITS_MEMBER(level) + IPC_STRUCT_TRAITS_MEMBER(finalized) IPC_STRUCT_TRAITS_MEMBER(initialization_time) IPC_STRUCT_TRAITS_MEMBER(vendor_id) IPC_STRUCT_TRAITS_MEMBER(device_id) @@ -106,7 +104,6 @@ IPC_STRUCT_TRAITS_BEGIN(GPUInfo) IPC_STRUCT_TRAITS_MEMBER(gl_renderer) IPC_STRUCT_TRAITS_MEMBER(gl_extensions) IPC_STRUCT_TRAITS_MEMBER(can_lose_context) - IPC_STRUCT_TRAITS_MEMBER(collection_error) #if defined(OS_WIN) IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics) #endif @@ -153,8 +150,7 @@ IPC_MESSAGE_CONTROL4(GpuMsg_CreateViewCommandBuffer, // Tells the GPU process to create a context for collecting graphics card // information. -IPC_MESSAGE_CONTROL1(GpuMsg_CollectGraphicsInfo, - GPUInfo::Level /* level */) +IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo) #if defined(OS_MACOSX) // Tells the GPU process that the browser process handled the swap diff --git a/content/gpu/gpu_info_collector.cc b/content/gpu/gpu_info_collector.cc index 5211e9d..13b293e 100644 --- a/content/gpu/gpu_info_collector.cc +++ b/content/gpu/gpu_info_collector.cc @@ -55,8 +55,8 @@ std::string GetGLString(unsigned int pname) { return ""; } -uint32 GetVersionNumberFromString(const std::string& version_string) { - int major = 0, minor = 0; +// Return a version string in the format of "major.minor". +std::string GetVersionFromString(const std::string& version_string) { size_t begin = version_string.find_first_of("0123456789"); if (begin != std::string::npos) { size_t end = version_string.find_first_not_of("01234567890.", begin); @@ -67,12 +67,10 @@ uint32 GetVersionNumberFromString(const std::string& version_string) { sub_string = version_string.substr(begin); std::vector<std::string> pieces; base::SplitString(sub_string, '.', &pieces); - if (pieces.size() >= 2) { - base::StringToInt(pieces[0], &major); - base::StringToInt(pieces[1], &minor); - } + if (pieces.size() >= 2) + return pieces[0] + "." + pieces[1]; } - return ((major << 8) + minor); + return ""; } } // namespace anonymous @@ -107,10 +105,9 @@ bool CollectGLVersionInfo(GPUInfo* gpu_info) { std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION); - uint32 gl_version = GetVersionNumberFromString(gl_version_string); - gpu_info->gl_version = gl_version; + gpu_info->gl_version = GetVersionFromString(gl_version_string); - uint32 glsl_version = GetVersionNumberFromString(glsl_version_string); + std::string glsl_version = GetVersionFromString(glsl_version_string); gpu_info->pixel_shader_version = glsl_version; gpu_info->vertex_shader_version = glsl_version; diff --git a/content/gpu/gpu_info_collector_linux.cc b/content/gpu/gpu_info_collector_linux.cc index 08b1f9c..6ee7c97 100644 --- a/content/gpu/gpu_info_collector_linux.cc +++ b/content/gpu/gpu_info_collector_linux.cc @@ -143,15 +143,13 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) { // desktop GL and GL_ARB_robustness extension is available. gpu_info->can_lose_context = (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); - gpu_info->level = GPUInfo::kComplete; + gpu_info->finalized = true; return CollectGraphicsInfoGL(gpu_info); } bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); - gpu_info->level = GPUInfo::kPartial; - bool rt = true; if (!CollectVideoCardInfo(gpu_info)) rt = false; diff --git a/content/gpu/gpu_info_collector_mac.mm b/content/gpu/gpu_info_collector_mac.mm index e1b625d..c524fa7 100644 --- a/content/gpu/gpu_info_collector_mac.mm +++ b/content/gpu/gpu_info_collector_mac.mm @@ -49,15 +49,13 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) { gpu_info->can_lose_context = (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); - gpu_info-> level = GPUInfo::kComplete; + gpu_info->finalized = true; return CollectGraphicsInfoGL(gpu_info); } bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); - gpu_info->level = GPUInfo::kPartial; - bool rt = true; if (!CollectVideoCardInfo(gpu_info)) rt = false; diff --git a/content/gpu/gpu_info_collector_unittest.cc b/content/gpu/gpu_info_collector_unittest.cc index a441484..1cc4b64 100644 --- a/content/gpu/gpu_info_collector_unittest.cc +++ b/content/gpu/gpu_info_collector_unittest.cc @@ -27,8 +27,8 @@ class GPUInfoCollectorTest : public testing::Test { const uint32 device_id = 0x0658; const char* driver_vendor = ""; // not implemented const char* driver_version = ""; - const uint32 shader_version = 0x00000128; - const uint32 gl_version = 0x00000301; + const char* shader_version = "1.40"; + const char* gl_version = "3.1"; const char* gl_renderer = "Quadro FX 380/PCI/SSE2"; const char* gl_vendor = "NVIDIA Corporation"; const char* gl_version_string = "3.1.0"; @@ -41,8 +41,8 @@ class GPUInfoCollectorTest : public testing::Test { const uint32 device_id = 0x0640; const char* driver_vendor = ""; // not implemented const char* driver_version = "1.6.18"; - const uint32 shader_version = 0x00000114; - const uint32 gl_version = 0x00000201; + const char* shader_version = "1.20"; + const char* gl_version = "2.1"; const char* gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; const char* gl_vendor = "NVIDIA Corporation"; const char* gl_version_string = "2.1 NVIDIA-1.6.18"; @@ -55,8 +55,8 @@ class GPUInfoCollectorTest : public testing::Test { const uint32 device_id = 0x0658; const char* driver_vendor = "NVIDIA"; const char* driver_version = "195.36.24"; - const uint32 shader_version = 0x00000132; - const uint32 gl_version = 0x00000302; + const char* shader_version = "1.50"; + const char* gl_version = "3.2"; const char* gl_renderer = "Quadro FX 380/PCI/SSE2"; const char* gl_vendor = "NVIDIA Corporation"; const char* gl_version_string = "3.2.0 NVIDIA 195.36.24"; @@ -69,7 +69,6 @@ class GPUInfoCollectorTest : public testing::Test { test_values_.device_id = device_id; test_values_.driver_vendor = driver_vendor; test_values_.driver_version =driver_version; - test_values_.driver_date = ""; test_values_.pixel_shader_version = shader_version; test_values_.vertex_shader_version = shader_version; test_values_.gl_version = gl_version; @@ -113,8 +112,8 @@ class GPUInfoCollectorTest : public testing::Test { TEST_F(GPUInfoCollectorTest, DriverVendorGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - std::string driver_vendor = gpu_info.driver_vendor; - EXPECT_EQ(test_values_.driver_vendor, driver_vendor); + EXPECT_EQ(test_values_.driver_vendor, + gpu_info.driver_vendor); } // Skip Windows because the driver version is obtained from bot registry. @@ -122,56 +121,56 @@ TEST_F(GPUInfoCollectorTest, DriverVendorGL) { TEST_F(GPUInfoCollectorTest, DriverVersionGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - std::string driver_version = gpu_info.driver_version; - EXPECT_EQ(test_values_.driver_version, driver_version); + EXPECT_EQ(test_values_.driver_version, + gpu_info.driver_version); } #endif TEST_F(GPUInfoCollectorTest, PixelShaderVersionGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - uint32 ps_version = gpu_info.pixel_shader_version; - EXPECT_EQ(test_values_.pixel_shader_version, ps_version); + EXPECT_EQ(test_values_.pixel_shader_version, + gpu_info.pixel_shader_version); } TEST_F(GPUInfoCollectorTest, VertexShaderVersionGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - uint32 vs_version = gpu_info.vertex_shader_version; - EXPECT_EQ(test_values_.vertex_shader_version, vs_version); + EXPECT_EQ(test_values_.vertex_shader_version, + gpu_info.vertex_shader_version); } TEST_F(GPUInfoCollectorTest, GLVersionGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - uint32 gl_version = gpu_info.gl_version; - EXPECT_EQ(test_values_.gl_version, gl_version); + EXPECT_EQ(test_values_.gl_version, + gpu_info.gl_version); } TEST_F(GPUInfoCollectorTest, GLVersionStringGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - std::string gl_version_string = gpu_info.gl_version_string; - EXPECT_EQ(test_values_.gl_version_string, gl_version_string); + EXPECT_EQ(test_values_.gl_version_string, + gpu_info.gl_version_string); } TEST_F(GPUInfoCollectorTest, GLRendererGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - std::string gl_renderer = gpu_info.gl_renderer; - EXPECT_EQ(test_values_.gl_renderer, gl_renderer); + EXPECT_EQ(test_values_.gl_renderer, + gpu_info.gl_renderer); } TEST_F(GPUInfoCollectorTest, GLVendorGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - std::string gl_vendor = gpu_info.gl_vendor; - EXPECT_EQ(test_values_.gl_vendor, gl_vendor); + EXPECT_EQ(test_values_.gl_vendor, + gpu_info.gl_vendor); } TEST_F(GPUInfoCollectorTest, GLExtensionsGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - std::string gl_extensions = gpu_info.gl_extensions; - EXPECT_EQ(test_values_.gl_extensions, gl_extensions); + EXPECT_EQ(test_values_.gl_extensions, + gpu_info.gl_extensions); } diff --git a/content/gpu/gpu_info_collector_win.cc b/content/gpu/gpu_info_collector_win.cc index 35ab7c0..75302d0 100644 --- a/content/gpu/gpu_info_collector_win.cc +++ b/content/gpu/gpu_info_collector_win.cc @@ -20,6 +20,19 @@ #include "libEGL/main.h" #include "libEGL/Display.h" +namespace { + +// The version number stores the major and minor version in the least 16 bits; +// for example, 2.5 is 0x00000205. +// Returned string is in the format of "major.minor". +std::string VersionNumberToString(uint32 version_number) { + int hi = (version_number >> 8) & 0xff; + int low = version_number & 0xff; + return base::IntToString(hi) + "." + base::IntToString(low); +} + +} // namespace anonymous + // Setup API functions typedef HDEVINFO (WINAPI*SetupDiGetClassDevsWFunc)( CONST GUID *ClassGuid, @@ -51,13 +64,10 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { - gpu_info->level = GPUInfo::kComplete; + gpu_info->finalized = true; return CollectGraphicsInfoGL(gpu_info); } - // Set to partial now in case this function returns false below. - gpu_info->level = GPUInfo::kPartial; - // TODO(zmo): the following code only works if running on top of ANGLE. // Need to handle the case when running on top of real EGL/GLES2 drivers. @@ -91,8 +101,6 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) { bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); - gpu_info->level = GPUInfo::kPreliminary; - bool rt = true; if (!CollectVideoCardInfo(gpu_info)) rt = false; @@ -111,8 +119,10 @@ bool CollectGraphicsInfoD3D(IDirect3D9* d3d, GPUInfo* gpu_info) { if (d3d->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3d_caps) == D3D_OK) { - gpu_info->pixel_shader_version = d3d_caps.PixelShaderVersion; - gpu_info->vertex_shader_version = d3d_caps.VertexShaderVersion; + gpu_info->pixel_shader_version = + VersionNumberToString(d3d_caps.PixelShaderVersion); + gpu_info->vertex_shader_version = + VersionNumberToString(d3d_caps.VertexShaderVersion); } else { LOG(ERROR) << "d3d->GetDeviceCaps() failed"; succeed = false; diff --git a/content/gpu/gpu_info_unittest_win.cc b/content/gpu/gpu_info_unittest_win.cc index d468a48..182f2d3 100644 --- a/content/gpu/gpu_info_unittest_win.cc +++ b/content/gpu/gpu_info_unittest_win.cc @@ -47,13 +47,11 @@ class GPUInfoTest : public testing::Test { TEST_F(GPUInfoTest, PixelShaderVersionD3D) { GPUInfo gpu_info; ASSERT_TRUE(gpu_info_collector::CollectGraphicsInfoD3D(&d3d_, &gpu_info)); - uint32 ps_version = gpu_info.pixel_shader_version; - EXPECT_EQ(ps_version, D3DPS_VERSION(3, 0)); + EXPECT_EQ(gpu_info.pixel_shader_version, "3.0"); } TEST_F(GPUInfoTest, VertexShaderVersionD3D) { GPUInfo gpu_info; ASSERT_TRUE(gpu_info_collector::CollectGraphicsInfoD3D(&d3d_, &gpu_info)); - uint32 vs_version = gpu_info.vertex_shader_version; - EXPECT_EQ(vs_version, D3DVS_VERSION(3, 0)); + EXPECT_EQ(gpu_info.vertex_shader_version, "3.0"); } diff --git a/content/gpu/gpu_thread.cc b/content/gpu/gpu_thread.cc index 7eaf7fd..3dc960e 100644 --- a/content/gpu/gpu_thread.cc +++ b/content/gpu/gpu_thread.cc @@ -48,7 +48,8 @@ bool InitializeGpuSandbox() { #if defined(OS_WIN) GpuThread::GpuThread(sandbox::TargetServices* target_services) - : target_services_(target_services) { + : target_services_(target_services), + collecting_dx_diagnostics_(false) { } #else GpuThread::GpuThread() { @@ -129,11 +130,7 @@ void GpuThread::OnInitialize() { MessageLoop::current()->Quit(); return; } - bool gpu_info_result = gpu_info_collector::CollectGraphicsInfo(&gpu_info_); - if (!gpu_info_result) { - gpu_info_.collection_error = true; - LOG(ERROR) << "gpu_info_collector::CollectGraphicsInfo() failed"; - } + gpu_info_collector::CollectGraphicsInfo(&gpu_info_); content::GetContentClient()->SetGpuInfo(gpu_info_); LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo complete"; @@ -247,11 +244,11 @@ void GpuThread::OnSynchronize() { Send(new GpuHostMsg_SynchronizeReply()); } -void GpuThread::OnCollectGraphicsInfo(GPUInfo::Level level) { +void GpuThread::OnCollectGraphicsInfo() { #if defined(OS_WIN) - if (level == GPUInfo::kComplete && gpu_info_.level <= GPUInfo::kPartial) { + if (!gpu_info_.finalized && !collecting_dx_diagnostics_) { // Prevent concurrent collection of DirectX diagnostics. - gpu_info_.level = GPUInfo::kCompleting; + collecting_dx_diagnostics_ = true; // Asynchronously collect the DirectX diagnostics because this can take a // couple of seconds. @@ -262,7 +259,8 @@ void GpuThread::OnCollectGraphicsInfo(GPUInfo::Level level) { // Flag GPU info as complete if the DirectX diagnostics cannot be // collected. - gpu_info_.level = GPUInfo::kComplete; + collecting_dx_diagnostics_ = false; + gpu_info_.finalized = true; } else { // Do not send response if we are still completing the GPUInfo struct return; @@ -340,7 +338,8 @@ void GpuThread::CollectDxDiagnostics(GpuThread* thread) { // Runs on the GPU thread. void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { thread->gpu_info_.dx_diagnostics = node; - thread->gpu_info_.level = GPUInfo::kComplete; + thread->gpu_info_.finalized = true; + thread->collecting_dx_diagnostics_ = false; thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); } diff --git a/content/gpu/gpu_thread.h b/content/gpu/gpu_thread.h index 21ad923..4a0c348 100644 --- a/content/gpu/gpu_thread.h +++ b/content/gpu/gpu_thread.h @@ -58,7 +58,7 @@ class GpuThread : public ChildThread { void OnEstablishChannel(int renderer_id); void OnCloseChannel(const IPC::ChannelHandle& channel_handle); void OnSynchronize(); - void OnCollectGraphicsInfo(GPUInfo::Level level); + void OnCollectGraphicsInfo(); void OnCreateViewCommandBuffer( gfx::PluginWindowHandle window, int32 render_view_id, @@ -89,6 +89,9 @@ class GpuThread : public ChildThread { #if defined(OS_WIN) // Windows specific client sandbox interface. sandbox::TargetServices* target_services_; + + // Indicates whether DirectX Diagnostics collection is ongoing. + bool collecting_dx_diagnostics_; #endif DISALLOW_COPY_AND_ASSIGN(GpuThread); |