[Blink Geometry Mapper Transfrom] Add fast path for z-axis translation [chromium/src : main]

4 views
Skip to first unread message

Jayson Adams (Gerrit)

unread,
Jun 27, 2022, 8:24:40 PM6/27/22
to Stephen Chenney, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, pdr+graphi...@chromium.org

Attention is currently required from: Stephen Chenney.

Jayson Adams would like Stephen Chenney to review this change.

View Change

[Blink Geometry Mapper Transfrom] Add fast path for z-axis translation

UpdateScreenTransform() in the GeometryMapperTransformCache has a fast
path for unity transforms or simple 2d translations. All other
transforms go through the slow path which consists of 64
mutliplications and 48 additions. However, there's another fast path
case: a simple z-axis transformation, which requires only 4 multiplies
and 4 adds. This cl adds a fast path for the simple z-axis transform
case.

Bug: 1336059

Test: out/Default/blink_platform_unittests \
--gtest_filter=TransformationMatrixTest*

Change-Id: I9e35e6df17bdaef37e4b946daa658a3d99b376d0
---
M third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache.cc
M third_party/blink/renderer/platform/transforms/transformation_matrix.cc
M third_party/blink/renderer/platform/transforms/transformation_matrix.h
M third_party/blink/renderer/platform/transforms/transformation_matrix_test.cc
4 files changed, 112 insertions(+), 0 deletions(-)


To view, visit change 3704397. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9e35e6df17bdaef37e4b946daa658a3d99b376d0
Gerrit-Change-Number: 3704397
Gerrit-PatchSet: 6
Gerrit-Owner: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
Gerrit-MessageType: newchange

Jayson Adams (Gerrit)

unread,
Jun 27, 2022, 8:24:46 PM6/27/22
to blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, pdr+graphi...@chromium.org, Stephen Chenney, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze

Attention is currently required from: Stephen Chenney.

View Change

1 comment:

To view, visit change 3704397. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9e35e6df17bdaef37e4b946daa658a3d99b376d0
Gerrit-Change-Number: 3704397
Gerrit-PatchSet: 6
Gerrit-Owner: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
Gerrit-Comment-Date: Tue, 28 Jun 2022 00:24:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Philip Rogers (Gerrit)

unread,
Jun 27, 2022, 8:29:33 PM6/27/22
to Xianzhu Wang, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, pdr+graphi...@chromium.org, Jayson Adams, Stephen Chenney

Attention is currently required from: Stephen Chenney, Xianzhu Wang.

Philip Rogers would like Xianzhu Wang to review this change authored by Jayson Adams.

View Change

[Blink Geometry Mapper Transfrom] Add fast path for z-axis translation

UpdateScreenTransform() in the GeometryMapperTransformCache has a fast
path for unity transforms or simple 2d translations. All other
transforms go through the slow path which consists of 64
mutliplications and 48 additions. However, there's another fast path
case: a simple z-axis transformation, which requires only 4 multiplies
and 4 adds. This cl adds a fast path for the simple z-axis transform
case.

Bug: 1336059

Test: out/Default/blink_platform_unittests \
--gtest_filter=TransformationMatrixTest*

Change-Id: I9e35e6df17bdaef37e4b946daa658a3d99b376d0
---
M third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache.cc
M third_party/blink/renderer/platform/transforms/transformation_matrix.cc
M third_party/blink/renderer/platform/transforms/transformation_matrix.h
M third_party/blink/renderer/platform/transforms/transformation_matrix_test.cc
4 files changed, 112 insertions(+), 0 deletions(-)


To view, visit change 3704397. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9e35e6df17bdaef37e4b946daa658a3d99b376d0
Gerrit-Change-Number: 3704397
Gerrit-PatchSet: 6
Gerrit-Owner: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
Gerrit-Reviewer: Xianzhu Wang <wangx...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-Attention: Xianzhu Wang <wangx...@chromium.org>

Xianzhu Wang (Gerrit)

unread,
Jun 27, 2022, 8:37:42 PM6/27/22
to Jayson Adams, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, pdr+graphi...@chromium.org, Philip Rogers, Stephen Chenney, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze

Attention is currently required from: Jayson Adams, Stephen Chenney.

View Change

1 comment:

  • Patchset:

    • Patch Set #6:

      A data point from Skia: They simplified SkMatrix44 to SkM44 to just use the "slow" path for all matrix operations and they observed performance improvements. Their theory is that the reduced branch instructions makes the pipeline and SIMD operations more efficient. I'm not sure their theory applies to blink. I planned to investigate this, but for now I'm not actively working on it.

      Jayson, do you have performance test data for this patch?

