diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-27 00:19:37 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-27 00:19:37 +0000 |
commit | f3f79b10e5f2231e2133c00e2f901029234ff7c2 (patch) | |
tree | 7baf1575a544aede45c2d9b4ca4c49a77ecbb65c /chrome/gpu | |
parent | 09433b23b0126c80c78aad19eda8c59216026842 (diff) | |
download | chromium_src-f3f79b10e5f2231e2133c00e2f901029234ff7c2.zip chromium_src-f3f79b10e5f2231e2133c00e2f901029234ff7c2.tar.gz chromium_src-f3f79b10e5f2231e2133c00e2f901029234ff7c2.tar.bz2 |
Reland 72704 - Defered collect DirectX diagnostics until they are needed for about:gpu.
This is because collecting the stats often crashes.
Added a guard to prevent the collection of diagnostics on multiple threads simultaneously.
Renamed GPUInfo::Progress to GPUInfo::Level.
TEST=try, about:gpu does not cause concurrent diagnostics collection
BUG=none
Review URL: http://codereview.chromium.org/6364013
Review URL: http://codereview.chromium.org/6341011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/gpu')
-rw-r--r-- | chrome/gpu/gpu_info_collector_linux.cc | 2 | ||||
-rw-r--r-- | chrome/gpu/gpu_info_collector_mac.mm | 2 | ||||
-rw-r--r-- | chrome/gpu/gpu_info_collector_win.cc | 4 | ||||
-rw-r--r-- | chrome/gpu/gpu_thread.cc | 35 | ||||
-rw-r--r-- | chrome/gpu/gpu_thread.h | 2 |
5 files changed, 26 insertions, 19 deletions
diff --git a/chrome/gpu/gpu_info_collector_linux.cc b/chrome/gpu/gpu_info_collector_linux.cc index 617c28b..638081d 100644 --- a/chrome/gpu/gpu_info_collector_linux.cc +++ b/chrome/gpu/gpu_info_collector_linux.cc @@ -133,7 +133,7 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) { // desktop GL and GL_ARB_robustness extension is available. gpu_info->SetCanLoseContext( gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); - gpu_info->SetProgress(GPUInfo::kComplete); + gpu_info->SetLevel(GPUInfo::kComplete); return CollectGraphicsInfoGL(gpu_info); } diff --git a/chrome/gpu/gpu_info_collector_mac.mm b/chrome/gpu/gpu_info_collector_mac.mm index a904164..e401e8f 100644 --- a/chrome/gpu/gpu_info_collector_mac.mm +++ b/chrome/gpu/gpu_info_collector_mac.mm @@ -48,7 +48,7 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) { gpu_info->SetCanLoseContext( gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); - gpu_info->SetProgress(GPUInfo::kComplete); + gpu_info->SetLevel(GPUInfo::kComplete); return CollectGraphicsInfoGL(gpu_info); } diff --git a/chrome/gpu/gpu_info_collector_win.cc b/chrome/gpu/gpu_info_collector_win.cc index 39efdbef..84b62d7 100644 --- a/chrome/gpu/gpu_info_collector_win.cc +++ b/chrome/gpu/gpu_info_collector_win.cc @@ -24,7 +24,7 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { - gpu_info->SetProgress(GPUInfo::kComplete); + gpu_info->SetLevel(GPUInfo::kComplete); return CollectGraphicsInfoGL(gpu_info); } @@ -49,7 +49,7 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) { // DirectX diagnostics are collected asynchronously because it takes a // couple of seconds. Do not mark as complete until that is done. - gpu_info->SetProgress(GPUInfo::kPartial); + gpu_info->SetLevel(GPUInfo::kPartial); return true; } diff --git a/chrome/gpu/gpu_thread.cc b/chrome/gpu/gpu_thread.cc index 6e9b3da..752478e 100644 --- a/chrome/gpu/gpu_thread.cc +++ b/chrome/gpu/gpu_thread.cc @@ -95,18 +95,6 @@ void GpuThread::OnInitialize() { gpu_info_collector::CollectGraphicsInfo(&gpu_info_); child_process_logging::SetGpuInfo(gpu_info_); -#if defined(OS_WIN) - // Asynchronously collect the DirectX diagnostics because this can take a - // couple of seconds. - if (!base::WorkerPool::PostTask( - FROM_HERE, - NewRunnableFunction(&GpuThread::CollectDxDiagnostics, this), - true)) { - // Flag GPU info as complete if the DirectX diagnostics cannot be collected. - gpu_info_.SetProgress(GPUInfo::kComplete); - } -#endif - // Record initialization only after collecting the GPU info because that can // take a significant amount of time. gpu_info_.SetInitializationTime(base::Time::Now() - process_start_time_); @@ -208,7 +196,26 @@ void GpuThread::OnSynchronize() { Send(new GpuHostMsg_SynchronizeReply()); } -void GpuThread::OnCollectGraphicsInfo() { +void GpuThread::OnCollectGraphicsInfo(GPUInfo::Level level) { +#if defined(OS_WIN) + if (level == GPUInfo::kComplete && gpu_info_.level() <= GPUInfo::kPartial) { + // Prevent concurrent collection of DirectX diagnostics. + gpu_info_.SetLevel(GPUInfo::kCompleting); + + // Asynchronously collect the DirectX diagnostics because this can take a + // couple of seconds. + if (!base::WorkerPool::PostTask( + FROM_HERE, + NewRunnableFunction(&GpuThread::CollectDxDiagnostics, this), + true)) { + + // Flag GPU info as complete if the DirectX diagnostics cannot be + // collected. + gpu_info_.SetLevel(GPUInfo::kComplete); + } + } +#endif + Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); } @@ -262,7 +269,7 @@ void GpuThread::CollectDxDiagnostics(GpuThread* thread) { // Runs on the GPU thread. void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { thread->gpu_info_.SetDxDiagnostics(node); - thread->gpu_info_.SetProgress(GPUInfo::kComplete); + thread->gpu_info_.SetLevel(GPUInfo::kComplete); } #endif diff --git a/chrome/gpu/gpu_thread.h b/chrome/gpu/gpu_thread.h index 6928645..1bbb225 100644 --- a/chrome/gpu/gpu_thread.h +++ b/chrome/gpu/gpu_thread.h @@ -50,7 +50,7 @@ class GpuThread : public ChildThread { void OnEstablishChannel(int renderer_id); void OnCloseChannel(const IPC::ChannelHandle& channel_handle); void OnSynchronize(); - void OnCollectGraphicsInfo(); + void OnCollectGraphicsInfo(GPUInfo::Level level); #if defined(OS_MACOSX) void OnAcceleratedSurfaceBuffersSwappedACK( int renderer_id, int32 route_id, uint64 swap_buffers_count); |