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

Unified Diff: cc/output/gl_renderer.cc

Issue 2245813002: Round IOSurface sizes to 64 pixels for filter effects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp73_rp_fuzzy_match
Patch Set: Compile error. Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 48611c498189b0050a4856998c214834d509a370..c1f73f82aaaf4fcb5bc5459ce1a16c426d99e82c 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -3942,7 +3942,29 @@ void GLRenderer::CopyRenderPassDrawQuadToOverlayResource(
// |params.dst_rect| now contain values that reflect a potentially increased
// size quad.
gfx::RectF updated_dst_rect = params.dst_rect;
- *new_bounds = updated_dst_rect;
+
+ // Round the size of the IOSurface to a multiple of 64 pixels. This reduces
+ // memory fragmentation. https://crbug.com/146070. This also allows IOSurfaces
+ // to be more easily reused during a resize operation.
+ uint32_t iosurface_multiple = 64;
ccameron 2016/08/15 18:37:06 May be more concise to do updated_dst_rest.set_w
erikchen 2016/08/15 19:31:57 Done, although we can't change updated_dst_rect, s
+ uint32_t iosurface_width = updated_dst_rect.width();
+ if (iosurface_width % iosurface_multiple != 0) {
+ iosurface_width -= iosurface_width % iosurface_multiple;
+ iosurface_width += iosurface_multiple;
+ }
+
+ uint32_t iosurface_height = updated_dst_rect.height();
+ if (iosurface_height % iosurface_multiple != 0) {
+ iosurface_height -= iosurface_height % iosurface_multiple;
+ iosurface_height += iosurface_multiple;
+ }
+
+ *resource = overlay_resource_pool_->AcquireResource(
+ gfx::Size(iosurface_width, iosurface_height), ResourceFormat::RGBA_8888,
+ output_surface_->device_color_space());
+ *new_bounds =
+ gfx::RectF(updated_dst_rect.x(), updated_dst_rect.y(),
+ (*resource)->size().width(), (*resource)->size().height());
// Calculate new projection and window matrices for a minimally sized viewport
// using InitializeViewport(). This requires creating a dummy DrawingFrame.
@@ -3982,9 +4004,6 @@ void GLRenderer::CopyRenderPassDrawQuadToOverlayResource(
}
// Establish destination texture.
- *resource = overlay_resource_pool_->AcquireResource(
- gfx::Size(updated_dst_rect.width(), updated_dst_rect.height()),
- ResourceFormat::RGBA_8888, output_surface_->device_color_space());
ResourceProvider::ScopedWriteLockGL destination(resource_provider_,
(*resource)->id(), false);
GLuint temp_fbo;
« 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