#include "content/public/common/content_client.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/content_switches.h"
+#include "content/public/common/web_preferences.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/config/gpu_control_list_jsons.h"
#include "gpu/config/gpu_driver_bug_workaround_type.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_switches.h"
#include "ui/gl/gpu_switching_manager.h"
-#include "webkit/common/webpreferences.h"
#if defined(OS_MACOSX)
#include <ApplicationServices/ApplicationServices.h>
return;
}
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
bool disabled = false;
// Use entry 0 to capture the total number of times that data
std::vector<uint32> flag_disabled_entries;
disabled = true;
blacklist->GetDecisionEntries(&flag_disabled_entries, disabled);
- for (size_t i = 0; i < flag_disabled_entries.size(); ++i) {
+ for (uint32 disabled_entry : flag_disabled_entries) {
UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerDisabledEntry",
- flag_disabled_entries[i], max_entry_id + 1);
+ disabled_entry, max_entry_id + 1);
}
const gpu::GpuFeatureType kGpuFeatures[] = {
}
#endif // OS_MACOSX
-#if defined(OS_ANDROID)
-void ApplyAndroidWorkarounds(const gpu::GPUInfo& gpu_info,
- CommandLine* command_line,
- std::set<int>* workarounds) {
- std::string vendor(StringToLowerASCII(gpu_info.gl_vendor));
- std::string renderer(StringToLowerASCII(gpu_info.gl_renderer));
- std::string version(StringToLowerASCII(gpu_info.gl_version));
-
- bool is_img =
- gpu_info.gl_vendor.find("Imagination") != std::string::npos;
-
- gfx::DeviceDisplayInfo info;
- int default_tile_size = 256;
-
- // TODO(epenner): Now that this is somewhat generic, maybe we can
- // unify this for all platforms (http://crbug.com/159524)
-
- bool real_size_supported = true;
- int display_width = info.GetPhysicalDisplayWidth();
- int display_height = info.GetPhysicalDisplayHeight();
- if (display_width == 0 || display_height == 0) {
- real_size_supported = false;
- display_width = info.GetDisplayWidth();
- display_height = info.GetDisplayHeight();
- }
-
- int portrait_width = std::min(display_width, display_height);
- int landscape_width = std::max(display_width, display_height);
-
- if (real_size_supported) {
- // Maximum HD dimensions should be 768x1280
- // Maximum FHD dimensions should be 1200x1920
- if (portrait_width > 768 || landscape_width > 1280)
- default_tile_size = 384;
- if (portrait_width > 1200 || landscape_width > 1920)
- default_tile_size = 512;
-
- // Adjust for some resolutions that barely straddle an extra
- // tile when in portrait mode. This helps worst case scroll/raster
- // by not needing a full extra tile for each row.
- if (default_tile_size == 256 && portrait_width == 768)
- default_tile_size += 32;
- if (default_tile_size == 384 && portrait_width == 1200)
- default_tile_size += 32;
- } else {
- // We don't know the exact resolution due to screen controls etc.
- // So this just estimates the values above using tile counts.
- int numTiles = (display_width * display_height) / (256 * 256);
- if (numTiles > 16)
- default_tile_size = 384;
- if (numTiles >= 40)
- default_tile_size = 512;
- }
-
- // IMG: Fast async texture uploads only work with non-power-of-two,
- // but still multiple-of-eight sizes.
- // http://crbug.com/168099
- if (is_img)
- default_tile_size -= 8;
-
- // Set the command line if it isn't already set and we changed
- // the default tile size.
- if (default_tile_size != 256 &&
- !command_line->HasSwitch(switches::kDefaultTileWidth) &&
- !command_line->HasSwitch(switches::kDefaultTileHeight)) {
- std::stringstream size;
- size << default_tile_size;
- command_line->AppendSwitchASCII(
- switches::kDefaultTileWidth, size.str());
- command_line->AppendSwitchASCII(
- switches::kDefaultTileHeight, size.str());
- }
-}
-#endif // OS_ANDROID
-
// Block all domains' use of 3D APIs for this many milliseconds if
// approaching a threshold where system stability might be compromised.
const int64 kBlockAllDomainsMs = 10000;
bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const {
#if defined(OS_CHROMEOS)
if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING &&
- CommandLine::ForCurrentProcess()->HasSwitch(
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisablePanelFitting)) {
return true;
}
if (card_blacklisted_) {
if (reason) {
*reason = "GPU access is disabled ";
- CommandLine* command_line = CommandLine::ForCurrentProcess();
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kDisableGpu))
*reason += "through commandline switch --disable-gpu.";
else
return;
}
- const CommandLine* command_line = CommandLine::ForCurrentProcess();
+ const base::CommandLine* command_line =
+ base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kSkipGpuDataLoading))
return;
gpu::GpuControlList::kOsAny, std::string(), gpu_info_);
}
gpu::GpuDriverBugList::AppendWorkaroundsFromCommandLine(
- &gpu_driver_bugs_, *CommandLine::ForCurrentProcess());
+ &gpu_driver_bugs_, *base::CommandLine::ForCurrentProcess());
// We have to update GpuFeatureType before notify all the observers.
NotifyGpuInfoUpdate();
}
void GpuDataManagerImplPrivate::AppendRendererCommandLine(
- CommandLine* command_line) const {
+ base::CommandLine* command_line) const {
DCHECK(command_line);
if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) &&
}
void GpuDataManagerImplPrivate::AppendGpuCommandLine(
- CommandLine* command_line) const {
+ base::CommandLine* command_line) const {
DCHECK(command_line);
std::string use_gl =
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kUseGL);
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kUseGL);
base::FilePath swiftshader_path =
- CommandLine::ForCurrentProcess()->GetSwitchValuePath(
+ base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
switches::kSwiftShaderPath);
if (gpu_driver_bugs_.find(gpu::DISABLE_D3D11) != gpu_driver_bugs_.end())
command_line->AppendSwitch(switches::kDisableD3D11);
}
void GpuDataManagerImplPrivate::AppendPluginCommandLine(
- CommandLine* command_line) const {
+ base::CommandLine* command_line) const {
DCHECK(command_line);
#if defined(OS_MACOSX)
#endif
if (!IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) &&
- !CommandLine::ForCurrentProcess()->HasSwitch(
+ !base::CommandLine::ForCurrentProcess()->HasSwitch(
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() {
return;
}
{
+ gpu_info_.process_crash_count = GpuProcessHost::gpu_crash_count();
GpuDataManagerImpl::UnlockedSession session(owner_);
observer_list_->Notify(
&GpuDataManagerObserver::OnGpuProcessCrashed, exit_code);
gpu_process_accessible_(true),
finalized_(false) {
DCHECK(owner_);
- CommandLine* command_line = CommandLine::ForCurrentProcess();
+ const base::CommandLine* command_line =
+ base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kDisableGpu))
DisableHardwareAcceleration();
const std::string& gpu_driver_bug_list_json,
const gpu::GPUInfo& gpu_info) {
const bool log_gpu_control_list_decisions =
- CommandLine::ForCurrentProcess()->HasSwitch(
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kLogGpuControlListDecisions);
if (!gpu_blacklist_json.empty()) {
UpdateGpuInfo(gpu_info);
UpdateGpuSwitchingManager(gpu_info);
UpdatePreliminaryBlacklistedFeatures();
-
-#if defined(OS_ANDROID)
- ApplyAndroidWorkarounds(
- gpu_info, CommandLine::ForCurrentProcess(), &gpu_driver_bugs_);
-#endif // OS_ANDROID
}
void GpuDataManagerImplPrivate::UpdateBlacklistedFeatures(
if (!GpuAccessAllowed(NULL) ||
blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) {
if (!swiftshader_path_.empty() &&
- !CommandLine::ForCurrentProcess()->HasSwitch(
+ !base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableSoftwareRasterizer))
use_swiftshader_ = true;
}