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 // TODO(epenner): Now that this is somewhat generic, maybe we can | 250 // For very high resolution displays (eg. Nexus 10), set the default |
251 // unify this for all platforms (http://crbug.com/159524) | 251 // tile size to be 512. This should be removed in favour of a generic |
252 | 252 // hueristic that works across all platforms and devices, once that |
253 bool real_size_supported = true; | 253 // exists: http://crbug.com/159524. This switches to 512 for screens |
254 int display_width = info.GetPhysicalDisplayWidth(); | 254 // containing 40 or more 256x256 tiles, such that 1080p devices do |
255 int display_height = info.GetPhysicalDisplayHeight(); | 255 // not use 512x512 tiles (eg. 1920x1280 requires 37.5 tiles) |
256 if (display_width == 0 || display_height == 0) { | 256 int numTiles = (info.GetDisplayWidth() * |
257 real_size_supported = false; | 257 info.GetDisplayHeight()) / (256 * 256); |
258 display_width = info.GetDisplayWidth(); | 258 if (numTiles >= 40) |
259 display_height = info.GetDisplayHeight(); | 259 default_tile_size = 512; |
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 } | |
289 | 260 |
290 // IMG: Fast async texture uploads only work with non-power-of-two, | 261 // IMG: Fast async texture uploads only work with non-power-of-two, |
291 // but still multiple-of-eight sizes. | 262 // but still multiple-of-eight sizes. |
292 // http://crbug.com/168099 | 263 // http://crbug.com/168099 |
293 if (is_img) | 264 if (is_img) |
294 default_tile_size -= 8; | 265 default_tile_size -= 8; |
295 | 266 |
296 // Set the command line if it isn't already set and we changed | 267 // Set the command line if it isn't already set and we changed |
297 // the default tile size. | 268 // the default tile size. |
298 if (default_tile_size != 256 && | 269 if (default_tile_size != 256 && |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 | 1177 |
1207 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { | 1178 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { |
1208 gpu_process_accessible_ = false; | 1179 gpu_process_accessible_ = false; |
1209 gpu_info_.finalized = true; | 1180 gpu_info_.finalized = true; |
1210 complete_gpu_info_already_requested_ = true; | 1181 complete_gpu_info_already_requested_ = true; |
1211 // Some observers might be waiting. | 1182 // Some observers might be waiting. |
1212 NotifyGpuInfoUpdate(); | 1183 NotifyGpuInfoUpdate(); |
1213 } | 1184 } |
1214 | 1185 |
1215 } // namespace content | 1186 } // namespace content |
OLD | NEW |