Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: content/gpu/gpu_child_thread.cc

Issue 10310180: Disable GPU info collection on GPU process startup on Win/Mac. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/gpu/gpu_child_thread.cc
===================================================================
--- content/gpu/gpu_child_thread.cc (revision 137174)
+++ content/gpu/gpu_child_thread.cc (working copy)
@@ -47,10 +47,7 @@
} // namespace
-GpuChildThread::GpuChildThread(bool dead_on_arrival,
- const content::GPUInfo& gpu_info)
- : dead_on_arrival_(dead_on_arrival),
- gpu_info_(gpu_info) {
+GpuChildThread::GpuChildThread() {
#if defined(OS_WIN)
target_services_ = NULL;
collecting_dx_diagnostics_ = false;
@@ -58,18 +55,13 @@
}
GpuChildThread::GpuChildThread(const std::string& channel_id)
- : ChildThread(channel_id),
- dead_on_arrival_(false) {
+ : ChildThread(channel_id) {
#if defined(OS_WIN)
target_services_ = NULL;
collecting_dx_diagnostics_ = false;
#endif
- if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info_)) {
- LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo failed";
- }
}
-
GpuChildThread::~GpuChildThread() {
logging::SetLogMessageHandler(NULL);
}
@@ -106,12 +98,6 @@
}
void GpuChildThread::OnInitialize() {
- if (dead_on_arrival_) {
- LOG(INFO) << "Exiting GPU process due to errors during initialization";
- MessageLoop::current()->Quit();
- return;
- }
-
// We don't need to pipe log messages if we are running the GPU thread in
// the browser process.
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) &&
@@ -163,9 +149,9 @@
ChildProcess::current()->io_message_loop_proxy(),
ChildProcess::current()->GetShutDownEvent()));
- // Ensure the browser process receives the GPU info before a reply to any
- // subsequent IPC it might send.
- Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_));
+#if defined(OS_LINUX)
+ OnCollectGraphicsInfo();
+#endif
}
void GpuChildThread::StopWatchdog() {
@@ -175,26 +161,48 @@
}
void GpuChildThread::OnCollectGraphicsInfo() {
+ DCHECK(CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableGpuSandbox));
+ if (!gpu_info_.finalized) {
+ // Load and initialize the GL implementation and locate the GL entry points.
+ if (gfx::GLSurface::InitializeOneOff()) {
apatrick_chromium 2012/05/16 18:02:35 At this point, the GPU sandbox might have been tur
+ // Collect information about the GPU.
+ if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info_)) {
apatrick_chromium 2012/05/16 18:02:35 .. ditto this.
+ VLOG(1) << "gpu_info_collector::CollectGraphicsInfo failed";
+ }
+
+#if defined(OS_LINUX)
+ if (gpu_info_.gpu.vendor_id == 0x10de && // NVIDIA
+ gpu_info_.driver_vendor == "NVIDIA") {
+ base::ThreadRestrictions::AssertIOAllowed();
+ if (access("/dev/nvidiactl", R_OK) != 0) {
apatrick_chromium 2012/05/16 18:02:35 ... and I suspect this might fail on Linux once th
+ VLOG(1) << "NVIDIA device file /dev/nvidiactl access denied";
+ gpu_info_.gpu_accessible = false;
+ }
+ }
+#endif
+ } else {
+ VLOG(1) << "gfx::GLSurface::InitializeOneOff failed";
+ gpu_info_.gpu_accessible = false;
+ }
+#if !defined(OS_WIN)
+ gpu_info_.finalized = true;
+#endif
+ }
#if defined(OS_WIN)
if (!gpu_info_.finalized && !collecting_dx_diagnostics_) {
// Prevent concurrent collection of DirectX diagnostics.
collecting_dx_diagnostics_ = true;
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableGpuSandbox)) {
- // Asynchronously collect the DirectX diagnostics because this can take a
- // couple of seconds.
- if (!base::WorkerPool::PostTask(
- FROM_HERE, base::Bind(&GpuChildThread::CollectDxDiagnostics, this),
- true)) {
- // Flag GPU info as complete if the DirectX diagnostics cannot be
- // collected.
- collecting_dx_diagnostics_ = false;
- gpu_info_.finalized = true;
- } else {
- // Do not send response if we are still completing the GPUInfo struct
- return;
- }
+ // Asynchronously collect the DirectX diagnostics because this can take a
+ // couple of seconds.
+ if (!base::WorkerPool::PostTask(
+ FROM_HERE, base::Bind(&GpuChildThread::CollectDxDiagnostics, this),
+ true)) {
+ // Flag GPU info as complete if the DirectX diagnostics cannot be
+ // collected.
+ collecting_dx_diagnostics_ = false;
+ gpu_info_.finalized = true;
}
}
#endif
@@ -202,20 +210,20 @@
}
void GpuChildThread::OnClean() {
- LOG(INFO) << "GPU: Removing all contexts";
+ VLOG(1) << "GPU: Removing all contexts";
if (gpu_channel_manager_.get())
gpu_channel_manager_->LoseAllContexts();
}
void GpuChildThread::OnCrash() {
- LOG(INFO) << "GPU: Simulating GPU crash";
+ VLOG(1) << "GPU: Simulating GPU crash";
// Good bye, cruel world.
volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL;
*it_s_the_end_of_the_world_as_we_know_it = 0xdead;
}
void GpuChildThread::OnHang() {
- LOG(INFO) << "GPU: Simulating GPU hang";
+ VLOG(1) << "GPU: Simulating GPU hang";
for (;;) {
// Do not sleep here. The GPU watchdog timer tracks the amount of user
// time this thread is using and it doesn't use much while calling Sleep.
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | content/gpu/gpu_main.cc » ('j') | content/gpu/gpu_main.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698