Commit 5c4d3d4a authored by danakj's avatar danakj Committed by Commit Bot

Reduce fragmentation of gpu memory by rounding RenderPass textures.

The IOSurface textures for RenderPasses do this, citing bug
146070. We can do the same for the RenderPass textures. This affects
any pixel tests that have anti-aliasing, as the float value of
texcoords is changed. So we have to add anti-aliased versions of a few
pixel tests, and rebase a number.

R=ccameron@chromium.org

Bug: 146070
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I41628534048b526afb2ac02378d71c329cc02344
Reviewed-on: https://chromium-review.googlesource.com/841284
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526617}
parent ada54005
......@@ -348,7 +348,7 @@ TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPass_Software) {
TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassAA_GL) {
RunBlendingWithRenderPass(ZERO_COPY,
FILE_PATH_LITERAL("blending_render_pass.png"),
FILE_PATH_LITERAL("blending_render_pass_aa.png"),
kUseAntialiasing);
}
......@@ -370,9 +370,9 @@ TEST_F(LayerTreeHostBlendingPixelTest,
}
TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassWithMaskAA_GL) {
RunBlendingWithRenderPass(ZERO_COPY,
FILE_PATH_LITERAL("blending_render_pass_mask.png"),
kUseMasks | kUseAntialiasing);
RunBlendingWithRenderPass(
ZERO_COPY, FILE_PATH_LITERAL("blending_render_pass_mask_aa.png"),
kUseMasks | kUseAntialiasing);
}
TEST_F(LayerTreeHostBlendingPixelTest,
......@@ -396,7 +396,7 @@ TEST_F(LayerTreeHostBlendingPixelTest,
TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassColorMatrixAA_GL) {
RunBlendingWithRenderPass(ZERO_COPY,
FILE_PATH_LITERAL("blending_render_pass.png"),
FILE_PATH_LITERAL("blending_render_pass_aa.png"),
kUseAntialiasing | kUseColorMatrix);
}
......@@ -423,9 +423,9 @@ TEST_F(LayerTreeHostBlendingPixelTest,
TEST_F(LayerTreeHostBlendingPixelTest,
BlendingWithRenderPassWithMaskColorMatrixAA_GL) {
RunBlendingWithRenderPass(ZERO_COPY,
FILE_PATH_LITERAL("blending_render_pass_mask.png"),
kUseMasks | kUseAntialiasing | kUseColorMatrix);
RunBlendingWithRenderPass(
ZERO_COPY, FILE_PATH_LITERAL("blending_render_pass_mask_aa.png"),
kUseMasks | kUseAntialiasing | kUseColorMatrix);
}
TEST_F(LayerTreeHostBlendingPixelTest,
......@@ -443,7 +443,7 @@ TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassShaders_GL) {
TEST_F(LayerTreeHostBlendingPixelTest, BlendingWithRenderPassShadersAA_GL) {
RunBlendingWithRenderPass(ZERO_COPY,
FILE_PATH_LITERAL("blending_render_pass.png"),
FILE_PATH_LITERAL("blending_render_pass_aa.png"),
kUseAntialiasing | kForceShaders);
}
......@@ -463,16 +463,16 @@ TEST_F(LayerTreeHostBlendingPixelTest,
TEST_F(LayerTreeHostBlendingPixelTest,
BlendingWithRenderPassShadersWithMaskAA_GL) {
RunBlendingWithRenderPass(ZERO_COPY,
FILE_PATH_LITERAL("blending_render_pass_mask.png"),
kUseMasks | kUseAntialiasing | kForceShaders);
RunBlendingWithRenderPass(
ZERO_COPY, FILE_PATH_LITERAL("blending_render_pass_mask_aa.png"),
kUseMasks | kUseAntialiasing | kForceShaders);
}
TEST_F(LayerTreeHostBlendingPixelTest,
BlendingWithRenderPassShadersWithMaskAA_GL_TextureRect) {
RunBlendingWithRenderPass(ZERO_COPY,
FILE_PATH_LITERAL("blending_render_pass_mask.png"),
kUseMasks | kUseAntialiasing | kForceShaders);
RunBlendingWithRenderPass(
ZERO_COPY, FILE_PATH_LITERAL("blending_render_pass_mask_aa.png"),
kUseMasks | kUseAntialiasing | kForceShaders);
}
TEST_F(LayerTreeHostBlendingPixelTest,
......@@ -485,7 +485,7 @@ TEST_F(LayerTreeHostBlendingPixelTest,
TEST_F(LayerTreeHostBlendingPixelTest,
BlendingWithRenderPassShadersColorMatrixAA_GL) {
RunBlendingWithRenderPass(ZERO_COPY,
FILE_PATH_LITERAL("blending_render_pass.png"),
FILE_PATH_LITERAL("blending_render_pass_aa.png"),
kUseAntialiasing | kUseColorMatrix | kForceShaders);
}
......@@ -506,7 +506,7 @@ TEST_F(LayerTreeHostBlendingPixelTest,
TEST_F(LayerTreeHostBlendingPixelTest,
BlendingWithRenderPassShadersWithMaskColorMatrixAA_GL) {
RunBlendingWithRenderPass(
ZERO_COPY, FILE_PATH_LITERAL("blending_render_pass_mask.png"),
ZERO_COPY, FILE_PATH_LITERAL("blending_render_pass_mask_aa.png"),
kUseMasks | kUseAntialiasing | kUseColorMatrix | kForceShaders);
}
......
......@@ -551,8 +551,14 @@ TEST_P(LayerTreeHostMaskAsBlendingPixelTest, PixelAlignedNoop) {
mask_layer->SetBlendMode(SkBlendMode::kDstIn);
mask_isolation->AddChild(mask_layer);
RunPixelResourceTest(
root, base::FilePath(FILE_PATH_LITERAL("mask_as_blending_noop.png")));
if (use_antialiasing_) {
RunPixelResourceTest(
root,
base::FilePath(FILE_PATH_LITERAL("mask_as_blending_noop_aa.png")));
} else {
RunPixelResourceTest(
root, base::FilePath(FILE_PATH_LITERAL("mask_as_blending_noop.png")));
}
}
TEST_P(LayerTreeHostMaskAsBlendingPixelTest, PixelAlignedClippedCircle) {
......@@ -664,9 +670,17 @@ TEST_P(LayerTreeHostMaskAsBlendingPixelTest, RotatedClippedCircle) {
mask_layer->SetBlendMode(SkBlendMode::kDstIn);
mask_isolation->AddChild(mask_layer);
RunPixelResourceTest(
root,
base::FilePath(FILE_PATH_LITERAL("mask_as_blending_rotated_circle.png")));
if (use_antialiasing_ && force_shaders_) {
RunPixelResourceTest(
root, base::FilePath(FILE_PATH_LITERAL(
"mask_as_blending_rotated_circle_aa_shaders.png")));
} else if (use_antialiasing_) {
RunPixelResourceTest(root, base::FilePath(FILE_PATH_LITERAL(
"mask_as_blending_rotated_circle_aa.png")));
} else {
RunPixelResourceTest(root, base::FilePath(FILE_PATH_LITERAL(
"mask_as_blending_rotated_circle.png")));
}
}
TEST_P(LayerTreeHostMaskAsBlendingPixelTest, RotatedClippedCircleUnderflow) {
......
......@@ -659,7 +659,14 @@ gfx::Rect DirectRenderer::ComputeScissorRectForRenderPass(
// static
gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) {
return render_pass->output_rect.size();
// Round the size of the render pass backings to a multiple of 64 pixels. This
// reduces memory fragmentation. https://crbug.com/146070. This also allows
// backings to be more easily reused during a resize operation.
gfx::Size required_size = render_pass->output_rect.size();
int multiple = 64;
int width = cc::MathUtil::CheckedRoundUp(required_size.width(), multiple);
int height = cc::MathUtil::CheckedRoundUp(required_size.height(), multiple);
return gfx::Size(width, height);
}
void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) {
......
......@@ -3348,9 +3348,9 @@ void GLRenderer::CopyRenderPassDrawQuadToOverlayResource(
// memory fragmentation. https://crbug.com/146070. This also allows IOSurfaces
// to be more easily reused during a resize operation.
uint32_t iosurface_multiple = 64;
uint32_t iosurface_width = cc::MathUtil::UncheckedRoundUp(
uint32_t iosurface_width = cc::MathUtil::CheckedRoundUp(
static_cast<uint32_t>(updated_dst_rect.width()), iosurface_multiple);
uint32_t iosurface_height = cc::MathUtil::UncheckedRoundUp(
uint32_t iosurface_height = cc::MathUtil::CheckedRoundUp(
static_cast<uint32_t>(updated_dst_rect.height()), iosurface_multiple);
*resource = overlay_resource_pool_->AcquireResource(
......
......@@ -12,6 +12,9 @@ class PixelExpectations(GpuTestExpectations):
# self.Fail('Pixel_Canvas2DRedBox',
# ['mac', 'amd', ('nvidia', 0x1234)], bug=123)
# Needs rebaseline.
self.Fail('Pixel_CSSFilterEffects_NoOverlays', ['mac'])
# Seems to be flaky on the new AMD R7 240 drivers.
self.Flaky('Pixel_GpuRasterization_BlueBox',
['win', ('amd', 0x6613)], bug=653538)
......
......@@ -696,7 +696,7 @@ def MacSpecificPages(base_name):
'filter_effects.html',
base_name + '_CSSFilterEffects_NoOverlays',
test_rect=[0, 0, 300, 300],
revision=6,
revision=7,
tolerance=10,
browser_args=['--disable-mac-overlays']),
]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment