OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/gpu/gpu_data_manager_impl_private.h" | 5 #include "content/browser/gpu/gpu_data_manager_impl_private.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 void ApplyAndroidWorkarounds(const gpu::GPUInfo& gpu_info, | 240 void ApplyAndroidWorkarounds(const gpu::GPUInfo& gpu_info, |
241 CommandLine* command_line) { | 241 CommandLine* command_line) { |
242 std::string vendor(StringToLowerASCII(gpu_info.gl_vendor)); | 242 std::string vendor(StringToLowerASCII(gpu_info.gl_vendor)); |
243 std::string renderer(StringToLowerASCII(gpu_info.gl_renderer)); | 243 std::string renderer(StringToLowerASCII(gpu_info.gl_renderer)); |
244 bool is_img = | 244 bool is_img = |
245 gpu_info.gl_vendor.find("Imagination") != std::string::npos; | 245 gpu_info.gl_vendor.find("Imagination") != std::string::npos; |
246 | 246 |
247 gfx::DeviceDisplayInfo info; | 247 gfx::DeviceDisplayInfo info; |
248 int default_tile_size = 256; | 248 int default_tile_size = 256; |
249 | 249 |
250 // For very high resolution displays (eg. Nexus 10), set the default | 250 // TODO(epenner): Now that this is somewhat generic, maybe we can |
251 // tile size to be 512. This should be removed in favour of a generic | 251 // unify this for all platforms (http://crbug.com/159524) |
252 // hueristic that works across all platforms and devices, once that | 252 |
253 // exists: http://crbug.com/159524. This switches to 512 for screens | 253 bool real_size_supported = true; |
254 // containing 40 or more 256x256 tiles, such that 1080p devices do | 254 int display_width = info.GetPhysicalDisplayWidth(); |
255 // not use 512x512 tiles (eg. 1920x1280 requires 37.5 tiles) | 255 int display_height = info.GetPhysicalDisplayHeight(); |
256 int numTiles = (info.GetDisplayWidth() * | 256 if (display_width == 0 || display_height == 0) { |
257 info.GetDisplayHeight()) / (256 * 256); | 257 real_size_supported = false; |
258 if (numTiles >= 40) | 258 display_width = info.GetDisplayWidth(); |
259 default_tile_size = 512; | 259 display_height = info.GetDisplayHeight(); |
| 260 } |
| 261 |
| 262 int portrait_width = std::min(display_width, display_height); |
| 263 int landscape_width = std::max(display_width, display_height); |
| 264 |
| 265 if (real_size_supported) { |
| 266 // Maximum HD dimensions should be 768x1280 |
| 267 // Maximum FHD dimensions should be 1200x1920 |
| 268 if (portrait_width > 768 || landscape_width > 1280) |
| 269 default_tile_size = 384; |
| 270 if (portrait_width > 1200 || landscape_width > 1920) |
| 271 default_tile_size = 512; |
| 272 |
| 273 // Adjust for some resolutions that barely straddle an extra |
| 274 // tile when in portrait mode. This helps worst case scroll/raster |
| 275 // by not needing a full extra tile for each row. |
| 276 if (default_tile_size == 256 && portrait_width == 768) |
| 277 default_tile_size += 32; |
| 278 if (default_tile_size == 384 && portrait_width == 1200) |
| 279 default_tile_size += 32; |
| 280 } else { |
| 281 // We don't know the exact resolution due to screen controls etc. |
| 282 // So this just estimates the values above using tile counts. |
| 283 int numTiles = (display_width * display_height) / (256 * 256); |
| 284 if (numTiles > 16) |
| 285 default_tile_size = 384; |
| 286 if (numTiles >= 40) |
| 287 default_tile_size = 512; |
| 288 } |
260 | 289 |
261 // IMG: Fast async texture uploads only work with non-power-of-two, | 290 // IMG: Fast async texture uploads only work with non-power-of-two, |
262 // but still multiple-of-eight sizes. | 291 // but still multiple-of-eight sizes. |
263 // http://crbug.com/168099 | 292 // http://crbug.com/168099 |
264 if (is_img) | 293 if (is_img) |
265 default_tile_size -= 8; | 294 default_tile_size -= 8; |
266 | 295 |
267 // Set the command line if it isn't already set and we changed | 296 // Set the command line if it isn't already set and we changed |
268 // the default tile size. | 297 // the default tile size. |
269 if (default_tile_size != 256 && | 298 if (default_tile_size != 256 && |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 | 1206 |
1178 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { | 1207 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { |
1179 gpu_process_accessible_ = false; | 1208 gpu_process_accessible_ = false; |
1180 gpu_info_.finalized = true; | 1209 gpu_info_.finalized = true; |
1181 complete_gpu_info_already_requested_ = true; | 1210 complete_gpu_info_already_requested_ = true; |
1182 // Some observers might be waiting. | 1211 // Some observers might be waiting. |
1183 NotifyGpuInfoUpdate(); | 1212 NotifyGpuInfoUpdate(); |
1184 } | 1213 } |
1185 | 1214 |
1186 } // namespace content | 1215 } // namespace content |
OLD | NEW |