bool gpu_changed = false;
if (flags & kCGDisplayAddFlag) {
uint32 vendor_id, device_id;
- if (gpu::CollectGpuID(&vendor_id, &device_id) == gpu::kGpuIDSuccess) {
+ if (gpu::CollectGpuID(&vendor_id, &device_id) == gpu::kCollectInfoSuccess) {
gpu_changed = manager->UpdateActiveGpu(vendor_id, device_id);
}
}
return true;
}
#endif // OS_CHROMEOS
- if (use_swiftshader_) {
+ if (use_swiftshader_ || ShouldUseWarp()) {
// Skia's software rendering is probably more efficient than going through
// software emulation of the GPU, so use that.
if (feature == gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)
}
size_t GpuDataManagerImplPrivate::GetBlacklistedFeatureCount() const {
- if (use_swiftshader_)
+ if (use_swiftshader_ || ShouldUseWarp())
return 1;
return blacklisted_features_.size();
}
bool GpuDataManagerImplPrivate::GpuAccessAllowed(
std::string* reason) const {
- if (use_swiftshader_)
+ if (use_swiftshader_ || ShouldUseWarp())
return true;
if (!gpu_process_accessible_) {
}
void GpuDataManagerImplPrivate::RequestCompleteGpuInfoIfNeeded() {
- if (complete_gpu_info_already_requested_ || gpu_info_.finalized)
+ if (complete_gpu_info_already_requested_ || IsCompleteGpuInfoAvailable())
return;
complete_gpu_info_already_requested_ = true;
new GpuMsg_CollectGraphicsInfo());
}
+bool GpuDataManagerImplPrivate::IsEssentialGpuInfoAvailable() const {
+ if (gpu_info_.basic_info_state == gpu::kCollectInfoNone ||
+ gpu_info_.context_info_state == gpu::kCollectInfoNone) {
+ return false;
+ }
+ return true;
+}
+
bool GpuDataManagerImplPrivate::IsCompleteGpuInfoAvailable() const {
- return gpu_info_.finalized;
+#if defined(OS_WIN)
+ if (gpu_info_.dx_diagnostics_info_state == gpu::kCollectInfoNone)
+ return false;
+#endif
+ return IsEssentialGpuInfoAvailable();
}
void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate() const {
EnableSwiftShaderIfNecessary();
}
+bool GpuDataManagerImplPrivate::ShouldUseWarp() const {
+ return use_warp_ ||
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp);
+}
+
void GpuDataManagerImplPrivate::AddObserver(GpuDataManagerObserver* observer) {
GpuDataManagerImpl::UnlockedSession session(owner_);
observer_list_->AddObserver(observer);
gpu::CollectBasicGraphicsInfo(&gpu_info);
}
#if defined(ARCH_CPU_X86_FAMILY)
- if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id)
- gpu_info.finalized = true;
-#endif
+ if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) {
+ gpu_info.context_info_state = gpu::kCollectInfoNonFatalFailure;
+#if defined(OS_WIN)
+ gpu_info.dx_diagnostics_info_state = gpu::kCollectInfoNonFatalFailure;
+#endif // OS_WIN
+ }
+#endif // ARCH_CPU_X86_FAMILY
std::string gpu_blacklist_string;
std::string gpu_driver_bug_list_string;
void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) {
// No further update of gpu_info if falling back to SwiftShader.
- if (use_swiftshader_)
+ if (use_swiftshader_ || ShouldUseWarp())
return;
gpu::MergeGPUInfo(&gpu_info_, gpu_info);
- complete_gpu_info_already_requested_ =
- complete_gpu_info_already_requested_ || gpu_info_.finalized;
+ if (IsCompleteGpuInfoAvailable())
+ complete_gpu_info_already_requested_ = true;
UpdateGpuInfoHelper();
}
gpu_info_.driver_vendor);
command_line->AppendSwitchASCII(switches::kGpuDriverVersion,
gpu_info_.driver_version);
+
+ if (ShouldUseWarp())
+ command_line->AppendSwitch(switches::kUseWarp);
}
void GpuDataManagerImplPrivate::AppendPluginCommandLine(
switches::kDisableAcceleratedVideoDecode)) {
prefs->pepper_accelerated_video_decode_enabled = true;
}
-
- if (!IsFeatureBlacklisted(
- gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION_EXPANDED_HEURISTICS) ||
- base::FieldTrialList::FindFullName(
- "GpuRasterizationExpandedContentWhitelist") == "Enabled")
- prefs->use_expanded_heuristics_for_gpu_rasterization = true;
}
void GpuDataManagerImplPrivate::DisableHardwareAcceleration() {
for (int i = 0; i < gpu::NUMBER_OF_GPU_FEATURE_TYPES; ++i)
blacklisted_features_.insert(i);
+ EnableWarpIfNecessary();
EnableSwiftShaderIfNecessary();
NotifyGpuInfoUpdate();
}
}
bool GpuDataManagerImplPrivate::CanUseGpuBrowserCompositor() const {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableGpuCompositing))
+ return false;
+ if (ShouldUseWarp())
+ return true;
if (ShouldUseSwiftShader())
return false;
if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING))
: complete_gpu_info_already_requested_(false),
observer_list_(new GpuDataManagerObserverList),
use_swiftshader_(false),
+ use_warp_(false),
card_blacklisted_(false),
update_histograms_(true),
window_count_(0),
blacklisted_features_.insert(gpu::GPU_FEATURE_TYPE_WEBGL);
}
+ EnableWarpIfNecessary();
EnableSwiftShaderIfNecessary();
}
}
void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() {
+ if (ShouldUseWarp())
+ return;
+
if (!GpuAccessAllowed(NULL) ||
blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) {
if (!swiftshader_path_.empty() &&
}
}
+void GpuDataManagerImplPrivate::EnableWarpIfNecessary() {
+#if defined(OS_WIN)
+ if (use_warp_)
+ return;
+ // We should only use WARP if we are unable to use the regular GPU for
+ // compositing, and if we in Metro mode.
+ use_warp_ =
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kViewerConnect) &&
+ !CanUseGpuBrowserCompositor();
+#endif
+}
+
+void GpuDataManagerImplPrivate::ForceWarpModeForTesting() {
+ use_warp_ = true;
+}
+
std::string GpuDataManagerImplPrivate::GetDomainFromURL(
const GURL& url) const {
// For the moment, we just use the host, or its IP address, as the
void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() {
gpu_process_accessible_ = false;
- gpu_info_.finalized = true;
+ gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure;
+#if defined(OS_WIN)
+ gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure;
+#endif
complete_gpu_info_already_requested_ = true;
// Some observers might be waiting.
NotifyGpuInfoUpdate();