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

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 1896223003: Move the mapped memory limit from the compositor to the GLHelper context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-limits
Patch Set: limit-android: comment Created 4 years, 8 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
Index: content/browser/renderer_host/render_widget_host_view_android.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index ba7c865c496935933dfd1b539c435ba77cbe63e7..2f8be8d81927baec388010d0a6805fb2a1710b92 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -165,17 +165,23 @@ void GLHelperHolder::Initialize() {
attributes.sample_buffers = 0;
attributes.bind_generates_resource = false;
- static const size_t kBytesPerPixel = 4;
- gfx::DeviceDisplayInfo display_info;
- size_t full_screen_texture_size_in_bytes = display_info.GetDisplayHeight() *
- display_info.GetDisplayWidth() *
- kBytesPerPixel;
+ constexpr size_t kBytesPerPixel = 4;
+ size_t full_screen_texture_size_in_bytes =
+ gfx::DeviceDisplayInfo().GetDisplayHeight() *
+ gfx::DeviceDisplayInfo().GetDisplayWidth() * kBytesPerPixel;
+
gpu::SharedMemoryLimits limits;
- limits.command_buffer_size = 64 * 1024;
- limits.start_transfer_buffer_size = 64 * 1024;
- limits.min_transfer_buffer_size = 64 * 1024;
- limits.max_transfer_buffer_size = std::min(
- 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize);
+ // The GLHelper context doesn't do a lot of stuff, so we don't expect it to
+ // need a lot of space for commands.
+ limits.command_buffer_size = 1024;
+ // The transfer buffer is used for shaders among other things, so give some
+ // reasonable but small limit.
+ limits.start_transfer_buffer_size = 4 * 1024;
+ limits.min_transfer_buffer_size = 4 * 1024;
+ limits.max_transfer_buffer_size = full_screen_texture_size_in_bytes;
+ // This context is used for doing async readbacks, so allow at least a full
+ // screen readback to be mapped.
+ limits.mapped_memory_reclaim_limit = full_screen_texture_size_in_bytes;
bool share_resources = false;
bool automatic_flushes = false;

Powered by Google App Engine
This is Rietveld 408576698