Index: content/gpu/gpu_info_collector_android.cc |
=================================================================== |
--- content/gpu/gpu_info_collector_android.cc (revision 200330) |
+++ content/gpu/gpu_info_collector_android.cc (working copy) |
@@ -11,9 +11,6 @@ |
#include "base/string_util.h" |
#include "base/strings/string_piece.h" |
#include "base/strings/string_split.h" |
-#include "cc/base/switches.h" |
-#include "content/public/common/content_switches.h" |
-#include "ui/gfx/android/device_display_info.h" |
namespace { |
@@ -49,10 +46,7 @@ |
namespace gpu_info_collector { |
bool CollectContextGraphicsInfo(content::GPUInfo* gpu_info) { |
- // can_lose_context must be false to enable accelerated Canvas2D |
- gpu_info->can_lose_context = false; |
- gpu_info->finalized = true; |
- return CollectGraphicsInfoGL(gpu_info); |
+ return CollectBasicGraphicsInfo(gpu_info); |
} |
GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) { |
@@ -64,78 +58,12 @@ |
bool CollectBasicGraphicsInfo(content::GPUInfo* gpu_info) { |
gpu_info->can_lose_context = false; |
- // Create a short-lived context on the UI thread to collect the GL strings. |
- if (!CollectGraphicsInfoGL(gpu_info)) |
- return false; |
+ gpu_info->finalized = true; |
- std::string vendor(StringToLowerASCII(gpu_info->gl_vendor)); |
- std::string renderer(StringToLowerASCII(gpu_info->gl_renderer)); |
- bool is_img = vendor.find("imagination") != std::string::npos; |
- bool is_arm = vendor.find("arm") != std::string::npos; |
- bool is_qualcomm = vendor.find("qualcomm") != std::string::npos; |
- bool is_mali_t604 = is_arm && renderer.find("mali-t604") != std::string::npos; |
- bool is_vivante = vendor.find("vivante") != std::string::npos; |
- is_vivante |= vendor.find("hisilicon") != std::string::npos; |
+ gpu_info->machine_model = base::android::BuildInfo::GetInstance()->model(); |
- base::android::BuildInfo* build_info = |
- base::android::BuildInfo::GetInstance(); |
- std::string model = build_info->model(); |
- model = StringToLowerASCII(model); |
- bool is_nexus7 = model.find("nexus 7") != std::string::npos; |
- bool is_nexus10 = model.find("nexus 10") != std::string::npos; |
- |
- // IMG: avoid context switching perf problems, crashes with share groups |
- // Mali-T604: http://crbug.com/154715 |
- // QualComm, NVIDIA: Crashes with share groups |
- if (is_vivante || is_img || is_mali_t604 || is_nexus7 || is_qualcomm) { |
- CommandLine::ForCurrentProcess()->AppendSwitch( |
- switches::kEnableVirtualGLContexts); |
- } |
- |
- gfx::DeviceDisplayInfo info; |
- int default_tile_size = 256; |
- |
- // For very high resolution displays (eg. Nexus 10), set the default |
- // tile size to be 512. This should be removed in favour of a generic |
- // hueristic that works across all platforms and devices, once that |
- // exists: http://crbug.com/159524. This switches to 512 for screens |
- // containing 40 or more 256x256 tiles, such that 1080p devices do |
- // not use 512x512 tiles (eg. 1920x1280 requires 37.5 tiles) |
- int numTiles = (info.GetDisplayWidth() * |
- info.GetDisplayHeight()) / (256 * 256); |
- 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 && |
- !CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kDefaultTileWidth) && |
- !CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kDefaultTileHeight)) { |
- std::stringstream size; |
- size << default_tile_size; |
- CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
- switches::kDefaultTileWidth, size.str()); |
- CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
- switches::kDefaultTileHeight, size.str()); |
- } |
- |
- // Increase the resolution of low resolution tiles for Nexus tablets. |
- if ((is_nexus7 || is_nexus10) && |
- !CommandLine::ForCurrentProcess()->HasSwitch( |
- cc::switches::kLowResolutionContentsScaleFactor)) { |
- CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
- cc::switches::kLowResolutionContentsScaleFactor, "0.25"); |
- } |
- |
- return true; |
+ // Create a short-lived context on the UI thread to collect the GL strings. |
+ return CollectGraphicsInfoGL(gpu_info); |
} |
bool CollectDriverInfoGL(content::GPUInfo* gpu_info) { |