To view, visit change 3704397. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9e35e6df17bdaef37e4b946daa658a3d99b376d0
Gerrit-Change-Number: 3704397
Gerrit-PatchSet: 6
Gerrit-Owner: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
Gerrit-Reviewer: Xianzhu Wang <wangx...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-Attention: Jayson Adams <shr...@chromium.org>
Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
Gerrit-Comment-Date: Tue, 28 Jun 2022 00:37:32 +0000

Xianzhu Wang (Gerrit)

unread,
Jun 27, 2022, 8:49:08 PM6/27/22
to Jayson Adams, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, pdr+graphi...@chromium.org, Philip Rogers, Stephen Chenney, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze

Attention is currently required from: Jayson Adams, Stephen Chenney.

View Change

1 comment:

  • Patchset:

    • Patch Set #6:

      A data point from Skia: They simplified SkMatrix44 to SkM44 to just use the "slow" path for all matr […]

      I saw the improvement described in the bug. I would like to see the impact of this CL on generic 3d transform benchmarks because the added condition may have a negative performance impact.

To view, visit change 3704397. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9e35e6df17bdaef37e4b946daa658a3d99b376d0
Gerrit-Change-Number: 3704397
Gerrit-PatchSet: 6
Gerrit-Owner: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
Gerrit-Reviewer: Xianzhu Wang <wangx...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-Attention: Jayson Adams <shr...@chromium.org>
Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
Gerrit-Comment-Date: Tue, 28 Jun 2022 00:48:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Xianzhu Wang <wangx...@chromium.org>
Gerrit-MessageType: comment

Xianzhu Wang (Gerrit)

unread,
Jun 27, 2022, 10:11:18 PM6/27/22
to Jayson Adams, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, pdr+graphi...@chromium.org, Philip Rogers, Stephen Chenney, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze

Attention is currently required from: Jayson Adams, Stephen Chenney.

View Change

1 comment:

  • Patchset:

    • Patch Set #6:

      I saw the improvement described in the bug. […]

      How about a different method: assuming PendingLayers with transforms that are not in the same plane as overlapping? In this way we'll skip overlap testing for these PendingLayers.

To view, visit change 3704397. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9e35e6df17bdaef37e4b946daa658a3d99b376d0
Gerrit-Change-Number: 3704397
Gerrit-PatchSet: 6
Gerrit-Owner: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
Gerrit-Reviewer: Xianzhu Wang <wangx...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-Attention: Jayson Adams <shr...@chromium.org>
Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
Gerrit-Comment-Date: Tue, 28 Jun 2022 02:11:10 +0000

Jayson Adams (Gerrit)

unread,
Jun 28, 2022, 1:40:54 PM6/28/22
to blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, pdr+graphi...@chromium.org, Xianzhu Wang, Philip Rogers, Stephen Chenney, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze

Attention is currently required from: Stephen Chenney, Xianzhu Wang.

View Change

1 comment:

  • Patchset:

    • Patch Set #6:

      How about a different method: assuming PendingLayers with transforms that are not in the same plane […]

      Hello wangxianzhu@, thanks for taking a look! It sounds like you're saying we should investigate the approach you suggest rather than the change I propose in my cl? That's fine, but I am unable to code that up myself (at least not without a lot of pointers). I know little about blink and layers and 3d transforms.

      I'm also happy to run this change against the generic 3d transform benchmarks - I just need a pointer to doing that.

To view, visit change 3704397. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9e35e6df17bdaef37e4b946daa658a3d99b376d0
Gerrit-Change-Number: 3704397
Gerrit-PatchSet: 6
Gerrit-Owner: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
Gerrit-Reviewer: Xianzhu Wang <wangx...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-Attention: Xianzhu Wang <wangx...@chromium.org>
Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
Gerrit-Comment-Date: Tue, 28 Jun 2022 17:40:44 +0000

Xianzhu Wang (Gerrit)

unread,
Jun 28, 2022, 2:51:58 PM6/28/22
to Jayson Adams, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, pdr+graphi...@chromium.org, Philip Rogers, Stephen Chenney, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze

Attention is currently required from: Jayson Adams, Stephen Chenney.

View Change

1 comment:

  • Patchset:

    • Patch Set #6:

      Hello wangxianzhu@, thanks for taking a look! It sounds like you're saying we should investigate the […]

      The approach will require the following changes:
      1. Extract a function SourceToDestinationProjectionInternalSamePlaneOnly() from GeometryMapper::SourceToDestinationProjectionInternal(), to include the part before Case 2. In the function, set success = false before returning. The latter can be changed to call the new function before mapping in the screen space.
      2. In LocalToAncestorVisualRectInternal(), if expand==kExpandVisualRectForCompositingOverlap, call the new function instead of the old function, and if success is false, return InfiniteLooseFloatClipRect().

      Can you introduce some background about the bug and the CL, e.g. how they are related to your work, so that we can decide how much we can ask you to do, etc.?

