Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: blimp/client/support/compositor/blimp_layer_tree_settings.cc

Issue 2613303002: android: Use ScreenInfo to calculate tile size (Closed)
Patch Set: delete blimp Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/gpu/render_widget_compositor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "blimp/client/support/compositor/blimp_layer_tree_settings.h" 5 #include "blimp/client/support/compositor/blimp_layer_tree_settings.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_split.h" 11 #include "base/strings/string_split.h"
12 #include "base/sys_info.h" 12 #include "base/sys_info.h"
13 #include "blimp/client/support/compositor/blimp_gpu_memory_buffer_manager.h" 13 #include "blimp/client/support/compositor/blimp_gpu_memory_buffer_manager.h"
14 #include "cc/base/switches.h" 14 #include "cc/base/switches.h"
15 #include "cc/trees/layer_tree_settings.h" 15 #include "cc/trees/layer_tree_settings.h"
16 #include "third_party/skia/include/core/SkColor.h" 16 #include "third_party/skia/include/core/SkColor.h"
17 #include "ui/gfx/buffer_types.h" 17 #include "ui/gfx/buffer_types.h"
18 #include "ui/gl/gl_switches.h" 18 #include "ui/gl/gl_switches.h"
19 19
20 #if defined(OS_ANDROID)
21 #include "ui/gfx/android/device_display_info.h"
22 #endif
23
24 namespace blimp { 20 namespace blimp {
25 namespace client { 21 namespace client {
26 22
27 // TODO(dtrainor): This is temporary to get the compositor up and running. 23 // TODO(dtrainor): This is temporary to get the compositor up and running.
28 // Much of this will either have to be pulled from the server or refactored to 24 // Much of this will either have to be pulled from the server or refactored to
29 // share the settings from render_widget_compositor.cc. 25 // share the settings from render_widget_compositor.cc.
30 void PopulateCommonLayerTreeSettings(cc::LayerTreeSettings* settings) { 26 void PopulateCommonLayerTreeSettings(cc::LayerTreeSettings* settings) {
31 // For web contents, layer transforms should scale up the contents of layers 27 // For web contents, layer transforms should scale up the contents of layers
32 // to keep content always crisp when possible. 28 // to keep content always crisp when possible.
33 settings->layer_transforms_should_scale_layer_contents = true; 29 settings->layer_transforms_should_scale_layer_contents = true;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING; 160 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING;
165 #else 161 #else
166 // Ignore what the system said and give all clients the same maximum 162 // Ignore what the system said and give all clients the same maximum
167 // allocation on desktop platforms. 163 // allocation on desktop platforms.
168 memory_policy.bytes_limit_when_visible = 512 * 1024 * 1024; 164 memory_policy.bytes_limit_when_visible = 512 * 1024 * 1024;
169 memory_policy.priority_cutoff_when_visible = 165 memory_policy.priority_cutoff_when_visible =
170 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; 166 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
171 #endif 167 #endif
172 168
173 int default_tile_size = 256; 169 int default_tile_size = 256;
174 #if defined(OS_ANDROID)
175 gfx::DeviceDisplayInfo info;
176 bool real_size_supported = true;
177 int display_width = info.GetPhysicalDisplayWidth();
178 int display_height = info.GetPhysicalDisplayHeight();
179 if (display_width == 0 || display_height == 0) {
180 real_size_supported = false;
181 display_width = info.GetDisplayWidth();
182 display_height = info.GetDisplayHeight();
183 }
184
185 int portrait_width = std::min(display_width, display_height);
186 int landscape_width = std::max(display_width, display_height);
187
188 if (real_size_supported) {
189 // Maximum HD dimensions should be 768x1280
190 // Maximum FHD dimensions should be 1200x1920
191 if (portrait_width > 768 || landscape_width > 1280)
192 default_tile_size = 384;
193 if (portrait_width > 1200 || landscape_width > 1920)
194 default_tile_size = 512;
195
196 // Adjust for some resolutions that barely straddle an extra
197 // tile when in portrait mode. This helps worst case scroll/raster
198 // by not needing a full extra tile for each row.
199 if (default_tile_size == 256 && portrait_width == 768)
200 default_tile_size += 32;
201 if (default_tile_size == 384 && portrait_width == 1200)
202 default_tile_size += 32;
203 } else {
204 // We don't know the exact resolution due to screen controls etc.
205 // So this just estimates the values above using tile counts.
206 int numTiles = (display_width * display_height) / (256 * 256);
207 if (numTiles > 16)
208 default_tile_size = 384;
209 if (numTiles >= 40)
210 default_tile_size = 512;
211 }
212 #endif
213 settings->default_tile_size.SetSize(default_tile_size, default_tile_size); 170 settings->default_tile_size.SetSize(default_tile_size, default_tile_size);
214 171
215 settings->renderer_settings.buffer_to_texture_target_map = 172 settings->renderer_settings.buffer_to_texture_target_map =
216 BlimpGpuMemoryBufferManager::GetDefaultBufferToTextureTargetMap(); 173 BlimpGpuMemoryBufferManager::GetDefaultBufferToTextureTargetMap();
217 } 174 }
218 175
219 } // namespace client 176 } // namespace client
220 } // namespace blimp 177 } // namespace blimp
OLDNEW
« no previous file with comments | « no previous file | content/renderer/gpu/render_widget_compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698