3379 Commits

Author SHA1 Message Date
Lee Salzman
6fc4f6027b Bug 1923636 - Avoid copying paths when transforming. r=aosmond
TransformedCopyToBuilder is called any time in Canvas2D the transform
is modified and then a path op is used. On cases that repeatedly change
the transform while building paths, this leads to fairly significant
expense in repeatedly copying the path contents as well as allocating
and deallocating paths.

To work around this, a new primitive TransformedMoveToBuilder is provided
that allows in-place transforming of the path contents. Because paths that
are "finished" and referenced externally can't be safely modified, extra
static methods (i.e. ToBuilder) are added to guarantee that there are no
other refs to the path before modifying its contents.

One snag is that ArcParams could previously not handle transforms, so it
is modified to allow a transform to be supplied to an Arc op, which is
only flattened out when it is streamed to a sink.

Differential Revision: https://phabricator.services.mozilla.com/D225548
2024-10-14 22:48:45 +00:00
Jonathan Kew
81119c1956 Bug 1917742 - Share link-target escaping code between DrawTargetCairo::Link and DrawTargetCairo::Destination. r=gfx-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D224319
2024-10-03 15:37:11 +00:00
serge-sans-paille
b3b181100c Bug 1921341 - Remove global constructor from gfx/thebes/gfxSVGGlyphs.cpp r=longsonr
Differential Revision: https://phabricator.services.mozilla.com/D223866
2024-10-03 06:55:08 +00:00
Sandor Molnar
6f7a808f76 Backed out 6 changesets (bug 1921341, bug 1921268, bug 1921270, bug 1921269, bug 1921267, bug 1921276) for causing build bustages @ gfxSVGGlyphs.h CLOSED TREE
Backed out changeset 2a5d5e7e863b (bug 1921341)
Backed out changeset 86df2445ee83 (bug 1921276)
Backed out changeset bf1b223af380 (bug 1921270)
Backed out changeset 4cdbd2521712 (bug 1921269)
Backed out changeset 6bb5d64f664a (bug 1921267)
Backed out changeset 7ec43f4b07ff (bug 1921268)
2024-10-03 02:05:13 +03:00
serge-sans-paille
8d2b2709da Bug 1921341 - Remove global constructor from gfx/thebes/gfxSVGGlyphs.cpp r=longsonr
Differential Revision: https://phabricator.services.mozilla.com/D223866
2024-10-02 19:41:40 +00:00
Timothy Nikkel
b82057711a Bug 1920673. Avoid calling IsSingular on a matrix before inverting it, just try to invert it and see if it succeeds. r=gfx-reviewers,nical
This repeated work does show up in profiles.

Differential Revision: https://phabricator.services.mozilla.com/D223289
2024-10-02 11:43:25 +00:00
Butkovits Atila
c73347890d Backed out 6 changesets (bug 1921267, bug 1921270, bug 1921269, bug 1921276, bug 1921268, bug 1921341) for causing bustages at WheelHandlingHelper.cpp.
Backed out changeset d9054241c1f4 (bug 1921341)
Backed out changeset 5b4ba445b189 (bug 1921276)
Backed out changeset 6497eb64ef2a (bug 1921270)
Backed out changeset 9c39218f7372 (bug 1921269)
Backed out changeset 2d5d640c060d (bug 1921267)
Backed out changeset 7b068aede249 (bug 1921268)
2024-10-01 15:17:46 +03:00
serge-sans-paille
253ef0db38 Bug 1921341 - Remove global constructor from gfx/thebes/gfxSVGGlyphs.cpp r=longsonr
Differential Revision: https://phabricator.services.mozilla.com/D223866
2024-10-01 09:09:39 +00:00
Emilio Cobos Álvarez
fe1d67cc92 Bug 1921049 - Remove some bindgen includes. r=firefox-style-system-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D223615
2024-09-25 17:43:28 +00:00
serge-sans-paille
e09fc341b4 Bug 1919771 - Remove global constructor from gfx/2d/Blur.cpp r=emilio
This requires hard-coding the value of sqrt(2 * M_PI) as sqrt is not
constexpr.

The value has been generated through the execution of:

    #include <math.h>
    #include <stdio.h>
    int main() {
      double s = sqrt(2 * M_PI);
      printf("%a\n", s);
      return 0;
    }

Differential Revision: https://phabricator.services.mozilla.com/D222795
2024-09-23 05:09:13 +00:00
Andrew Osmond
4685d5aacf Bug 1918778 - Correct ownership/recycling issues with MacIOSurface. r=bradwerth
This patch corrects a few different issues related to recycling
MacIOSurface objects.

