14 ms·
WebKit switching to Skia for 2d graphics rendering
- valleyer 3y ago"WebKit Switching to Skia for 2D Graphics Rendering" ... for the GTK and WPE ports. Not on Apple platforms.
- 01HNNWZ0MV43FF 3y agoOh. I thought all web browsers were on Skia now. I guess the Apple platform is CoreGraphics and GTK was Cairo? (Edit: Read the article. Yes)
- tuankiet65 3y agoWebKit on Apple platforms uses Core Graphics and Core Animation, yes.
- the_common_man 3y agooh, title buried the lede there
- DANmode 3y agoBrutal.
- ho_schi 3y agoI think this are good news for WebKitGtk. I wondered about the license because they had already problems with LibWebTRC which uses BoringSSL (BSD-License). Skia seems to use the new BSD-License without the advertising clause and is therefore compatible with the GPL. PS: As valleyer mentions - this affects WebKitGtk not all WebKit ports? At least Skia is usable on MacOS/iOS.
- sph 3y agoFor others that didn't know about this advertising clause: https://www.gnu.org/licenses/bsd.html https://www.gnu.org/licenses/bsd.html
- thrwwycbr 3y agoI think they try to unify their rendering workflow, just like chromium did when they forked off blink and switched to skia. In WebKit, however, that implies that they refactor the Bridge API that is used in between contexts and processes which was an internal API before and broke away often. So I'd guess they start to do incremental changes on the Web API implementations first before they break too much anywhere else (e.g. sidebars, UIs, widgets, devtools are rendered differently but rely on the very same Bridge API)
- DennisAleynikov 3y agoAwesome! Glad to see skia is finding uses in places other than fuschia
- paraboul 3y agoWell, it powers web rendering in Chrome
- pavlov 3y agoAnd Android graphics...
- mort96 3y agoAnd Canvas in Firefox...
- refulgentis 3y agoAnd Flutter on Canvas
- jdthedisciple 3y agoAnd some rendering libraries in .NET
- ceronman 3y agoAnd the new UI framework for Jetbrains Fleet. And the new UI framework for Clojure Humble UI
- Doctor_Fegg 3y agoAll right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
- andsoitis 3y ago> but none of them met all our requirements, so we decided to try writing our own library. Question requirements. You can always find a reason to build rather than buy, but can you reframe your requirements in such a way that you can get away with something off the shelf and then rather spend your resources on the things that you can do uniquely different for your application.
- mort96 3y agoI mean I really don't know what library they could've tried other than Skia that's suitable to build a GPU renderer for Canvas's API, and they explain why they were hesitant to try Skia. Do you have any suggestions?
- marwis 3y agoMozilla's WebRender. It's actually a better option by their own criteria because it's developed as a standalone reusable library.
- deleted 3y ago[deleted]
- mort96 3y agoOh I read the article with the assumption that this was 2D canvas rendering, but upon re-reading it I see that it's probably about normal web content. WebRender would've been a terrible fit for Canvas, but it would certainly make sense if this is about rendering normal web content.
- thrwwycbr 3y agoMaybe try to build your own Browser and try to keep up with upstream that has daily changes in the hundreds of commits...and then realize how elitarian that answer was? They are a software product fork used by billions, with a team that doesn't get paid to develop on it, with not enough funding to just "buy" a battle tested library which has zero problems; because any bug would literally potentially break the web for years.
- tapirl 3y agoSo will they maintain a stable C API to skia? It is long-time known pain point that the skia official doesn't provide a usable C API.
- mort96 3y agoWhy would they? The API they (WebKit) are providing is the Canvas API, the fact that they're using Skia behind the scenes is an implementation detail... I don't see why they would go through the trouble of maintaining a stable C API for internal use in a C++ project?
- cylemons 3y agoMaybe so they could use newer versions of skia
- mort96 3y agoThis assumes that maintaining a stable C interface to Skia, and then writing the WebKit rendering code against that C interface, is easier than maintaining WebKit rendering code which calls Skia's C++ interface directly. I'm not convinced that that's the case. At the very least, the stable interface should probably be C++, mapping between C and C++ is often non-trivial...
- londons_explore 3y agoOne way to keep a stable API is to pin the version used... And let's be honest, the external API doesn't change awfully fast anyway. A totally dead project would fall behind, but even a tiny amount of work would be able to keep up.
- feverzsj 3y agoI think only Microsoft maintains a stable C API for their SkiaSharp. Skia only cares about google projects. I don't even know why they bother to opensource it.
- 3y ago
- vthommeret 3y agoI was curious how Igalia was funded and this was a surprisingly good interview on how they’re structured, how they work with the major browser companies, etc… Apparently many Apple, Google, Firefox engineers left to work for them. https://thenewstack.io/igalia-the-open-source-powerhouse-youve-never-heard-of/ https://thenewstack.io/igalia-the-open-source-powerhouse-you...
- infogulch 3y agoIgalia is also working on Servo. https://news.ycombinator.com/item?id=37430579 https://news.ycombinator.com/item?id=37430579
- spaniard89277 3y agoIt's in my city. Their offices are just a small flat in in a pretty bland neighborhood. I guess most of them work remote.
- TingPing 3y ago82% remote :) (Not counting those that live in the city but are still WFH)
- thrdbndndn 3y agoThanks for the article, I never heard of them. Since they are apparently "powerful" enough to decide major direction of WebKit development as evidenced by OP's article, what exactly is their relationship with Apple in this regard? Like who has the final say and who do the day-to-day decisions? I'm always curious about the politics and power structure/dynamics of these major open source projects, especially the ones backed up by large companies.
- TingPing 3y agoTo be clear WebKit is made up of multiple ports. These ports are maintained by their own groups and Igalia maintains WebKitGTK/WPE where this change is happening. It does not affect the Apple ports of WebKit. To answer your question though. WebKit is Apple's project and they do the majority of contributions. Igalia is the second largest contributor and collaborates with Apple regularly. Within the GTK/WPE ports Igalia controls them.
- zerr 3y agoDidn't Flutter ditch Skia recently due to performance reasons?
- canucker2016 3y agoYes, from 2023 Jul 21 blog entry, https://medium.com/@wartelski/impeller-rendering-engine-is-it-good-enough-for-flutter-ff2677714343 https://medium.com/@wartelski/impeller-rendering-engine-is-i... : "Impeller is a new Flutter rendering engine that the Flutter team claims solves the early-onset jank problem. It is designed as a replacement for Skia, with the goal of enabling better animations and addressing the jank issue, while also potentially providing support for 3D, which was not previously possible with Skia, as it exclusively supports 2D. Unlike Skia, Impeller compiles shaders during the build process instead of at runtime. In Flutter 3.10, Impeller replaces Skia engine and becomes the primary rendering engine on iOS."
- charcircuit 3y ago>Unlike Skia, Impeller compiles shaders during the build process instead of at runtime. This wouldn't work on most platforms as graphic driver updates can break compatibility with previously compiled shaders.
- jsheard 3y agoThere's often multiple compilation steps, first compiling some application specific representation down to HLSL/GLSL/MSL source code, then compiling that down to DXIL/SPIRV/Metal bytecode, and then handing that off to the driver for compilation to native code. The first two steps at least can be done ahead of time, the bytecode is stable. Metal and CUDA actually let you AOT compile native binaries since they have relatively few hardware targets to support, with a fallback to compiling bytecode to native at runtime for forwards compatibility.
- incrudible 3y agoThe bytecode compilation doesn't really matter, it's still gonna jank. Maybe not as badly, but it will. The only way to get rid of jank is to cache not the bytecode and not even the native code, but the PSOs. Realistically, that is only possible on the target machine, unless you have a ginormous farm of machines representing all the permutations of hardware and drivers. That's basically what Steam does with its mass of users. The alternative is to just not have that many shader permutations, and potentially take a performance hit from that. This seems to be the strategy that Impeller is following.
- max_ 3y agoHi guys, I have a question. What is the 3D equivalent to Skia?
- rice7th 3y agoI guess there's no such thing. It's probably going to be raw opengl or something; 3D graphics is A LOT more complex than 2d graphics
- longor1996 3y agobgfx and The-Forge come to mind: https://github.com/bkaradzic/bgfx https://github.com/bkaradzic/bgfx https://github.com/ConfettiFX/The-Forge https://github.com/ConfettiFX/The-Forge
- figomore 3y agoQt3D from Qt.
- krona 3y agoCould someone who knows Skia internals describe, if possible, the tradeoffs that Skia has made between performance, rendering quality and API DX? Presumably this is partly why it has become so popular, but as someone who's been writing mostly 2D GL/WebGPU apps for a decade I've only briefly considered a Skia as an alternative, but this is mostly out of ignorance.
- londons_explore 3y agoI've only briefly looked at skia internals.... And it's awfully complex! But the external API is fairly simple. Basically you queue up various drawing commands and at the last minute tell it to execute the queued commands somewhere. The queue is 'optimized' - for example if you tell it to draw some text and later crop the text out of the image, then no CPU/GPU time will be spent drawing text that won't be visible in the output. You can also draw text small and scale it up later without getting jagged edges as you would if you'd scaled up a raster image. That ability lets you make tile based renderers, where you queue up all the commands for say a whole webpage, but then draw only a small square of the page like a map tile, and as the user scrolls/pans, you can draw more tiles as needed.
- coffeeaddict1 3y agoSkia is a great library, but as all things Google it's a pain to build. They don't use CMake and building it from source takes 20-30 minutes on a modern laptop. Furthermore, it's constantly changing its APIs and much of it is undocumented and unclear on how to use optimally. Most of the decisions taken by development team aren't discussed in the open and this makes it hard to understand the codebase. I wish there was a nice and small vector graphics library with GPU acceleration. So far Skia is the only real option, despite its downsides.
- deleted 3y ago[deleted]
- danpalmer 3y agoOut of interest what's difficult about it to build? In my experience CMake isn't exactly a great developer experience, and many projects of this size take similar times to build. Is the problem specific to Skia or Google open source projects, or is it more based on the (necessary) size of the project?
- pcwalton 3y agoThe difficult parts change all the time and usually boil down to some sort of undocumented or poorly-documented dependency, especially if you're trying to enable the GPU backends. Every time someone I know tries to get it building it takes them a week to figure out how to do it.
- Lutger 3y agoI used to do that when I started out with C/C++...15 years ago. Now my patience is running out after 10 minutes. Tooling has become so much better, but it seems not that much with some C/C++ projects. At least the build times are better, I remember big libs would could take hours to build.
- ho_schi 3y agoMeson and ninja improved a lot in this area for C/C++.
- londons_explore 3y agoBlink, Chromiums rendering engine, based on WebKit, already uses skia right? Why not just import all that code?
- jsheard 3y agoBlink split from WebKit a decade ago, I doubt they still have enough in common for it to be worth merging features.
- jwells89 3y agoParticularly with Blink being entirely reliant on Chromium for multiprocess, whereas WebKit handles multiprocess itself. This was actually one of the issues that spurred Blink’s forking and entails significantly different architectures.
- a1o 3y agoUhm, I am a bit sad that bringing Cairo up to speed isn't easier, as Cairo is an easier to use dependency than Skia. I always find building these complex stuff from Google a huge pain - and now they have the additional idea of living on the head and not providing actual releases too...
- Sytten 3y agoI wish WebKit GTK was more performant in general (and also in the MDN compatibility list but its another topic). It is getting better but it really is a blocker on shipping quality application with Tauri on Linux. There is a reason most apps using native webviews only target macos and windows, WebKit GfK is mostly undocumented for frontend engineers and often very much outdated / not installed on end user machines.
- TingPing 3y agoThe performance improvements of WebKitGTK aren't small, in my personal benchmarks on like MotionMark, performance has doubled in recent years and that is before Skia.
- Wowfunhappy 3y ago> I wish WebKit was [...] in the MDN compatibility list Are the capabilities substantially different from Apple webkit?
- TingPing 3y agoThe majority of web features are the same, though some do require some platform specific work. There are a few big differences like WebRTC support isn't in WebKitGTK releases.
- Wowfunhappy 3y ago> There are a few big differences like WebRTC support isn't in WebKitGTK releases. Ah, thanks—I can see how that's the kind of thing you would want to see in a compatibility table!
- prosody 3y agoAdding to this wishlist, if it were available on Windows then it would be an option for a cross-platform webview widget, but it hasn’t supported it for a while now.
- deleted 3y ago[deleted]
- prosody 3y agoSomewhat connected question, what is WPE? It’s something that got abstracted out of WebkitGTK, right? Is it a standalone port itself, or is it more like the framework to build a highly specialized one? I’ve seen at least in past versions that libwpe is an optional dependency of WebkitGTK, so they didn’t like abstract and then rebase it on the new component. Or is libwpe separate from WPE?
- JoelEinbinder 3y agoIt's been a few years since I was looking into it, so this might be out of date. But WPE is targeted at kiosks and places you might want to display web content but not have a full web browser. Igalia can sell consulting services to these companies, as opposed to webkitgtk which has a small number of non-paying users. So WPE serves as a place for more active development of webkit-on-linux while not breaking webkitgtk which powers the web browser "Web" on gnome. Things from WPE tend to slowly make it into the webkitgtk build eventually. It's all maintained by the same people. Looking at https://webkit.org/wpe/ https://webkit.org/wpe/, the first design goal is the one that justifies WPE vs other webkit ports: "To provide a no-frills, straight to the point, web runtime for embedded devices." The other goals, like standards compliant and hardware acceleration, are there to differentiate WPE from non-webkit and ancient-webkit browser engines that people might use on embedded devices.
- TingPing 3y agoYou could describe WPE as WebKitGTK but you bring your own GTK. GTK is sometimes inappropriate for embedded devices that have a unique display stack. Using WPE brings in minimal dependencies and can render to anything you desire. libwpe is just used for some basic code sharing between the two, GTK is not based on WPE.
- leetrout 3y agoCouple things I've seen in this space looking around the past couple weeks... Flutter made a different engine called Impeller[0] which is replacing Skia. Which is a bit surprising as an ignorant outsider. I hope that works out. Rive (https://rive.app https://rive.app), is a new animation tool that targets multiple platforms including web and their CEO Guido Rosso gave a great interview on School of Motion[1] about how they are building an animation first vector engine. There is a side by side demo at 46:56[2] of Skia, Impeller and Rive. 0: https://docs.flutter.dev/perf/impeller https://docs.flutter.dev/perf/impeller 1: https://www.youtube.com/watch?v=U0Jd5-eStu4&t=2514s https://www.youtube.com/watch?v=U0Jd5-eStu4&t=2514s 2: https://youtu.be/U0Jd5-eStu4?si=8vv3c2bw3VumLzeu&t=2816 https://youtu.be/U0Jd5-eStu4?si=8vv3c2bw3VumLzeu&t=2816
- tadfisher 3y agoThere's also the GTK Scene Graph Kit[0], which just added GPU-accelerated path drawing and is shaping up to be a decent Cairo replacement. 0: https://docs.gtk.org/gsk4/ https://docs.gtk.org/gsk4/
- mardifoufs 3y agoCompletely ignorant question: what's the issue with Cairo? I know it has had a hard time getting maintained but is there any article or blog talking about how it works or how it doesn't work? I've never used it directly but I'm super curious to know more !
- wffurr 3y agoThe op talks a bit about the limitations of Cairo.
- __s 3y ago> There was an attempt at making Cairo support GPU rendering, which did not work particularly well due to the library being designed around stateful operation based upon the PostScript model—resulting in a convenient and familiar API, great output quality, but hard to retarget and with some particularly slow corner cases. Meanwhile, other web engines have moved more work to the GPU, including 2D rendering, where many operations are considerably faster.
- mrpippy 3y agoThe title should probably be "WebKit *on non-Apple platforms* switching to Skia..."
- vfclists 3y agoFFS why are the fonts so small? Why do I have to increase the font size 150% to read it comfortably? How can we trust a browser created by developers who seem incapable of creating readable web pages? They should be capable of dogfooding their own output on the most basic level.
- unleaded 3y agoyou know what website you're writing this on?
- maattdd 3y agoThe title of the article has changed to make it clearer than it only concerns the GTK and WPE ports. "WebKitGTK and WPEWebKit Switching to Skia for 2D Graphics Rendering" Can we update the title here also?
- rezmason 3y agoI really like how much utility we've all managed to get from Cairo. It is everywhere. https://en.wikipedia.org/wiki/Cairo_(graphics)#Notable_usage https://en.wikipedia.org/wiki/Cairo_(graphics)#Notable_usage I don't know the full story behind it, but from an outsider's point of view, any open library that pulls that kind of weight for so long should be considered a major feat of engineering.
- miohtama 3y agoI thought always that Safari was the fastest to render web pages on Mac/iOS. But sounds like I was wrong? > In December 2023 we made the decision of giving Skia a try internally and see if it would be worth the effort of maintaining the project as a third party module inside WebKit. In just one month we had implemented enough features to be able to run all MotionMark tests. The results in the desktop were quite impressive, getting double the score of MotionMark global result. We still had to do more tests in embedded devices which are the actual target of WPE, but it was clear that, at least in the desktop, with this very initial implementation that was not even optimized (we kept our current architecture that is optimized for CPU rendering) we got much better results.
- TheTon 3y agoThis post seems to be just about the GTK port of WebKit. So they’re comparing Skia vs Cairo on Linux. There’s no mention of Skia vs CoreGraphics for macOS. It doesn’t sound like that is something that is being considered.
- pipeline_peak 3y ago> Safari adopts Google library And so it begins...
- ComputerGuru 3y agoNothing to do with Safari.
- pipeline_peak 3y agoTrue, but how does this draw any concern away from Google having a major control in browser usershare?
- simscitizen 3y agoWho simplified the title here? This is only for the GTK and WPE ports of WebKit. Not for other platforms that WebKit supports.
- jessevdk 3y agoThe title was changed I think after I submitted it. I don’t have the karma to update it though.
- Jarred 3y agoIs this for all of WebKit or the non-Cocoa/Apple builds? It reads like WebKit on Mac (Safari) will not be impacted by this change
- mortallywounded 3y agoI had to build Skia once in order to build Aseprite from source... I gave up and bought Aseprite instead.
- hermet 3y agoPlease have a look at this one: https://github.com/thorvg/thorvg https://github.com/thorvg/thorvg. ThorVG is portable and super lightweight, and it's currently undergoing development with WebGPU.
- caycep 3y agowould this be for just linux, or for MacOS too? I assume Safari uses Apple's own built in stack
- musicale 3y agoIf Apple adopts Skia in its own versions of WebKit, then Quickdraw GX's grandchild will have come home: [1] https://en.wikipedia.org/wiki/QuickDraw_GX https://en.wikipedia.org/wiki/QuickDraw_GX [2] https://en.wikipedia.org/wiki/Skia_Graphics_Engine https://en.wikipedia.org/wiki/Skia_Graphics_Engine