[webkit-dev] Replacing Cairo in WebKit with Skia

Carlos Garcia Campos cgarcia at igalia.com
Fri Feb 2 06:49:00 PST 2024

Hi WebKittens,

At Igalia we have spent some time exploring different options to
replace the Cairo 2D rendering library in the GTK and WPE ports (we
even tried rolling our own library). Recently we decided to try Skia
and we have successfully integrated it in the WPE port. Right now we
can compile WebKit with Skia linked statically, as part of the CMake
build, and run a number benchmarks. This has allowed us to compare the
Skia GPU and CPU renderers with the existing Cairo one in different

The results are very promising: benchmarks are faster than Cairo's CPU
rendering, specially with Skia's GPU renderer. The improvement varies
for each device, but in any case it is already clear that the change is
a net positive on every configuration we have tested. Additionally, the
integration in the build system is well isolated: importing Skia under
Source/ThirdParty there is no need for any additional dependencies,
patching Skia has not been needed, and the changes in WebKit are
limited to code from the WPE port.

After talking to teams from Google, Sony, Apple and RedHat during this
week, everyone thinks using Skia will be a great improvement for the
GTK, WPE, PlayStation and WinCairo ports. Therefore, we would like to
start upstreaming what we have to the WebKit repository and continue
the work there.

Points we need to consider:

    - Skia is licensed under the BSD 3-Clause “New” license, which
should be compatible with WebKit's.

    - The Skia source tree would add about 170MiB to the repository
under Source/ThirdParty. For the sake of comparison, libwebrtc weighs
367MiB and ANGLE 73MiB.

    - We plan to update Skia frequently following Google's
recommendation. We have already agreed with the Skia maintainers to
stay in contact and will explore integrating an automated system to
test updates. We have also discussed Skia's security policy with
Google, and we will have a procedure in place to incorporate security
fixes, the latest when we start making releases using Skia.

    - We cannot promise a timeline at the moment but expect refactors
in the GTK and WPE ports after the initial integration. We have big
plans for rearchitecting the rendering pipeline to better take
advantage of GPUs, and we hope we can get rid of some complex code
while at it.

Please let us know if you have any questions, we plan to do this job
sooner rather than later if there are no objections. We are very
excited about this move since we really think it will be a great step
ahead for the non Apple ports of WebKit, allowing the project to grow
even bigger and stronger.

Best regards,

- The Igalia team

Carlos Garcia Campos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 224 bytes
Desc: This is a digitally signed message part
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20240202/1cc09859/attachment.bin>

More information about the webkit-dev mailing list