1) When recycling a surface, we must check that the cached surfaces
   match all of the requested parameters, not just the size. If we do
   not, we should just flush the whole cache immediately since they
   should all be created with the same parameters.

2) Allocations can fail, and we should check for failing to get a
   surface from the allocator and fall back if so.

3) Locking can fail, and we should check that return value at all of the
   call sites.

This may help resolve a number of otherwise difficult to understand
crash signatures. It may also solve display corruption issues in rare
cases where the parameters that changed were roughly equivalent such
that everything appears to work, but they differ enough to change the
presentation.

Differential Revision: https://phabricator.services.mozilla.com/D222205
2024-09-14 16:23:54 +00:00
Lee Salzman
9d82b3bbe9 Bug 1917156 - Implement RemoveAllClips for DrawTargetRecording. r=aosmond
CanvasRenderingContext2D depends on RemoveAllClips for efficient resetting,
but DrawTargetRecording did not implement this, causing fast resets to fail.

Differential Revision: https://phabricator.services.mozilla.com/D221285
2024-09-06 15:20:15 +00:00
Lee Salzman
3d4233ed3e Bug 1910815 - Inflate glyph bounds to account for potential font hinting. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D219403
2024-08-18 23:17:52 +00:00
Lee Salzman
f3426b8589 Bug 1910869 - Support preblending in DrawTargetWebgl's glyph caching. r=aosmond
Even though glyph masks are stored without any baked-in color, the blending weights
they represent are preblended so as to be gamma-aware on macOS and Windows. That means
the color requested for the glyph alters the mask itself. It is not sufficient to
store a single mask that can be used for any color, rather, there must be different
masks stored for each potential preblend ramp that is generated by Skia.

Skia uses a quantization scheme where only the high bits of the color are used to
generate the preblend ramp so as to minimize the number of tables generated, so we do
our best to mimic that scheme and avoid generating an excessive number of masks. This
allows reuse of masks for some subset of colors, albeit not every color.

However, coaxing Skia into generating preblended masks without baking in the final
rasterized color requires some subversive use of SkShader to alter the queried luminance
color without changing the actual color of an SkPaint. An alternative invasive approach
would be to modify Skia to support this via a flag in SkPaint directly, but that would
require patching Skia directly, which might be necessary in the future should SkShader
become deprecated.

Differential Revision: https://phabricator.services.mozilla.com/D219242
2024-08-15 22:50:24 +00:00
Butkovits Atila
006e623c21 Backed out changeset 0ac3aa2e9c97 (bug 1910869) for causing failures at 2d.text.draw.generic.family.w.html. CLOSED TREE 2024-08-15 21:23:02 +03:00
Lee Salzman
9c37d6e05c Bug 1910869 - Support preblending in DrawTargetWebgl's glyph caching. r=aosmond
Even though glyph masks are stored without any baked-in color, the blending weights
they represent are preblended so as to be gamma-aware on macOS and Windows. That means
the color requested for the glyph alters the mask itself. It is not sufficient to
store a single mask that can be used for any color, rather, there must be different
masks stored for each potential preblend ramp that is generated by Skia.

Skia uses a quantization scheme where only the high bits of the color are used to
generate the preblend ramp so as to minimize the number of tables generated, so we do
our best to mimic that scheme and avoid generating an excessive number of masks. This
allows reuse of masks for some subset of colors, albeit not every color.

However, coaxing Skia into generating preblended masks without baking in the final
rasterized color requires some subversive use of SkShader to alter the queried luminance
color without changing the actual color of an SkPaint. An alternative invasive approach
would be to modify Skia to support this via a flag in SkPaint directly, but that would
require patching Skia directly, which might be necessary in the future should SkShader
become deprecated.

Differential Revision: https://phabricator.services.mozilla.com/D219242
2024-08-15 13:25:00 +00:00
Timothy Nikkel
03258de701 Bug 1910492. Make ViewportUtils use Matrix4x4Flagged. r=layout-reviewers,emilio
Generally we want to move to more flagged matrices because the transforms are usually simple, just offsets, or simple 2d transforms and the operations do show up in profiles if we do them in the "dumb" way of assuming a full 3d transform.

This specific code isn't necessarily performance critical, but it simplifies nsIFrame::GetTransformMatrix (which is performance critical) so that everything there is Matrix4x4Flagged except the one conversion for GetResultingTransformMatrix.

Matrix4x4TypedFlagged::ToUnknownMatrix gets its first user with this change and we need to make some fixes so that it actually works. We need to friend all template instantiations of this class so that it can access the private constructor of the class with different units. We also need to move the MatrixType enum outside of the class so it doesn't get the templated units imprinted on its type. Maybe there is a better way to do this.

