summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-10-30 14:29:54 +0100
committerMoonchild <moonchild@palemoon.org>2023-11-01 10:31:18 +0100
commit5c9a1efa7c5eac311422ecedd06f52f7740c9dd4 (patch)
treef0e59c1d6035c44c049c2f5158cb871293f8a717
parent93ddeb613ece2af0e77c295b617c90553d15def2 (diff)
downloaduxp-5c9a1efa7c5eac311422ecedd06f52f7740c9dd4.tar.gz
Issue #2364 - Only use HWA AlphaBoxBlur when targets are large enough.
There's considerable cost associated with creating HWA draw targets which would negate and regress the performance won by it if used for too small targets (like small spans of text). This only uses HWA if >= 8K SurfaceAllocationSize to balance HWA draw target cost with box blur cost.
-rw-r--r--gfx/thebes/gfxBlur.cpp5
-rw-r--r--layout/reftests/box-shadow/reftest.list2
2 files changed, 6 insertions, 1 deletions
diff --git a/gfx/thebes/gfxBlur.cpp b/gfx/thebes/gfxBlur.cpp
index 77003d3f9a..63e261a9ec 100644
--- a/gfx/thebes/gfxBlur.cpp
+++ b/gfx/thebes/gfxBlur.cpp
@@ -75,7 +75,12 @@ gfxAlphaBoxBlur::InitDrawTarget(const DrawTarget* aReferenceDT,
// Check if the backend has an accelerated DrawSurfaceWithShadow.
// Currently, only D2D1.1 supports this.
// Otherwise, DrawSurfaceWithShadow only supports square blurs without spread.
+ // When blurring small draw targets such as short spans of text, the cost of
+ // creating and flushing an accelerated draw target exceeds the gains from
+ // the faster HWA blur, so we also make sure the blurred data exceeds
+ // a sufficient number of pixels before HWA kicks in to offset this cost.
if (aBlurRadius.IsSquare() && aSpreadRadius.IsEmpty() &&
+ blurDataSize >= 8192 &&
backend == BackendType::DIRECT2D1_1) {
mAccelerated = true;
mDrawTarget =
diff --git a/layout/reftests/box-shadow/reftest.list b/layout/reftests/box-shadow/reftest.list
index 0c3bb1d38a..a195dcf430 100644
--- a/layout/reftests/box-shadow/reftest.list
+++ b/layout/reftests/box-shadow/reftest.list
@@ -26,7 +26,7 @@ fuzzy-if(OSX==1010,1,24) fuzzy-if(d2d,16,908) == boxshadow-large-border-radius.h
fuzzy(3,500) fuzzy-if(d2d,2,1080) == boxshadow-border-radius-int.html boxshadow-border-radius-int-ref.html
== boxshadow-inset-neg-spread.html about:blank
== boxshadow-inset-neg-spread2.html boxshadow-inset-neg-spread2-ref.html
-fuzzy(26,3610) == boxshadow-rotated.html boxshadow-rotated-ref.html # Bug 1211264
+fuzzy(26,3610) fuzzy-if(d2d,26,5910) == boxshadow-rotated.html boxshadow-rotated-ref.html # Bug 1211264
== boxshadow-inset-large-border-radius.html boxshadow-inset-large-border-radius-ref.html
# fuzzy due to blur going inside, but as long as it's essentially black instead of a light gray its ok.