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

Issue 1949253004: Rounded background image fast path (Closed)

Created:
4 years, 7 months ago by f(malita)
Modified:
4 years, 7 months ago
CC:
ajuma+watch-canvas_chromium.org, blink-reviews, blink-reviews-layout_chromium.org, blink-reviews-paint_chromium.org, blink-reviews-platform-graphics_chromium.org, bsalomon_chromium, Rik, chromium-reviews, danakj+watch_chromium.org, dcheng, dshwang, drott+blinkwatch_chromium.org, krit, eae+blinkwatch, fs, gyuyoung2, haraken, jbroman, jchaffraix+rendering, Justin Novosad, kinuko+watch, kouhei+svg_chromium.org, leviw+renderwatch, pdr+renderingwatchlist_chromium.org, pdr+svgwatchlist_chromium.org, pdr+graphicswatchlist_chromium.org, reed1, rwlbuis, Stephen Chennney, slimming-paint-reviews_chromium.org, szager+layoutwatch_chromium.org, zoltan1
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Rounded background image fast path The current box background paint logic relies on clipping for drawing rounded-rect background images. This can yield some pathological rasterization slowdowns on the GPU backend. In the case where a single image tile covers the whole box (no fancy tiling involved/required), a more efficient way to draw is to use a Skia shader and just fill the rounded rect shape (skipping the unnecessary clip). This CL implements such an optimization: 1) Introduce a new Image virtual (applyShader) which configures the paint for filling arbitrary shapes with the image content. 2) Add a new GraphicsContext method for drawing rounded-rect images (drawRRectImage) using shaders build via #1. 3) Expand BoxPainter's fillFastBottomLayer() fast path to detect when tiling is not required and use #2 for painting rounded-rect background images. This avoids clipping for simple rounded-rect background images/gradients, and improves GPU rasterization times significantly in some cases. In local testing, Animometer/CSS-bouncing-gradient-circles shows a ~26% score improvement with the software backend (300 -> 370) and a 14X score improvement with Ganesh (27 -> 380). BUG=603966 R=fs@opera.com,chrishtr@chromium.org,schenney@chromium.org CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel Committed: https://crrev.com/4c1400381d16b6dcd8921a8f19a2ae9af4aac4cf Cr-Commit-Position: refs/heads/master@{#395492}

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : #

Patch Set 7 : #

Patch Set 8 : #

Patch Set 9 : #

Patch Set 10 : #

Patch Set 11 : #

Patch Set 12 : #

Patch Set 13 : #

Patch Set 14 : #

Patch Set 15 : #

Patch Set 16 : #

Patch Set 17 : #

Patch Set 18 : #

Patch Set 19 : #

Patch Set 20 : test: disable bitmap shaders #

Patch Set 21 : #

Patch Set 22 : rebased #

Patch Set 23 : #

Total comments: 5

Patch Set 24 : review #

Total comments: 9

Patch Set 25 : review #

Total comments: 4

Patch Set 26 : review #

Total comments: 2

Patch Set 27 : todo #

Unified diffs Side-by-side diffs Delta from patch set Stats (+302 lines, -81 lines) Patch
M third_party/WebKit/Source/core/paint/BackgroundImageGeometry.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/paint/BoxPainter.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 4 chunks +161 lines, -59 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 chunks +6 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2 chunks +22 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/GraphicsContext.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 3 chunks +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +45 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/Image.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2 chunks +15 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/Image.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +44 lines, -10 lines 0 comments Download

Messages

