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

Unified Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 2099903002: Make tile size a function of the device scale factor. Base URL: https://chromium.googlesource.com/chromium/src.git@layouttests-display
Patch Set: tilesize: . Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« cc/trees/layer_tree_impl.h ('K') | « content/public/common/content_switches.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/gpu/render_widget_compositor.cc
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index c73ca064a9d6fcc57e93ca15291a46c23b664ace..14571894bb12b3ac399a8ec81b4a8d03409fb427 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -38,6 +38,7 @@
#include "cc/proto/compositor_message.pb.h"
#include "cc/resources/single_release_callback.h"
#include "cc/scheduler/begin_frame_source.h"
+#include "cc/tiles/picture_layer_tiling.h"
enne (OOO) 2016/06/28 18:39:02 ?
#include "cc/trees/latency_info_swap_promise_monitor.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/remote_proto_channel.h"
@@ -62,7 +63,6 @@
#if defined(OS_ANDROID)
#include "base/android/build_info.h"
-#include "ui/gfx/android/device_display_info.h"
#endif
namespace base {
@@ -136,58 +136,6 @@ cc::LayerSelection ConvertWebSelection(const WebSelection& web_selection) {
return cc_selection;
}
-gfx::Size CalculateDefaultTileSize(float initial_device_scale_factor) {
- int default_tile_size = 256;
-#if defined(OS_ANDROID)
- // TODO(epenner): unify this for all platforms if it
- // makes sense (http://crbug.com/159524)
-
- 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;
- }
-#elif defined(OS_CHROMEOS) || defined(OS_MACOSX)
- // Use 512 for high DPI (dsf=2.0f) devices.
- if (initial_device_scale_factor >= 2.0f)
- default_tile_size = 512;
-#endif
-
- return gfx::Size(default_tile_size, default_tile_size);
-}
-
// Check cc::TopControlsState, and blink::WebTopControlsState
// are kept in sync.
static_assert(int(blink::WebTopControlsBoth) == int(cc::BOTH),
@@ -289,38 +237,6 @@ cc::LayerTreeSettings RenderWidgetCompositor::GenerateLayerTreeSettings(
settings.main_frame_before_activation_enabled =
cmd.HasSwitch(cc::switches::kEnableMainFrameBeforeActivation);
- // TODO(danakj): This should not be a setting O_O; it should change when the
- // device scale factor on LayerTreeHost changes.
- settings.default_tile_size = CalculateDefaultTileSize(device_scale_factor);
- if (cmd.HasSwitch(switches::kDefaultTileWidth)) {
- int tile_width = 0;
- GetSwitchValueAsInt(cmd, switches::kDefaultTileWidth, 1,
- std::numeric_limits<int>::max(), &tile_width);
- settings.default_tile_size.set_width(tile_width);
- }
- if (cmd.HasSwitch(switches::kDefaultTileHeight)) {
- int tile_height = 0;
- GetSwitchValueAsInt(cmd, switches::kDefaultTileHeight, 1,
- std::numeric_limits<int>::max(), &tile_height);
- settings.default_tile_size.set_height(tile_height);
- }
-
- int max_untiled_layer_width = settings.max_untiled_layer_size.width();
- if (cmd.HasSwitch(switches::kMaxUntiledLayerWidth)) {
- GetSwitchValueAsInt(cmd, switches::kMaxUntiledLayerWidth, 1,
- std::numeric_limits<int>::max(),
- &max_untiled_layer_width);
- }
- int max_untiled_layer_height = settings.max_untiled_layer_size.height();
- if (cmd.HasSwitch(switches::kMaxUntiledLayerHeight)) {
- GetSwitchValueAsInt(cmd, switches::kMaxUntiledLayerHeight, 1,
- std::numeric_limits<int>::max(),
- &max_untiled_layer_height);
- }
-
- settings.max_untiled_layer_size = gfx::Size(max_untiled_layer_width,
- max_untiled_layer_height);
-
settings.gpu_rasterization_msaa_sample_count =
compositor_deps->GetGpuRasterizationMSAASampleCount();
settings.gpu_rasterization_forced =
@@ -405,6 +321,9 @@ cc::LayerTreeSettings RenderWidgetCompositor::GenerateLayerTreeSettings(
bool using_synchronous_compositor =
GetContentClient()->UsingSynchronousCompositing();
+ // TODO(crbug.com/622885): Android viewport is assumed to be fixed forever.
+ settings.use_viewport_for_tile_size = true;
+
// We can't use GPU rasterization on low-end devices, because the Ganesh
// cache would consume too much memory.
if (base::SysInfo::IsLowEndDevice())
« cc/trees/layer_tree_impl.h ('K') | « content/public/common/content_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698