summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_main.cc5
-rw-r--r--chrome/browser/gpu_data_manager.cc59
-rw-r--r--chrome/browser/gpu_data_manager.h6
-rw-r--r--chrome/browser/gpu_process_host_ui_shim.cc12
-rw-r--r--chrome/browser/gpu_process_host_ui_shim.h2
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc6
-rw-r--r--chrome/common/gpu_messages_internal.h6
-rw-r--r--chrome/gpu/gpu_thread.cc15
8 files changed, 65 insertions, 46 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 5206a98..a7a565c 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -1742,8 +1742,9 @@ int BrowserMain(const MainFunctionParams& parameters) {
// might have shutdown because an update was available.
profile->GetCloudPrintProxyService();
- // Need to initialize GpuDataManager to load the current GPU blacklist
- // and schedule a GPU blacklist auto update.
+ // Need to initialize GpuDataManager to load the current GPU blacklist,
+ // collect preliminary GPU info, run through GPU blacklist, and schedule
+ // a GPU blacklist auto update.
GpuDataManager* gpu_data_manager = GpuDataManager::GetInstance();
DCHECK(gpu_data_manager);
diff --git a/chrome/browser/gpu_data_manager.cc b/chrome/browser/gpu_data_manager.cc
index 2e967b9..d6f3fa2 100644
--- a/chrome/browser/gpu_data_manager.cc
+++ b/chrome/browser/gpu_data_manager.cc
@@ -15,22 +15,24 @@
#include "chrome/common/child_process_logging.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
+#include "chrome/gpu/gpu_info_collector.h"
#include "content/browser/gpu_blacklist.h"
#include "grit/browser_resources.h"
#include "ui/base/resource/resource_bundle.h"
GpuDataManager::GpuDataManager()
- : complete_gpu_info_already_requested_(false)
- , gpu_feature_flags_set_(false)
- , gpu_blacklist_cache_(NULL) {
+ : complete_gpu_info_already_requested_(false),
+ gpu_feature_flags_set_(false),
+ gpu_blacklist_cache_(NULL) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(g_browser_process);
- PrefService* prefs = g_browser_process->local_state();
+ PrefService* local_state = g_browser_process->local_state();
// If we bring up chrome normally, prefs should never be NULL; however, we
- // we handle the case where prefs == NULL for certain tests.
- if (prefs) {
- prefs->RegisterDictionaryPref(prefs::kGpuBlacklist);
- gpu_blacklist_cache_ = prefs->GetMutableDictionary(prefs::kGpuBlacklist);
+ // we handle the case where local_state == NULL for certain tests.
+ if (local_state) {
+ local_state->RegisterDictionaryPref(prefs::kGpuBlacklist);
+ gpu_blacklist_cache_ =
+ local_state->GetMutableDictionary(prefs::kGpuBlacklist);
DCHECK(gpu_blacklist_cache_);
gpu_blacklist_updater_ = new GpuBlacklistUpdater();
@@ -40,6 +42,13 @@ GpuDataManager::GpuDataManager()
LoadGpuBlacklist();
UpdateGpuBlacklist();
+
+ GPUInfo gpu_info;
+ gpu_info_collector::CollectPreliminaryGraphicsInfo(&gpu_info);
+ UpdateGpuInfo(gpu_info);
+ UpdateGpuFeatureFlags();
+
+ preliminary_gpu_feature_flags_ = gpu_feature_flags_;
}
GpuDataManager::~GpuDataManager() { }
@@ -96,7 +105,13 @@ const ListValue& GpuDataManager::log_messages() const {
GpuFeatureFlags GpuDataManager::GetGpuFeatureFlags() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
UpdateGpuFeatureFlags();
- return gpu_feature_flags_;
+ // We only need to return the bits that are not in the preliminary
+ // gpu feature flags because the latter work through renderer
+ // commandline switches.
+ uint32 mask = ~(preliminary_gpu_feature_flags_.flags());
+ GpuFeatureFlags masked_flags;
+ masked_flags.set_flags(gpu_feature_flags_.flags() & mask);
+ return masked_flags;
}
void GpuDataManager::AddGpuInfoUpdateCallback(Callback0::Type* callback) {
@@ -115,6 +130,32 @@ bool GpuDataManager::RemoveGpuInfoUpdateCallback(Callback0::Type* callback) {
return false;
}
+void GpuDataManager::AppendRendererCommandLine(
+ CommandLine* command_line) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(command_line);
+
+ uint32 flags = preliminary_gpu_feature_flags_.flags();
+ if ((flags & GpuFeatureFlags::kGpuFeatureWebgl) &&
+ !command_line->HasSwitch(switches::kDisableExperimentalWebGL))
+ command_line->AppendSwitch(switches::kDisableExperimentalWebGL);
+ if ((flags & GpuFeatureFlags::kGpuFeatureMultisampling) &&
+ !command_line->HasSwitch(switches::kDisableGLMultisampling))
+ command_line->AppendSwitch(switches::kDisableGLMultisampling);
+ // If we have kGpuFeatureAcceleratedCompositing, we disable all GPU features.
+ if (flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing) {
+ const char* switches[] = {
+ switches::kDisableAcceleratedCompositing,
+ switches::kDisableExperimentalWebGL
+ };
+ const int switch_count = sizeof(switches) / sizeof(char*);
+ for (int i = 0; i < switch_count; ++i) {
+ if (!command_line->HasSwitch(switches[i]))
+ command_line->AppendSwitch(switches[i]);
+ }
+ }
+}
+
void GpuDataManager::RunGpuInfoUpdateCallbacks() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
std::set<Callback0::Type*>::iterator i = gpu_info_update_callbacks_.begin();
diff --git a/chrome/browser/gpu_data_manager.h b/chrome/browser/gpu_data_manager.h
index f0edd14..850e3de 100644
--- a/chrome/browser/gpu_data_manager.h
+++ b/chrome/browser/gpu_data_manager.h
@@ -16,6 +16,7 @@
#include "chrome/common/gpu_feature_flags.h"
#include "chrome/common/gpu_info.h"
+class CommandLine;
class DictionaryValue;
class GpuBlacklist;
class GPUInfo;
@@ -51,6 +52,10 @@ class GpuDataManager {
// Returns true if removed, or false if it was not found.
bool RemoveGpuInfoUpdateCallback(Callback0::Type* callback);
+ // Inserting disable-feature switches into renderer process command-line
+ // in correspondance to preliminary gpu feature flags.
+ void AppendRendererCommandLine(CommandLine* command_line);
+
private:
friend struct DefaultSingletonTraits<GpuDataManager>;
@@ -79,6 +84,7 @@ class GpuDataManager {
bool gpu_feature_flags_set_;
GpuFeatureFlags gpu_feature_flags_;
+ GpuFeatureFlags preliminary_gpu_feature_flags_;
GPUInfo gpu_info_;
diff --git a/chrome/browser/gpu_process_host_ui_shim.cc b/chrome/browser/gpu_process_host_ui_shim.cc
index ac0ea32..54c9ad0 100644
--- a/chrome/browser/gpu_process_host_ui_shim.cc
+++ b/chrome/browser/gpu_process_host_ui_shim.cc
@@ -380,8 +380,6 @@ bool GpuProcessHostUIShim::OnControlMessageReceived(
OnDestroyCommandBuffer)
IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected,
OnGraphicsInfoCollected)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_PreliminaryGraphicsInfoCollected,
- OnPreliminaryGraphicsInfoCollected)
IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage,
OnLogMessage)
IPC_MESSAGE_HANDLER(GpuHostMsg_SynchronizeReply,
@@ -463,16 +461,6 @@ void GpuProcessHostUIShim::OnGraphicsInfoCollected(const GPUInfo& gpu_info) {
gpu_data_manager_->UpdateGpuInfo(gpu_info);
}
-void GpuProcessHostUIShim::OnPreliminaryGraphicsInfoCollected(
- const GPUInfo& gpu_info, IPC::Message* reply_msg) {
- gpu_data_manager_->UpdateGpuInfo(gpu_info);
- GpuFeatureFlags flags = gpu_data_manager_->GetGpuFeatureFlags();
-
- GpuHostMsg_PreliminaryGraphicsInfoCollected::WriteReplyParams(
- reply_msg, flags.flags() != 0);
- Send(reply_msg);
-}
-
void GpuProcessHostUIShim::OnLogMessage(int level,
const std::string& header,
const std::string& message) {
diff --git a/chrome/browser/gpu_process_host_ui_shim.h b/chrome/browser/gpu_process_host_ui_shim.h
index ddd9dec..c0a0858 100644
--- a/chrome/browser/gpu_process_host_ui_shim.h
+++ b/chrome/browser/gpu_process_host_ui_shim.h
@@ -143,8 +143,6 @@ class GpuProcessHostUIShim
void OnDestroyCommandBuffer(gfx::PluginWindowHandle window,
int32 renderer_id, int32 render_view_id);
void OnGraphicsInfoCollected(const GPUInfo& gpu_info);
- void OnPreliminaryGraphicsInfoCollected(
- const GPUInfo& gpu_info, IPC::Message* reply_msg);
void OnLogMessage(int level, const std::string& header,
const std::string& message);
void OnSynchronizeReply();
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 374d5c3..9c47b23 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -33,6 +33,7 @@
#include "chrome/browser/extensions/extension_message_service.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/user_script_master.h"
+#include "chrome/browser/gpu_data_manager.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/io_thread.h"
#include "chrome/browser/metrics/user_metrics.h"
@@ -636,6 +637,11 @@ void BrowserRenderProcessHost::AppendRendererCommandLine(
// Turn this policy into a command line switch.
command_line->AppendSwitch(switches::kDisable3DAPIs);
}
+
+ // Appending disable-gpu-feature switches due to software rendering list.
+ GpuDataManager* gpu_data_manager = GpuDataManager::GetInstance();
+ DCHECK(gpu_data_manager);
+ gpu_data_manager->AppendRendererCommandLine(command_line);
}
void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer(
diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h
index eaf5088..eecc12e 100644
--- a/chrome/common/gpu_messages_internal.h
+++ b/chrome/common/gpu_messages_internal.h
@@ -133,12 +133,6 @@ IPC_MESSAGE_CONTROL3(GpuHostMsg_DestroyCommandBuffer,
IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected,
GPUInfo /* GPU logging stats */)
-// Request from GPU to check if GPU is blacklisted based on preliminary GPU
-// info.
-IPC_SYNC_MESSAGE_CONTROL1_1(GpuHostMsg_PreliminaryGraphicsInfoCollected,
- GPUInfo, /* preliminary GPU logging stats */
- bool /* blacklisted or not */)
-
// Message from GPU to add a GPU log message to the about:gpu page.
IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage,
int /*severity*/,
diff --git a/chrome/gpu/gpu_thread.cc b/chrome/gpu/gpu_thread.cc
index 58a4c47..80dd643 100644
--- a/chrome/gpu/gpu_thread.cc
+++ b/chrome/gpu/gpu_thread.cc
@@ -121,21 +121,6 @@ void GpuThread::OnInitialize() {
if (!single_process)
logging::SetLogMessageHandler(GpuProcessLogMessageHandler);
- // Collect as much GPU info as possible without creating GL/D3D context.
- gpu_info_collector::CollectPreliminaryGraphicsInfo(&gpu_info_);
- LOG(INFO) << "gpu_info_collector::CollectPreliminaryGraphicsInfo complete";
-
- // Go through GPU blacklist with partial GPU info; if GPU is already
- // blacklisted, don't create GL/D3D context.
- bool blacklisted;
- Send(new GpuHostMsg_PreliminaryGraphicsInfoCollected(gpu_info_,
- &blacklisted));
- if (blacklisted) {
- LOG(INFO) << "GPU is blacklisted based on preliminary GPU info collection";
- MessageLoop::current()->Quit();
- return;
- }
-
// Load the GL implementation and locate the bindings before starting the GPU
// watchdog because this can take a lot of time and the GPU watchdog might
// terminate the GPU process.