Differential Revision: https://phabricator.services.mozilla.com/D218018
2024-08-10 10:31:18 +00:00
Lee Salzman
be6f184cbb Bug 1909718 - Guard against lossy PathSkia::AsRect conversions. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D218912
2024-08-09 15:31:07 +00:00
Frédéric Wang
8956b160de Bug 1908069 - Add border/padding/margin support to MathML token elements. r=emilio
See D216670 for the general approach taken.

Differential Revision: https://phabricator.services.mozilla.com/D216855
2024-08-07 06:00:44 +00:00
Brad Werth
94fbd5e7d6 Bug 1906527 Part 3: Add YUV422P10 and NV16 formats. r=gfx-reviewers,ahale
YUV422P10 is needed to properly tag decoded YUV422P10 video. NV16 is
needed to describe the macOS 10-bit YUV422 formats.

Differential Revision: https://phabricator.services.mozilla.com/D217334
2024-08-05 17:59:15 +00:00
Brad Werth
0ac2dc146e Bug 1906527 Part 1: Rename SurfaceFormat::YUV422 to YUY2, and rename YUV to YUV420. r=jgilbert
This is just a renaming patch, motivated by a need for clarity before
addding more YUV formats. Comments and log messages are updated as well,
and one function in MacIOSurface is renamed.

There is one small change in TextureHost.cpp  to satisfy clang-tidy.

Differential Revision: https://phabricator.services.mozilla.com/D217883
2024-08-05 17:59:15 +00:00
Lee Salzman
b6671f4c3a Bug 1911019 - Use different anti-aliasing approximation for subpixel rectangles. r=aosmond
The previous attempt at refining the subpixel anti-aliasing approximation modified the
distance-to-edge tracking, which can cause the AA to approach zero too soon.

This fixes this by reverting the distance-to-edge tracking back to the way it was, but
instead limiting the alpha to the area of the subpixel rectangle if necessary.

Differential Revision: https://phabricator.services.mozilla.com/D218493
2024-08-04 17:16:32 +00:00
Lee Salzman
def60a14fa Bug 1911231 - Clip fill/clear ops to viewport when possible. r=aosmond
We can avoid falling back to Skia on certain fill/clear ops so long as
the transform produces axis-aligned rectangles. In that case, we can
do a precise clip of the transformed rect to the viewport, which can
then be accelerated without any risk of fallback.

Differential Revision: https://phabricator.services.mozilla.com/D218472
2024-08-03 18:57:01 +00:00
Iulian Moraru
7279a1df13 Backed out 7 changesets (bug 1908069) for causing wr failures on mo-lspace-rspace-4.html. CLOSED TREE
Backed out changeset d497ae104185 (bug 1908069)
Backed out changeset c87b8ca300dc (bug 1908069)
Backed out changeset 3e76c02843a7 (bug 1908069)
Backed out changeset f4c5983c700b (bug 1908069)
Backed out changeset 5468da212605 (bug 1908069)
Backed out changeset ab5ab71ddfc4 (bug 1908069)
Backed out changeset 21269d373fff (bug 1908069)
2024-08-01 19:45:36 +03:00
Frédéric Wang
50e29b7ba1 Bug 1908069 - Add border/padding/margin support to MathML token elements. r=emilio
See D216670 for the general approach taken.

Differential Revision: https://phabricator.services.mozilla.com/D216855
2024-08-01 12:58:08 +00:00
Tamas Szentpeteri
84b3fd388b Backed out 7 changesets (bug 1908069) for causing mochitest failures related to EnumSet.h. CLOSED TREE
Backed out changeset 7a9063b6e9f1 (bug 1908069)
Backed out changeset 6b8c788b3fb3 (bug 1908069)
Backed out changeset 6775a291fb83 (bug 1908069)
Backed out changeset 526b1ba8c610 (bug 1908069)
Backed out changeset e7797c083647 (bug 1908069)
Backed out changeset 2c4076a423fa (bug 1908069)
Backed out changeset 8fac35770369 (bug 1908069)
2024-07-31 18:45:21 +03:00
Frédéric Wang
801d4ad508 Bug 1908069 - Add border/padding/margin support to MathML token elements. r=emilio
See D216670 for the general approach taken.

