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

Side by Side Diff: chrome/browser/gpu_process_host.cc

Issue 5612002: Blacklist bad GPU drivers: currenly we disable all gpu related features if th... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/gpu_process_host.h ('k') | chrome/browser/resources/gpu_blacklist.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/gpu_process_host.h" 5 #include "chrome/browser/gpu_process_host.h"
6 6
7 #include "app/app_switches.h" 7 #include "app/app_switches.h"
8 #include "app/resource_bundle.h"
8 #include "base/command_line.h" 9 #include "base/command_line.h"
9 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/string_piece.h"
10 #include "base/thread.h" 12 #include "base/thread.h"
11 #include "chrome/browser/browser_thread.h" 13 #include "chrome/browser/browser_thread.h"
14 #include "chrome/browser/gpu_blacklist.h"
12 #include "chrome/browser/gpu_process_host_ui_shim.h" 15 #include "chrome/browser/gpu_process_host_ui_shim.h"
13 #include "chrome/browser/renderer_host/render_view_host.h" 16 #include "chrome/browser/renderer_host/render_view_host.h"
14 #include "chrome/browser/renderer_host/render_widget_host_view.h" 17 #include "chrome/browser/renderer_host/render_widget_host_view.h"
15 #include "chrome/browser/renderer_host/resource_message_filter.h" 18 #include "chrome/browser/renderer_host/resource_message_filter.h"
16 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" 19 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
17 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/gpu_feature_flags.h"
18 #include "chrome/common/gpu_info.h" 22 #include "chrome/common/gpu_info.h"
19 #include "chrome/common/gpu_messages.h" 23 #include "chrome/common/gpu_messages.h"
20 #include "chrome/common/render_messages.h" 24 #include "chrome/common/render_messages.h"
25 #include "grit/browser_resources.h"
21 #include "ipc/ipc_channel_handle.h" 26 #include "ipc/ipc_channel_handle.h"
22 #include "ipc/ipc_switches.h" 27 #include "ipc/ipc_switches.h"
23 #include "media/base/media_switches.h" 28 #include "media/base/media_switches.h"
24 29
25 #if defined(OS_LINUX) 30 #if defined(OS_LINUX)
26 // These two #includes need to come after render_messages.h. 31 // These two #includes need to come after render_messages.h.
27 #include <gdk/gdkwindow.h> // NOLINT 32 #include <gdk/gdkwindow.h> // NOLINT
28 #include <gdk/gdkx.h> // NOLINT 33 #include <gdk/gdkx.h> // NOLINT
29 #include "app/x11_util.h" 34 #include "app/x11_util.h"
30 #include "gfx/gtk_native_view_id_manager.h" 35 #include "gfx/gtk_native_view_id_manager.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 95
91 bool GpuProcessHost::EnsureInitialized() { 96 bool GpuProcessHost::EnsureInitialized() {
92 if (!initialized_) { 97 if (!initialized_) {
93 initialized_ = true; 98 initialized_ = true;
94 initialized_successfully_ = Init(); 99 initialized_successfully_ = Init();
95 } 100 }
96 return initialized_successfully_; 101 return initialized_successfully_;
97 } 102 }
98 103
99 bool GpuProcessHost::Init() { 104 bool GpuProcessHost::Init() {
105 if (!LoadGpuBlacklist())
106 return false;
107
100 if (!CreateChannel()) 108 if (!CreateChannel())
101 return false; 109 return false;
102 110
103 if (!CanLaunchGpuProcess()) 111 if (!CanLaunchGpuProcess())
104 return false; 112 return false;
105 113
106 return LaunchGpuProcess(); 114 return LaunchGpuProcess();
107 } 115 }
108 116
109 // static 117 // static
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // If the IO thread does not handle the message then automatically route it 200 // If the IO thread does not handle the message then automatically route it
193 // to the UI thread. The UI thread will report an error if it does not 201 // to the UI thread. The UI thread will report an error if it does not
194 // handle it. 202 // handle it.
195 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message)) 203 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message))
196 IPC_END_MESSAGE_MAP() 204 IPC_END_MESSAGE_MAP()
197 } 205 }
198 206
199 void GpuProcessHost::OnChannelEstablished( 207 void GpuProcessHost::OnChannelEstablished(
200 const IPC::ChannelHandle& channel_handle, 208 const IPC::ChannelHandle& channel_handle,
201 const GPUInfo& gpu_info) { 209 const GPUInfo& gpu_info) {
210 GpuFeatureFlags gpu_feature_flags;
211 if (channel_handle.name.size() != 0) {
212 gpu_feature_flags = gpu_blacklist_->DetermineGpuFeatureFlags(
213 GpuBlacklist::kOsAny, NULL, gpu_info);
214 }
202 const ChannelRequest& request = sent_requests_.front(); 215 const ChannelRequest& request = sent_requests_.front();
203 SendEstablishChannelReply(channel_handle, gpu_info, request.filter); 216 // Currently if any of the GPU features are blacklised, we don't establish a
217 // GPU channel.
218 if (gpu_feature_flags.flags() != 0) {
219 Send(new GpuMsg_CloseChannel(channel_handle));
220 SendEstablishChannelReply(IPC::ChannelHandle(), gpu_info, request.filter);
221 } else {
222 SendEstablishChannelReply(channel_handle, gpu_info, request.filter);
223 }
204 sent_requests_.pop(); 224 sent_requests_.pop();
205 } 225 }
206 226
207 void GpuProcessHost::OnSynchronizeReply() { 227 void GpuProcessHost::OnSynchronizeReply() {
208 const SynchronizationRequest& request = 228 const SynchronizationRequest& request =
209 queued_synchronization_replies_.front(); 229 queued_synchronization_replies_.front();
210 SendSynchronizationReply(request.reply, request.filter); 230 SendSynchronizationReply(request.reply, request.filter);
211 queued_synchronization_replies_.pop(); 231 queued_synchronization_replies_.pop();
212 } 232 }
213 233
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 #elif defined(OS_POSIX) 549 #elif defined(OS_POSIX)
530 false, // Never use the zygote (GPU plugin can't be sandboxed). 550 false, // Never use the zygote (GPU plugin can't be sandboxed).
531 base::environment_vector(), 551 base::environment_vector(),
532 #endif 552 #endif
533 cmd_line); 553 cmd_line);
534 554
535 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", 555 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents",
536 kLaunched, kGPUProcessLifetimeEvent_Max); 556 kLaunched, kGPUProcessLifetimeEvent_Max);
537 return true; 557 return true;
538 } 558 }
559
560 bool GpuProcessHost::LoadGpuBlacklist() {
561 if (gpu_blacklist_.get() != NULL)
562 return true;
563 static const base::StringPiece gpu_blacklist_json(
564 ResourceBundle::GetSharedInstance().GetRawDataResource(
565 IDR_GPU_BLACKLIST));
566 GpuBlacklist* blacklist = new GpuBlacklist();
567 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
568 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) ||
569 blacklist->LoadGpuBlacklist(gpu_blacklist_json.as_string(), true)) {
570 gpu_blacklist_.reset(blacklist);
571 return true;
572 }
573 delete blacklist;
574 return false;
575 }
576
OLDNEW
« no previous file with comments | « chrome/browser/gpu_process_host.h ('k') | chrome/browser/resources/gpu_blacklist.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698