| Index: gpu/config/gpu_util.cc
|
| diff --git a/gpu/config/gpu_util.cc b/gpu/config/gpu_util.cc
|
| index 49eb25b7f1cfb7d1b66f3d17a7a82245e61d82b3..a305c29698a9baa8e1a72d17c3427712ccf81de0 100644
|
| --- a/gpu/config/gpu_util.cc
|
| +++ b/gpu/config/gpu_util.cc
|
| @@ -12,8 +12,12 @@
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/strings/string_split.h"
|
| #include "base/strings/string_util.h"
|
| +#include "base/sys_info.h"
|
| +#include "gpu/config/gpu_blacklist.h"
|
| #include "gpu/config/gpu_control_list_jsons.h"
|
| #include "gpu/config/gpu_driver_bug_list.h"
|
| +#include "gpu/config/gpu_feature_type.h"
|
| +#include "gpu/config/gpu_finch_features.h"
|
| #include "gpu/config/gpu_info_collector.h"
|
| #include "gpu/config/gpu_switches.h"
|
| #include "ui/gl/gl_switches.h"
|
| @@ -59,6 +63,32 @@ void StringToIds(const std::string& str, std::vector<uint32_t>* list) {
|
| }
|
| }
|
|
|
| +GpuFeatureStatus GetGpuRasterizationFeatureStatus(
|
| + const std::set<int>& blacklisted_features,
|
| + const base::CommandLine& command_line) {
|
| + if (command_line.HasSwitch(switches::kDisableGpuRasterization))
|
| + return kGpuFeatureStatusDisabled;
|
| + else if (command_line.HasSwitch(switches::kEnableGpuRasterization))
|
| + return kGpuFeatureStatusEnabled;
|
| +
|
| + if (blacklisted_features.count(GPU_FEATURE_TYPE_GPU_RASTERIZATION))
|
| + return kGpuFeatureStatusBlacklisted;
|
| +
|
| +#if defined(OS_ANDROID)
|
| + // We can't use GPU rasterization on low-end devices, because the Ganesh
|
| + // cache would consume too much memory.
|
| + if (base::SysInfo::IsLowEndDevice())
|
| + return kGpuFeatureStatusBlacklisted;
|
| +#endif // defined(OS_ANDROID)
|
| +
|
| + // Gpu Rasterization on platforms that are not fully enabled is controlled by
|
| + // a finch experiment.
|
| + if (!base::FeatureList::IsEnabled(features::kDefaultEnableGpuRasterization))
|
| + return kGpuFeatureStatusDisabled;
|
| +
|
| + return kGpuFeatureStatusEnabled;
|
| +}
|
| +
|
| } // namespace anonymous
|
|
|
| void ApplyGpuDriverBugWorkarounds(const GPUInfo& gpu_info,
|
| @@ -151,4 +181,22 @@ void InitializeDualGpusIfSupported(
|
| ui::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu();
|
| }
|
|
|
| +GpuFeatureInfo GetGpuFeatureInfo(const GPUInfo& gpu_info,
|
| + const base::CommandLine& command_line) {
|
| + GpuFeatureInfo gpu_feature_info;
|
| + std::set<int> blacklisted_features;
|
| + if (!command_line.HasSwitch(switches::kIgnoreGpuBlacklist)) {
|
| + std::unique_ptr<GpuBlacklist> list(GpuBlacklist::Create());
|
| + list->LoadList(kSoftwareRenderingListJson, GpuControlList::kCurrentOsOnly);
|
| + blacklisted_features =
|
| + list->MakeDecision(GpuControlList::kOsAny, std::string(), gpu_info);
|
| + }
|
| +
|
| + // Currently only used for GPU rasterization.
|
| + gpu_feature_info.status_values[GPU_FEATURE_TYPE_GPU_RASTERIZATION] =
|
| + GetGpuRasterizationFeatureStatus(blacklisted_features, command_line);
|
| +
|
| + return gpu_feature_info;
|
| +}
|
| +
|
| } // namespace gpu
|
|
|