Differential Revision: https://phabricator.services.mozilla.com/D216855
2024-07-31 14:14:29 +00:00
Kelsey Gilbert
3a3aeacc4e Bug 1909019 - Use ParamTraits_TiedFields/_IsEnumCase in WebRenderMessageUtils instead of PlainOldDataSerializer. (complete) r=gw,mccr8,ahale
Differential Revision: https://phabricator.services.mozilla.com/D217509
2024-07-26 23:51:26 +00:00
Brad Werth
e95b162d3d Bug 1905674: Create an aggregate memory reporter for SourceSurfaceRawData. r=gfx-reviewers,lsalzman
This aggregates all SourceSurfaceAlignedRawdata into a single line item
of "explicit/gfx/source-surface-aligned-raw-data". If we want to get
more granular, we just need to decide if we split by SurfaceFormat, by
size buckets, or whatever.

I've confirmed this measures the memory held by the reproduction case in
Bug 1904048, which was the motivation for this issue.

Differential Revision: https://phabricator.services.mozilla.com/D217181
2024-07-24 20:10:42 +00:00
Jonathan Kew
c59f25be3e Bug 1908587 - Backout changeset 8fe914e33e27 (bug 1892913, patch 22), so that we explicitly use a CGLayer-backed quartz surface when appropriate. r=gfx-reviewers,jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D217013
2024-07-19 07:46:19 +00:00
Sylvestre Ledru
45030f6970 Bug 1519636 - Reformat recent changes to the Google coding style r=emilio,necko-reviewers,geckoview-reviewers,application-update-reviewers,media-playback-reviewers,devtools-reviewers,anti-tracking-reviewers,profiler-reviewers,win-reviewers,migration-reviewers,padenot,mconley,nchevobbe,kershaw,gstoll,mstange,bytesized,m_kato
This new version of clang 17 also slightly changed the formatting.

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D215914
2024-07-17 11:15:31 +00:00
Lee Salzman
cf0e75ec46 Bug 1907755 - Avoid inadvertent copies when drawing a canvas to itself. r=aosmond
Even though drawing a canvas to itself tries to use ExtractSubrect to get a limited
copy where applicable, the canvas still inadvertently forces the copy-on-write snapshot
to also force a copy due to SurfaceFromElementResult holding a subversive extra reference
to the snapshot, keeping it alive when it need not be.

RecordedTextureData also holds a reference to the snapshot that needs to be cleaned up
as well when the DT is modified.

Differential Revision: https://phabricator.services.mozilla.com/D216520
2024-07-15 13:31:40 +00:00
Timothy Nikkel
efd77fbe7c Bug 1906581. In nsIFrame::GetTransformMatrix construct a Matrix4x4Flagged directly instead of converting from Matrix4x4. r=layout-reviewers,emilio
nsIFrame::GetTransformMatrix returns a Matrix4x4Flagged (a matrix with a type field signifying if it is identity, simple 2d matrix, or full 3d matrix so operations can be simplified) but we construct simple Matrix4x4 and return them, which forces us to construct a Matrix4x4Flagged and Analyze() it to determine what type it is. We should just construct a flagged matrix directly. This shows up in profiles.

GetTransformMatrix got converted from Matrix4x4 to Matrix4x4Flagged for perf reasons in the past, so that explains how we ended up in this situation.

We still use Matrix4x4 in the more complicated actually transformed case.

Differential Revision: https://phabricator.services.mozilla.com/D215867
2024-07-12 10:09:47 +00:00
Ting-Yu Lin
9ad26d34a9 Bug 1906716 - Remove MaybeIntSize that is used by only one caller. r=gfx-reviewers,bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D215947
2024-07-08 20:38:03 +00:00
Norisz Fay
783fac5174 Backed out changeset c8f96b912b44 (bug 1897783) for causing reftest failures CLOSED TREE 2024-06-23 09:35:16 +03:00
Toby
d83add5f62 Bug 1897783 - Fix incorrect rounding in software rendering of feColorMatrix. r=longsonr
This doesn't fix a similar problem in ArithmeticCombineTwoPixels because the fixes there have performance implications, appear wrong, or are wrong for common inputs.

Since hue-rotate is defined in terms of a color matrix, some tests involving hue-rotate behave slightly differently.

Differential Revision: https://phabricator.services.mozilla.com/D211113
2024-06-23 00:32:59 +00:00
Norisz Fay
ab496ea9a6 Backed out changeset 084a189b3e01 (bug 1897783) for causing reftest svg/css filters related failures 2024-06-20 20:05:39 +03:00
Toby
91a13d17d8 Bug 1897783 - Fix incorrect rounding in software rendering of feColorMatrix. r=longsonr
This doesn't fix a similar problem in ArithmeticCombineTwoPixels because the fixes there have performance implications, appear wrong, or are wrong for common inputs.

Since hue-rotate is defined in terms of a color matrix, some tests involving hue-rotate behave slightly differently.

