Index: blimp/client/support/compositor/blimp_layer_tree_settings.cc |
diff --git a/blimp/client/support/compositor/blimp_layer_tree_settings.cc b/blimp/client/support/compositor/blimp_layer_tree_settings.cc |
index f168e58aff3f47af33821346846e944635c7b402..7602735c2d5d14ea6f1d2b3f85d80ccfc0dc617e 100644 |
--- a/blimp/client/support/compositor/blimp_layer_tree_settings.cc |
+++ b/blimp/client/support/compositor/blimp_layer_tree_settings.cc |
@@ -10,12 +10,17 @@ |
#include "base/strings/string_number_conversions.h" |
#include "base/strings/string_split.h" |
#include "base/sys_info.h" |
+#include "blimp/client/support/compositor/blimp_gpu_memory_buffer_manager.h" |
#include "cc/base/switches.h" |
#include "cc/trees/layer_tree_settings.h" |
#include "third_party/skia/include/core/SkColor.h" |
#include "ui/gfx/buffer_types.h" |
#include "ui/gl/gl_switches.h" |
+#if defined(OS_ANDROID) |
+#include "ui/gfx/android/device_display_info.h" |
+#endif |
+ |
namespace blimp { |
namespace client { |
@@ -168,6 +173,52 @@ void PopulateCommonLayerTreeSettings(cc::LayerTreeSettings* settings) { |
memory_policy.priority_cutoff_when_visible = |
gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; |
#endif |
+ |
+ int default_tile_size = 256; |
+#if defined(OS_ANDROID) |
+ gfx::DeviceDisplayInfo info; |
+ 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; |
+ } |
+#endif |
+ settings->default_tile_size.SetSize(default_tile_size, default_tile_size); |
+ |
+ settings->renderer_settings.buffer_to_texture_target_map = |
+ BlimpGpuMemoryBufferManager::GetDefaultBufferToTextureTargetMap(); |
+ settings->use_output_surface_begin_frame_source = true; |
} |
} // namespace client |