OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 bool dead_on_arrival = false; | 74 bool dead_on_arrival = false; |
75 | 75 |
76 // Load and initialize the GL implementation and locate the GL entry points. | 76 // Load and initialize the GL implementation and locate the GL entry points. |
77 content::GPUInfo gpu_info; | 77 content::GPUInfo gpu_info; |
78 if (gfx::GLSurface::InitializeOneOff()) { | 78 if (gfx::GLSurface::InitializeOneOff()) { |
79 // Collect information about the GPU. | 79 // Collect information about the GPU. |
80 if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info)) { | 80 if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info)) { |
81 LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo failed"; | 81 LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo failed"; |
82 } | 82 } |
83 | 83 |
| 84 #if defined(OS_LINUX) |
| 85 if (gpu_info.vendor_id == 0x10de) { // NVIDIA |
| 86 base::ThreadRestrictions::AssertIOAllowed(); |
| 87 if (access("/dev/nvidiactl", R_OK) != 0) { |
| 88 LOG(INFO) << "NVIDIA device file /dev/nvidiactl access denied"; |
| 89 gpu_info.gpu_accessible = false; |
| 90 dead_on_arrival = true; |
| 91 } |
| 92 } |
| 93 #endif |
| 94 |
84 // Set the GPU info even if it failed. | 95 // Set the GPU info even if it failed. |
85 content::GetContentClient()->SetGpuInfo(gpu_info); | 96 content::GetContentClient()->SetGpuInfo(gpu_info); |
86 } else { | 97 } else { |
87 LOG(INFO) << "gfx::GLSurface::InitializeOneOff failed"; | 98 LOG(INFO) << "gfx::GLSurface::InitializeOneOff failed"; |
| 99 gpu_info.gpu_accessible = false; |
88 dead_on_arrival = true; | 100 dead_on_arrival = true; |
89 } | 101 } |
90 | 102 |
91 base::win::ScopedCOMInitializer com_initializer; | 103 base::win::ScopedCOMInitializer com_initializer; |
92 | 104 |
93 #if defined(OS_WIN) | 105 #if defined(OS_WIN) |
94 // Preload this DLL because the sandbox prevents it from loading. | 106 // Preload this DLL because the sandbox prevents it from loading. |
95 LoadLibrary(L"setupapi.dll"); | 107 LoadLibrary(L"setupapi.dll"); |
96 | 108 |
97 // Cause advapi32 to load before the sandbox is turned on. | 109 // Cause advapi32 to load before the sandbox is turned on. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 child_thread->Init(start_time); | 144 child_thread->Init(start_time); |
133 | 145 |
134 gpu_process.set_main_thread(child_thread); | 146 gpu_process.set_main_thread(child_thread); |
135 | 147 |
136 main_message_loop.Run(); | 148 main_message_loop.Run(); |
137 | 149 |
138 child_thread->StopWatchdog(); | 150 child_thread->StopWatchdog(); |
139 | 151 |
140 return 0; | 152 return 0; |
141 } | 153 } |
OLD | NEW |