Differential Revision: https://phabricator.services.mozilla.com/D211113
2024-06-20 11:12:44 +00:00
Bob Owen
34ad2acbb3 Bug 1901555: Remove file attribute check in GetFontFileName. r=lsalzman
With a USER_RESTRICTED access token level this requires a sync call to the
parent process via the sandbox's shared memory IPC.
This patch also caches the font file name as GetFontFileName, still requires
a number of calls into DirectWrite.

Differential Revision: https://phabricator.services.mozilla.com/D213258
2024-06-14 10:39:56 +00:00
sotaro
c7248636fd Bug 1901192 - Force uploading recycled DataSourceSurface by CanvasTranslator r=gfx-reviewers,lsalzman
As a simple workaround, use DataSourceSurfaceWrapper to force the upload of recycled DataSourceSurface.

Differential Revision: https://phabricator.services.mozilla.com/D212903
2024-06-10 17:35:43 +00:00
Jonathan Kew
b3d36fba68 Bug 1896076 - patch 2 - Support passing both a local destination name and a URI when generating a hyperlink. r=gfx-reviewers,lsalzman
To take advantage of the new cairo capability, extend the link APIs to support
passing both a local destination name and a URI from the display list to the
rendering backend.

With this change, links to parts of the document that aren't included in the
print-to-pdf output will point back to the online resource, instead of just being
dead links.

(Note that this won't work the same on macOS at present, as we don't use
the cairo pdf backend there.)

Differential Revision: https://phabricator.services.mozilla.com/D211995
2024-05-29 17:19:38 +00:00
Lee Salzman
d000b70f42 Bug 1896902 - Fix missing float header in HelpersD2D. r=aosmond
It looks like there was some header bootlegging happening that was recently
impacted by a Skia update. This adds the missing float header.

Differential Revision: https://phabricator.services.mozilla.com/D210500
2024-05-15 15:51:42 +00:00
Jonathan Kew
c6df5f3132 Bug 1896892 - Remove the double-escaping of backslashes when writing links to the cairo-pdf backend. r=gfx-reviewers,jrmuizel
This reverts part of bug 1748077, which was working around a quirk of
the cairo pdf backend. The behavior there was fixed upstream in
https://gitlab.freedesktop.org/cairo/cairo/-/issues/526, so since we've
updated to cairo-1.18.0 we no longer need this; it would in fact make
links with backslashes be recorded incorrectly.

Differential Revision: https://phabricator.services.mozilla.com/D210479
2024-05-15 13:58:13 +00:00
Lee Salzman
65c2a6379d Bug 1890216 - Fix Skia API usage in Gecko for m125 update. r=aosmond
A number of public APIs in Skia have changed since the update to m125,
so various places in Gecko need to be updated to track it.

Differential Revision: https://phabricator.services.mozilla.com/D209821
2024-05-15 01:57:52 +00:00
sotaro
2be68ff00a Bug 1879425 - Log GPU device reset to gfx Failure Log of about:support r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D209926
2024-05-14 10:50:23 +00:00
Stanca Serban
dcd1e2c3f0 Backed out changeset 1c48635919fb (bug 1879425) for causing build bustages. CLOSED TREE 2024-05-14 04:55:08 +03:00
sotaro
e18a85127f Bug 1879425 - Log GPU device reset to gfx Failure Log of about:support r=gfx-reviewers,lsalzman
Unify how to log device reset. It helps for debugging.

Differential Revision: https://phabricator.services.mozilla.com/D209926
2024-05-14 00:46:12 +00:00
Iulian Moraru
fcee835d59 Backed out 4 changesets (bug 1890216) for causing multiple new permafailures. CLOSED TREE
Backed out changeset 31ffc16da37b (bug 1890216)
Backed out changeset 9da95cf34386 (bug 1890216)
Backed out changeset 9e684b8096fc (bug 1890216)
Backed out changeset 9014c3f367eb (bug 1890216)
2024-05-10 19:01:50 +03:00
Lee Salzman
69890c6a53 Bug 1890216 - Fix Skia API usage in Gecko for m125 update. r=aosmond
A number of public APIs in Skia have changed since the update to m125,
so various places in Gecko need to be updated to track it.

Differential Revision: https://phabricator.services.mozilla.com/D209821
2024-05-10 03:49:34 +00:00
flowejam
01aa9e23fe Bug 1843950: Change BasePoint::Length() return type to avoid truncation to int. r=botond
Created a new metafunction, FloatType, which will prevent truncation of the
decimal portion of the Length method result. Added GTest unit tests, and converted
old unit tests in gfx/2d/unittest/TestPoint.cpp to gtests.

Differential Revision: https://phabricator.services.mozilla.com/D208306
2024-05-09 00:02:55 +00:00