Total messages: 30 (11 generated)
f(malita)
4 years, 7 months ago (2016-05-20 00:24:51 UTC) #8
fs
That's some persuasive numbers you've got there =) The BoxPainter code isn't particularly easy to ...
4 years, 7 months ago (2016-05-20 12:47:35 UTC) #9
Stephen Chennney
I'm off today but I want to understand this. Please hold off on committing until ...
4 years, 7 months ago (2016-05-20 13:57:20 UTC) #10
f(malita)
https://codereview.chromium.org/1949253004/diff/440001/third_party/WebKit/Source/core/paint/BoxPainter.cpp File third_party/WebKit/Source/core/paint/BoxPainter.cpp (right): https://codereview.chromium.org/1949253004/diff/440001/third_party/WebKit/Source/core/paint/BoxPainter.cpp#newcode394 third_party/WebKit/Source/core/paint/BoxPainter.cpp:394: // When the layer has an image, figure whether ...
4 years, 7 months ago (2016-05-20 13:57:57 UTC) #11
f(malita)
On 2016/05/20 13:57:20, Stephen Chennney wrote: > I'm off today but I want to understand ...
4 years, 7 months ago (2016-05-20 14:01:04 UTC) #12
fs
https://codereview.chromium.org/1949253004/diff/440001/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp File third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp (right): https://codereview.chromium.org/1949253004/diff/440001/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp#newcode67 third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp:67: m_gradient->setGradientSpaceTransform(transform); On 2016/05/20 at 13:57:57, f(malita) wrote: > On ...
4 years, 7 months ago (2016-05-20 14:18:57 UTC) #13
chrishtr
https://codereview.chromium.org/1949253004/diff/460001/third_party/WebKit/Source/core/paint/BoxPainter.cpp File third_party/WebKit/Source/core/paint/BoxPainter.cpp (right): https://codereview.chromium.org/1949253004/diff/460001/third_party/WebKit/Source/core/paint/BoxPainter.cpp#newcode401 third_party/WebKit/Source/core/paint/BoxPainter.cpp:401: if (!geometry->destRect().isEmpty()) { It's not so good that this ...
4 years, 7 months ago (2016-05-20 15:44:13 UTC) #14
f(malita)
https://codereview.chromium.org/1949253004/diff/460001/third_party/WebKit/Source/core/paint/BoxPainter.cpp File third_party/WebKit/Source/core/paint/BoxPainter.cpp (right): https://codereview.chromium.org/1949253004/diff/460001/third_party/WebKit/Source/core/paint/BoxPainter.cpp#newcode401 third_party/WebKit/Source/core/paint/BoxPainter.cpp:401: if (!geometry->destRect().isEmpty()) { On 2016/05/20 15:44:13, chrishtr wrote: > ...
4 years, 7 months ago (2016-05-20 19:17:12 UTC) #15
chrishtr
https://codereview.chromium.org/1949253004/diff/460001/third_party/WebKit/Source/core/paint/BoxPainter.cpp File third_party/WebKit/Source/core/paint/BoxPainter.cpp (right): https://codereview.chromium.org/1949253004/diff/460001/third_party/WebKit/Source/core/paint/BoxPainter.cpp#newcode401 third_party/WebKit/Source/core/paint/BoxPainter.cpp:401: if (!geometry->destRect().isEmpty()) { On 2016/05/20 at 19:17:11, f(malita) wrote: ...
4 years, 7 months ago (2016-05-20 19:52:35 UTC) #16
f(malita)
https://codereview.chromium.org/1949253004/diff/460001/third_party/WebKit/Source/core/paint/BoxPainter.cpp File third_party/WebKit/Source/core/paint/BoxPainter.cpp (right): https://codereview.chromium.org/1949253004/diff/460001/third_party/WebKit/Source/core/paint/BoxPainter.cpp#newcode401 third_party/WebKit/Source/core/paint/BoxPainter.cpp:401: if (!geometry->destRect().isEmpty()) { On 2016/05/20 19:52:35, chrishtr wrote: > ...
4 years, 7 months ago (2016-05-22 14:04:07 UTC) #17
chrishtr
I assume there are already layout tests that exercise this? Which ones? https://codereview.chromium.org/1949253004/diff/460001/third_party/WebKit/Source/core/paint/BoxPainter.cpp File third_party/WebKit/Source/core/paint/BoxPainter.cpp ...
4 years, 7 months ago (2016-05-23 19:59:22 UTC) #18
Stephen Chennney
I'm fine with this. It's a bit harder to follow but more speed is good. ...
4 years, 7 months ago (2016-05-23 20:21:15 UTC) #19
f(malita)
https://codereview.chromium.org/1949253004/diff/500001/third_party/WebKit/Source/core/paint/BoxPainter.cpp File third_party/WebKit/Source/core/paint/BoxPainter.cpp (right): https://codereview.chromium.org/1949253004/diff/500001/third_party/WebKit/Source/core/paint/BoxPainter.cpp#newcode428 third_party/WebKit/Source/core/paint/BoxPainter.cpp:428: // RoundedInnerRectClipper handles this case via discrete, corner-wise clipping. ...
4 years, 7 months ago (2016-05-23 21:12:23 UTC) #20
chrishtr
On 2016/05/23 at 21:12:23, fmalita wrote: > https://codereview.chromium.org/1949253004/diff/500001/third_party/WebKit/Source/core/paint/BoxPainter.cpp > File third_party/WebKit/Source/core/paint/BoxPainter.cpp (right): > > https://codereview.chromium.org/1949253004/diff/500001/third_party/WebKit/Source/core/paint/BoxPainter.cpp#newcode428 ...
4 years, 7 months ago (2016-05-23 21:18:04 UTC) #21
chrishtr
lgtm
4 years, 7 months ago (2016-05-23 21:18:19 UTC) #22
f(malita)
On 2016/05/23 21:18:04, chrishtr wrote: > On 2016/05/23 at 21:12:23, fmalita wrote: > > Still, ...
4 years, 7 months ago (2016-05-23 21:39:04 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1949253004/520001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1949253004/520001
4 years, 7 months ago (2016-05-23 21:45:05 UTC) #26
commit-bot: I haz the power
Committed patchset #27 (id:520001)
4 years, 7 months ago (2016-05-24 00:53:20 UTC) #28
commit-bot: I haz the power
4 years, 7 months ago (2016-05-24 00:54:40 UTC) #30
Message was sent while issue was closed.
Patchset 27 (id:??) landed as
https://crrev.com/4c1400381d16b6dcd8921a8f19a2ae9af4aac4cf
Cr-Commit-Position: refs/heads/master@{#395492}

Powered by Google App Engine
This is Rietveld 408576698