To view, visit change 3704397. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9e35e6df17bdaef37e4b946daa658a3d99b376d0
Gerrit-Change-Number: 3704397
Gerrit-PatchSet: 6
Gerrit-Owner: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
Gerrit-Reviewer: Xianzhu Wang <wangx...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-Attention: Jayson Adams <shr...@chromium.org>
Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
Gerrit-Comment-Date: Tue, 28 Jun 2022 18:51:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Xianzhu Wang <wangx...@chromium.org>
Comment-In-Reply-To: Jayson Adams <shr...@chromium.org>
Gerrit-MessageType: comment

Jayson Adams (Gerrit)

unread,
Jul 27, 2022, 6:56:45 PM7/27/22
to blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, pdr+graphi...@chromium.org, Xianzhu Wang, Philip Rogers, Stephen Chenney, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze

Attention is currently required from: Stephen Chenney, Xianzhu Wang.

View Change

1 comment:

  • Patchset:

    • Patch Set #6:

      The approach will require the following changes: […]

      Hello,

      Sorry I've been out of touch for so long. We went into a long weekend and then vacation for me, then prep for a week-long conference in NYC and the conference itself. Anyways, I'm back now.

      A couple questions:

      • You said SourceToDestinationProjectionInternalSamePlaneOnly() should include the part before Case 2. Do you mean everything before Case 2, or just the code for Case 1a and 1b?
      • You say set success = false before returning. Do you mean in all cases? That seems odd if so, but I don't know when it would be set to true.

      Re: background on the bug and CL, I work on investigating excess CPU use in Chrome Mac. I was profiling the renderer, saw this case, and took a stab at a fix. I'm up for making changes to the code to improve performance but I'm not a graphics expert (or web platform person either), so I need some help making heads or tails of things.

To view, visit change 3704397. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9e35e6df17bdaef37e4b946daa658a3d99b376d0
Gerrit-Change-Number: 3704397
Gerrit-PatchSet: 6
Gerrit-Owner: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
Gerrit-Reviewer: Xianzhu Wang <wangx...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-Attention: Xianzhu Wang <wangx...@chromium.org>
Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
Gerrit-Comment-Date: Wed, 27 Jul 2022 22:56:33 +0000

Xianzhu Wang (Gerrit)

unread,
Jul 27, 2022, 7:26:03 PM7/27/22
to Jayson Adams, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, pdr+graphi...@chromium.org, Philip Rogers, Stephen Chenney, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze

Attention is currently required from: Jayson Adams, Stephen Chenney.

View Change

1 comment:

To view, visit change 3704397. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9e35e6df17bdaef37e4b946daa658a3d99b376d0
Gerrit-Change-Number: 3704397
Gerrit-PatchSet: 6
Gerrit-Owner: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
Gerrit-Reviewer: Xianzhu Wang <wangx...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-Attention: Jayson Adams <shr...@chromium.org>
Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
Gerrit-Comment-Date: Wed, 27 Jul 2022 23:25:55 +0000

Jayson Adams (Gerrit)

unread,
Jul 28, 2022, 5:52:10 PM7/28/22
to blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, pdr+graphi...@chromium.org, Xianzhu Wang, Philip Rogers, Stephen Chenney, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze

Jayson Adams abandoned this change.

View Change

To view, visit change 3704397. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9e35e6df17bdaef37e4b946daa658a3d99b376d0
Gerrit-Change-Number: 3704397
Gerrit-PatchSet: 6
Gerrit-Owner: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
Gerrit-Reviewer: Xianzhu Wang <wangx...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-MessageType: abandon

Jayson Adams (Gerrit)

unread,
Jul 28, 2022, 5:52:51 PM7/28/22
to blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, pdr+graphi...@chromium.org, Xianzhu Wang, Philip Rogers, Stephen Chenney, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze

View Change

1 comment:

  • Patchset:

    • Patch Set #6:

      Now we are investigating reducing PendingLayer::MightOverlap() invokes (partly inspired by your work […]

      This bug is tricky to repro (it depends on the ads the site is serving). Comparing Chrome with and without your CL (no longer WIP?), the percentage of main thread time spent in blink::PendingLayer::MightOverlap() drops by 28% with the CL applied. I can also see that the number of blink::TransformationMatrix::Multiply()s drops to almost nothing. Thanks for making the change!!

To view, visit change 3704397. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9e35e6df17bdaef37e4b946daa658a3d99b376d0
Gerrit-Change-Number: 3704397
Gerrit-PatchSet: 6
Gerrit-Owner: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Jayson Adams <shr...@chromium.org>
Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
Gerrit-Reviewer: Xianzhu Wang <wangx...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-Comment-Date: Thu, 28 Jul 2022 21:52:41 +0000
Reply all
Reply to author
Forward
0 new messages