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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 2646643002: android: Tweak readback context memory limits (Closed)
Patch Set: 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 attributes.bind_generates_resource = false; 189 attributes.bind_generates_resource = false;
190 190
191 gpu::SharedMemoryLimits limits; 191 gpu::SharedMemoryLimits limits;
192 // The GLHelper context doesn't do a lot of stuff, so we don't expect it to 192 // The GLHelper context doesn't do a lot of stuff, so we don't expect it to
193 // need a lot of space for commands. 193 // need a lot of space for commands.
194 limits.command_buffer_size = 1024; 194 limits.command_buffer_size = 1024;
195 // The transfer buffer is used for shaders among other things, so give some 195 // The transfer buffer is used for shaders among other things, so give some
196 // reasonable but small limit. 196 // reasonable but small limit.
197 limits.start_transfer_buffer_size = 4 * 1024; 197 limits.start_transfer_buffer_size = 4 * 1024;
198 limits.min_transfer_buffer_size = 4 * 1024; 198 limits.min_transfer_buffer_size = 4 * 1024;
199 199 limits.max_transfer_buffer_size = 128 * 1024;;
danakj 2017/01/18 23:21:55 double ;;
boliu 2017/01/19 00:00:50 oops, fixed
200 // Use the largest available display size as the max texture size. 200 // Very few allocations from mapped memory pool, so this can be really low.
201 constexpr size_t kBytesPerPixel = 4; 201 limits.mapped_memory_reclaim_limit = 4 * 1024;
202 size_t max_screen_texture_size_in_bytes = limits.min_transfer_buffer_size;
203 for (auto& display : display::Screen::GetScreen()->GetAllDisplays()) {
204 gfx::Size size = display.GetSizeInPixel();
205 size_t display_size_in_bytes =
206 kBytesPerPixel * size.width() * size.height();
207 if (display_size_in_bytes > max_screen_texture_size_in_bytes)
208 max_screen_texture_size_in_bytes = display_size_in_bytes;
209 }
210
211 limits.max_transfer_buffer_size = max_screen_texture_size_in_bytes;
212 // This context is used for doing async readbacks, so allow at least a full
213 // screen readback to be mapped.
214 limits.mapped_memory_reclaim_limit = max_screen_texture_size_in_bytes;
215 202
216 constexpr bool automatic_flushes = false; 203 constexpr bool automatic_flushes = false;
217 constexpr bool support_locking = false; 204 constexpr bool support_locking = false;
218 const GURL url("chrome://gpu/RenderWidgetHostViewAndroid"); 205 const GURL url("chrome://gpu/RenderWidgetHostViewAndroid");
219 206
220 provider_ = new ui::ContextProviderCommandBuffer( 207 provider_ = new ui::ContextProviderCommandBuffer(
221 std::move(gpu_channel_host), gpu::GPU_STREAM_DEFAULT, 208 std::move(gpu_channel_host), gpu::GPU_STREAM_DEFAULT,
222 gpu::GpuStreamPriority::NORMAL, gpu::kNullSurfaceHandle, url, 209 gpu::GpuStreamPriority::NORMAL, gpu::kNullSurfaceHandle, url,
223 automatic_flushes, support_locking, limits, attributes, nullptr, 210 automatic_flushes, support_locking, limits, attributes, nullptr,
224 ui::command_buffer_metrics::BROWSER_OFFSCREEN_MAINTHREAD_CONTEXT); 211 ui::command_buffer_metrics::BROWSER_OFFSCREEN_MAINTHREAD_CONTEXT);
(...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 if (!compositor) 2059 if (!compositor)
2073 return; 2060 return;
2074 2061
2075 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( 2062 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>(
2076 overscroll_refresh_handler, compositor, 2063 overscroll_refresh_handler, compositor,
2077 ui::GetScaleFactorForNativeView(GetNativeView())); 2064 ui::GetScaleFactorForNativeView(GetNativeView()));
2078 is_showing_overscroll_glow_ = true; 2065 is_showing_overscroll_glow_ = true;
2079 } 2066 }
2080 2067
2081 } // namespace content 2068 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698