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

Side by Side 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: Comments from ccameron. 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 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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 3924 matching lines...) Expand 10 before | Expand all | Expand 10 after
3935 // Perform basic initialization with the screen-sized viewport. 3935 // Perform basic initialization with the screen-sized viewport.
3936 if (!InitializeRPDQParameters(&params)) 3936 if (!InitializeRPDQParameters(&params))
3937 return; 3937 return;
3938 3938
3939 if (!UpdateRPDQWithSkiaFilters(&params)) 3939 if (!UpdateRPDQWithSkiaFilters(&params))
3940 return; 3940 return;
3941 3941
3942 // |params.dst_rect| now contain values that reflect a potentially increased 3942 // |params.dst_rect| now contain values that reflect a potentially increased
3943 // size quad. 3943 // size quad.
3944 gfx::RectF updated_dst_rect = params.dst_rect; 3944 gfx::RectF updated_dst_rect = params.dst_rect;
3945 *new_bounds = updated_dst_rect; 3945
3946 // Round the size of the IOSurface to a multiple of 64 pixels. This reduces
3947 // memory fragmentation. https://crbug.com/146070. This also allows IOSurfaces
3948 // to be more easily reused during a resize operation.
3949 uint32_t iosurface_multiple = 64;
3950 uint32_t iosurface_width = MathUtil::UncheckedRoundUp(
3951 static_cast<uint32_t>(updated_dst_rect.width()), iosurface_multiple);
3952 uint32_t iosurface_height = MathUtil::UncheckedRoundUp(
3953 static_cast<uint32_t>(updated_dst_rect.height()), iosurface_multiple);
3954
3955 *resource = overlay_resource_pool_->AcquireResource(
3956 gfx::Size(iosurface_width, iosurface_height), ResourceFormat::RGBA_8888,
3957 output_surface_->device_color_space());
3958 *new_bounds =
3959 gfx::RectF(updated_dst_rect.x(), updated_dst_rect.y(),
3960 (*resource)->size().width(), (*resource)->size().height());
3946 3961
3947 // Calculate new projection and window matrices for a minimally sized viewport 3962 // Calculate new projection and window matrices for a minimally sized viewport
3948 // using InitializeViewport(). This requires creating a dummy DrawingFrame. 3963 // using InitializeViewport(). This requires creating a dummy DrawingFrame.
3949 { 3964 {
3950 DrawingFrame frame; 3965 DrawingFrame frame;
3951 force_drawing_frame_framebuffer_unflipped_ = true; 3966 force_drawing_frame_framebuffer_unflipped_ = true;
3952 gfx::Rect frame_rect = 3967 gfx::Rect frame_rect =
3953 gfx::Rect(0, 0, updated_dst_rect.width(), updated_dst_rect.height()); 3968 gfx::Rect(0, 0, updated_dst_rect.width(), updated_dst_rect.height());
3954 InitializeViewport(&frame, frame_rect, frame_rect, frame_rect.size()); 3969 InitializeViewport(&frame, frame_rect, frame_rect, frame_rect.size());
3955 force_drawing_frame_framebuffer_unflipped_ = false; 3970 force_drawing_frame_framebuffer_unflipped_ = false;
(...skipping 19 matching lines...) Expand all
3975 bool clipped = false; 3990 bool clipped = false;
3976 params.contents_device_transform.FlattenTo2d(); 3991 params.contents_device_transform.FlattenTo2d();
3977 gfx::QuadF device_layer_quad = MathUtil::MapQuad( 3992 gfx::QuadF device_layer_quad = MathUtil::MapQuad(
3978 params.contents_device_transform, SharedGeometryQuad(), &clipped); 3993 params.contents_device_transform, SharedGeometryQuad(), &clipped);
3979 LayerQuad device_layer_edges(device_layer_quad); 3994 LayerQuad device_layer_edges(device_layer_quad);
3980 InflateAntiAliasingDistances(device_layer_quad, &device_layer_edges, 3995 InflateAntiAliasingDistances(device_layer_quad, &device_layer_edges,
3981 params.edge); 3996 params.edge);
3982 } 3997 }
3983 3998
3984 // Establish destination texture. 3999 // Establish destination texture.
3985 *resource = overlay_resource_pool_->AcquireResource(
3986 gfx::Size(updated_dst_rect.width(), updated_dst_rect.height()),
3987 ResourceFormat::RGBA_8888, output_surface_->device_color_space());
3988 ResourceProvider::ScopedWriteLockGL destination(resource_provider_, 4000 ResourceProvider::ScopedWriteLockGL destination(resource_provider_,
3989 (*resource)->id(), false); 4001 (*resource)->id(), false);
3990 GLuint temp_fbo; 4002 GLuint temp_fbo;
3991 4003
3992 gl_->GenFramebuffers(1, &temp_fbo); 4004 gl_->GenFramebuffers(1, &temp_fbo);
3993 gl_->BindFramebuffer(GL_FRAMEBUFFER, temp_fbo); 4005 gl_->BindFramebuffer(GL_FRAMEBUFFER, temp_fbo);
3994 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 4006 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
3995 destination.target(), destination.texture_id(), 0); 4007 destination.target(), destination.texture_id(), 0);
3996 DCHECK(gl_->CheckFramebufferStatus(GL_FRAMEBUFFER) == 4008 DCHECK(gl_->CheckFramebufferStatus(GL_FRAMEBUFFER) ==
3997 GL_FRAMEBUFFER_COMPLETE); 4009 GL_FRAMEBUFFER_COMPLETE);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
4061 4073
4062 gl_->ScheduleCALayerSharedStateCHROMIUM( 4074 gl_->ScheduleCALayerSharedStateCHROMIUM(
4063 ca_layer_overlay->shared_state->opacity, is_clipped, clip_rect, 4075 ca_layer_overlay->shared_state->opacity, is_clipped, clip_rect,
4064 sorting_context_id, gl_transform); 4076 sorting_context_id, gl_transform);
4065 gl_->ScheduleCALayerCHROMIUM( 4077 gl_->ScheduleCALayerCHROMIUM(
4066 texture_id, contents_rect, ca_layer_overlay->background_color, 4078 texture_id, contents_rect, ca_layer_overlay->background_color,
4067 ca_layer_overlay->edge_aa_mask, bounds_rect, filter); 4079 ca_layer_overlay->edge_aa_mask, bounds_rect, filter);
4068 } 4080 }
4069 4081
4070 } // namespace cc 4082 } // namespace cc
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