From 82c989cfafe0f1e332c3aa8b994bc9e1c98704f0 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Sat, 20 May 2023 02:30:12 +0000 Subject: [PATCH] Bug 1834079 - Move stroke fallback heuristic to after we attempt AA-Stroke. r=jrmuizel We have a heuristic that falls back from stroking certain paths with acceleration because both WGR and the texture cache can have slow output as the size of the path increases in screen area. AA-Stroke tends to have better output for these paths, or at least, this heuristic tends to have a detrimental effect on AA-Stroke usage and performance in important tests. Lets move the heuristic to after we use AA-Stroke for now. Differential Revision: https://phabricator.services.mozilla.com/D178549 --- dom/canvas/DrawTargetWebgl.cpp | 19 +++++++++++-------- dom/encoding/test/reftest/reftest.list | 4 ++-- layout/reftests/backgrounds/reftest.list | 2 +- layout/reftests/bugs/reftest.list | 2 +- layout/reftests/transform/reftest.list | 2 +- ...osition-fixed-scroll-nested-fixed.html.ini | 2 +- .../offset-path-ray-contain-004.html.ini | 3 +++ .../meta/resize-observer/devicepixel.html.ini | 3 +++ 8 files changed, 23 insertions(+), 14 deletions(-) create mode 100644 testing/web-platform/meta/css/motion/offset-path-ray-contain-004.html.ini create mode 100644 testing/web-platform/meta/resize-observer/devicepixel.html.ini diff --git a/dom/canvas/DrawTargetWebgl.cpp b/dom/canvas/DrawTargetWebgl.cpp index 081acf6e154c..7abcf12ae515 100644 --- a/dom/canvas/DrawTargetWebgl.cpp +++ b/dom/canvas/DrawTargetWebgl.cpp @@ -3024,14 +3024,6 @@ bool DrawTargetWebgl::SharedContext::DrawPathAccel( } // Nudge the bounds to account for the quantization rounding. Rect quantBounds = Rect(intBounds) + (realOrigin - quantizedOrigin); - // If a stroke path covers too much screen area, it is likely that most is - // empty space in the interior. This usually imposes too high a cost versus - // just rasterizing without acceleration. - if (aStrokeOptions && - intBounds.width * intBounds.height > - (mViewportSize.width / 2) * (mViewportSize.height / 2)) { - return false; - } // If the pattern is a solid color, then this will be used along with a path // mask to render the path, as opposed to baking the pattern into the cached // path texture. @@ -3221,6 +3213,17 @@ bool DrawTargetWebgl::SharedContext::DrawPathAccel( } } + // If a stroke path covers too much screen area, it is likely that most is + // empty space in the interior. This usually imposes too high a cost versus + // just rasterizing without acceleration. Note that AA-Stroke generally + // produces more acceptable amounts of geometry for larger paths, so we do + // this heuristic after we attempt AA-Stroke. + if (aStrokeOptions && + intBounds.width * intBounds.height > + (mViewportSize.width / 2) * (mViewportSize.height / 2)) { + return false; + } + // If there isn't a valid texture handle, then we need to rasterize the // path in a software canvas and upload this to a texture. Solid color // patterns will be rendered as a path mask that can then be modulated diff --git a/dom/encoding/test/reftest/reftest.list b/dom/encoding/test/reftest/reftest.list index 3bd8a5fda00e..1e6bbb23e40e 100644 --- a/dom/encoding/test/reftest/reftest.list +++ b/dom/encoding/test/reftest/reftest.list @@ -1,5 +1,5 @@ == bug863728-1.html bug863728-1-ref.html -fuzzy(0-1,0-10) fuzzy-if(winWidget&&browserIsFission,47-137,211-251) == bug863728-2.html bug863728-2-ref.html # fission: bug 1717838 +fuzzy(0-128,0-281) fuzzy-if(winWidget&&browserIsFission,47-137,211-251) == bug863728-2.html bug863728-2-ref.html # fission: bug 1717838 == bug863728-3.html bug863728-3-ref.html == bug945215-1.html bug945215-1-ref.html -fuzzy(0-1,0-10) fuzzy-if(winWidget&&browserIsFission,47-137,211-251) == bug945215-2.html bug945215-2-ref.html # fission: bug 1717838 +fuzzy(0-128,0-281) fuzzy-if(winWidget&&browserIsFission,47-137,211-251) == bug945215-2.html bug945215-2-ref.html # fission: bug 1717838 diff --git a/layout/reftests/backgrounds/reftest.list b/layout/reftests/backgrounds/reftest.list index 155b882e5830..c9274594e10b 100644 --- a/layout/reftests/backgrounds/reftest.list +++ b/layout/reftests/backgrounds/reftest.list @@ -165,7 +165,7 @@ fuzzy(0-95,0-2206) == attachment-local-clipping-image-5.html attachment-local-cl fuzzy(0-109,0-908) fuzzy-if(geckoview&&device,64-64,2010-2830) == attachment-local-clipping-image-6.html attachment-local-clipping-image-6-ref.html fuzzy(0-1,0-84) == background-multiple-with-border-radius.html background-multiple-with-border-radius-ref.html -fuzzy(0-11,0-49600) fails-if(useDrawSnapshot) == background-repeat-large-area.html background-repeat-large-area-ref.html # bug 1734383 +fuzzy(0-74,0-49600) fails-if(useDrawSnapshot) == background-repeat-large-area.html background-repeat-large-area-ref.html # bug 1734383 fuzzy(0-31,0-474) fails-if(useDrawSnapshot) == background-tiling-zoom-1.html background-tiling-zoom-1-ref.html # drawSnapshot doesn't deal with zoom properly diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 48c4d74d2cdf..e8ebe027518d 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1166,7 +1166,7 @@ fails-if(Android) == 455826-1.html 455826-1-ref.html == chrome://reftest/content/bugs/456147.xhtml 456147-ref.html fuzzy(24-110,110-800) == 456219-1a.html 456219-1-ref.html # bug 1128229 fuzzy(24-110,107-1251) == 456219-1b.html 456219-1-ref.html # bug 1128229 -fuzzy(24-110,107-2940) == 456219-1c.html 456219-1-ref.html # bug 1128229 +fuzzy(24-110,107-3051) == 456219-1c.html 456219-1-ref.html # bug 1128229 fuzzy(0-10,0-8) == 456219-2.html 456219-2-ref.html == 456330-1.gif 456330-1-ref.png == 456484-1.html 456484-1-ref.html diff --git a/layout/reftests/transform/reftest.list b/layout/reftests/transform/reftest.list index 857d85f514e4..4893c4a6d80e 100644 --- a/layout/reftests/transform/reftest.list +++ b/layout/reftests/transform/reftest.list @@ -165,7 +165,7 @@ test-pref(layout.animation.prerender.partial.jank,true) test-pref(layout.animati test-pref(layout.animation.prerender.partial.jank,true) test-pref(layout.animation.prerender.partial,true) test-pref(layout.animation.prerender.viewport-ratio-limit,"1.125") == partial-prerender-translate-4.html partial-prerender-expansion-ref.html # This reftest doesn't fail on WebRender, this reftest fails only if there is a jank mechanism and the mechanism does inproperly handle position:fixed scroll target test-pref(layout.animation.prerender.partial.jank,true) test-pref(layout.animation.prerender.partial,true) test-pref(layout.animation.prerender.viewport-ratio-limit,"1.125") == partial-prerender-translate-5.html partial-prerender-translate-5-ref.html -random-if(useDrawSnapshot) test-pref(layout.animation.prerender.partial.jank,true) test-pref(layout.animation.prerender.partial,true) test-pref(layout.animation.prerender.viewport-ratio-limit,"1.125") fuzzy(0-46,0-1250) fuzzy-if(Android,0-255,0-9900) random-if(gtkWidget&&isDebugBuild) == partial-prerender-translate-6.html partial-prerender-translate-6-ref.html +skip-if(useDrawSnapshot) test-pref(layout.animation.prerender.partial.jank,true) test-pref(layout.animation.prerender.partial,true) test-pref(layout.animation.prerender.viewport-ratio-limit,"1.125") fuzzy(0-46,0-1250) fuzzy-if(Android,0-255,0-9900) random-if(gtkWidget&&isDebugBuild) random-if(useDrawSnapshot) == partial-prerender-translate-6.html partial-prerender-translate-6-ref.html test-pref(layout.animation.prerender.partial.jank,true) test-pref(layout.animation.prerender.partial,true) test-pref(layout.animation.prerender.viewport-ratio-limit,"1.125") fuzzy(0-4,0-1200) == partial-prerender-translate-7.html partial-prerender-translate-2-ref.html # This reftest doesn't fail on WebRender, this reftest fails only if there is a jank mechanism and the mechanism doesn't properly clip transform in iframes. test-pref(layout.animation.prerender.partial.jank,true) test-pref(layout.animation.prerender.partial,true) test-pref(layout.animation.prerender.viewport-ratio-limit,"1.125") == partial-prerender-translate-8.html partial-prerender-translate-8-ref.html diff --git a/testing/web-platform/meta/css/css-position/position-fixed-scroll-nested-fixed.html.ini b/testing/web-platform/meta/css/css-position/position-fixed-scroll-nested-fixed.html.ini index 69983f538a07..e96e1951e991 100644 --- a/testing/web-platform/meta/css/css-position/position-fixed-scroll-nested-fixed.html.ini +++ b/testing/web-platform/meta/css/css-position/position-fixed-scroll-nested-fixed.html.ini @@ -1,3 +1,3 @@ [position-fixed-scroll-nested-fixed.html] expected: - if os == "android": FAIL + if os == "android": [PASS, FAIL] diff --git a/testing/web-platform/meta/css/motion/offset-path-ray-contain-004.html.ini b/testing/web-platform/meta/css/motion/offset-path-ray-contain-004.html.ini new file mode 100644 index 000000000000..efd7b2deea0f --- /dev/null +++ b/testing/web-platform/meta/css/motion/offset-path-ray-contain-004.html.ini @@ -0,0 +1,3 @@ +[offset-path-ray-contain-004.html] + fuzzy: + maxDifference=0-1;totalPixels=0-50 diff --git a/testing/web-platform/meta/resize-observer/devicepixel.html.ini b/testing/web-platform/meta/resize-observer/devicepixel.html.ini new file mode 100644 index 000000000000..5d112a1c9afd --- /dev/null +++ b/testing/web-platform/meta/resize-observer/devicepixel.html.ini @@ -0,0 +1,3 @@ +[devicepixel.html] + fuzzy: + maxDifference=0-191;totalPixels=0-2188