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

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

Issue 2297933002: blimp: Set up the CompositorDependencies for blimp in Chrome. (Closed)
Patch Set: retry gpu process failures after crbug.com/643282 Created 4 years, 3 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
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 "cc/base/switches.h" 14 #include "cc/base/switches.h"
14 #include "cc/trees/layer_tree_settings.h" 15 #include "cc/trees/layer_tree_settings.h"
15 #include "third_party/skia/include/core/SkColor.h" 16 #include "third_party/skia/include/core/SkColor.h"
16 #include "ui/gfx/buffer_types.h" 17 #include "ui/gfx/buffer_types.h"
17 #include "ui/gl/gl_switches.h" 18 #include "ui/gl/gl_switches.h"
18 19
20 #if defined(OS_ANDROID)
21 #include "ui/gfx/android/device_display_info.h"
22 #endif
23
19 namespace blimp { 24 namespace blimp {
20 namespace client { 25 namespace client {
21 26
22 // TODO(dtrainor): This is temporary to get the compositor up and running. 27 // TODO(dtrainor): This is temporary to get the compositor up and running.
23 // Much of this will either have to be pulled from the server or refactored to 28 // Much of this will either have to be pulled from the server or refactored to
24 // share the settings from render_widget_compositor.cc. 29 // share the settings from render_widget_compositor.cc.
25 void PopulateCommonLayerTreeSettings(cc::LayerTreeSettings* settings) { 30 void PopulateCommonLayerTreeSettings(cc::LayerTreeSettings* settings) {
26 // For web contents, layer transforms should scale up the contents of layers 31 // For web contents, layer transforms should scale up the contents of layers
27 // to keep content always crisp when possible. 32 // to keep content always crisp when possible.
28 settings->layer_transforms_should_scale_layer_contents = true; 33 settings->layer_transforms_should_scale_layer_contents = true;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 166 }
162 memory_policy.priority_cutoff_when_visible = 167 memory_policy.priority_cutoff_when_visible =
163 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING; 168 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING;
164 #else 169 #else
165 // Ignore what the system said and give all clients the same maximum 170 // Ignore what the system said and give all clients the same maximum
166 // allocation on desktop platforms. 171 // allocation on desktop platforms.
167 memory_policy.bytes_limit_when_visible = 512 * 1024 * 1024; 172 memory_policy.bytes_limit_when_visible = 512 * 1024 * 1024;
168 memory_policy.priority_cutoff_when_visible = 173 memory_policy.priority_cutoff_when_visible =
169 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; 174 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
170 #endif 175 #endif
176
177 int default_tile_size = 256;
178 #if defined(OS_ANDROID)
179 gfx::DeviceDisplayInfo info;
180 bool real_size_supported = true;
181 int display_width = info.GetPhysicalDisplayWidth();
182 int display_height = info.GetPhysicalDisplayHeight();
183 if (display_width == 0 || display_height == 0) {
184 real_size_supported = false;
185 display_width = info.GetDisplayWidth();
186 display_height = info.GetDisplayHeight();
187 }
188
189 int portrait_width = std::min(display_width, display_height);
190 int landscape_width = std::max(display_width, display_height);
191
192 if (real_size_supported) {
193 // Maximum HD dimensions should be 768x1280
194 // Maximum FHD dimensions should be 1200x1920
195 if (portrait_width > 768 || landscape_width > 1280)
196 default_tile_size = 384;
197 if (portrait_width > 1200 || landscape_width > 1920)
198 default_tile_size = 512;
199
200 // Adjust for some resolutions that barely straddle an extra
201 // tile when in portrait mode. This helps worst case scroll/raster
202 // by not needing a full extra tile for each row.
203 if (default_tile_size == 256 && portrait_width == 768)
204 default_tile_size += 32;
205 if (default_tile_size == 384 && portrait_width == 1200)
206 default_tile_size += 32;
207 } else {
208 // We don't know the exact resolution due to screen controls etc.
209 // So this just estimates the values above using tile counts.
210 int numTiles = (display_width * display_height) / (256 * 256);
211 if (numTiles > 16)
212 default_tile_size = 384;
213 if (numTiles >= 40)
214 default_tile_size = 512;
215 }
216 #endif
217 settings->default_tile_size.SetSize(default_tile_size, default_tile_size);
218
219 settings->renderer_settings.buffer_to_texture_target_map =
220 BlimpGpuMemoryBufferManager::GetDefaultBufferToTextureTargetMap();
221 settings->use_output_surface_begin_frame_source = true;
171 } 222 }
172 223
173 } // namespace client 224 } // namespace client
174 } // namespace blimp 225 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698