<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<feed xmlns="http://www.w3.org/2005/Atom">

	<title>Planet Igalia</title>
	<!--<link rel="self" type="text/atom" href=""/>-->
	<link rel="alternate" type="text/html" href="https://planet.igalia.com/"/>
	<id>https://planet.igalia.com//atom.xml</id>
	<updated>2026-11-10T14:00:35+00:00</updated>
	<generator uri="http://www.planetplanet.org/">Planet/2.0 +http://www.planetplanet.org</generator>
	 <link href="https://planet.igalia.com//atom.xml" rel="self" type="application/atom+xml" />

	<entry>
		<title>Ricardo Garc&#237;a: XDC 2026 CTS Talk</title>
		<link rel="alternate" type="text/html" href="https://rg3.name/202611091721.html"/>
		<id>https://rg3.name/202611091721.html</id>
		<updated>2026-11-09T17:21:00+00:00</updated>
		<content type="html">
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;At the end of September I attended &lt;a href=&quot;https://indico.freedesktop.org/event/12/&quot;&gt;XDC 2026&lt;/a&gt; in Toronto, where I gave a &lt;a href=&quot;https://indico.freedesktop.org/event/12/contributions/548/&quot;&gt;lightning talk&lt;/a&gt; about a memory usage problem we recently solved in Vulkan CTS.
It was a lot of fun to meet again in person the people I work with every day, including many &lt;a href=&quot;https://www.igalia.com/&quot;&gt;Igalia&lt;/a&gt; colleagues once more.
I also enjoyed Toronto very much, and I had the chance to go up the CN Tower and enjoy the impressive views of the city from there.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;You can find the recording of the talk below, followed by the slides and a transcription for those more inclined to read than to watch a video.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;sect3&quot;&gt;
&lt;h4 id=&quot;_xdc_2026_recording&quot;&gt;XDC 2026 Recording&lt;/h4&gt;
&lt;div class=&quot;youtube&quot;&gt;
html, body { height: 100%; margin: 0; overflow: hidden; background: #000; } a { position: absolute; inset: 0; } a:focus-visible { outline: 4px solid #fff; outline-offset: -4px; } img { position: absolute; width: 100%; top: 0; bottom: 0; margin: auto; opacity: .25; } span { position: absolute; inset: 0; height: 1.5em; margin: auto; text-align: center; font: 500% sans-serif; color: #fff; }&lt;a href=&quot;https://www.youtube-nocookie.com/embed/KnFUUSFhlec?autoplay=1&quot;&gt;&lt;img src=&quot;https://rg3.name/img/youtube/KnFUUSFhlec.jpg&quot; alt=&quot;Play video: Vulkan CTS uses too much system memory? No problem&quot; /&gt;&lt;span&gt;&amp;#x25b6;&lt;/span&gt;&lt;/a&gt;&quot;&gt;
&lt;p class=&quot;youtube-link&quot;&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=KnFUUSFhlec&quot;&gt;Watch on YouTube: Vulkan CTS uses too much system memory? No problem&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sect3&quot;&gt;
&lt;h4 id=&quot;_talk_slides_and_transcription&quot;&gt;Talk slides and transcription&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2026/slide-01.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2026/slide-01-tn.png&quot; alt=&quot;Title Slide: Vulkan CTS uses too much system memory? No problem&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;Hello, I&#8217;m Ricardo from Igalia and I&#8217;m going to talk about a memory usage problem that we recently fixed in Vulkan CTS and what we learned while fixing it.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2026/slide-02.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2026/slide-02-tn.png&quot; alt=&quot;Slide 2: The Problem&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;The situation was that the amount of memory needed by deqp-vk, the main Vulkan CTS binary, had been increasing along the years and it got to a point where it was starting to cause issues for CI systems.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;I used Valgrind to measure the amount of memory that was used by the process and found out that the peak amount used, in my system, was around 900 MB. I analyzed the situation and, after doing some changes, I was able to decrease that number to around 300 MB on the same system.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;How did we reach the initial situation and how did we solve it? That&#8217;s what I wanted to explain today. It&#8217;s actually very simple and we can apply the same change to more cases to improve the situation even more. In fact, I have a change under review that will bring the number down to 200 MB.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2026/slide-03.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2026/slide-03-tn.png&quot; alt=&quot;Slide 3: dEQP-VK.api.smoke.triangle&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;First, a bit of context.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;CTS organizes tests in a tree. When we mention a test like dEQP-VK.api.smoke.triangle, the dots here separate the steps in the path from the root node, called &#8220;dEQP-VK&#8221;, to the test case, called &#8220;triangle&#8221;. Internally, &#8220;dEQP-VK&#8221;, &#8220;api&#8221; and &#8220;smoke&#8221; are objects of a &#8220;test group&#8221; class, while &#8220;triangle&#8221;, the leaf node in the tree that you can see colored green here, is an object of type &#8220;test case&#8221;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;videoblock&quot;&gt;
&lt;div class=&quot;content&quot;&gt;
&lt;video src=&quot;https://rg3.name/img/xdc-2026/slide-04.mp4&quot; width=&quot;600&quot; height=&quot;338&quot; poster=&quot;https://rg3.name/img/xdc-2026/slide-04-tn.png&quot; controls=&quot;controls&quot;&gt;
&lt;a href=&quot;https://rg3.name/img/xdc-2026/slide-04.mp4&quot;&gt;Download the video: Slide 4: Test Instances?&lt;/a&gt;
&lt;/video&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;When a test case is run, it creates a sub-object called the &#8220;test instance&#8221; to run the actual test. Test instances are the ones allocating buffers, images, creating pipelines, etc, and doing most work, so it&#8217;s natural to take a look at them first to see if some of them are problematic. However, it&#8217;s more or less obvious, reading the CTS source code, that test instances have a very short lifespan. They destroy resources immediately and, because deqp-vk is single-threaded, we only have one instance alive at any given moment.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;During the analysis, I immediately saw test instances were not the main issue, despite being the prime suspects, and Valgrind confirmed that most of the allocated memory was being used by test cases, not instances.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;videoblock&quot;&gt;
&lt;div class=&quot;content&quot;&gt;
&lt;video src=&quot;https://rg3.name/img/xdc-2026/slide-05.mp4&quot; width=&quot;600&quot; height=&quot;338&quot; poster=&quot;https://rg3.name/img/xdc-2026/slide-05-tn.png&quot; controls=&quot;controls&quot;&gt;
&lt;a href=&quot;https://rg3.name/img/xdc-2026/slide-05.mp4&quot;&gt;Download the video: Slide 5: Direct Hierarchy Creation&lt;/a&gt;
&lt;/video&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;This was interesting because the lifetime of test cases and groups is not so clear at all when reading the source code. In fact, some pieces of code in CTS may lead you to believe most of the hierarchy of test cases and groups is created first and kept alive for a long time, but what I discovered while taking a close look is that that&#8217;s not exactly true. What&#8217;s true is that many pieces of code in CTS create large portions of the tree in a single step, including hundreds or thousands of test case objects that can be quite large.
This is represented in the slide here. When the main subgroup is created, the whole subtree is immediately created with it. If the test cases are large, the program uses a lot of memory.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;videoblock&quot;&gt;
&lt;div class=&quot;content&quot;&gt;
&lt;video src=&quot;https://rg3.name/img/xdc-2026/slide-06.mp4&quot; width=&quot;600&quot; height=&quot;338&quot; poster=&quot;https://rg3.name/img/xdc-2026/slide-06-tn.png&quot; controls=&quot;controls&quot;&gt;
&lt;a href=&quot;https://rg3.name/img/xdc-2026/slide-06.mp4&quot;&gt;Download the video: Slide 6: Delayed Creation&lt;/a&gt;
&lt;/video&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;When I saw a lot of allocations belonged to test cases, my first reaction was analyzing why those test cases were so large and how to make them smaller, but it turned out I was missing the forest for the trees.
Taking a couple of steps back, I noticed CTS has an internal mechanism that allows us to avoid creating child nodes in the tree until the moment we enter the parent node to do something with it, and the same mechanism deletes those child nodes once we&#8217;re done. In other words, this mechanism allows us to keep in memory only the portion of the tree that we&#8217;re really working with at a given moment.
The main problem is that this mechanism is not always used and, because this is not obvious, not documented in the source, not used in many many cases and it normally does not create a huge problem, some CTS developers, including myself, may not even know it exists or, if they know, they may not realize how it really works and plays a major role in the amount of memory used by the process.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2026/slide-07.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2026/slide-07-tn.png&quot; alt=&quot;Slide 7: Conclusion&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;When we use that mechanism properly and we divide cases in small groups, we&#8217;re able to have only a few test cases alive at the same time in memory, and we could reduce peak memory needs by a large amount, even if the test cases are large. Converting some groups to this mechanism is what allowed us to go from 900MBs to 300MBs.
Of course, in the long term we need to analyze why those test cases are so large and how they can be redesigned to be smaller, but that can be difficult. In contrast, changing the way test cases are created to take advantage of this is usually not hard and the mechanism is a very powerful tool to attack the memory usage problem.
The main conclusion is that there&#8217;s no excuse for deqp-vk to need a lot of memory, except maybe to run a particular test for a very short amount of time.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2026/slide-08.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2026/slide-08-tn.png&quot; alt=&quot;Slide 8: Thanks! rgarcia@igalia.com&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;If you have issues related to this, please reach out. Thank you!&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sect3&quot;&gt;
&lt;h4 id=&quot;_hallway_comments&quot;&gt;Hallway comments&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;Since it was a lightning talk, there was no Q&amp;amp;A section, but I got a few comments in the hallway after the talk.
The summary is that the changes we made to use delayed creation for some of the affected tests also make tree traversal faster when you only select some tests, or even a single one.
The reason is that deqp-vk is smart enough to check, before expanding a group, if the partial test name so far matches any of the given globs, and it does not expand the group if it doesn&amp;#8217;t.
With delayed creation, the subtrees of groups that are not expanded are never created, so we avoid paying the cost of creating the whole hierarchy and the selected tests start running earlier.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Ricardo Garc&#237;a</name>
			<uri>https://rg3.name</uri>
		</author>
	</entry>

	<entry>
		<title>Mauricio Faria de Oliveira: page_owner Part 3: filtering (and optimizing!) output</title>
		<link rel="alternate" type="text/html" href="https://mfo.dev.br/posts/2026-11-09-page_owner-part-3-filtering-and-optimizing-output/"/>
		<id>https://mfo.dev.br/posts/2026-11-09-page_owner-part-3-filtering-and-optimizing-output/</id>
		<updated>2026-11-09T00:00:00+00:00</updated>
		<content type="html">
&lt;p&gt;This blog post is &lt;a href=&quot;https://mfo.dev.br/tags/page_owner/&quot;&gt;part of a series&lt;/a&gt; about the &lt;code&gt;page_owner&lt;/code&gt; debug feature in the Linux memory management subsystem, related to the talk &lt;a href=&quot;https://www.youtube.com/live/Uq6HAXrwA_Q?t=28077s&quot;&gt;&lt;em&gt;Linux page_owner: memory profiling at page granularity with stack traces&lt;/em&gt;&lt;/a&gt; presented at &lt;a href=&quot;https://mfo.dev.br/posts/2026-09-02-fosforums-2026-talking-about-page_owner/&quot;&gt;FOSForums 2026&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://mfo.dev.br/posts/2026-02-23-page_owner-part-1-quick-introduction/&quot;&gt;Part 1&lt;/a&gt; is a quick introduction to &lt;code&gt;page_owner&lt;/code&gt; and its debugfs files.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://mfo.dev.br/posts/2026-02-23-page_owner-part-2-optimizing-output/&quot;&gt;Part 2&lt;/a&gt; describes challenges with processing &lt;code&gt;page_owner&lt;/code&gt; files over time and a solution with new debugfs files in Linux v6.19.&lt;/li&gt;
&lt;li&gt;Part 3 describes the filtering features for &lt;code&gt;page_owner&lt;/code&gt; in Linux 7.3.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&quot;filtering-features&quot;&gt;
 &lt;a class=&quot;header-link&quot; href=&quot;https://mfo.dev.br/tags/igalia/index.xml#filtering-features&quot;&gt;
 Filtering features
 &lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Linux 7.3 added &lt;em&gt;filtering features&lt;/em&gt; to &lt;code&gt;page_owner&lt;/code&gt;: the &lt;a href=&quot;https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8570b65220e80f0dafa517edd07fb5e63eff5344&quot;&gt;&lt;code&gt;print_mode&lt;/code&gt; filter&lt;/a&gt; and the &lt;a href=&quot;https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bed80036125a18bb3784c59e644a12027a17f4a7&quot;&gt;NUMA node filter&lt;/a&gt;, contributed by Zhen Ni, for more efficient debugging &#8212; specially in large-memory systems, and also helpful for high-frequency profiling.&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;print mode&lt;/em&gt; filter enables an output optimization for &lt;code&gt;/sys/kernel/debug/page_owner&lt;/code&gt; (detailed-output file) similar to &lt;code&gt;/sys/kernel/debug/page_owner_stacks/show_handles&lt;/code&gt; (optimized-output file &lt;a href=&quot;https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3b52b9e31a860df97bb46e9f3bfdab9f36d5d893&quot;&gt;introduced&lt;/a&gt; in Linux 6.19). It replaces stack traces with their handle numbers, which reduces duplicate information &#8212; saving processing time and storage usage.&lt;/p&gt;
&lt;p&gt;The handle numbers can be resolved to stack traces with &lt;code&gt;/sys/kernel/debug/page_owner_stacks/show_stacks_handles&lt;/code&gt; (also &lt;a href=&quot;https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5513cfbcf4da97ba0476d63e7670fdfcde59580f&quot;&gt;introduced&lt;/a&gt; in Linux 6.19), which lists stack traces along with their handle numbers.&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;NUMA node&lt;/em&gt; filter, intuitively, filters the pages listed in &lt;code&gt;/sys/kernel/debug/page_owner&lt;/code&gt; by NUMA node(s).&lt;/p&gt;
&lt;p&gt;Both filters are described in their commit messages, and the files &lt;code&gt;show_handles&lt;/code&gt; and &lt;code&gt;show_stacks_handles&lt;/code&gt; are covered in &lt;a href=&quot;https://mfo.dev.br/posts/2026-02-23-page_owner-part-2-optimizing-output/&quot;&gt;Part 2&lt;/a&gt;.&lt;/p&gt;
&lt;h1 id=&quot;configuration-interface&quot;&gt;
 &lt;a class=&quot;header-link&quot; href=&quot;https://mfo.dev.br/tags/igalia/index.xml#configuration-interface&quot;&gt;
 Configuration interface
 &lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;The configuration interface has an elegant design, &lt;a href=&quot;https://lore.kernel.org/all/agHRhlfIYbaqHHMK@tiehlicka/&quot;&gt;suggested&lt;/a&gt; by Michal Hocko. The user first writes the filter(s) &#8212; that is, &lt;code&gt;mode=...&lt;/code&gt; and/or &lt;code&gt;nid=...&lt;/code&gt; line(s) &#8212; to the &lt;code&gt;page_owner&lt;/code&gt; file, and then reads it as usual. The resulting contents have such filter(s) applied.&lt;/p&gt;
&lt;p&gt;This not only avoids adding more files in &lt;code&gt;debugfs&lt;/code&gt; for configuring the filters, but it also keeps the filter configuration &lt;em&gt;per file descriptor&lt;/em&gt; when accessing &lt;code&gt;/sys/kernel/debug/page_owner&lt;/code&gt;, which allows concurrent users to have independent configuration, unaffected by each other.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/mm/page_owner_filter.c?h=v7.3&quot;&gt;&lt;code&gt;page_owner_filter&lt;/code&gt;&lt;/a&gt; tool has been added to help with that, with the options &lt;code&gt;--mode &amp;lt;stack|handle|stack_handle&amp;gt;&lt;/code&gt; for printing only stack traces (default), only handle numbers, or both, and &lt;code&gt;--node &amp;lt;nodes&amp;gt;&lt;/code&gt; for selecting NUMA nodes, which can take a list, range, or both mixed.&lt;/p&gt;
&lt;p&gt;The shell also works just fine. The trick is, the same file descriptor must be used for both writing the filter configuration and reading the contents. So, it is required to manually open/close and write/read with redirection, otherwise the shell uses different file descriptors.&lt;/p&gt;
&lt;p&gt;For example, using file descriptor 3:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the file in read-write mode as file descriptor 3: &lt;br /&gt;
&lt;code&gt;# exec 3&amp;lt;&amp;gt;/sys/kernel/debug/page_owner&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Write the filter line(s) into it: &lt;br /&gt;
&lt;code&gt;# echo 'mode=handle' &amp;gt;&amp;amp;3&lt;/code&gt; &lt;br /&gt;
and/or &lt;br /&gt;
&lt;code&gt;# echo 'nid=1' &amp;gt;&amp;amp;3&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;And read it, optionally into a file: &lt;br /&gt;
&lt;code&gt;# cat &amp;lt;&amp;amp;3 &amp;gt;page_owner.filtered&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Finally, close it: &lt;br /&gt;
&lt;code&gt;# exec 3&amp;gt;&amp;amp;-&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;examples&quot;&gt;
 &lt;a class=&quot;header-link&quot; href=&quot;https://mfo.dev.br/tags/igalia/index.xml#examples&quot;&gt;
 Examples
 &lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Example with &lt;code&gt;mode=handle&lt;/code&gt; (note there are only handle numbers, no stack traces):&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;# exec 3&amp;lt;&amp;gt;/sys/kernel/debug/page_owner
# echo 'mode=handle' &amp;gt;&amp;amp;3

# head &amp;lt;&amp;amp;3
Page allocated via order 0, mask 0x0(), pid 0, tgid 0 (swapper), ts 125421401 ns
PFN 0x100000 type Unmovable Block 2048 type Unmovable Flags 0x200000000000004(referenced|node=0|zone=2)
handle: 1048577

Page allocated via order 0, mask 0x0(), pid 0, tgid 0 (swapper), ts 125422032 ns
PFN 0x100001 type Unmovable Block 2048 type Unmovable Flags 0x200000000000004(referenced|node=0|zone=2)
handle: 1048577

Page allocated via order 0, mask 0x0(), pid 0, tgid 0 (swapper), ts 125422143 ns
PFN 0x100002 type Unmovable Block 2048 type Unmovable Flags 0x200000000000004(referenced|node=0|zone=2)

# exec 3&amp;gt;&amp;amp;-
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Example with &lt;code&gt;mode=handle&lt;/code&gt; and &lt;code&gt;nid=1&lt;/code&gt; (note there are only &lt;code&gt;node=1&lt;/code&gt; pages):&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;# exec 3&amp;lt;&amp;gt;/sys/kernel/debug/page_owner
# echo 'mode=handle' &amp;gt;&amp;amp;3
# echo 'nid=1' &amp;gt;&amp;amp;3

# head &amp;lt;&amp;amp;3
Page allocated via order 0, mask 0x0(), pid 0, tgid 0 (swapper), ts 215517152 ns
PFN 0x480000 type Unmovable Block 9216 type Unmovable Flags 0x600000000000000(node=1|zone=2)
handle: 1048577

Page allocated via order 0, mask 0x0(), pid 0, tgid 0 (swapper), ts 215517302 ns
PFN 0x480001 type Unmovable Block 9216 type Unmovable Flags 0x600000000000000(node=1|zone=2)
handle: 1048577

Page allocated via order 0, mask 0x252000(__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_THISNODE), pid 0, tgid 0 (swapper/0), ts 224577206 ns
PFN 0x480002 type Unmovable Block 9216 type Unmovable Flags 0x600000000000200(workingset|node=1|zone=2)

# exec 3&amp;gt;&amp;amp;-
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Example with default configuration (without &lt;code&gt;mode=handle&lt;/code&gt; or &lt;code&gt;nid=1&lt;/code&gt;):&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;# head /sys/kernel/debug/page_owner
Page allocated via order 0, mask 0x0(), pid 0, tgid 0 (swapper), ts 125421401 ns
PFN 0x100000 type Unmovable Block 2048 type Unmovable Flags 0x200000000000004(referenced|node=0|zone=2)
 register_early_stack+0x32/0x65
 init_page_owner+0x33/0x330
 page_ext_init+0x2d2/0x320
 mm_core_init+0x10c/0x130

Page allocated via order 0, mask 0x0(), pid 0, tgid 0 (swapper), ts 125422032 ns
PFN 0x100001 type Unmovable Block 2048 type Unmovable Flags 0x200000000000004(referenced|node=0|zone=2)
 register_early_stack+0x32/0x65
&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;measuring-improvements&quot;&gt;
 &lt;a class=&quot;header-link&quot; href=&quot;https://mfo.dev.br/tags/igalia/index.xml#measuring-improvements&quot;&gt;
 Measuring improvements
 &lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;The improvements in processing time and storage usage obtained with the &lt;code&gt;print_mode&lt;/code&gt; filter depend on how many characters are reduced by replacing stack traces with handle numbers. It is proportional to the number of allocated pages / stack traces printed, and the length of each stack trace (i.e., number of stack frames/lines, and length of function names and instruction offsets). Thus, of course, it varies with the workload.&lt;/p&gt;
&lt;p&gt;For demonstration purposes, a high duplicate stack trace rate is fit by &lt;code&gt;stress-ng&lt;/code&gt;&amp;rsquo;s &lt;code&gt;mmap&lt;/code&gt; stressor, which can allocate an arbitrary amount of memory with a single &lt;code&gt;mmap()&lt;/code&gt; call (99% of total memory, in this example).&lt;/p&gt;
&lt;p&gt;That is paired with &lt;code&gt;strace&lt;/code&gt;&amp;rsquo;s delay injection starting in the third &lt;code&gt;munmap()&lt;/code&gt; (found empirically) in order to keep memory allocated for 5 minutes (300 seconds), providing enough time for collecting data and maintaining page allocations as similar as possible.&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;# strace --inject=munmap:delay_enter=300s:when=3 --follow-forks \
 -- stress-ng --mmap 1 --mmap-bytes '99%' --timeout 300s \
 &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp;

# free -g
 total used free shared buff/cache available
Mem: 31 31 0 0 0 0
Swap: 0 0 0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The baseline is &lt;code&gt;page_owner&lt;/code&gt; with the default configuration (no filters). It is 4.2 GiB in size, taking approximately 18 seconds to be read (measured three times).&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;# time wc --bytes &amp;lt;/sys/kernel/debug/page_owner | numfmt --to=iec-i
4.2Gi

real	0m18.407s
user	0m0.093s
sys	0m18.314s
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The test is &lt;code&gt;page_owner&lt;/code&gt; with the &lt;code&gt;mode=handle&lt;/code&gt; filter. It is 2.1 GiB in size, taking approximately 3 seconds to be read (measured 3 times).&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;# exec 3&amp;lt;&amp;gt;/sys/kernel/debug/page_owner \
 &amp;amp;&amp;amp; echo 'mode=handle' &amp;gt;&amp;amp;3 \
 &amp;amp;&amp;amp; time wc --bytes &amp;lt;&amp;amp;3 | numfmt --to=iec-i \
 &amp;amp;&amp;amp; exec 3&amp;gt;&amp;amp;-
2.1Gi

real	0m2.794s
user	0m0.112s
sys	0m2.682s

# killall -9 strace stress-ng
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The measured improvement is &lt;em&gt;50% of the size in 1/6 of the time!&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Remember that, for &lt;code&gt;mode=handle&lt;/code&gt;, the &lt;code&gt;show_stacks_handles&lt;/code&gt; file is required and must also be considered. However, its size is negligible compared to the &lt;code&gt;page_owner&lt;/code&gt; file (~0.01%):&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;# wc --bytes &amp;lt;/sys/kernel/debug/page_owner_stacks/show_stacks_handles | numfmt --to=iec-i
298Ki
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And any additional processing time required for resolving handle numbers to stack traces with &lt;code&gt;show_stacks_handles&lt;/code&gt; is usually limited to just the handle numbers/stack traces of interest, only in post-processing/presentation stages, which should also be negligible compared to processing all stack traces in every read of &lt;code&gt;page_owner&lt;/code&gt;.&lt;/p&gt;
&lt;h1 id=&quot;conclusion&quot;&gt;
 &lt;a class=&quot;header-link&quot; href=&quot;https://mfo.dev.br/tags/igalia/index.xml#conclusion&quot;&gt;
 Conclusion
 &lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;The new filtering features for &lt;code&gt;page_owner&lt;/code&gt; in Linux 7.3 provide optimized output for &lt;code&gt;/sys/debug/page_owner&lt;/code&gt;, which is significantly faster to read and smaller to store, that is specially relevant on large-memory systems and helpful for high-frequency profiling.&lt;/p&gt;                </content>
		<author>
			<name>Mauricio Faria de Oliveira</name>
			<uri>https://mfo.dev.br/tags/igalia/</uri>
		</author>
	</entry>

	<entry>
		<title>Igalia WebKit Team: WebKit Igalia Periodical #84</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/webkit/blog/2026/wip-84/"/>
		<id>https://blogs.igalia.com/webkit/blog/2026/wip-84/</id>
		<updated>2026-11-02T19:30:03+00:00</updated>
		<content type="html">
&lt;p&gt;Update on what happened in WebKit in the week from October 26 to November 2.&lt;/p&gt;
&lt;p&gt;
In this week's installment we have an improvement to WebKit when
running under Flatpak, OpenSSL being made the default crypto
backend for the WPE and GTK ports, improved support for the Media
Playback Quality spec, and the usual plethora of improvements and
fixes to the Layer-Based SVG Engine.
&lt;/p&gt;
&lt;h2 id=&quot;cross-port-cat&quot;&gt;Cross-Port &#128049;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;When running in Flatpak, &lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/55227c72722df7f03b134fc9c064af0bb7f3d616&quot;&gt;use the flatpak-portal D-Bus API&lt;/a&gt; to spawn sub processes instead of &lt;code&gt;flatpak-spawn&lt;/code&gt;. This provides a small improvement in launch times and memory usage.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/325135@main&quot;&gt;OpenSSL is now the default backend for crypto in the WPE and GTK ports&lt;/a&gt;. The libgcrypt backend will remain in tree for the current cycle but can be considered deprecated and will be removed after the next stable release series.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;multimedia-movie-camera&quot;&gt;Multimedia &#127909;&lt;/h3&gt;
&lt;div class=&quot;wip-description&quot;&gt;
&lt;p&gt;GStreamer-based multimedia support for WebKit, including (but not limited to) playback, capture, WebAudio, WebCodecs, and WebRTC.&lt;/p&gt;
&lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/325099@main&quot;&gt;Improved support&lt;/a&gt; for the &lt;a rel=&quot;external&quot; href=&quot;https://w3c.github.io/media-playback-quality/&quot;&gt;Media Playback Quality spec&lt;/a&gt; in WebKitGTK/WPE, avoiding statistics counter resets during flushes and pauses, and properly keeping the statistics after player suspension.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;graphics-frame-photo&quot;&gt;Graphics &#128444;&#65039;&lt;/h3&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/325442@main&quot;&gt;Fixed the sizing of &lt;code&gt;&amp;lt;foreignObject&amp;gt;&lt;/code&gt;&lt;/a&gt; in vertical &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode&quot;&gt;writing modes&lt;/a&gt; in the Layer-Based SVG Engine (LBSE), where its width and height were swapped. The viewport size is now mapped to the logical axes, as the legacy SVG engine does.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/324918@main&quot;&gt;Skipped SVG filters that change nothing&lt;/a&gt;, such as an &lt;code&gt;feOffset&lt;/code&gt; without an offset or an &lt;code&gt;feDropShadow&lt;/code&gt; with zero blur and offset, in the Layer-Based SVG Engine (LBSE), matching the legacy SVG engine.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/325095@main&quot;&gt;Fixed missing repaints&lt;/a&gt; in the Layer-Based SVG Engine (LBSE) when an attribute of an SVG filter primitive changes before the filter has painted for the first time. The elements using the filter are now always repainted, as in the legacy SVG engine.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/325164@main&quot;&gt;Removed an extra clip&lt;/a&gt; on the outermost &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; element in the Layer-Based SVG Engine (LBSE), which truncated &lt;code&gt;drop-shadow()&lt;/code&gt; filters, &lt;code&gt;box-shadow&lt;/code&gt;, outlines painting outside the border box, and rotated inline &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; elements. The existing viewport overflow clip already handles this correctly, including transforms.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/325439@main&quot;&gt;Fixed &lt;code&gt;getScreenCTM()&lt;/code&gt;&lt;/a&gt; in the Layer-Based SVG Engine (LBSE) to include CSS &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/zoom&quot;&gt;&lt;code&gt;zoom&lt;/code&gt;&lt;/a&gt; on the outermost &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; while still ignoring page zoom, matching the legacy SVG engine. This resolves the remaining &lt;code&gt;getScreenCTM()&lt;/code&gt; issues in LBSE.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/324618@main&quot;&gt;Removed the transform-to-root check&lt;/a&gt; from SVG container layout in the Layer-Based SVG Engine (LBSE), which re-laid out a whole subtree whenever an ancestor changed its transform to the outermost &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; element. Transforms now invalidate the relevant state directly, so these extra re-layouts are no longer needed.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/325227@main&quot;&gt;Fixed outlines, masks and event regions&lt;/a&gt; being displaced on an outermost &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; that is not at the origin of its containing block in the Layer-Based SVG Engine (LBSE). Besides the visual fix, this also corrects the regions used for wheel event handling.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/325228@main&quot;&gt;Fixed SVG text being laid out with a stale font size&lt;/a&gt; after its own &lt;code&gt;transform&lt;/code&gt; changes in the Layer-Based SVG Engine (LBSE). The transform is now updated &lt;em&gt;before&lt;/em&gt; the on-screen font size is computed, so text metrics match the legacy SVG engine.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/325461@main&quot;&gt;Fixed non-scaling strokes on SVG text&lt;/a&gt; ensuring they are measured in the coordinate system of the outermost &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; element, like shapes already were, instead of in screen space. A CSS transform on the outermost &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; or on one of its HTML ancestors now scales the &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/vector-effect&quot;&gt;&lt;code&gt;vector-effect: non-scaling-stroke&lt;/code&gt;&lt;/a&gt; of text correctly, in both the Layer-Based SVG Engine (LBSE) and the legacy SVG engine.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/325041@main&quot;&gt;Aligned the filter source image to whole device pixels&lt;/a&gt; when repainting filtered SVG content in the Layer-Based SVG Engine (LBSE), so a repaint always fully replaces the pixels it touches, instead of leaving stale pixels behind when content wasn't device-pixel aligned.&lt;/p&gt;
  &lt;/div&gt;
&lt;div class=&quot;wip-end&quot;&gt;
&lt;p&gt;That&#8217;s all for this week!&lt;/p&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Igalia WebKit Team</name>
			<uri>https://blogs.igalia.com/webkit</uri>
		</author>
	</entry>

	<entry>
		<title>Tiago Vignatti: The Psychoses of 2026</title>
		<link rel="alternate" type="text/html" href="https://vignatti.com/posts/the-psychoses-of-2026/"/>
		<id>https://vignatti.com/posts/the-psychoses-of-2026/</id>
		<updated>2026-10-27T15:00:00+00:00</updated>
		<content type="html">
Political psychosis, AI psychosis.                </content>
		<author>
			<name>Tiago Vignatti</name>
			<uri>https://vignatti.com/posts/</uri>
		</author>
	</entry>

	<entry>
		<title>Igalia WebKit Team: WebKit Igalia Periodical #83</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/webkit/blog/2026/wip-83/"/>
		<id>https://blogs.igalia.com/webkit/blog/2026/wip-83/</id>
		<updated>2026-10-26T19:03:33+00:00</updated>
		<content type="html">
&lt;p&gt;Update on what happened in WebKit in the week from October 19 to October 26.&lt;/p&gt;
&lt;p&gt;
An exciting bag of news this week which includes a fix for processes
not being closed under memory pressure, process prewarming when
sandboxing is enabled, a couple of GStreamer-related changes including
one that make auxiliary processes' startups faster, and the usual influx
of LBSE fixes. In addition to that we got a libsoup release with security
fixes, and the deprecation of the legacy libwpe-based API.
&lt;/p&gt;
&lt;h2 id=&quot;cross-port-cat&quot;&gt;Cross-Port &#128049;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/9e896da4cf9fa821823b97132d6eaae23c0036d2&quot;&gt;Fixed&lt;/a&gt; prewarmed and suspended processes not being closed under memory pressure.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/1bc2c0f87f28e007ec9bfb14f94fd1e4d2cdb9fb&quot;&gt;Fixed&lt;/a&gt; process prewarming when the sandbox is enabled.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;networking-signal-strength&quot;&gt;Networking &#128246;&lt;/h3&gt;
&lt;div class=&quot;wip-description&quot;&gt;
&lt;p&gt;Networking support, including the libsoup HTTP library.&lt;/p&gt;
&lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Released &lt;a rel=&quot;external&quot; href=&quot;https://gitlab.gnome.org/GNOME/libsoup/-/commit/2756d0076654b680d2021a08b9f2bd9d36d7ae1b&quot;&gt;libsoup 3.8.1&lt;/a&gt;. The release contains various security fixes as well as bug fixes for HTTP/2 and zstd encoding support.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;multimedia-movie-camera&quot;&gt;Multimedia &#127909;&lt;/h3&gt;
&lt;div class=&quot;wip-description&quot;&gt;
&lt;p&gt;GStreamer-based multimedia support for WebKit, including (but not limited to) playback, capture, WebAudio, WebCodecs, and WebRTC.&lt;/p&gt;
&lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/324215@main&quot;&gt;Media player now internally uses the GStreamer playbin3 element&lt;/a&gt;, playbin support is deprecated given that it isn't much maintained anymore and less efficient than playbin3.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/070ff828ed26b6305dd78575369cdddb79b5411f&quot;&gt;Dynamically load flite&lt;/a&gt; when used, reducing process startup time significantly.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;graphics-frame-photo&quot;&gt;Graphics &#128444;&#65039;&lt;/h3&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/324123@main&quot;&gt;Fixed SVG text not being re-measured&lt;/a&gt; when a CSS transform changes the scale of an enclosing &lt;code&gt;&amp;lt;g&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;use&amp;gt;&lt;/code&gt; or nested &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; in the Layer-Based SVG Engine (LBSE). Such text used to keep its old on-screen font size, and it is now laid out again at the new scale, as it already was when the SVG &lt;code&gt;transform&lt;/code&gt; attribute changed.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;wpe-webkit-pager&quot;&gt;WPE WebKit &#128223;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;The legacy &lt;code&gt;libwpe&lt;/code&gt;-based API &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/324630@main&quot;&gt;has been deprecated&lt;/a&gt;. While removal is not planned, this means that starting with the 2.56 release series (due in March 2027) building applications that are use it will produce deprecation warnings. The recently announced &lt;a rel=&quot;external&quot; href=&quot;https://wpewebkit.org/blog/2026-10-06-wpe-platform.html&quot;&gt;WPEPlatform API&lt;/a&gt; should be preferred, and migrating to it is encouraged.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;wpe-platform-api-jigsaw&quot;&gt;WPE Platform API &#129513;&lt;/h3&gt;
&lt;div class=&quot;wip-description&quot;&gt;
&lt;p&gt;New, modern platform API that supersedes usage of libwpe and WPE backends.&lt;/p&gt;
&lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;The &lt;code&gt;formats&lt;/code&gt; array passed to the &lt;a rel=&quot;external&quot; href=&quot;https://wpewebkit.org/reference/stable/wpe-platform-2.0/vfunc.Clipboard.changed.html&quot;&gt;WPEClipboard.changed&lt;/a&gt; virtual function &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/324164@main&quot;&gt;now indicates the array length correctly&lt;/a&gt;. While at it, the virtual functions of the &lt;code&gt;WPEClipboard&lt;/code&gt; class &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/323708@main&quot;&gt;have been documented&lt;/a&gt;.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;community-events-handshake&quot;&gt;Community &amp;amp; Events &#129309;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/Igalia/wpe-platform-gtk/commit/22441fe253771cfcd6014ecbbe1be54a436d7e18&quot;&gt;Fix&lt;/a&gt; dark-mode when using wpe-platform-gtk.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;infrastructure-construction-site&quot;&gt;Infrastructure &#127959;&#65039;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Build with &lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/c47b7c073c22efb2fd6363b440245b9fb6d6fc79&quot;&gt;-z pack-relative-relocs&lt;/a&gt; reducing the binary size and memory usage.&lt;/p&gt;
  &lt;/div&gt;
&lt;div class=&quot;wip-end&quot;&gt;
&lt;p&gt;That&#8217;s all for this week!&lt;/p&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Igalia WebKit Team</name>
			<uri>https://blogs.igalia.com/webkit</uri>
		</author>
	</entry>

	<entry>
		<title>Jacobo Aragunde: Apache POI 6.0.0 released</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/jaragunde/2026/10/apache-poi-6-0-0-released/?pk_campaign=feed&amp;pk_kwd=apache-poi-6-0-0-released"/>
		<id>https://blogs.igalia.com/jaragunde/?p=1179</id>
		<updated>2026-10-23T15:56:55+00:00</updated>
		<content type="html">
&lt;p&gt;A brief note to celebrate the release of &lt;a href=&quot;https://poi.apache.org/&quot;&gt;Apache POI 6.0.0&lt;/a&gt;! I started contributing to this project last year, and this is the first release since I joined the Project Management Committee.&lt;/p&gt;
&lt;p&gt;Apache POI is a Java library that allows reading and writing Office documents, both in binary and XML formats (OOXML). My main contributions have been adding API to access properties in docx documents that were previously hidden (&lt;a href=&quot;https://github.com/apache/poi/pull/843&quot;&gt;table indent&lt;/a&gt;, &lt;a href=&quot;https://github.com/apache/poi/pull/859&quot;&gt;embedded charts&lt;/a&gt;, &lt;a href=&quot;https://github.com/apache/poi/pull/1172&quot;&gt;right-to-left&lt;/a&gt;, among others), improved support for pptx rendering (&lt;a href=&quot;https://github.com/apache/poi/pull/990&quot;&gt;transparent bitmaps&lt;/a&gt;, &lt;a href=&quot;https://github.com/apache/poi/pull/1174&quot;&gt;theme colors as highlight&lt;/a&gt;, &lt;a href=&quot;https://github.com/apache/poi/pull/969&quot;&gt;fix table style rules&lt;/a&gt;) and, additionally, general bugfixing.&lt;/p&gt;
&lt;p&gt;We at &lt;a href=&quot;https://www.igalia.com&quot;&gt;Igalia&lt;/a&gt; are best known for our work in browsers, compilers, multimedia, kernel or graphics, but this is an example of our wider contribution to Open Source Software. One of the things we do is contributing fixes and features to the projects our customers rely on, to make their lives easier and at the same time improve OSS for everyone.&lt;/p&gt;
&lt;p&gt;Get in touch if you want to &lt;a href=&quot;https://www.igalia.com/contact/&quot;&gt;talk about Open Source&lt;/a&gt; &lt;img src=&quot;https://s.w.org/images/core/emoji/16.0.1/72x72/1f642.png&quot; alt=&quot;&#128578;&quot; class=&quot;wp-smiley&quot; /&gt;&lt;/p&gt;
&lt;img src=&quot;https://stats.igalia.com/piwik.php?idsite=22&amp;rec=1&amp;url=https%3A%2F%2Fblogs.igalia.com%2Fjaragunde%2F2026%2F10%2Fapache-poi-6-0-0-released%2F%3Fpk_campaign%3Dfeed%26pk_kwd%3Dapache-poi-6-0-0-released&amp;action_name=Apache%20POI%206.0.0%20released&amp;urlref=https%3A%2F%2Fblogs.igalia.com%2Fjaragunde%2Ffeed%2F&quot; width=&quot;0&quot; height=&quot;0&quot; alt=&quot;&quot; /&gt;                </content>
		<author>
			<name>Jacobo Aragunde P&#233;rez</name>
			<uri>https://blogs.igalia.com/jaragunde</uri>
		</author>
	</entry>

	<entry>
		<title>Cristina Murillo: How I got started with Vulkan CTS</title>
		<link rel="alternate" type="text/html" href="https://crmurillo.github.io/blog/how-i-got-started-with-vulkan-cts/"/>
		<id>https://crmurillo.github.io/blog/how-i-got-started-with-vulkan-cts/</id>
		<updated>2026-10-22T00:00:00+00:00</updated>
		<content type="html">
&lt;p&gt;This year I started working on Vulkan Video and the Vulkan Conformance Test Suite (CTS) as part of my role as a &lt;em&gt;multimedia developer&lt;/em&gt; at &lt;a href=&quot;https://www.igalia.com/&quot;&gt;Igalia&lt;/a&gt;. I'm also a member of the Khronos Vulkan Video Technical Subgroup (TSG), the group that develops the Vulkan Video extensions.&lt;/p&gt;
&lt;p&gt;I want to share in a blog &lt;em&gt;series&lt;/em&gt; what I've learned along the way, starting from my first task: write the conformance tests to identify a parser bug.&lt;/p&gt;
&lt;h2&gt;CTS in one paragraph&lt;/h2&gt;
&lt;p&gt;The Vulkan Conformance Test Suite is necessary to verify whether a Vulkan driver is conformant with regards to the specification. It lives in the &lt;a href=&quot;https://github.com/KhronosGroup/VK-GL-CTS&quot;&gt;VK-GL-CTS&lt;/a&gt; repository, alongside tests for other graphics APIs like OpenGL and OpenGL ES. It is built on a framework called &lt;em&gt;drawElements Quality Program (dEQP)&lt;/em&gt;. Hence the prefix &lt;code&gt;dEQP-VK&lt;/code&gt; seen in the test cases. The video tests live under &lt;code&gt;dEQP-VK.video.*&lt;/code&gt;, where I focus the most.&lt;/p&gt;
&lt;h2&gt;The problem&lt;/h2&gt;
&lt;p&gt;My first task started with a bug in &lt;a href=&quot;https://github.com/KhronosGroup/Vulkan-Video-Samples&quot;&gt;Vulkan Video Samples&lt;/a&gt;, a set of sample applications from the Khronos Group. Its parser library is used by CTS for the decode tests.&lt;/p&gt;
&lt;p&gt;According to the AV1 specification, a frame can be broken into tiles that can be decoded independently of each other, allowing decoders to process them in parallel. Tiles are divided internally into a matrix of superblocks (SB), square regions of 64x64 or 128x128 luma samples. At the bottom of this hierarchy is the mode info (MI) unit, a 4x4 block of luma samples.&lt;/p&gt;
&lt;p&gt;The following example shows a frame split into 2x2 tiles, with superblocks of size 64x64 luma samples. The start column and start row of a tile are specified in MI units, in &lt;code&gt;MiColStarts&lt;/code&gt; and &lt;code&gt;MiRowStarts&lt;/code&gt; respectively.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  A frame, split into 2&#215;2 tiles

         Tile 0            Tile 1
         0     1     2     3     4     5            &#8592; superblock column index
         &#8595;                 &#8595;
   0  &#8594;  &#9484;&#9472;&#9472;&#9472;&#9472;&#9472;&#9516;&#9472;&#9472;&#9472;&#9472;&#9472;&#9516;&#9472;&#9472;&#9472;&#9472;&#9472;&#9573;&#9472;&#9472;&#9472;&#9472;&#9472;&#9516;&#9472;&#9472;&#9472;&#9472;&#9472;&#9516;&#9472;&#9472;&#9472;&#9472;&#9472;&#9488;
         &#9474; SB  &#9474; SB  &#9474; SB  &#9553; SB  &#9474; SB  &#9474; SB  &#9474;
  16     &#9500;&#9472;&#9472;&#9472;&#9472;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9579;&#9472;&#9472;&#9472;&#9472;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9508;      SB = superblock (64&#215;64 pixels)
         &#9474; SB  &#9474; SB  &#9474; SB  &#9553; SB  &#9474; SB  &#9474; SB  &#9474;
  32  &#8594;  &#9566;&#9552;&#9552;&#9552;&#9552;&#9552;&#9578;&#9552;&#9552;&#9552;&#9552;&#9552;&#9578;&#9552;&#9552;&#9552;&#9552;&#9552;&#9580;&#9552;&#9552;&#9552;&#9552;&#9552;&#9578;&#9552;&#9552;&#9552;&#9552;&#9552;&#9578;&#9552;&#9552;&#9552;&#9552;&#9552;&#9569;      &#9552; &#9553;  tile boundary
         &#9474; SB  &#9474; SB  &#9474; SB  &#9553; SB  &#9474; SB  &#9474; SB  &#9474;      &#9472; &#9474;  superblock boundary
  48     &#9500;&#9472;&#9472;&#9472;&#9472;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9579;&#9472;&#9472;&#9472;&#9472;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9532;&#9472;&#9472;&#9472;&#9472;&#9472;&#9508;
         &#9474; SB  &#9474; SB  &#9474; SB  &#9553; SB  &#9474; SB  &#9474; SB  &#9474;
  64     &#9492;&#9472;&#9472;&#9472;&#9472;&#9472;&#9524;&#9472;&#9472;&#9472;&#9472;&#9472;&#9524;&#9472;&#9472;&#9472;&#9472;&#9472;&#9576;&#9472;&#9472;&#9472;&#9472;&#9472;&#9524;&#9472;&#9472;&#9472;&#9472;&#9472;&#9524;&#9472;&#9472;&#9472;&#9472;&#9472;&#9496;
   &#8593;     0     16    32    48    64    80    96     &#8592; MI column
MI row                                          
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For example, for Tile 1:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  MiColStarts[1] = 3 SB &#215; 16 MI = 48
  MiRowStarts[0] = 0 SB &#215; 16 MI = 0

  1 SB = 64 pixels = 64 &#247; 4 = 16 MI
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When an application asks a Vulkan driver to decode an AV1 frame, it passes the tile information in a struct called &lt;code&gt;StdVideoAV1TileInfo&lt;/code&gt;, which contains the fields &lt;code&gt;pMiColStarts&lt;/code&gt; and &lt;code&gt;pMiRowStarts&lt;/code&gt; corresponding to &lt;code&gt;MiColStarts&lt;/code&gt; and &lt;code&gt;MiRowStarts&lt;/code&gt; in the AV1 specification. For Tile 1, the driver received a start column of 3 instead of 48, since the Vulkan Video Samples parser assigned &lt;code&gt;MiColStarts&lt;/code&gt; as follows (and the same for &lt;code&gt;MiRowStarts&lt;/code&gt;):&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;pic_data-&amp;gt;MiColStarts[i] = start_sb;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The parser was passing superblock indices instead of MI units (Thanks &lt;a href=&quot;https://blogs.igalia.com/zzoon/&quot;&gt;@zzoon&lt;/a&gt; for reporting and fixing it! &lt;a href=&quot;https://github.com/KhronosGroup/Vulkan-Video-Samples/issues/152&quot;&gt;Issue #152&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;A driver doesn't actually need the application to provide &lt;code&gt;MiColStarts&lt;/code&gt; and &lt;code&gt;MiRowStarts&lt;/code&gt;. It already has enough information to calculate the tile starts from the tile sizes, the superblock size and the frame dimensions. That's exactly what the Vulkan specification now recommends in a note added in version 1.4.344:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;quot;Historically some applications incorrectly specified the values in &lt;code&gt;pMiColStarts&lt;/code&gt; and &lt;code&gt;pMiRowStarts&lt;/code&gt; in terms of superblocks instead of mode info blocks, therefore it is recommended for implementations to ignore the values specified in &lt;code&gt;pMiColStarts&lt;/code&gt; and &lt;code&gt;pMiRowStarts&lt;/code&gt;. Instead, the values should be calculated based on &lt;code&gt;flags.uniform_tile_spacing_flag&lt;/code&gt;, &lt;code&gt;pWidthInSbsMinus1&lt;/code&gt;, &lt;code&gt;pHeightInSbsMinus1&lt;/code&gt;, the sequence header parameter &lt;code&gt;flags.use_128x128_superblock&lt;/code&gt;, and the coded extent of the decoded picture.&amp;quot;[1]&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Mesa's RADV[2] and ANV[3] drivers now follow this recommendation.&lt;/p&gt;
&lt;p&gt;Fixing the parser and the drivers solves part of the problem. But other applications might still be sending superblock units, and those applications will only work on drivers that ignore the fields. My task was to write a CTS test that checks whether a driver ignores them.&lt;/p&gt;
&lt;h2&gt;The tests&lt;/h2&gt;
&lt;p&gt;CTS decodes video with the same parser as Vulkan Video Samples, which after the fix sends tile starts in the correct unit, MI. Therefore, the existing AV1 decode tests already cover correct usage: the driver gets the right values, and the decoded frames must match. What was missing was an additional test for incorrect usage, a test that still sends superblock units.&lt;/p&gt;
&lt;p&gt;For that, I added an option to the CTS decoder, &lt;code&gt;ForceSbTileUnits&lt;/code&gt;. If enabled, it converts the tile starts back into superblock units right before each frame is submitted.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;const uint32_t sbShift = seq-&amp;gt;flags.use_128x128_superblock ? 5u : 4u;

for (uint32_t i = 0; i &amp;lt; p-&amp;gt;tileInfo.TileCols; ++i)
    p-&amp;gt;MiColStarts[i] = static_cast&amp;lt;uint16_t&amp;gt;(p-&amp;gt;MiColStarts[i] &amp;gt;&amp;gt; sbShift);
for (uint32_t i = 0; i &amp;lt; p-&amp;gt;tileInfo.TileRows; ++i)
    p-&amp;gt;MiRowStarts[i] = static_cast&amp;lt;uint16_t&amp;gt;(p-&amp;gt;MiRowStarts[i] &amp;gt;&amp;gt; sbShift);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If the clip is single tile, every start is 0, and 0 is the same in either unit, so the test wouldn't check anything. For this reason, it's important to test on clips with multiple tiles.&lt;/p&gt;
&lt;p&gt;Every decoded frame is hashed and compared against a known-good checksum. In the existing AV1 tests, which send MI units, a mismatch is a failure. In the new tests, which send superblock units, there are two possible outcomes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Pass: the driver ignores the superblock values, as the specification note recommends, and decodes the same frames as the existing test.&lt;/li&gt;
&lt;li&gt;QualityWarning: the driver reads the values as MI units, places the tiles in the wrong positions, and the checksums don't match.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It's a warning and not a failure because ignoring these fields is only a recommendation, not a requirement. A driver that trusts those fields is still conformant. The goal is to push drivers to accept both units, so they keep working with applications that still send the wrong units.&lt;/p&gt;
&lt;h2&gt;What I learned&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;One test is really several.&lt;/strong&gt; Every decode test runs in four variants: the decoded picture buffer (DPB) is either layered or separated, and images use either general or video-specific layouts. Two clips &#215; four variants gave me eight new test cases, with names like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;dEQP-VK.video.decode.av1.svcl1t2_8_sb_tile_units_layered_dpb_general_layout
dEQP-VK.video.decode.av1.argon_filmgrain_10_test1019_sb_tile_units_separated_dpb_video_layout
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;New tests go in the mustpass list.&lt;/strong&gt; That's the list of tests a driver has to run to be conformant. Despite the name, not every test has to pass: on a driver without AV1 decode support, these tests report &lt;code&gt;NotSupported&lt;/code&gt;, and that's fine. A &lt;code&gt;QualityWarning&lt;/code&gt; is also an accepted result. It doesn't block conformance, but it shows up in the results for driver developers to see.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Hunting bugs and developing tests to catch them can lead you through the whole stack: from the AV1 and Vulkan specifications, to the sample application and CTS, down to the drivers.&lt;/p&gt;
&lt;h2&gt;References&lt;/h2&gt;
&lt;p&gt;[1] &lt;a href=&quot;https://docs.vulkan.org/spec/latest/chapters/videocoding.html#_av1_decoding_parameters&quot;&gt;https://docs.vulkan.org/spec/latest/chapters/videocoding.html#_av1_decoding_parameters&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;[2] &lt;a href=&quot;https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39492&quot;&gt;https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39492&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;[3] &lt;a href=&quot;https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39471&quot;&gt;https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39471&lt;/a&gt;&lt;/p&gt;                </content>
		<author>
			<name>Cristina Murillo</name>
			<uri>https://crmurillo.github.io/</uri>
		</author>
	</entry>

	<entry>
		<title>Nikolas Zimmermann: Making LBSE performant</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/nzimmermann/posts/2026-10-21-lbse-performance/"/>
		<id>https://blogs.igalia.com/nzimmermann/posts/2026-10-21-lbse-performance/</id>
		<updated>2026-10-21T00:00:00+00:00</updated>
		<content type="html">
Closing the MotionMark/Suits gap between LBSE and the legacy SVG engine                </content>
		<author>
			<name>Nikolas Zimmermann</name>
			<uri>https://blogs.igalia.com/nzimmermann/</uri>
		</author>
	</entry>

	<entry>
		<title>Thadeu Lima de Souza Cascardo: Restricting device memory usage on Linux 7.3</title>
		<link rel="alternate" type="text/html" href="https://cascardo.eti.br/blog/dmem_cgroup_7.3/"/>
		<id>https://cascardo.eti.br/blog/dmem_cgroup_7.3/</id>
		<updated>2026-10-20T17:19:57+00:00</updated>
		<content type="html">
&lt;p&gt;Linux cgroups has been used for a while to group processes and control their access to certain system resources. One of those resources is memory, through the use of memcg. That control is dynamic, allowing for cgroups to setup a minimal and a maximal amount of memory, as well as low and high thresholds, which will control the reclaim process.&lt;/p&gt;

&lt;p&gt;But what about device memory that is not available as system RAM? Memory that is not available to the Linux page allocator? One of those device memories is GPU VRAM.&lt;/p&gt;

&lt;p&gt;That's where the dmem cgroup controller comes in. Introduced in Linux 6.14, it was first adopted by the Intel Xe driver. In Linux 6.15, AMD amdgpu driver also adopted it. In 7.3, it was adopted by nouveau.&lt;/p&gt;

&lt;p&gt;Such a cgroup controller allows the system to be configured such that a workload, be it a browser, a game, or another GPU rendering process can have some minimal VRAM available. Or it can prevent one of these processes from using all VRAM, preventing your compositor from using it, for example.&lt;/p&gt;

&lt;p&gt;Let's go through the system knobs that are available to control this and what's new in Linux 7.3.&lt;/p&gt;

&lt;h2&gt;dmem regions and dmem.capacity&lt;/h2&gt;

&lt;p&gt;Since a given system might have multiple GPUs, there might be multiple device memory regions. So, on dmem, each such region is described by a name. Every dmem cgroup setting file will contain one line per region. One of those files shows the capacity of each region in bytes and is present only in the root cgroup.&lt;/p&gt;

&lt;p&gt;After enabling the dmem cgroup with the following command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# echo +dmem &amp;gt; /sys/fs/cgroup/cgroup.subtree_control
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;One can inspect the capacity of any available regions by looking at &lt;code&gt;dmem.capacity&lt;/code&gt; at the root cgroup:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# cat /sys/fs/cgroup/dmem.capacity
drm/0000:03:00.0/vram 8573157376
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That shows that the GPU at PCI address 0000:03:00.0 has a 8176MiB VRAM dmem region.&lt;/p&gt;

&lt;h2&gt;dmem settings&lt;/h2&gt;

&lt;p&gt;When introduced at 6.14, the following settings were available.&lt;/p&gt;

&lt;h3&gt;dmem.current&lt;/h3&gt;

&lt;p&gt;In every dmem cgroup, including the root cgroup, the dmem.current is a read-only file that shows the current usage of each region by the given cgroup.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# cat /sys/fs/cgroup/user.slice/dmem.current
drm/0000:03:00.0/vram 292757504
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here, it shows that user.slice cgroup is currently using above 292 MB of VRAM.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# cat /sys/fs/cgroup/dmem.current
drm/0000:03:00.0/vram 311377920
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here, we can check that total system usage is above 311 MB.&lt;/p&gt;

&lt;h3&gt;dmem.max&lt;/h3&gt;

&lt;p&gt;Excluding the root cgroup, dmem cgroups can control the maximal number of bytes that can be allocated from a region by processes in that cgroup. If an allocation moves the usage above the max setting, it will be refused. In that case, the allocation might be attempted at system memory or it might trigger eviction, depending on the allocation parameters and the driver.&lt;/p&gt;

&lt;p&gt;Here, the &lt;code&gt;max&lt;/code&gt; value has special meaning, which is unrestricted usage.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# echo drm/0000:03:00.0/vram 536870912 &amp;gt; /sys/fs/cgroup/user.slice/dmem.max
# cat /sys/fs/cgroup/user.slice/dmem.max
drm/0000:03:00.0/vram 536870912
# echo drm/0000:03:00.0/vram max &amp;gt; /sys/fs/cgroup/user.slice/dmem.max
# cat /sys/fs/cgroup/user.slice/dmem.max
drm/0000:03:00.0/vram max
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;dmem.min&lt;/h3&gt;

&lt;p&gt;dmem.min, also not available on the root cgroup, will control the eviction process - when memory needs to be moved out of VRAM to make room for other VRAM allocations. If an object belongs to a cgroup which is using less than its min setting, it will not be considered for eviction. It effectively works as a hard protection such that the cgroup can use at least the minimal setting.&lt;/p&gt;

&lt;p&gt;Given multiple cgroups may set a minimal value that exceeds the device memory capacity, it computes an effective minimal depending on the hierarchy.&lt;/p&gt;

&lt;h3&gt;dmem.low&lt;/h3&gt;

&lt;p&gt;While dmem.min works as a hard limit, dmem.low is a soft limit that will prevent eviction in case other objects from different cgroups are available for eviction. That is, the system will try to evict from different, possibly unprotected cgroups, before it tries to evict from a cgroup if evicting would leave its usage below the value set as dmem.low.&lt;/p&gt;

&lt;h2&gt;Recent developments in Linux 7.3&lt;/h2&gt;

&lt;p&gt;Some new changes have been recently introduced in the dmem cgroup controller and its integration with GPUs.&lt;/p&gt;

&lt;p&gt;One of those is a new read-only file, &lt;code&gt;dmem.peak&lt;/code&gt;, which was introduced to allow the peak usage of a region in a cgroup to be inspected.&lt;/p&gt;

&lt;p&gt;Also, Linux 7.3 fixed certain scenarios where a given cgroup would not be able to allocate VRAM up to its minimal or low limits if other processes had already allocated most of VRAM, even though they had no such limits set.&lt;/p&gt;

&lt;p&gt;Changing multiple regions' settings in a single write was possible before 7.3, but it was prone to failures which would not be reported to userspace and might have left the values partially updated. Starting with 7.3, only one region may be updated per write.&lt;/p&gt;

&lt;p&gt;And, finally, prior to 7.3, setting &lt;code&gt;dmem.max&lt;/code&gt; in a cgroup that was using more than the new setting would silently fail. Now, there is a mechanism that allows a reclaim mechanism to be triggered. That way, when a process writes to &lt;code&gt;dmem.max&lt;/code&gt; and sets a maximal value below the current usage, it will wait (unless &lt;code&gt;O_NONBLOCK&lt;/code&gt; is used) for the reclaim process to move objects out of VRAM until the usage gets below the maximal value. If that is not possible for some reason, the setting will still be in place, restricting further alloctions by that cgroup.&lt;/p&gt;                </content>
		<author>
			<name>Thadeu Lima de Souza Cascardo</name>
			<uri>https://cascardo.eti.br/tags/igalia/</uri>
		</author>
	</entry>

	<entry>
		<title>Seokho Song: Custom Highlight Universal Selector ::highlight(*)</title>
		<link rel="alternate" type="text/html" href="https://blog.seokho.dev/development/2026/10/20/CSS-Custom-Highlight-Universal-Selector.html"/>
		<id>https://blog.seokho.dev/development/2026/10/20/CSS-Custom-Highlight-Universal-Selector</id>
		<updated>2026-10-20T00:00:00+00:00</updated>
		<content type="html">
&lt;p&gt;I recently added a universal selector for CSS custom highlights, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;::highlight(*)&lt;/code&gt;, to the relevant CSS Specifications (the bulk of it is actually in &lt;a href=&quot;https://drafts.csswg.org/css-pseudo-4/&quot;&gt;CSS Pseudos&lt;/a&gt; not &lt;a href=&quot;https://drafts.csswg.org/css-highlight-api-1/&quot;&gt;CSS Custom Highlights&lt;/a&gt;) and implemented it in Chromium.&lt;/p&gt;

&lt;p&gt;It will ship in Chrome 158. This post introduces what it is and why it&#8217;s useful.&lt;/p&gt;

&lt;h2 id=&quot;what-are-css-custom-highlights&quot;&gt;What are CSS Custom Highlights?&lt;/h2&gt;

&lt;p&gt;CSS Custom Highlights allow you to style arbitrary ranges of text without wrapping them in extra elements.&lt;/p&gt;

&lt;p&gt;For example, you can write it for searching text:&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// ::highlight(search) { background-color: yellow } &lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ranges&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;matchOffsets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(([&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;StaticRange&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;startContainer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;textNode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;startOffset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                    &lt;span class=&quot;na&quot;&gt;endContainer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;   &lt;span class=&quot;nx&quot;&gt;textNode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;endOffset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;   &lt;span class=&quot;nx&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}))&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;CSS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;highlights&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Highlight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ranges&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// No DOM mutation: re-running the search replaces the registry entry&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note that this is a pseudo-element, so you can scope it to an element, like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;span::highlight(awesome)&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#foo::highlight(bar)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Custom Highlights have been Baseline newly available since June 2025, so every browser is shipping support for the above.&lt;/p&gt;

&lt;h2 id=&quot;whats-the-problem&quot;&gt;What&#8217;s the problem?&lt;/h2&gt;

&lt;p&gt;Until now, authors had to give a specific custom highlight name.&lt;/p&gt;

&lt;p&gt;But&#8230; what if we want to create a global rule that applies to all of the highlights?&lt;/p&gt;

&lt;p&gt;We had no particular way to reduce duplication.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  
&lt;span class=&quot;nd&quot;&gt;::highlight&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;spelling&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;  
  &lt;span class=&quot;nl&quot;&gt;text-decoration-color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;yellow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;text-decoration-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;underline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/* Duplicated! */&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;text-decoration-style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wavy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/* Duplicated! */&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;/* ... */&lt;/span&gt;

&lt;span class=&quot;nd&quot;&gt;::highlight&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;punctuation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;text-decoration-color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;red&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;text-decoration-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;underline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/* Duplicated! */&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;text-decoration-style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wavy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/* Duplicated! */&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;What if we need to change more than 20 duplicated styles?
This gets tedious, and it means that every shared change has to be made in several places.&lt;/p&gt;

&lt;h2 id=&quot;introducing-a-universal-selector-for-highlight&quot;&gt;Introducing a Universal Selector for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;::highlight&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;To solve the problem, &lt;a href=&quot;https://github.com/w3c/csswg-drafts/issues/9091&quot;&gt;CSSWG resolved&lt;/a&gt; to add a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*&lt;/code&gt; argument that matches every named highlight.&lt;/p&gt;

&lt;p&gt;On September 30, 2026, my &lt;a href=&quot;https://github.com/w3c/csswg-drafts/pull/14301&quot;&gt;spec PR&lt;/a&gt; was merged.&lt;/p&gt;

&lt;p&gt;Now the example above becomes:&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;::highlight&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; 
  &lt;span class=&quot;nl&quot;&gt;text-decoration-line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;underline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;text-decoration-style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wavy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
 
&lt;span class=&quot;nd&quot;&gt;::highlight&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;spelling&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;  
  &lt;span class=&quot;nl&quot;&gt;text-decoration-color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;yellow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nd&quot;&gt;::highlight&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;punctuation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;text-decoration-color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;red&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The result is the same as the above duplicated version, because all named custom highlights (spelling, punctuation) will use the styles from the universal (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*&lt;/code&gt;) one.&lt;/p&gt;

&lt;p&gt;Simple, isn&#8217;t it?&lt;/p&gt;

&lt;h3 id=&quot;highlight-has-zero-specificity&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;::highlight(*)&lt;/code&gt; has zero specificity&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://drafts.csswg.org/selectors/#specificity-rules&quot;&gt;CSS Selectors&lt;/a&gt; has a specificity algorithm that is used to calculate the &#8220;weight&#8221; of each rule, in order to determine which selector has more priority.&lt;/p&gt;

&lt;p&gt;Simply, when two rules set the same property, the cascade uses specificity to decide which one wins. See the detail in the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Cascade/Specificity&quot;&gt;MDN docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Highlights as widely deployed today (with a custom ident) have a specificity equivalent to using a tag name. However, we have modified that so that highlights using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*&lt;/code&gt; have zero specificity.&lt;/p&gt;

&lt;p&gt;On the implementation side, I explicitly return 0 when the argument is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;language-cpp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    
&lt;span class=&quot;kr&quot;&gt;inline&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CSSSelector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SpecificityForOneSelector&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;c1&quot;&gt;// ...&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;kPseudoHighlight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
          &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Argument&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;UniversalSelectorAtom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fallthrough&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Since zero is the lowest specificity, named custom highlights always win. (But &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;p::highlight(*)&lt;/code&gt; ties with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;::highlight(foo)&lt;/code&gt;, since &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;p&lt;/code&gt; has the equivalent specificity.)&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;::highlight&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; 
	&lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;red&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/* LOSE... */&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;blue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nd&quot;&gt;::highlight&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;foo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;green&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/* WIN! */&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;foo&lt;/code&gt; ends up with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;color: green&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;background-color: blue&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;a-fallback-for-every-highlight&quot;&gt;A fallback for every highlight&lt;/h3&gt;
&lt;p&gt;A highlight with no matching &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;::highlight()&lt;/code&gt; rule paints nothing. 
With &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;::highlight(*)&lt;/code&gt;, every registered highlight falls back to the universal rule, like a default custom highlight.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;
&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;style&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nd&quot;&gt;::highlight&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(*)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;red&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;p&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;target&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Hello, highlights!&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;selectNodeContents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;CSS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;highlights&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Highlight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The registered custom highlight &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bar&lt;/code&gt; will paint &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;color: red&lt;/code&gt; because it falls back to the universal one.&lt;/p&gt;

&lt;p&gt;For more on the API, see MDN &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/CSS_Custom_Highlight_API&quot;&gt;CSS Custom Highlight API&lt;/a&gt; (it may not be updated yet).&lt;/p&gt;

&lt;p&gt;On October 20, 2026, the Intent to Ship received three LGTMs from the Blink API owners, and I merged the shipping CL. This feature will be shipped in Chrome M158, scheduled for November 4, 2026.&lt;/p&gt;

&lt;p&gt;You can find the details in the &lt;a href=&quot;https://chromestatus.com/feature/5174965228929024&quot;&gt;feature entry&lt;/a&gt;, the &lt;a href=&quot;https://chromium-review.googlesource.com/c/chromium/src/+/8235619&quot;&gt;feature implementation&lt;/a&gt;, and the &lt;a href=&quot;https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/8577240&quot;&gt;DevTools support implementation&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;acknowledgments&quot;&gt;Acknowledgments&lt;/h2&gt;

&lt;p&gt;I&#8217;m thrilled to have worked on this from spec to shipping.&lt;/p&gt;

&lt;p&gt;Thanks to fantasai for reviewing the specification, to Rune for reviewing the Chromium patches, and to my colleague Stephen at Igalia. This work was funded by Bloomberg.&lt;/p&gt;                </content>
		<author>
			<name>Seokho Song (me@seokho.dev)</name>
			<uri>https://blog.seokho.dev/</uri>
		</author>
	</entry>

	<entry>
		<title>Igalia WebKit Team: WebKit Igalia Periodical #82</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/webkit/blog/2026/wip-82/"/>
		<id>https://blogs.igalia.com/webkit/blog/2026/wip-82/</id>
		<updated>2026-10-19T19:23:20+00:00</updated>
		<content type="html">
&lt;p&gt;Update on what happened in WebKit in the week from October 12 to October 19.&lt;/p&gt;
&lt;p&gt;
Another busy week for the team! This week we had a variety of fixes,
including the regular batch on the Layer-Based SVG Engine, a new pair
of properties for WPE WebKit, and a new ApplicationManifest API which
improves support for progressive web applications.
&lt;/p&gt;
&lt;h2 id=&quot;cross-port-cat&quot;&gt;Cross-Port &#128049;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/b42c00d76f85fa148475f562cd2593e282e3a1a4&quot;&gt;Add new ApplicationManifest&lt;/a&gt; API. This allows looking up the &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Manifest&quot;&gt;webmanifest&lt;/a&gt; for Progressive Web Applications.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;graphics-frame-photo&quot;&gt;Graphics &#128444;&#65039;&lt;/h3&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Fixed the repaint rects of SVG text using &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/vector-effect&quot;&gt;&lt;code&gt;vector-effect: non-scaling-stroke&lt;/code&gt;&lt;/a&gt;, first by &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/324037@main&quot;&gt;taking the scale into account&lt;/a&gt; in the Layer-Based SVG Engine (LBSE), which used to repaint a larger area than it paints for scaled-up text. A follow-up &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/324095@main&quot;&gt;made the decision per text run&lt;/a&gt;, since &lt;code&gt;vector-effect&lt;/code&gt; is not inherited and a &lt;code&gt;&amp;lt;tspan&amp;gt;&lt;/code&gt; inside a non-scaling &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt; paints a regular scaling stroke, and unified the computation so that the legacy SVG engine and LBSE now report identical repaint rects.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/323864@main&quot;&gt;Fixed the composited bounds&lt;/a&gt; of layers below pixel-moving CSS &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/filter&quot;&gt;&lt;code&gt;filter&lt;/code&gt;&lt;/a&gt; effects such as &lt;code&gt;blur()&lt;/code&gt; and &lt;code&gt;drop-shadow()&lt;/code&gt;, whose backing store previously missed the pixels the filter samples outside the clip. The clips above a layer are now expanded by the filter outsets of the layer and its ancestors, and a change to those outsets updates the composited bounds of all descendants. This change fixes the cross-platform part, and the CoreAnimation based ports, as well as GTK/WPE.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/323849@main&quot;&gt;Fixed repaints&lt;/a&gt; when an SVG element switches to a wider &lt;code&gt;clip-path&lt;/code&gt;, &lt;code&gt;mask&lt;/code&gt; or &lt;code&gt;filter&lt;/code&gt; in the Layer-Based SVG Engine (LBSE), which previously only repainted the area it covered before the change and left the newly revealed area stale. Style changes that alter the visual overflow now trigger a repaint of the new bounds as well.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/323840@main&quot;&gt;Fixed the repaint region&lt;/a&gt; of elements clipped by a &lt;code&gt;&amp;lt;clipPath&amp;gt;&lt;/code&gt; with a &lt;code&gt;transform&lt;/code&gt; attribute in the Layer-Based SVG Engine (LBSE), where changing that transform repainted the wrong area.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/323666@main&quot;&gt;Fixed &lt;code&gt;mix-blend-mode&lt;/code&gt;&lt;/a&gt; on a document-root &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; element in the Layer-Based SVG Engine (LBSE), which wrongly blended the page background along with the SVG contents. The blend mode is now applied to the SVG contents only, matching the legacy SVG engine.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/323837@main&quot;&gt;Fixed elements staying clipped&lt;/a&gt; on screen after their &lt;code&gt;&amp;lt;clipPath&amp;gt;&lt;/code&gt; was removed in the Layer-Based SVG Engine (LBSE), because the clipped elements were never repainted. Destroying an SVG resource now notifies its clients, which repaint the area the resource used to cover.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/323090@main&quot;&gt;Fixed hit testing&lt;/a&gt; of children inside transformed layered SVG groups in the Layer-Based SVG Engine (LBSE), where points outside a shape could hit it and transformed children could be missed entirely.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/323223@main&quot;&gt;Stopped recomputing the transform twice&lt;/a&gt; on nearly every layout of an SVG container without a layer in the Layer-Based SVG Engine (LBSE). The transform reference box is now remembered for such renderers when &lt;code&gt;transform-box&lt;/code&gt; is &lt;code&gt;view-box&lt;/code&gt; (the default), so the post-layout update only runs when the box actually moved.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/323818@main&quot;&gt;Fixed repaints of SVG groups and their content&lt;/a&gt; in the Layer-Based SVG Engine (LBSE), which previously left stale content on screen when something inside a &lt;code&gt;&amp;lt;g&amp;gt;&lt;/code&gt; moved or when the &lt;code&gt;&amp;lt;g&amp;gt;&lt;/code&gt; itself changed (a new transform / changed &lt;code&gt;clip-path&lt;/code&gt; etc.). Images, text and shapes now compute their final position during their own layout, and groups with a layer remember their transform so they repaint both the old and new area on change, which brings text repaints in transformed groups in line with the legacy SVG engine.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/323563@main&quot;&gt;Fixed painting&lt;/a&gt; of descendants with &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/visibility&quot;&gt;&lt;code&gt;visibility: visible&lt;/code&gt;&lt;/a&gt; inside hidden &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;foreignObject&amp;gt;&lt;/code&gt; elements in the Layer-Based SVG Engine (LBSE), which skipped the whole subtree, unlike the legacy SVG engine. Hidden &lt;code&gt;&amp;lt;g&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt; containers now also run the mask and clipping mask phases, so such descendants are masked and clipped as well.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;wpe-webkit-pager&quot;&gt;WPE WebKit &#128223;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;On WPE &lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/b42c00d76f85fa148475f562cd2593e282e3a1a4&quot;&gt;expose&lt;/a&gt; &lt;code&gt;WindowProperties:geometry&lt;/code&gt; and &lt;code&gt;WindowProperties:has-custom-geometry&lt;/code&gt; like GTK.&lt;/p&gt;
  &lt;/div&gt;
&lt;div class=&quot;wip-end&quot;&gt;
&lt;p&gt;That&#8217;s all for this week!&lt;/p&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Igalia WebKit Team</name>
			<uri>https://blogs.igalia.com/webkit</uri>
		</author>
	</entry>

	<entry>
		<title>Luke Lau: Cracking a popcount benchmark</title>
		<link rel="alternate" type="text/html" href="http://lukelau.me/2026/10/17/table-lookups.html"/>
		<id>http://lukelau.me/2026/10/17/table-lookups</id>
		<updated>2026-10-16T16:00:00+00:00</updated>
		<content type="html">
&lt;p&gt;Last month I woke up to a &lt;a href=&quot;https://cc-perf.igalia.com/db_default/v4/nts/1117&quot;&gt;fresh regression&lt;/a&gt; on llvm-test-suite where the automotive-bitcount benchmark was 46% slower on RISC-V.&lt;/p&gt;

&lt;p&gt;What had happened was that SLP began vectorizing the following sequence in a hot loop:&lt;/p&gt;

&lt;div class=&quot;language-nasm highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;andi&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xf&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;slli&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x38&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;slli&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x34&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;srli&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x3c&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s4&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s4&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;srli&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x3c&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;slli&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x30&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s4&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;srli&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x3c&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s4&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;slli&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x2c&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;srli&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x3c&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;lbu&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;lbu&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;a4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;lbu&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;a5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;lbu&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;a6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s4&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;slli&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x28&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;slli&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x24&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;srli&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x3c&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;srli&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x3c&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s4&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s4&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;lbu&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;a7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;lbu&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;t0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;lbu&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;t1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;srliw&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x1c&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s4&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a4&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;lbu&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;t2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a6&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t0&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a5&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;t1&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a7&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a4&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;addi&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xd&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;bne&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xaf8&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x2b0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To this indexed gather &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vluxei64.v&lt;/code&gt; of 8 elements on RISC-V:&lt;/p&gt;

&lt;div class=&quot;language-nasm highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;vsetvli&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;e64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;m4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ma&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;vmv.v.x&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a2&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;vsrl.vv&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v12&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;vand.vi&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xf&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;vsetvli&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;e8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;mf2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ma&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;vluxei64.v&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;s4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v16&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;vsetvli&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;e32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;m2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ma&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;vzext.vf4&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v20&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;vwaddu.wv&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v16&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;addi&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x1&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;addi&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xd&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;bnez&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xb04&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x2bc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;On the surface the new vectorized code looks pretty reasonable, but in reality the vectorized code takes 51.9M cycles whilst the original scalar only takes 12.3M. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vluxei64.v&lt;/code&gt; and other indexed memory operations are pretty slow on most available RISC-V hardware today, typically only processing elements one at a time, and to make matters worse we have to do a bunch of 64-bit pointer arithmetic at a wide LMUL too.&lt;/p&gt;

&lt;p&gt;So there was somewhere where we weren&#8217;t taking this into account in the cost model, either in the RISC-V backend or in the SLP vectorizer. Just as I was about to crank up the cost for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vluxei64.v&lt;/code&gt; I took a step back and looked at the original C source for that function.&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;...};&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ntbl_bitcount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0000000FUL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;
         &lt;span class=&quot;n&quot;&gt;bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x000000F0UL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;
         &lt;span class=&quot;n&quot;&gt;bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00000F00UL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;
         &lt;span class=&quot;n&quot;&gt;bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0000F000UL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;
         &lt;span class=&quot;n&quot;&gt;bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x000F0000UL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;
         &lt;span class=&quot;n&quot;&gt;bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00F00000UL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;
         &lt;span class=&quot;n&quot;&gt;bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0F000000UL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;24&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;
         &lt;span class=&quot;n&quot;&gt;bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xF0000000UL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)];&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;As it turns out, this function is just popcount: it computes the number of bits set in a 32-bit integer &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x&lt;/code&gt;. And we have an instruction for this on RISC-V, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cpop&lt;/code&gt;! So why aren&#8217;t we lowering to it?&lt;/p&gt;

&lt;p&gt;AggressiveInstCombine can recognise some forms of popcount that directly manipulate the bits of the input, but the twist in arithmetic-bitcount is that it uses a table lookup on precomputed values instead.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x&lt;/code&gt; comes in as a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;long&lt;/code&gt; but is cast to a 32-bit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int&lt;/code&gt;. The function then breaks up the 32-bit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;int&lt;/code&gt; into 4-bit nibbles, shifting and masking it with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0xF&lt;/code&gt;, and looks up the popcount of each 4-bit nibble. Then it returns the sum of the 4-bit popcounts.&lt;/p&gt;

&lt;p&gt;Doing it per-nibble is a nice approach as it keeps the accessed part of the lookup table small at just 16 bytes, so it should all fit inside a single cache line. But even if all 8 loads are L1 cache hits, it&#8217;s not as fast as a native &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cpop&lt;/code&gt; on RISC-V. So how can we match this pattern? Here&#8217;s the IR before we reach AggressiveInstCombine:&lt;/p&gt;

&lt;div class=&quot;language-llvm highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;vg&quot;&gt;@bits&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;internal&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;unnamed_addr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;constant&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;256&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;c&quot;\00\01\01\02\01\02\02\03\01\02\02\03\02\03\03\04\01\02\02\03\02\03\03\04\02\03\03\04\03\04\04\05\01\02\02\03\02\03\03\04\02\03\03\04\03\04\04\05\02\03\03\04\03\04\04\05\03\04\04\05\04\05\05\06\01\02\02\03\02\03\03\04\02\03\03\04\03\04\04\05\02\03\03\04\03\04\04\05\03\04\04\05\04\05\05\06\02\03\03\04\03\04\04\05\03\04\04\05\04\05\05\06\03\04\04\05\04\05\05\06\04\05\05\06\05\06\06\07\01\02\02\03\02\03\03\04\02\03\03\04\03\04\04\05\02\03\03\04\03\04\04\05\03\04\04\05\04\05\05\06\02\03\03\04\03\04\04\05\03\04\04\05\04\05\05\06\03\04\04\05\04\05\05\06\04\05\05\06\05\06\06\07\02\03\03\04\03\04\04\05\03\04\04\05\04\05\05\06\03\04\04\05\04\05\05\06\04\05\05\06\05\06\06\07\03\04\04\05\04\05\05\06\04\05\05\06\05\06\06\07\04\05\05\06\05\06\06\07\05\06\06\07\06\07\07\08&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;align&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;dso_local&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;signext&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2041&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@ntbl_bitcount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;noundef&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;local_unnamed_addr&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;#0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nl&quot;&gt;entry:&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%arrayidx&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;getelementptr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;inbounds&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%arrayidx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;align&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!tbaa&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!4&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;zext&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%0&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv3&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%arrayidx5&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;getelementptr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;inbounds&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv3&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%arrayidx5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;align&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!tbaa&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!4&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv6&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;zext&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%2&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv6&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%3&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;8&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv9&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%arrayidx11&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;getelementptr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;inbounds&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv9&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%4&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%arrayidx11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;align&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!tbaa&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!4&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv12&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;zext&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%4&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add13&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv12&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%5&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;12&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv16&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%arrayidx18&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;getelementptr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;inbounds&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv16&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%6&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%arrayidx18&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;align&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!tbaa&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!4&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv19&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;zext&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%6&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add20&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%add13&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv19&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%7&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;16&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv23&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%arrayidx25&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;getelementptr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;inbounds&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv23&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%8&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%arrayidx25&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;align&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!tbaa&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!4&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv26&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;zext&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%8&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add27&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%add20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv26&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%9&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;20&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv30&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%arrayidx32&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;getelementptr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;inbounds&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv30&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%10&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%arrayidx32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;align&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!tbaa&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!4&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv33&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;zext&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%10&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add34&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%add27&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv33&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%11&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;24&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv37&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%arrayidx39&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;getelementptr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;inbounds&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv37&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%12&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%arrayidx39&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;align&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!tbaa&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!4&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv40&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;zext&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%12&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add41&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%add34&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv40&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%13&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;28&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%idxprom45&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%13&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%arrayidx46&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;getelementptr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;inbounds&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%idxprom45&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%14&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%arrayidx46&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;align&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!tbaa&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;!4&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv47&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;zext&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%14&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add48&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%add41&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv47&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;ret&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%add48&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You could write one big optimisation to recognise the whole chain, but it&#8217;s often better practice to do things as smaller, composable chunks. Lets start with a smaller chunk of the IR, focusing on a single table lookup:&lt;/p&gt;

&lt;div class=&quot;language-llvm highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;nv&quot;&gt;%gep&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;getelementptr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;256&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@bits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%ctpop&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;load&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ptr&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%gep&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;What&#8217;s important to note is that any read outside of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@bits&lt;/code&gt; is &lt;a href=&quot;https://llvm.org/docs/LangRef.html#pointer-aliasing-rules&quot;&gt;undefined behaviour&lt;/a&gt;, so we&#8217;re free to assume that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;%x&lt;/code&gt; lies somewhere within it. So given a load from some global variable &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@bits&lt;/code&gt; and an index into it &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;%x&lt;/code&gt;, if every element in the global variable maps to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bits[i] = popcount(i)&lt;/code&gt;, then we can replace &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bits[%x]&lt;/code&gt; with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;popcount(%x)&lt;/code&gt;. Here&#8217;s the implementation in AggressiveInstCombine, landed in &lt;a href=&quot;https://github.com/llvm/llvm-project/pull/231225&quot;&gt;#231225&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;language-c++ highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;bool&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;tryToRecognizeTableBasedCtpop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;LoadInst&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;LI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AccessType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                                          &lt;span class=&quot;n&quot;&gt;GlobalVariable&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GVTable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                                          &lt;span class=&quot;n&quot;&gt;Value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GepIdx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;APInt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GEPScale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                                          &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DataLayout&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                                          &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TargetTransformInfo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TTI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;Type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IdxTy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GepIdx&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IdxBits&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IdxTy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getIntegerBitWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;LI&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isSimple&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isPowerOf2_32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IdxBits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;TTI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getPopcntSupport&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IdxBits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TargetTransformInfo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;PSK_FastHardware&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;// GEPScale = the i8 in getelementptr [256 x i8]&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// AccessSize = the i8 in load i8&lt;/span&gt;
  &lt;span class=&quot;kt&quot;&gt;uint64_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TableSize&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getTypeAllocSize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GVTable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getValueType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
  &lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AccessSize&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getTypeStoreSize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AccessType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GEPScale&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AccessSize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kt&quot;&gt;uint64_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;NumEntries&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TableSize&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AccessSize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  
  &lt;span class=&quot;c1&quot;&gt;// Is this a popcount table?&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;uint64_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;I&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;I&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;NumEntries&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;I&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;auto&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;C&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dyn_cast_or_null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ConstantInt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ConstantFoldLoadFromConst&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;GVTable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getInitializer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AccessType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;I&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GEPScale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;C&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;C&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;popcount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;I&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;// Zero extend or truncate as needed&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;replaceWithPopCount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;LI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GepIdx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;With a quick profitability query and a check to make sure we&#8217;re loading from a popcount table, we collapse a lookup into a call to the dedicated popcount intrinsic &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@llvm.ctpop&lt;/code&gt; (plus a truncate to get it back to the right size):&lt;/p&gt;

&lt;div class=&quot;language-llvm highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;nv&quot;&gt;%ctpop&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@llvm.ctpop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%ctpop.trunc&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;trunc&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%ctpop&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i8&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When applied to the IR from the benchmark we&#8217;re left with a chain of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctpop&lt;/code&gt;s all operating on 4-bit chunks at a time, summed together:&lt;/p&gt;

&lt;div class=&quot;language-llvm highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;dso_local&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;signext&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2041&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@ntbl_bitcount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;noundef&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;local_unnamed_addr&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;#0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nl&quot;&gt;entry:&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@llvm.ctpop.i64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;trunc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%0&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv3&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@llvm.ctpop.i64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv6&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;trunc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%2&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv1&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%3&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;8&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv9&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%4&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@llvm.ctpop.i64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv12&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;trunc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%4&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add13&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv12&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%5&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;12&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv16&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%6&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@llvm.ctpop.i64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv19&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;trunc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%6&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add20&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%add13&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv19&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%7&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;16&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv23&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%8&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@llvm.ctpop.i64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv23&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv26&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;trunc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%8&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add27&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%add20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv26&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%9&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;20&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv30&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%10&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@llvm.ctpop.i64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv33&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;trunc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%10&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add34&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%add27&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv33&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%11&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;24&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv37&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%12&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@llvm.ctpop.i64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv37&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv40&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;trunc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%12&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add41&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%add34&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv40&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%13&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;28&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%idxprom45&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%13&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%14&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@llvm.ctpop.i64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%idxprom45&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv47&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;trunc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%14&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add48&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%add41&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv47&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;ret&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%add48&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We&#8217;re still using 8 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctpop&lt;/code&gt;s to compute 1 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctpop&lt;/code&gt; though, so the next step is to merge these together.&lt;/p&gt;

&lt;p&gt;If we have &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctpop(X) + ctpop(Y)&lt;/code&gt; we can fold that into &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctpop(X | Y)&lt;/code&gt; if  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Y&lt;/code&gt; don&#8217;t share any set bits. For example, if &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X = 0b11110000&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Y = 0b00001111&lt;/code&gt;, because they&#8217;re disjoint we have &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctpop(X) + ctpop(Y) = ctpop(0b11111111) = 8&lt;/code&gt;. This combine already exists in InstCombine:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &lt;span class=&quot;c1&quot;&gt;// ctpop(A) + ctpop(B) =&amp;gt; ctpop(A | B) if A and B have no bits set in common.&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;LHS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m_OneUse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Ctpop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
     &lt;span class=&quot;n&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;RHS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m_OneUse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Ctpop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
     &lt;span class=&quot;n&quot;&gt;haveNoCommonBitsSet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SQ&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getWithInstruction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;I&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;replaceInstUsesWith&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
       &lt;span class=&quot;n&quot;&gt;I&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Builder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CreateIntrinsic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Intrinsic&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ctpop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;I&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()},&lt;/span&gt;
                                  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Builder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CreateDisjointOr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)}));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But our motivating IR is slightly different. We have &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctpop(X &amp;amp; 0xf) + ctpop((X &amp;gt;&amp;gt; 4) &amp;amp; 0xf) + ctpop((X &amp;gt;&amp;gt; 8) &amp;amp; 0xf) + ...&lt;/code&gt;. Each 4-bit nibble overlaps in the same least significant bits which prevents the fold above, but:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;the individual bits that we extract from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X&lt;/code&gt; are distinct.&lt;/li&gt;
  &lt;li&gt;it doesn&#8217;t matter where the bits are placed in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctpop&lt;/code&gt;. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctpop(X)&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctpop(X &amp;lt;&amp;lt; 4)&lt;/code&gt; give the same result as long as no bits of X are shifted out.&lt;/li&gt;
  &lt;li&gt;we know that we can fold &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctpop(X) + ctpop(Y) -&amp;gt; ctpop(X | Y)&lt;/code&gt; when the bits are distinct.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So what we can do is shift back up the bits of X up so that they&#8217;re now in distinct bit positions, which allows us to do the earlier fold that combines the add:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ctpop(X &amp;amp; 0x0f) + ctpop((X &amp;gt;&amp;gt; 4) &amp;amp; 0xf)
=&amp;gt;
; shift the bits back up so they don't overlap
ctpop(X &amp;amp; 0x0f) + ctpop(((X &amp;gt;&amp;gt; 4) &amp;amp; 0xf) &amp;lt;&amp;lt; 4)
=&amp;gt;
ctpop(X &amp;amp; 0x0f) + ctpop(X &amp;amp; 0xf0)
=&amp;gt;
ctpop(X &amp;amp; (0x0f | 0xf0))
=&amp;gt;
ctpop(X &amp;amp; 0xff)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We can generalise this to arbitrary shifts and masks, and then we get this code in InstCombine (&lt;a href=&quot;https://github.com/llvm/llvm-project/pull/231321&quot;&gt;#231321&lt;/a&gt;):&lt;/p&gt;

&lt;div class=&quot;language-c++ highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;/// Given (X &amp;gt;&amp;gt; C) &amp;amp; M, returns {X, M &amp;lt;&amp;lt; C} (the source and a mask of what bits&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// of the source are in \p V).&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;std&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pair&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;APInt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;matchMaskedBits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;V&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BitWidth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;V&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getScalarSizeInBits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;APInt&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Mask&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;APInt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getAllOnes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BitWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;Value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Src&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;APInt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;M&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kt&quot;&gt;uint64_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ShAmt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;V&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m_And&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Src&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m_APInt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;M&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;V&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Src&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Mask&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;M&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;V&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m_LShrOrSelf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Src&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ShAmt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ShAmt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BitWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;V&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Src&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Mask&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ShAmt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;V&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Mask&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;/// ctpop((X &amp;gt;&amp;gt; C1) &amp;amp; M1) + ctpop((X &amp;gt;&amp;gt; C2) &amp;amp; M2)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// =&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// ctpop(X &amp;amp; ((M1 &amp;lt;&amp;lt; C1) | (M2 &amp;lt;&amp;lt; C2))) if M1 &amp;lt;&amp;lt; C1 and M2 &amp;lt;&amp;lt; C2 are disjoint&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;foldAddOfMaskedCtpops&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BinaryOperator&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;I&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                                    &lt;span class=&quot;n&quot;&gt;InstCombiner&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BuilderTy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Builder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;Value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;I&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getOperand&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m_OneUse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Ctpop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;I&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getOperand&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m_OneUse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Ctpop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))))&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;nullptr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;auto&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;XA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MaskA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;matchMaskedBits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;auto&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;XB&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MaskB&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;matchMaskedBits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;XA&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;XB&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MaskA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;intersects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MaskB&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;nullptr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;Value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Masked&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Builder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CreateAnd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;XA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MaskA&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MaskB&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Builder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CreateUnaryIntrinsic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Intrinsic&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ctpop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Masked&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If we try this out: Nothing changes! We don&#8217;t actually match the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctpop(X &amp;amp; 0x0f) + ctpop((X &amp;gt;&amp;gt; 4) &amp;amp; 0xf)&lt;/code&gt; pattern here because there&#8217;s truncates in between.&lt;/p&gt;

&lt;div class=&quot;language-llvm highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;nv&quot;&gt;%conv&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@llvm.ctpop.i64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;trunc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%0&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv3&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@llvm.ctpop.i64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv6&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;trunc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%2&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv1&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We can strip off the individual truncates by pulling them outside of the adds in InstCombine (&lt;a href=&quot;https://github.com/llvm/llvm-project/pull/231332&quot;&gt;#231332&lt;/a&gt;):&lt;/p&gt;

&lt;div class=&quot;language-c++ highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;c1&quot;&gt;// trunc(ctpop(A)) + trunc(ctpop(B)) =&amp;gt; trunc(ctpop(A) + ctpop(B))&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;LHS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m_OneUse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Trunc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m_Ctpop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())))))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;RHS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m_OneUse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Trunc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m_Ctpop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_Value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())))))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;TruncInst&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Builder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CreateAdd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;I&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Which now gives us the right shape for our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctpop&lt;/code&gt; pattern:&lt;/p&gt;

&lt;div class=&quot;language-llvm highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;nv&quot;&gt;%conv&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@llvm.ctpop.i64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lshr&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%conv3&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@llvm.ctpop.i64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%conv3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%3&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%0&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;trunc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%3&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And finally the entire function folds away to one call:&lt;/p&gt;

&lt;div class=&quot;language-llvm highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;dso_local&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;signext&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;33&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@ntbl_bitcount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;noundef&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;local_unnamed_addr&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;#0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nl&quot;&gt;entry:&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4294967295&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;33&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;@llvm.ctpop.i64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;%add48&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;trunc&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nuw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;nsw&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i64&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;ret&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;i32&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;%add48&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Which gives us a single RISC-V instruction:&lt;/p&gt;

&lt;div class=&quot;language-nasm highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nl&quot;&gt;ntbl_bitcount:&lt;/span&gt;                          &lt;span class=&quot;err&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ntbl_bitcount&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;.cfi_startproc&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;bb.0:&lt;/span&gt;                                &lt;span class=&quot;err&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;entry&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;cpopw&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;a0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a0&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;ret&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;As an added bonus, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ntbl_bitcount&lt;/code&gt; is inlined within the loop its called from. So if we&#8217;re compiling with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Zvbb&lt;/code&gt; (which &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rva23u64&lt;/code&gt; contains), the loop vectorizer is able to kick in and we get a vectorized reduction using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vcpop.v&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-nasm highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;bb.1:&lt;/span&gt;                                &lt;span class=&quot;err&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;vector.ph&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vsetvli&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;a2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;e64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;m2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ma&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vmv.v.x&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;v10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a0&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vid.v&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;v8&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;li&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;a0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;13&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vmadd.vx&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;v8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v10&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vmv.v.i&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;v10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;li&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;a0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;srli&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;a0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;32&lt;/span&gt;
&lt;span class=&quot;nl&quot;&gt;.LBB1_2:&lt;/span&gt;                                &lt;span class=&quot;err&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;vector.body&lt;/span&gt;
                                        &lt;span class=&quot;err&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;This&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Inner&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Loop&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Depth&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vsetvli&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;a2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;e64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;m2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ma&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vand.vx&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;v12&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a0&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vcpop.v&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;v12&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v12&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;sh1add&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a2&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vsetvli&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;e64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;m2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;tu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ma&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vadd.vv&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;v10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v12&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v10&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;sh2add&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a2&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vsetvli&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;e64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;m2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ma&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vadd.vx&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;v8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a3&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;sub&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;a2&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;bnez&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;.LBB1_2&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;bb.3:&lt;/span&gt;                                &lt;span class=&quot;err&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;for.cond.cleanup.loopexit&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vsetvli&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;a0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;e64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;m2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ma&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vmv.s.x&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;v8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;zero&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vredsum.vs&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;v8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v8&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;vmv.x.s&lt;/span&gt;	&lt;span class=&quot;nv&quot;&gt;a0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;v8&lt;/span&gt;
	&lt;span class=&quot;nf&quot;&gt;ret&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The final &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vcpop.v&lt;/code&gt; reduction is a mighty 115x times faster than the original SLP vectorized version as measured on a SpacemiT-K3. Not bad!&lt;/p&gt;

&lt;p&gt;Now with all this said, automotive-bitcount as a benchmark is very artificial. It just consists of a bunch of different implementations of popcount, each executed in a loop. However out of the 8 implementations, with these patches LLVM is able to lower 6 of them to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;llvm.ctpop&lt;/code&gt; intrinsics. In fact LLVM&#8217;s AggressiveInstCombine can already recognise various implementations of popcount, and there&#8217;s a whole zoo of different formats that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tryToRecognizePopCount&lt;/code&gt;/&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tryToRecognizePopCount1&lt;/code&gt;/&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tryToRecognizePopCount2n3&lt;/code&gt; detect:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;popcount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x55555555&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x33333333&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x33333333&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0F0F0F0F&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x01010101&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;24&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;popcnt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x55555555&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x33333333&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x33333333&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0F0F0F0F&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0000003F&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;popcnt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x55555555&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x33333333&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0F0F0F0F&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0000003F&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Ref. Hackers Delight&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;popcount32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x55555555&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x55555555&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x33333333&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x33333333&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0F0F0F0F&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0F0F0F0F&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00FF00FF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00FF00FF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0000FFFF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;popcount64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x5555555555555555&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x5555555555555555&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x3333333333333333&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x3333333333333333&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0F0F0F0F0F0F0F0F&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0F0F0F0F0F0F0F0F&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00FF00FF00FF00FF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00FF00FF00FF00FF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0000FFFF0000FFFF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0000FFFF0000FFFF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00000000FFFFFFFF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uWord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00000000FFFFFFFF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Try as you might to be clever with your magic constants and fancy bit shifts, LLVM sees through it all and steamrolls over it it with relish.&lt;/p&gt;

&lt;p&gt;I invite anyone to try and tackle the remaining two, &lt;a href=&quot;https://github.com/llvm/llvm-test-suite/blob/95569a773206d4ea96522bec400817478efa1511/MultiSource/Benchmarks/MiBench/automotive-bitcount/bitcnts.c#L45-L54&quot;&gt;bitcount and bit_shifter&lt;/a&gt;, since even though this series of patches stemmed from an artificial benchmark the table lookup popcount pattern shows up in a few places in the real world, notably &lt;a href=&quot;https://github.com/redis/redis/blob/e0bb9316848db7950c2b18cdc59c2058f62b8a3d/src/bitops.c#L55-L69&quot;&gt;Redis&lt;/a&gt; and &lt;a href=&quot;https://github.com/gcc-mirror/gcc/blob/af927b3bb7b08f5f164ed700f86c597d5867b2fb/gcc/bitmap.cc#L1083-L1093&quot;&gt;GCC&lt;/a&gt;. So sometimes chasing down these benchmarks can be for both fun and profit!&lt;/p&gt;                </content>
		<author>
			<name>Luke Lau</name>
			<uri>http://lukelau.me/</uri>
		</author>
	</entry>

	<entry>
		<title>Jan Varga: A Different Coordinate System</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/jvarga/a-different-coordinate-system/"/>
		<id>https://blogs.igalia.com/jvarga/a-different-coordinate-system/</id>
		<updated>2026-10-16T00:00:00+00:00</updated>
		<content type="html">
&lt;p&gt;I&#8217;ve spent most of my career working on Gecko, the browser engine behind
Firefox. Years in a big, mature codebase teach you a lot. You learn how things
fit together, where the hard problems hide, and which ideas have already been
tried (sometimes more than once).&lt;/p&gt;
&lt;p&gt;They also change how you think, and you don&#8217;t really notice it happening. Some
abstractions become so familiar that they stop looking like design choices.
Threading models, IPC boundaries, ownership rules, API layers: after a while,
that&#8217;s just how things are done. Most of the time this helps. But it also makes
it harder to imagine doing things any other way.&lt;/p&gt;
&lt;p&gt;Getting involved with Servo was one of the reasons I joined Igalia. Early in my
career, there was a point where I finally understood enough of Gecko to make
real changes in it. It took a while, and I remember how good that felt.&lt;/p&gt;
&lt;p&gt;Working on Servo gave me some of that feeling again. Obviously I knew a lot
more this time. Still, I was back to reading unfamiliar code and slowly
figuring out how a browser engine works, only now most of it was Rust. A lot of
the problems looked familiar to me, mostly storage, concurrency and async
stuff. But the code around them was organized differently, and I kept running
into things I&#8217;d stopped thinking about years ago.&lt;/p&gt;
&lt;p&gt;Rust is a big part of why. The compiler wants you to be explicit about who owns
what and how long it lives. In C++, I&#8217;ve become used to certain ownership
patterns over the years. Rust made me think about some of them again, and a
few times I realized that the design I had in mind wasn&#8217;t as obvious as I
thought.&lt;/p&gt;
&lt;p&gt;Comparing the two engines is interesting in itself. Gecko has decades of
development, compatibility requirements and real-world experience behind it.
Servo tackles many of the same problems with different abstractions and
constraints. I think Servo has a lot of potential, and working with both
engines has made me rethink some of the assumptions I&#8217;d developed over the
years.&lt;/p&gt;
&lt;p&gt;After so many years of maintaining production code, it&#8217;s refreshing to be a
beginner again in some areas. The experience is still there, but it&#8217;s easier to
ask basic questions. Why is this boundary here? Does this operation really need
to be async? Do we actually need this lock?&lt;/p&gt;
&lt;p&gt;I especially enjoyed asking those questions while helping with IndexedDB in
Servo. I&#8217;ve worked on IndexedDB in Gecko for many years, so seeing it built in
another engine made me look at old decisions differently.&lt;/p&gt;
&lt;p&gt;Threading is a good example. In Gecko, IndexedDB work can be spread across a
pool of up to 20 threads, and I&#8217;d always assumed more parallelism was better.
Then I ran some cross-browser comparisons under heavy multi-database load and,
out of curiosity, limited Firefox to a single thread. In that test, the
single-threaded configuration finished fastest. I didn&#8217;t expect that at all. It
opened up questions about responsiveness and scheduling that I&#8217;d like to
explore in Servo some day. That&#8217;s probably worth a separate post.&lt;/p&gt;
&lt;p&gt;Lately, other projects, mostly on Firefox, have kept me busy, so I haven&#8217;t had
much time for Servo. But I&#8217;m looking forward to getting back to it. Some of the
work there was new to me, but what I enjoyed most was seeing familiar things
again, from a different angle.&lt;/p&gt;                </content>
		<author>
			<name>Jan Varga</name>
			<uri>https://blogs.igalia.com/jvarga/jvarga/</uri>
		</author>
	</entry>

	<entry>
		<title>Eric Meyer: My Interop 2027 Rankings</title>
		<link rel="alternate" type="text/html" href="https://meyerweb.com/eric/thoughts/2026/10/14/my-interop-2027-rankings/"/>
		<id>https://meyerweb.com/eric/thoughts/?p=5795</id>
		<updated>2026-10-14T18:14:15+00:00</updated>
		<content type="html">
&lt;p&gt;The proposal period for Interop 2027 closed in late September, which
means the Interop team is now in the process of working through all the
proposals and ultimately deciding which will be taken on next year.&#160; Part
of that process is looking at &#8220;developer signals&#8221;, which is a loose
amalgamation of &#8220;State of&#8230;&#8221; survey results, feedback gathered by
developer relations teams, blog posts, YouTube videos, and so on.&lt;/p&gt;

&lt;p&gt;A relatively new tool is &lt;a href=&quot;https://interop-rank.fxdx.dev/&quot;&gt;Jake Archibald&#8217;s ranking
tool&lt;/a&gt;, where anyone with a Github login can add any of the ~150
proposals to a ranking list, then order them in the priority you would
give them if the decision were solely yours.&#160; The results will be
anonymized and shared with the Interop team.&lt;/p&gt;

&lt;p&gt;A number of people (like
&lt;a href=&quot;https://ohhelloana.blog/my-interop-2027/&quot;&gt;Ana&lt;/a&gt;,
&lt;a href=&quot;https://vale.rocks/micros/20261011-0700&quot;&gt;Declan&lt;/a&gt;,
&lt;a href=&quot;https://pawelgrzybek.com/my-interop-2027-picks/&quot;&gt;Pawe&#322;&lt;/a&gt;,
&lt;a href=&quot;https://www.sarasoueidan.com/blog/interop-2027-rankings/&quot;&gt;Sara&lt;/a&gt;,
&lt;a href=&quot;https://www.alwaystwisted.com/articles/and-thats-my-rank-2027-edition&quot;&gt;Stuart&lt;/a&gt;,
and
&lt;a href=&quot;https://tylersticka.com/journal/interop-2027-rank/&quot;&gt;Tyler&lt;/a&gt;)
have blogged about their rankings, and I love a good web standards
bandwagon, so here&#8217;s my bloggery!&#160; And if you&#8217;d like to hear me talk about all this,
&lt;a href=&quot;https://igalia.com/chats/interop2027&quot;&gt;head on over to Igalia Chats&lt;/a&gt; to give it a listen.&#160; And maybe even a subscribe!&lt;/p&gt;


&lt;p&gt;&lt;strong&gt;To be crystal clear:&lt;/strong&gt; these are my &lt;em&gt;personal&lt;/em&gt;
rankings, and do not predict or even affect how I will vote as &lt;a href=&quot;https://igalia.com&quot;&gt;Igalia&lt;/a&gt;&#8217;s representative to Interop.&#160; In
fact, it&#8217;s almost certain that I will, at some point in the process,
vote to cut more than one of the things I&#8217;ve ranked here, or at least
will not vote to advance them to the next step in the process.&#160; That&#8217;s
how Interop goes, given that there are an order of magnitude more
proposals than the teams have the resources to accept.&lt;/p&gt;


&lt;p&gt;First, let&#8217;s go with my Top Five, in order.&lt;/p&gt;

&lt;h3 id=&quot;javascript-temporal&quot;&gt;#1: &lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1381&quot;&gt;JavaScript
&lt;code&gt;Temporal&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;You might think I&#8217;m picking this one because Igalia has been a large
part of getting the standard finished and support into browsers, but I
actually ranked it first because it is it just such a huge step forward.&#160; I don&#8217;t write much JS, but even I know the &lt;code&gt;Date&lt;/code&gt; object is
terrible.&#160; The Temporal API is so much better, it&#8217;s hard to overstate.&#160; It
understands time zones, summer times, and even historical changes like
the exact moment a given country changed time zones.&#160; I can&#8217;t find
anything else in the list that I think is more deserving of all-browser
all-out effort to implement and make interoperable.&lt;/p&gt;

&lt;h3 id=&quot;improve-css-sibling-count-and-sibling-index-functions-interop.&quot;&gt;#2:
&lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1460&quot;&gt;Improve
CSS &lt;code&gt;sibling-count()&lt;/code&gt; and &lt;code&gt;sibling-index()&lt;/code&gt;
functions interop.&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This gets my second-place ranking because it is, to me, the essence
of the perfect Interop proposal.&#160; In Jake&#8217;s ranking tool, the summary for
this proposal is literally &#8220;Fix remaining test failures.&#8221; The proposal
itself says &#8220;These functions are shipped in all engines, but all have
[&lt;a href=&quot;https://wpt.fyi&quot;&gt;WPT&lt;/a&gt;] failures.&#8221; That&#8217;s what Interop is
&lt;em&gt;for&lt;/em&gt;, in my opinion.&#160; The thing exists, but needs a bit more work
to be truly interoperable.&lt;/p&gt;

&lt;h3 id=&quot;css-box-decoration-break-without-a-vendor-prefix&quot;&gt;#3: &lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1391&quot;&gt;CSS
&lt;code&gt;box-decoration-break&lt;/code&gt; without a vendor prefix&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This proposal gets the bronze medal from me for similar reasons the
previous proposal grabbed silver.&#160; In this case, we have a long-supported
feature that still has a vendor prefix clinging to it.&#160; Unprefix it,
already!&lt;/p&gt;

&lt;h3 id=&quot;html-headingoffset-and-headingreset-attributes&quot;&gt;#4: &lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1412&quot;&gt;HTML
&lt;code&gt;headingoffset&lt;/code&gt; and &lt;code&gt;headingreset&lt;/code&gt;
attributes&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This one&#8217;s emblematic of another role Interop has taken on over the
years, which is to get an up-and-coming feature interoperable from the
outset.&#160; Here, the ability to use HTML attributes to shift how heading
levels are treated is already behind flags in two browsers.&#160; Having the
browser teams agree to all work on the same thing at the same time would
help find any problems early, and get them fixed before the feature
comes out from behind the flags.&#160; I&#8217;ll also admit my personal ranking of
this is a little bit influenced by the fact that it would help me fix
problems on this very web site &amp;#x202F;&#8212;&amp;#x2009;&#160;indeed, in this very blog post&amp;#x202F;&#8212;&amp;#x2009;but it
would help a lot of others as well, such as Github.&lt;/p&gt;

&lt;h3 id=&quot;css-line-clamp-property-and-css-margin-trim&quot;&gt;#5: &lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1379&quot;&gt;CSS
&lt;code&gt;line-clamp&lt;/code&gt; property&lt;/a&gt; and &lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1444&quot;&gt;CSS
&lt;code&gt;margin-trim&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Okay, I cheated a little here by combining two proposals for this
article.&#160; In my actual ranking in Jake&#8217;s tool, I ranked them #5 and #6,
because I think if you&#8217;re going to clamp lines, you&#8217;re probably also
going to want to trim margins.&#160; I like the capabilities line-clamping
enables (and I&#8217;d think that even if Igalia weren&#8217;t one of the drivers of
its implementation), and I imagine that if you&#8217;re limiting an element&#8217;s
height to a certain number of lines of text, you&#8217;re probably trying to
make things on the page adhere to a vertical rhythm and you don&#8217;t want
inner margins possibly messing things up.&#160; Maybe I&#8217;m off base conflating
the two, but it feels right to me.&lt;/p&gt;

&lt;hr /&gt;
&lt;p&gt;So there you go, that&#8217;s my top five or six rankings.&#160; I ended up
ranking twenty proposals in all, triggering a friendly &#8220;whoooa there,
big fella&#8221;&#160;warning from the ranking tool.&#160; Here are the rest of what I
put on the list, grouped by high-level area and then sub-sorted in
roughly alphabetical order, with exceptions to group like topics
together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1465&quot;&gt;Trusted
Types&lt;/a&gt; &amp;#x202F;&#8212;&amp;#x2009;&#160;Support is already pretty good, but there are gaps, and this
helps a lot with security.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1355&quot;&gt;DOM
&lt;code&gt;moveBefore()&lt;/code&gt;&lt;/a&gt; &amp;#x202F;&#8212;&amp;#x2009;&#160;I ran into the lack of this when I was
&lt;a href=&quot;https://meyerweb.com/eric/thoughts/2026/04/27/canvas-ing-the-web/&quot;&gt;messing around with HTML-in-canvas&lt;/a&gt;.&#160; I&#8217;d love to see it
cross-browser.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1440&quot;&gt;DOM
Viewport Segments API&lt;/a&gt; &amp;#x202F;&#8212;&amp;#x2009;&#160;This seems useful, given the existence of
devices like Galaxy Fold and iPhone Duo.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1378&quot;&gt;Improve
interoperability of the WebCodecs API&lt;/a&gt; &amp;#x202F;&#8212;&amp;#x2009;&#160;Browsers use this, services
use this, interoperability is sub-standard.&#160; Let&#8217;s fix it.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1457&quot;&gt;CSS
anchor positioning with transforms and animations&lt;/a&gt; &amp;#x202F;&#8212;&amp;#x2009;&#160;Animating anchor
positioning seems like a thing people will want to do, so let&#8217;s make
sure browsers are consistent about it.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1394&quot;&gt;CSS
color gamut mapping&lt;/a&gt; &amp;#x202F;&#8212;&amp;#x2009;&#160;It turns out that the visual appearance of
color varies greatly depending on a thousand factors, and gamut mapping
would help resolve at least some of them.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1368&quot;&gt;CSS
&lt;code&gt;corner-shape&lt;/code&gt; property&lt;/a&gt; &amp;#x202F;&#8212;&amp;#x2009;&#160;It&#8217;s been too hard for too long
to create scalloped, beveled, and other not-ovoid corners.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1418&quot;&gt;CSS
&lt;code&gt;polygon()&lt;/code&gt; vertex rounding&lt;/a&gt;&amp;#x202F;&#8212;&amp;#x2009;I&#8217;d love to be able to
round the corners of a polygon, rather than have to construct an arc
path or even a &lt;code&gt;shape()&lt;/code&gt; value.&#160; This is of a piece with
&lt;code&gt;corner-shape&lt;/code&gt;, in my view.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1371&quot;&gt;CSS
&lt;code&gt;border-shape&lt;/code&gt; property&lt;/a&gt; &amp;#x202F;&#8212;&amp;#x2009;&#160;And while we&#8217;re at it, how
about we make it easier to shape the whole of the border area?&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1374&quot;&gt;CSS gap
decorations&lt;/a&gt; &amp;#x202F;&#8212;&amp;#x2009;&#160;Ever since we got Grid layout, I&#8217;ve wanted to be able
to draw decorations into the gaps, similar to &lt;code&gt;column-rule&lt;/code&gt;
in CSS Multicolumn.&#160; Doing it now requires essentially spacer-GIF
hackery, and I&#8217;d rather not have to do that.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1445&quot;&gt;CSS
grid lanes (masonry)&lt;/a&gt; &amp;#x202F;&#8212;&amp;#x2009;&#160;Masonry (or waterfall) layouts are
surprisingly common, and being able to do it in CSS is finally coming,
so let&#8217;s make sure it&#8217;s interoperable.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1346&quot;&gt;CSS
linked parameters&lt;/a&gt; &amp;#x202F;&#8212;&amp;#x2009;&#160;You know that thing where you can&#8217;t have your
page&#8217;s CSS change the stroke or fill colors of an external SVG?&#160; This
would fix that.&#160; Put it in my vein!&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1384&quot;&gt;CSS
transitioning/animating &lt;code&gt;display&lt;/code&gt; and
&lt;code&gt;content-visibility&lt;/code&gt;&lt;/a&gt; &amp;#x202F;&#8212;&amp;#x2009;&#160;The desire to transition from and
to &lt;code&gt;display: none&lt;/code&gt; has existed for about as long as CSS
transitions have existed, and I&#8217;d love to see it interoperable so people
can use it comfortably.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/web-platform-tests/interop/issues/1344&quot;&gt;CSS
&lt;code&gt;var()&lt;/code&gt; in size container queries&lt;/a&gt; &amp;#x202F;&#8212;&amp;#x2009;&#160;If wanting to say
&lt;code&gt;@container (width&amp;lt;= var(--min-width))&lt;/code&gt; has kept you using
a CSS preprocessor, this would free you.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That&#8217;s where I ended.&#160; There were a few I didn&#8217;t rank because I&#8217;m
pretty confident they&#8217;re already going to get strong ranking support.&#160; There were a few I wanted to rank, but couldn&#8217;t in good conscience
because they had no standard, no evidence of browser interest, or
neither of those.&#160; And in all honesty, there were some that didn&#8217;t get on
my list because I think they&#8217;re bad or terribly formed ideas.&lt;/p&gt;

&lt;p&gt;How about you &amp;#x202F;&#8212;&amp;#x2009;&#160;what are your favorites?&#160; &lt;a href=&quot;https://interop-rank.jakearchibald.com/&quot;&gt;Go rank them&lt;/a&gt;, blog
them, and spread the word however you can.&lt;/p&gt;
	&lt;hr /&gt;&lt;p&gt;Have something to say to all that?  You can &lt;a href=&quot;https://meyerweb.com/eric/thoughts/2026/10/14/my-interop-2027-rankings/#commentform&quot;&gt;add a comment to the post&lt;/a&gt;, or &lt;a href=&quot;mailto:eric@meyerweb.com?subject=In%20reply%20to%20%22My%20Interop%202027%20Rankings%22&quot;&gt;email Eric directly&lt;/a&gt;.&lt;/p&gt;                </content>
		<author>
			<name>Eric Meyer</name>
			<uri>https://meyerweb.com/eric/thoughts</uri>
		</author>
	</entry>

	<entry>
		<title>Igalia WebKit Team: WebKit Igalia Periodical #81</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/webkit/blog/2026/wip-81/"/>
		<id>https://blogs.igalia.com/webkit/blog/2026/wip-81/</id>
		<updated>2026-10-12T19:21:40+00:00</updated>
		<content type="html">
&lt;p&gt;Update on what happened in WebKit in the week from October 5 to October 12.&lt;/p&gt;
&lt;p&gt;
A CSS invalidation bugfix, moving steps for optgroup and hr elements,
and a handful of fixes to the Layer-Based SVG Engine compose this week's
bag of updates, changing to a calmer pace compared to the packed weeks
we've had recently!
&lt;/p&gt;
&lt;h2 id=&quot;cross-port-cat&quot;&gt;Cross-Port &#128049;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/323044@main&quot;&gt;Fixed&lt;/a&gt; various CSS selector invalidation when an element is moved.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/323397@main&quot;&gt;Add&lt;/a&gt; moving steps for &lt;code&gt;optgroup&lt;/code&gt; and &lt;code&gt;hr&lt;/code&gt; elements.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;graphics-frame-photo&quot;&gt;Graphics &#128444;&#65039;&lt;/h3&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/323088@main&quot;&gt;Fixed &lt;code&gt;buffered-rendering=&quot;static&quot;&lt;/code&gt;&lt;/a&gt; for SVG &lt;code&gt;&amp;lt;image&amp;gt;&lt;/code&gt; elements in the Layer-Based SVG Engine (LBSE), where the image used to be drawn at the wrong position inside its offscreen buffer and without its own transform. The image is now painted into the buffer relative to its own position, and the buffer is drawn back with the current transformation, which matches the behaviour of the legacy SVG engine.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/323089@main&quot;&gt;Added support for &lt;code&gt;pointer-events: bounding-box&lt;/code&gt;&lt;/a&gt; on SVG text in the Layer-Based SVG Engine (LBSE), so clicks that miss every glyph now fall back to hitting the text's bounding box (see &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events&quot;&gt;&lt;code&gt;pointer-events&lt;/code&gt;&lt;/a&gt;). It also fixed hit testing of transformed children in SVG containers, which were being tested a second time without their transforms.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/322884@main&quot;&gt;Fixed text not following its path&lt;/a&gt; in the Layer-Based SVG Engine (LBSE) when a &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/SVG/Element/textPath&quot;&gt;&lt;code&gt;&amp;lt;textPath&amp;gt;&lt;/code&gt;&lt;/a&gt; points to a path that doesn't exist yet. The text is now laid out along the path as soon as that path appears in the document, which also covers removing and re-adding the path or changing &lt;code&gt;href&lt;/code&gt; to another path.&lt;/p&gt;
  &lt;/div&gt;
&lt;div class=&quot;wip-end&quot;&gt;
&lt;p&gt;That&#8217;s all for this week!&lt;/p&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Igalia WebKit Team</name>
			<uri>https://blogs.igalia.com/webkit</uri>
		</author>
	</entry>

	<entry>
		<title>Manuel Rego: aamtest: Testing accessibility in WPT</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/mrego/aamtest-testing-accessibility-in-wpt/"/>
		<id>https://blogs.igalia.com/mrego/aamtest-testing-accessibility-in-wpt/</id>
		<updated>2026-10-09T00:00:00+00:00</updated>
		<content type="html">
code {
    word-wrap: anywhere;
  }

&lt;p&gt;Testing in the web platform is done in many different ways, but a very important one is through the &lt;a href=&quot;https://github.com/web-platform-tests/wpt/&quot;&gt;&lt;strong&gt;Web Platform Tests (WPT)&lt;/strong&gt; repository&lt;/a&gt;, which contains around 130,000 tests (note that almost 54,000 are from &lt;a href=&quot;https://github.com/tc39/test262&quot;&gt;test262&lt;/a&gt;, testing JavaScript), which make a total of about 2.25 million subtests. This shared test suite covers most of the web specifications, or at least that&#8217;s the aim. All this is relevant because the different web engines run these tests constantly to ensure compatibility and avoid regressions.&lt;/p&gt;
&lt;p&gt;WPT is great, but until very recently it couldn&#8217;t properly test platform accessibility (a11y) APIs, which means it was leaving out a very important part of the web, and not finding interop issues, catching regressions and identifying implementation gaps in that area. Browser engines have usually been testing a11y through internal tests, which is nice, but not enough in many cases. WPT can now test platform a11y APIs, and, as we&#8217;ll see later in this blog post, these new tests have already found bugs in web engines, and even in the specs.&lt;/p&gt;
&lt;h2 id=&quot;testing-a11y-on-the-web-platform&quot; tabindex=&quot;-1&quot;&gt;Testing a11y on the web platform &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/mrego/aamtest-testing-accessibility-in-wpt/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://www.igalia.com/&quot;&gt;&lt;strong&gt;Igalia&lt;/strong&gt;&lt;/a&gt; has been exploring ways to solve this problem for quite a while. A first attempt was a project called &lt;a href=&quot;https://github.com/igalia/acacia&quot;&gt;&lt;strong&gt;Acacia&lt;/strong&gt;&lt;/a&gt;, which was sponsored by the &lt;a href=&quot;https://www.sovereign.tech/programs/fund&quot;&gt;Sovereign Tech Fund&lt;/a&gt;. Given all platform a11y APIs have Python bindings, we were working on a Python library that would allow us to inspect them directly. After many conversations with different parties, that project was put on hold, and we moved to find a solution directly inside WPT based on all we&#8217;ve learnt in that project.&lt;/p&gt;
&lt;p&gt;That solution is now a reality, a &lt;strong&gt;new type of WPT tests called &lt;code&gt;aamtest&lt;/code&gt;&lt;/strong&gt;, which aim to test the AAM (Accessibility API Mappings) for the different platform a11y APIs. My colleague &lt;a href=&quot;https://www.igalia.com/team/spectranaut&quot;&gt;Valerie Young&lt;/a&gt; introduced this new type in March (&lt;a href=&quot;https://github.com/web-platform-tests/rfcs/blob/main/rfcs/wpt-for-aams.md&quot;&gt;RFC 204: WPT testing for AAMs&lt;/a&gt;) and started to write new tests based on that directly in WPT. As of today, there are 190 &lt;code&gt;aamtest&lt;/code&gt; tests in WPT, covering 4 specs: &lt;a href=&quot;https://w3c.github.io/aria/&quot;&gt;ARIA&lt;/a&gt;, &lt;a href=&quot;https://w3c.github.io/aria/core-aam/&quot;&gt;Core-AAM&lt;/a&gt;, &lt;a href=&quot;https://w3c.github.io/aria/html-aam/&quot;&gt;HTML-AAM&lt;/a&gt; and &lt;a href=&quot;https://w3c.github.io/aria/mathml-aam/&quot;&gt;MathML-AAM&lt;/a&gt;. We&#8217;re glad to mention that the recent work on this project has been funded by the &lt;a href=&quot;https://nlnet.nl/project/WPT-PlatformAccessibility/&quot;&gt;NLnet Foundation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Let&#8217;s use a diagram by my other coworker &lt;a href=&quot;https://www.igalia.com/team/alice&quot;&gt;Alice Boxhall&lt;/a&gt; to try to clarify a little bit more about what these new tests do. If you want a full description, the diagram is fully explained in the previously linked RFC.&lt;/p&gt;
&lt;figure&gt;
&lt;p&gt;&lt;img src=&quot;https://blogs.igalia.com/mrego/files/2026/10/platform_accessibility_api_testing.png&quot; alt=&quot;Diagram showing the interaction between a browser and accessibility APIs by Alice Boxhall&quot; /&gt;&lt;/p&gt;
  &lt;figcaption&gt;Diagram showing the interaction between a browser and accessibility APIs by Alice Boxhall&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;In this diagram you can see the different components related to the a11y support in browsers, and how they interact with each other. The green dashed line is the new proposed way to directly test the platform a11y APIs from WPT.&lt;/p&gt;
&lt;p&gt;It&#8217;s worth mentioning that back in June, Valerie gave &lt;a href=&quot;https://webengineshackfest.org/#wpt-accessibility&quot;&gt;a great talk at the Web Engines Hackfest&lt;/a&gt; covering all the details related to this work; don&#8217;t miss it if you want to dig deeper.&lt;/p&gt;
&lt;h2 id=&quot;what-does-an-aamtest-look-like&quot; tabindex=&quot;-1&quot;&gt;What does an &lt;code&gt;aamtest&lt;/code&gt; look like? &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/mrego/aamtest-testing-accessibility-in-wpt/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;These tests are written in Python and have different sections covering each platform a11y API. They&#8217;re all inside an &lt;code&gt;aamtests&lt;/code&gt; folder, which is how WPT identifies this kind of test and knows it has to enable a11y in the browser for them.&lt;/p&gt;
&lt;p&gt;Let&#8217;s take a look at one example (&lt;a href=&quot;https://github.com/web-platform-tests/wpt/blob/master/core-aam/aamtests/role/blockquote.py&quot;&gt;&lt;code&gt;core-aam/aamtests/role/blockquote.py&lt;/code&gt;&lt;/a&gt;) and explain the different parts.&lt;/p&gt;
&lt;pre class=&quot;language-py&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-py&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Testing: https://w3c.github.io/core-aam/#role-map-blockquote&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;TEST_HTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&amp;lt;div role='blockquote' id='test'&gt;content&amp;lt;/div&gt;&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;test_atspi&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;atspi&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; session&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; inline&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;br /&gt;    session&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; inline&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;TEST_HTML&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;# Spec:&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;# Role: ROLE_BLOCK_QUOTE&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    node &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; atspi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;find_node&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; session&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;assert&lt;/span&gt; atspi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Accessible&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;get_role&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;node&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; atspi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Role&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;BLOCK_QUOTE&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;test_axapi&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;axapi&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; session&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; inline&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;br /&gt;    session&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; inline&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;TEST_HTML&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;# Spec:&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;# AXRole: AXGroup&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;# AXSubrole: &amp;lt;nil&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    node &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; axapi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;find_node&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; session&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    role &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; axapi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;AXUIElementCopyAttributeValue&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;node&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;AXRole&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;assert&lt;/span&gt; role &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;AXGroup&quot;&lt;/span&gt;&lt;br /&gt;    subrole &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; axapi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;AXUIElementCopyAttributeValue&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;node&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;AXSubrole&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;assert&lt;/span&gt; subrole &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;None&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;test_ia2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;ia2&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; session&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; inline&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;br /&gt;    session&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; inline&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;TEST_HTML&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;# Spec:&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;# Role: ROLE_SYSTEM_GROUPING&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;# Role: IA2_ROLE_BLOCK_QUOTE&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    node &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; ia2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;find_node&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; session&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;assert&lt;/span&gt; ia2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;get_role&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;node&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;IA2_ROLE_BLOCK_QUOTE&quot;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;assert&lt;/span&gt; ia2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;get_msaa_role&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;node&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;ROLE_SYSTEM_GROUPING&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;test_uia&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;uia&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; session&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; inline&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;br /&gt;    session&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; inline&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;TEST_HTML&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;# Spec:&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;# Control Type: Group&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;# Localized Control Type: blockquote&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    node &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; uia&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;find_node&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; session&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;assert&lt;/span&gt; node&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CurrentControlType &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; uia&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ControlType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Group&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;assert&lt;/span&gt; node&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CurrentLocalizedControlType &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;blockquote&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As you can see, these are quite simple; in this case it&#8217;s a test to check that &lt;a href=&quot;https://w3c.github.io/aria/core-aam/#role-map-blockquote&quot;&gt;&lt;code&gt;role=&amp;quot;blockquote&amp;quot;&lt;/code&gt; is properly exposed&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The first thing in the test is some HTML code that we&#8217;ll use to test that the role is properly exposed; in this case it&#8217;s quite simple, consisting of a &lt;code&gt;DIV&lt;/code&gt; element with &lt;code&gt;role=&amp;quot;blockquote&amp;quot;&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-py&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-py&quot;&gt;TEST_HTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&amp;lt;div role='blockquote' id='test'&gt;content&amp;lt;/div&gt;&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next you can see 4 different functions prefixed with &lt;code&gt;test_&lt;/code&gt;, one per platform a11y API:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;test_atspi()&lt;/code&gt;: AT-SPI (Linux).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;test_axapi()&lt;/code&gt;: AX API (macOS).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;test_ia2()&lt;/code&gt;: IA2 (Windows).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;test_uia()&lt;/code&gt;: UIA (Windows).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All of them start with the same line, which inlines the HTML to be able to test it (this uses &lt;a href=&quot;https://w3c.github.io/webdriver/&quot;&gt;WebDriver&lt;/a&gt;). Then they have a comment with the mapping information from the spec. And after that, they use the Python library to check that the role is properly exposed to the platform a11y APIs.&lt;/p&gt;
&lt;p&gt;Let&#8217;s take a closer look at the AT-SPI one:&lt;/p&gt;
&lt;pre class=&quot;language-py&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-py&quot;&gt;    node &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; atspi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;find_node&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; session&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;assert&lt;/span&gt; atspi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Accessible&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;get_role&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;node&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; atspi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Role&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;BLOCK_QUOTE&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First it finds the a11y node corresponding to the DOM element with ID &lt;code&gt;test&lt;/code&gt;, and then uses the a11y library to get the role of that element. Finally it verifies that it&#8217;s the expected one.&lt;/p&gt;
&lt;p&gt;You can run these tests locally with the &lt;a href=&quot;https://web-platform-tests.org/running-tests/index.html&quot;&gt;WPT tooling&lt;/a&gt;, but you can also check the results for the different platforms on the &lt;a href=&quot;https://wpt.fyi/&quot;&gt;wpt.fyi website&lt;/a&gt;. For example, you can see &lt;a href=&quot;https://wpt.fyi/results/core-aam/aamtests/role/blockquote.py&quot;&gt;the results for this particular test&lt;/a&gt;.&lt;/p&gt;
&lt;figure&gt;
&lt;p&gt;&lt;img src=&quot;https://blogs.igalia.com/mrego/files/2026/10/wpt-results-for-blockquote-test.png&quot; alt=&quot;Screenshot of the results at wpt.fyi for core-aam/aamtests/role/blockquote.py, showing it passing for AT-SPI on Chrome and Firefox, and IA2 and UIA on Edge, while not running on Safari&quot; /&gt;&lt;/p&gt;
  &lt;figcaption&gt;Screenshot of results for &lt;code&gt;core-aam/aamtests/role/blockquote.py&lt;/code&gt; at wpt.fyi&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;We &lt;a href=&quot;https://github.com/web-platform-tests/wpt.fyi/pull/4847&quot;&gt;have also tweaked wpt.fyi&lt;/a&gt; so the tests show as missing for the platforms they don&#8217;t belong to. You can see that AT-SPI is only tested on Linux (Chrome and Firefox), while IA2 and UIA are tested on Windows (Edge). These tests cannot run on WPT&#8217;s macOS (Safari) CI infrastructure yet, though the WebKit team is working on adding support for them; for now, you can run them locally if you have a Mac.&lt;/p&gt;
&lt;p&gt;All this is great, allowing us to directly test the platform a11y APIs, and verify that things are properly exposed to assistive technology users. And being in WPT, it also helps us to check that implementations are compatible with each other, and that there are no regressions that go unnoticed.&lt;/p&gt;
&lt;h2 id=&quot;adding-events-support&quot; tabindex=&quot;-1&quot;&gt;Adding events support &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/mrego/aamtest-testing-accessibility-in-wpt/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In the last few months, I&#8217;ve had the chance to help with this project. And I&#8217;ve worked on adding one missing piece, the capability of &lt;strong&gt;testing a11y events&lt;/strong&gt;. When something changes on a page (like a form entry that is marked as disabled), platform a11y APIs emit events to notify assistive technologies, and thus the users, about it.&lt;/p&gt;
&lt;p&gt;In order to be able to test those events, we have added a &lt;strong&gt;new method called &lt;code&gt;expect_event()&lt;/code&gt;&lt;/strong&gt; to the testing infrastructure, which adds an event listener for a given event in a node, executes an action to trigger it, waits for the event and returns it. That way we can make the test suite more comprehensive by also covering events.&lt;/p&gt;
&lt;p&gt;Let&#8217;s see an example of how it works in the wild (&lt;a href=&quot;https://github.com/web-platform-tests/wpt/blob/master/core-aam/aamtests/event/aria_checked.py&quot;&gt;&lt;code&gt;core-aam/aamtests/event/aria_checked.py&lt;/code&gt;&lt;/a&gt;).&lt;/p&gt;
&lt;pre class=&quot;language-py&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-py&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Testing: https://w3c.github.io/aria/core-aam/#event-aria-checked&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;TEST_HTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&amp;lt;div id='target' role='checkbox' aria-checked='false'&gt;&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;test_atspi&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;atspi&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; session&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; inline&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;br /&gt;    session&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; inline&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;TEST_HTML&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;# Spec:&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;# object:state-changed:checked&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    node &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; atspi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;find_node&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;target&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; session&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;STATE_CHECKED&quot;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; atspi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;get_state_list_helper&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;node&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;toggle_aria_checked&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;br /&gt;        session&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;execute_script&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;br /&gt;            &lt;span class=&quot;token string&quot;&gt;&quot;target.ariaChecked = target.ariaChecked === 'true' ? 'false' : 'true'&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    event &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; atspi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;expect_event&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;token string&quot;&gt;&quot;object:state-changed:checked&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; dom_id&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;target&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;        action&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;toggle_aria_checked&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;assert&lt;/span&gt; event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;detail1 &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;STATE_CHECKED&quot;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; atspi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;get_state_list_helper&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;node&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    event &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; atspi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;expect_event&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;token string&quot;&gt;&quot;object:state-changed:checked&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; dom_id&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;target&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;        action&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;toggle_aria_checked&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;assert&lt;/span&gt; event&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;detail1 &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;STATE_CHECKED&quot;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; atspi&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;get_state_list_helper&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;node&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case the test checks the &lt;a href=&quot;https://w3c.github.io/aria/core-aam/#event-aria-checked&quot;&gt;event triggered when the &lt;code&gt;aria-checked&lt;/code&gt; attribute is modified&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Again it has quite simple HTML, and a similar structure to the previous one, though there are a couple of new things.&lt;/p&gt;
&lt;p&gt;We define a function &lt;code&gt;toggle_aria_checked()&lt;/code&gt; that modifies the value of the &lt;code&gt;aria-checked&lt;/code&gt; attribute. That function is passed as an action to &lt;code&gt;expect_event()&lt;/code&gt; to which we also pass the event name &lt;code&gt;object:state-changed:checked&lt;/code&gt; and the ID of the node in which we&#8217;re going to wait for the event. When the event is triggered, we get it and we can check different things on it to verify that it&#8217;s working correctly. Then we run it twice to check that the event is also triggered when you do the opposite change to the &lt;code&gt;aria-checked&lt;/code&gt; attribute.&lt;/p&gt;
&lt;h2 id=&quot;how-useful-are-these-tests&quot; tabindex=&quot;-1&quot;&gt;How useful are these tests? &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/mrego/aamtest-testing-accessibility-in-wpt/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;One question you might have is why we are doing all this, knowing web engines already have internal tests covering this (as mentioned before). That&#8217;s true, but just with the first tests we&#8217;ve added, &lt;strong&gt;we have discovered interop issues and missing features in different places&lt;/strong&gt;. Let&#8217;s review a few examples.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/web-platform-tests/wpt/pull/62585&quot;&gt;While working on events support&lt;/a&gt;, we started with a simple example changing the value of &lt;code&gt;aria-disabled&lt;/code&gt; and catching the expected events, which for &lt;a href=&quot;https://w3c.github.io/aria/core-aam/#event-aria-disabled&quot;&gt;AT-SPI is expected to trigger 2 events: &lt;code&gt;object:state-changed:enabled&lt;/code&gt; and &lt;code&gt;object:state-changed:sensitive&lt;/code&gt;&lt;/a&gt;. We realized that Firefox wasn&#8217;t doing that, as it was only triggering one of them (&lt;code&gt;enabled&lt;/code&gt;). This was a small issue and easy to fix, so we went ahead and &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2073191&quot;&gt;fixed the issue in Firefox&lt;/a&gt;; the patch landed even before the support for testing events in &lt;code&gt;aamtest&lt;/code&gt; was merged in WPT.&lt;/p&gt;
&lt;p&gt;Another example, &lt;a href=&quot;https://github.com/web-platform-tests/wpt/pull/63096&quot;&gt;while testing an ARIA &#8220;must&#8221; statement about &lt;code&gt;aria-errormessage&lt;/code&gt; when &lt;code&gt;aria-invalid=&amp;quot;false&amp;quot;&lt;/code&gt;&lt;/a&gt;, we found again that Firefox wasn&#8217;t fulfilling the spec. In this case, this was &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1375290&quot;&gt;a known old bug&lt;/a&gt; that we also fixed upstream.&lt;/p&gt;
&lt;p&gt;And it&#8217;s not only Firefox; for example, &lt;a href=&quot;https://github.com/web-platform-tests/wpt/pull/62435&quot;&gt;when we added tests for Core-AAM attributes&lt;/a&gt;, we discovered that &lt;a href=&quot;https://issues.chromium.org/issues/567972102&quot;&gt;Chromium wasn&#8217;t properly exposing &lt;code&gt;aria-sort=&amp;quot;none&amp;quot;&lt;/code&gt;&lt;/a&gt;, which again we fixed upstream.&lt;/p&gt;
&lt;p&gt;Last but not least, while working on these tests we have also found spec issues, not only implementation ones. For example, &lt;a href=&quot;https://github.com/web-platform-tests/wpt/pull/63093&quot;&gt;adding a test for the &lt;code&gt;&amp;lt;abbr&amp;gt;&lt;/code&gt; element&lt;/a&gt;, we found a wrong statement in the &lt;a href=&quot;https://github.com/w3c/aria/pull/2927&quot;&gt;HTML-AAM spec, which has already been fixed&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;There are more examples like these; these are just a few. In the early days of these new tests, they have already proven to be very valuable for identifying issues and improve the a11y support in different engines. It&#8217;s really nice to see how useful they are while things are coming along.&lt;/p&gt;
&lt;h2 id=&quot;future-work&quot; tabindex=&quot;-1&quot;&gt;Future work &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/mrego/aamtest-testing-accessibility-in-wpt/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This doesn&#8217;t finish here; this work can be considered the foundation, which is now in place and people can build things on top of it.&lt;/p&gt;
&lt;p&gt;Now that WPT has a new type of tests to cover a11y platform APIs, &lt;strong&gt;we expect that &lt;code&gt;aamtest&lt;/code&gt; tests start to be used more and more to cover a11y support for new and existing web platform features&lt;/strong&gt;. Our recent work has been focused on the Linux platform, but there is more work to do covering other platforms, completing tests for platforms that aren&#8217;t being tested yet. If you want to do that, you can &lt;a href=&quot;https://web-platform-tests.org/writing-tests/aamtest.html&quot;&gt;check the documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Not only that, with all these tests, we&#8217;re finding interoperability issues here and there, so we hope people start to fix them where convenient. Apart from that, there is some flakiness when running these tests in the WPT CI for both &lt;a href=&quot;https://issues.chromium.org/issues/565453068&quot;&gt;Chromium&lt;/a&gt; and &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=2035599&quot;&gt;Firefox&lt;/a&gt;, as they&#8217;re the first ones testing against the platform a11y APIs. This needs more investigation to come up with a solution.&lt;/p&gt;
&lt;p&gt;All in all, we&#8217;re very happy to have reached this point and to see these tests already having a positive impact on the web platform. We&#8217;d like to thank everyone who has been helping make this happen, whether through reviews, feedback, participation in discussions, and so on.&lt;/p&gt;                </content>
		<author>
			<name>Manuel Rego</name>
			<uri>https://blogs.igalia.com/mrego/</uri>
		</author>
	</entry>

	<entry>
		<title>Igalia WebKit Team: WebKit Igalia Periodical #80</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/webkit/blog/2026/wip-80/"/>
		<id>https://blogs.igalia.com/webkit/blog/2026/wip-80/</id>
		<updated>2026-10-05T19:21:33+00:00</updated>
		<content type="html">
&lt;p&gt;Update on what happened in WebKit in the week from September 28 to October 5.&lt;/p&gt;
&lt;p&gt;
Another week populated with updates! This time we sweep
through a new crypto backend, more layer-based SVG engine
updates, better filters, and some miscellaneous updates.
&lt;/p&gt;
&lt;h2 id=&quot;cross-port-cat&quot;&gt;Cross-Port &#128049;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/322482@main&quot;&gt;Add&lt;/a&gt; moving steps handling to map, img, label and radio input elements to handle their internal book keeping. This also handles custom element registries.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Initial support to build WPE and WebKitGTK with the OpenSSL crypto backend &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/322715@main&quot;&gt;has landed&lt;/a&gt;. This is still in development and not yet intended for use, but progress on bringing it to parity with the libgcrypt backend is ongoing.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;graphics-frame-photo&quot;&gt;Graphics &#128444;&#65039;&lt;/h3&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/322150@main&quot;&gt;Fixed stacked backdrop filters&lt;/a&gt; in the Skia compositor, so an element with a &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter&quot;&gt;&lt;code&gt;backdrop-filter&lt;/code&gt;&lt;/a&gt; placed over an earlier element with its own &lt;code&gt;backdrop-filter&lt;/code&gt; now shows that earlier element with its filter applied, instead of without it.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/322676@main&quot;&gt;Removed redundant save/restore pairs&lt;/a&gt; when painting transformed SVG shapes in the Layer-Based SVG Engine (LBSE), so each shape now uses a single pair, just like the legacy SVG engine. When DOM rendering happens in the GPU process, every state change is an IPC message, so this cuts LBSE from about 8.5 to about 6.5 messages per shape and closes the gap to the legacy engine.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/322184@main&quot;&gt;Fixed transformed &lt;code&gt;&amp;lt;clipPath&amp;gt;&lt;/code&gt; elements&lt;/a&gt; that use &lt;code&gt;clipPathUnits=&quot;objectBoundingBox&quot;&lt;/code&gt; in the Layer-Based SVG Engine (LBSE), whose transform was wrongly applied in bounding box units instead of user space. Rendering and hit testing now apply it in user space, matching the legacy SVG engine.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/322540@main&quot;&gt;Fixed hit testing and repainting of non-scaling strokes&lt;/a&gt; in the Layer-Based SVG Engine (LBSE), which kept using the old stroke width after the transform of the shape or one of its ancestors changed. A &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/vector-effect&quot;&gt;&lt;code&gt;vector-effect: non-scaling-stroke&lt;/code&gt;&lt;/a&gt; stroke depends on every transform up to the outermost &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; element, so its cached bounds are now cleared whenever one of those transforms changes.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/322384@main&quot;&gt;Fixed the source area of filters and backdrop filters&lt;/a&gt;: a filter's offscreen surface only covered the visible part of its layer, so when a layer was partly scrolled out of the viewport, its drop shadow was cut off even where the shadow itself fell inside the viewport. The surface now also covers the area the filter reads from outside the visible part, as in Chromium, and a &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter&quot;&gt;&lt;code&gt;backdrop-filter&lt;/code&gt;&lt;/a&gt; blur is mirrored at the border box as the spec requires, which fixes several web-platform-tests.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/322191@main&quot;&gt;Fixed viewport clipping of nested &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; elements&lt;/a&gt; with &lt;code&gt;overflow: hidden&lt;/code&gt; in the Layer-Based SVG Engine (LBSE), which did not clip descendants that have their own layer, such as a transformed &lt;code&gt;&amp;lt;g&amp;gt;&lt;/code&gt;. Containers that clip their overflow now get their own layer, like containers using &lt;code&gt;clip-path&lt;/code&gt; or &lt;code&gt;mask&lt;/code&gt; already do, so layered descendants are clipped correctly.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/322181@main&quot;&gt;Fixed misplaced child layers&lt;/a&gt; of SVG elements with a &lt;code&gt;filter&lt;/code&gt; in the Layer-Based SVG Engine (LBSE), which were drawn in the wrong position whenever an ancestor layer had a transform applied.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;wpe-webkit-pager&quot;&gt;WPE WebKit &#128223;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/322562@main&quot;&gt;Restored the Direct Rendering Manager (DRM) vertical blank monitor&lt;/a&gt; for the legacy WPE API, so rendering is once again paced by the display's actual refresh cycle instead of a fixed 60 Hz timer. Two regressions had silently disabled it: a missing display ID forced the timer fallback, and a shadowed variable broke the display controller lookup.&lt;/p&gt;
  &lt;/div&gt;
&lt;div class=&quot;wip-end&quot;&gt;
&lt;p&gt;That&#8217;s all for this week!&lt;/p&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Igalia WebKit Team</name>
			<uri>https://blogs.igalia.com/webkit</uri>
		</author>
	</entry>

	<entry>
		<title>Miyoung Shin: Extension Migration Progress Update &#8211; Part 3</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/mshin/2026/10/02/extension-migration-progress-update-part-3/?pk_campaign=feed&amp;pk_kwd=extension-migration-progress-update-part-3"/>
		<id>https://blogs.igalia.com/mshin/?p=182</id>
		<updated>2026-10-02T11:39:05+00:00</updated>
		<content type="html">
&lt;p&gt;In the previous post, &lt;a href=&quot;https://blogs.igalia.com/mshin/2026/09/07/extension-migration-progress-update-part-2/&quot;&gt;Extension Migration Progress Update &#8211; Part 2&lt;/a&gt;, we demonstrated how a Chrome extension can be installed from the Chrome Web Store using the Extension Shell.&lt;/p&gt;



&lt;p&gt;This time, we&amp;#8217;d like to take the demo one step further.&lt;/p&gt;



&lt;p&gt;Instead of focusing on the installation process, the following two videos show extensions that have already been installed in the Extension Shell and are actually running on real web pages.&lt;/p&gt;



&lt;p&gt;These demos are intended to show that the migrated extension APIs are not only sufficient to install extensions, but can also support extensions interacting with real-world web content.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Demo 1: Knockoff &#8211; Amazon Shopping Filter&lt;/h2&gt;



&lt;p&gt;The first demo uses &lt;a href=&quot;https://chromewebstore.google.com/detail/knockoff-amazon-shopping/pjgickchbiikhdfpmecaabkphmofpdce?hl=en-US&amp;utm_source=ext_sidebar&quot;&gt;Knockoff &#8211; Amazon Shopping Filter&lt;/a&gt;, a Chrome extension that filters products on Amazon.&lt;/p&gt;



&lt;p&gt;In the video, the extension is installed in the Extension Shell and then used while browsing an Amazon search results page.&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Extension:&lt;/strong&gt; &lt;a href=&quot;https://chromewebstore.google.com/detail/knockoff-amazon-shopping/pjgickchbiikhdfpmecaabkphmofpdce?hl=en-US&amp;utm_source=ext_sidebar&quot;&gt;Knockoff &#8211; Amazon Shopping Filter&lt;/a&gt;&lt;br /&gt;&lt;strong&gt;Test page:&lt;/strong&gt; &lt;a href=&quot;https://www.amazon.com/s?k=led+strip+lights&quot;&gt;Amazon &#8211; LED Strip Lights search&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;The video demonstrates the extension interacting with the Amazon page and modifying the displayed content based on its functionality.&lt;/p&gt;



&lt;figure class=&quot;wp-block-video&quot;&gt;&lt;video controls=&quot;controls&quot; src=&quot;https://blogs.igalia.com/mshin/files/2026/10/Extensions-Knockoff-Amazon-Shopping-Filter.webm&quot;&gt;&lt;/video&gt;&lt;/figure&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Demo 2: Allow Copy &amp;amp; Enable Right Click &#8211; Text Unlock&lt;/h2&gt;



&lt;p&gt;The second demo uses &lt;a href=&quot;https://chromewebstore.google.com/detail/allow-copy-enable-right-c/nclheheebllomilbamnipblbglnpmoom?hl=en-US&amp;utm_source=ext_sidebar&quot;&gt;Allow Copy &amp;amp; Enable Right Click &#8211; Text Unlock&lt;/a&gt;.&lt;/p&gt;



&lt;p&gt;This extension allows users to copy text and use the right-click context menu on websites that would otherwise prevent these actions.&lt;/p&gt;



&lt;p&gt;In the video, the extension is used on a real article page where copying and right-clicking are restricted.&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Extension:&lt;/strong&gt; &lt;a href=&quot;https://chromewebstore.google.com/detail/allow-copy-enable-right-c/nclheheebllomilbamnipblbglnpmoom?hl=en-US&amp;utm_source=ext_sidebar&quot;&gt;Allow Copy &amp;amp; Enable Right Click &#8211; Text Unlock&lt;/a&gt;&lt;br /&gt;&lt;strong&gt;Test page:&lt;/strong&gt; &lt;a href=&quot;https://otechworld.com/native-vs-cross-platform-app-development-what-should-businesses-choose-in-2026/&quot;&gt;Native vs Cross-Platform App Development &#8211; What Should Businesses Choose in 2026?&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;The video shows the extension modifying the behavior of the web page and enabling the previously restricted interactions.&lt;/p&gt;



&lt;figure class=&quot;wp-block-video&quot;&gt;&lt;video controls=&quot;controls&quot; src=&quot;https://blogs.igalia.com/mshin/files/2026/10/Extensions-Allow-Copy-Enable-Right-Click.webm&quot;&gt;&lt;/video&gt;&lt;/figure&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;From Installation to Real-World Usage&lt;/h2&gt;



&lt;p&gt;These demos represent the next step in our Extension Shell work.&lt;/p&gt;



&lt;p&gt;In Part 2, we showed that an extension could be installed directly from the Chrome Web Store. With these demos, we are showing what happens after installation: the extension can run on real websites and interact with their web content.&lt;/p&gt;



&lt;p&gt;Together, the demos cover the basic flow we want to support:&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Chrome Web Store &#8594; Extension installation &#8594; Extension execution &#8594; Interaction with real web content&lt;/strong&gt;&lt;/p&gt;



&lt;p&gt;There is still more work to do as we continue migrating extension APIs from &lt;code&gt;//chrome&lt;/code&gt; to &lt;code&gt;//extensions&lt;/code&gt;, but these demos provide a concrete example of how the migrated APIs can be used by real-world Chrome extensions outside of the Chrome browser UI.&lt;/p&gt;



&lt;p&gt;&lt;/p&gt;
&lt;img src=&quot;https://stats.igalia.com/piwik.php?idsite=19&amp;rec=1&amp;url=https%3A%2F%2Fblogs.igalia.com%2Fmshin%2F2026%2F10%2F02%2Fextension-migration-progress-update-part-3%2F%3Fpk_campaign%3Dfeed%26pk_kwd%3Dextension-migration-progress-update-part-3&amp;action_name=Extension%20Migration%20Progress%20Update%20%E2%80%93%20Part%203&amp;urlref=https%3A%2F%2Fblogs.igalia.com%2Fmshin%2Ffeed%2F&quot; width=&quot;0&quot; height=&quot;0&quot; alt=&quot;&quot; /&gt;                </content>
		<author>
			<name>mshin</name>
			<uri>https://blogs.igalia.com/mshin</uri>
		</author>
	</entry>

	<entry>
		<title>Alejandro Garc&#237;a Castro: wpe-android: Skia deferred display lists (DDL)</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/alex/2026/10/01/wpe-android-skia-deferred-display-lists-ddl/?pk_campaign=feed&amp;pk_kwd=wpe-android-skia-deferred-display-lists-ddl"/>
		<id>https://blogs.igalia.com/alex/?p=279</id>
		<updated>2026-10-01T19:44:08+00:00</updated>
		<content type="html">
&lt;p&gt;Following the last blog post, I would now document in more detail how we fixed the visual jank in the Android phones using WPE, it clearly shows testing an embedded engine in multiple devices is really valuable.&lt;/p&gt;



&lt;p&gt;&lt;br /&gt;Originally, the Pixel 7 looked broken: a horizontal bar of stale content between tile rows, black corners appearing around spinners and rounded elements, and images that sometimes came up as solid rectangles of garbage. We tested multiple options to analyze the problem: it was not a tearing problem, the frames were correctly isolated, it was the frames rendering being wrong, which is much more complex to look into and much harder to profile.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image aligncenter size-large is-resized&quot;&gt;&lt;a href=&quot;https://blogs.igalia.com/alex/files/2026/09/jank_wpe_android.png&quot;&gt;&lt;img width=&quot;461&quot; height=&quot;1024&quot; src=&quot;https://blogs.igalia.com/alex/files/2026/09/jank_wpe_android-461x1024.png&quot; alt=&quot;&quot; class=&quot;wp-image-282&quot; /&gt;&lt;/a&gt;&lt;/figure&gt;



&lt;p&gt;What eventually gave us the answer was testing different rendering configurations. Skia can rasterize on the CPU or on the GPU, we support both in WPE, and in both cases it can use a pool of worker threads, so when we ran some tests we verified:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;CPU with workers worked well, no jank.&lt;/li&gt;



&lt;li&gt;GPU on the main thread with no workers at all worked well, no jank.&lt;/li&gt;



&lt;li&gt;GPU with workers was broken: jank, every time.&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;So neither GPU rasterization nor parallelism was the problem on its own, it was the combination was causing the visual artifacts. The reason was that each painting worker has its own &lt;strong&gt;GrDirectContext&lt;/strong&gt;, with its own GL context, sharing the underlying EGL display and textures with the context the compositor uses to put the frame together. That kind of sharing depends on the driver getting context synchronization right, and on &lt;strong&gt;Mali&lt;/strong&gt; ((the Android driver for the Pixel 7 phone) it does not. We confirmed it by writting a small standalone reproducer outside WebKit.&lt;/p&gt;



&lt;p&gt;The fix for all of that, which is &lt;a href=&quot;https://blogs.igalia.com/carlosgc/&quot;&gt;Carlos&#8217;&lt;/a&gt; &lt;a href=&quot;https://github.com/WebKit/WebKit/pull/65286&quot;&gt;WebKit PR #65286&lt;/a&gt;, uses a Skia feature that exists precisely for this kind of problem: &lt;strong&gt;deferred display lists&lt;/strong&gt;. The feature comes from the idea of recording raster work in one place and executing it in the GPU process. In WPE we are currently still using a compositor thread with a GPU context, but the idea is the same. The approach is that you describe the destination surface up front, as a &lt;code&gt;GrSurfaceCharacterization&lt;/code&gt; holding the surface properties, and you build a &lt;code&gt;GrDeferredDisplayListRecorder&lt;/code&gt; from that description. The canvas you get from the recorder accepts and validates all the usual drawing, but does not send any GL commands at all, and at the end &lt;code&gt;detach()&lt;/code&gt; gives you a &lt;code&gt;GrDeferredDisplayList&lt;/code&gt;. The worker thread does all the expensive CPU side of painting (building the draw operations, resolving paints and geometry) with no GPU context required. Then the compositor thread, in &lt;code&gt;SkiaBackingStore::Tile::update&lt;/code&gt;, creates or reuses an &lt;code&gt;SkSurface&lt;/code&gt; compatible with the deferred operations object and calls &lt;code&gt;skgpu::ganesh::DrawDDL&lt;/code&gt; with it. The compositor&#8217;s context is the only thing that ever renders tile content with the GPU context.&lt;/p&gt;



&lt;p&gt;It is also very interesting how this is implemented. A thread with no GPU context can not sample a texture, so any image that already lives on the GPU (including the glyph and image atlases) can not be referenced directly while recording. Instead, they are turned into promise images. This is what makes atlas access safe from several recording threads at once. It is also the reason why, the first time we tested, every image was rendered as a black rectangle, which turned out to be an unrelated Android problem with the format used to upload those atlas textures, and cost us a couple of days wondering why the fix did not work.&lt;/p&gt;



&lt;p&gt;Once it was activated, the Pixel 7 jank was gone, the bars, the black corners and the garbage in general. Also, parallel painting is still parallel, only the submission is serialized. There was a price, though: moving all the real rasterization to the compositor thread puts it in the same queue as frame presentation, and the first version felt slower. The cause was a fresh render target being allocated for every tile update, so adding a cache to recycle the backing buffer solved the problem.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image aligncenter size-large is-resized&quot;&gt;&lt;a href=&quot;https://blogs.igalia.com/alex/files/2026/09/fixed_wpe_android.png&quot;&gt;&lt;img width=&quot;461&quot; height=&quot;1024&quot; src=&quot;https://blogs.igalia.com/alex/files/2026/09/fixed_wpe_android-461x1024.png&quot; alt=&quot;&quot; class=&quot;wp-image-283&quot; /&gt;&lt;/a&gt;&lt;/figure&gt;



&lt;p&gt;Nowadays we are using DDL and the skia compositor by default, we plan to remove TextureMapper support, and the Skia compositor is what we provide in main.&lt;/p&gt;



&lt;p&gt;The last part of the story is a warning note about benchmarks. When we ran a proper A/B testing with MotionMark, the overall score said deferred display lists were 7% slower, and that number was something we needed to understand: the whole difference came from a single subtest, Suits, which scored 76 against 19. The option without DDL was rendering incorrectly in Mali, so the benchmark in the end was rewarding broken frames in Android. The rendering was just find in Linux drivers where we tested it, so the decision took the whole situation into account. We did not want to add more rendering options (that usually means more complex maintenance), and the regression was measured against an architecture we knew was not completely safe.&lt;/p&gt;



&lt;p&gt;Next time I could talk about how we are currently planning to &lt;a href=&quot;https://github.com/WebKit/WebKit/pull/74334&quot;&gt;recover that performance&lt;/a&gt; that is going to show pretty soon in the benchmarks, and it has taken some time because it requires patching Skia.&lt;/p&gt;



&lt;p&gt;&lt;/p&gt;
&lt;img src=&quot;https://stats.igalia.com/piwik.php?idsite=40&amp;rec=1&amp;url=https%3A%2F%2Fblogs.igalia.com%2Falex%2F2026%2F10%2F01%2Fwpe-android-skia-deferred-display-lists-ddl%2F%3Fpk_campaign%3Dfeed%26pk_kwd%3Dwpe-android-skia-deferred-display-lists-ddl&amp;action_name=wpe-android%3A%20Skia%20deferred%20display%20lists%20%28DDL%29&amp;urlref=https%3A%2F%2Fblogs.igalia.com%2Falex%2Ffeed%2F&quot; width=&quot;0&quot; height=&quot;0&quot; alt=&quot;&quot; /&gt;                </content>
		<author>
			<name>alex</name>
			<uri>https://blogs.igalia.com/alex</uri>
		</author>
	</entry>

	<entry>
		<title>Igalia WebKit Team: WebKit Igalia Periodical #79</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/webkit/blog/2026/wip-79/"/>
		<id>https://blogs.igalia.com/webkit/blog/2026/wip-79/</id>
		<updated>2026-09-29T00:40:21+00:00</updated>
		<content type="html">
&lt;p&gt;Update on what happened in WebKit in the week from September 21 to September 28.&lt;/p&gt;
&lt;p&gt;
Following the stable releases last week, we have the first security
advisory covering fixes included in them; the flurry of fixes and
polish for the Skia compositor continues; SharedArrayBuffer gets
re-enabled, and more.
&lt;/p&gt;
&lt;h2 id=&quot;cross-port-cat&quot;&gt;Cross-Port &#128049;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/321775@main&quot;&gt;Fixed a crash on exit&lt;/a&gt; in WebKitGTK
and WPE WebKit, caused by the EGL display being torn down in an &lt;code&gt;atexit()&lt;/code&gt;
handler while other threads were still using it, by now destroying it on the
main thread once the GPU process has stopped its WebGL thread and the web
process has closed its pages.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/321973@main&quot;&gt;Fixed&lt;/a&gt; moving steps for source
element to account for the &lt;code&gt;&amp;lt;media&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;model&amp;gt;&lt;/code&gt; elements.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;javascriptcore-fish&quot;&gt;JavaScriptCore &#128031;&lt;/h3&gt;
&lt;div class=&quot;wip-description&quot;&gt;
&lt;p&gt;The built-in JavaScript/ECMAScript engine for WebKit, also known as JSC or SquirrelFish.&lt;/p&gt;
&lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/104506cdb2c45aa547db1eb50313abc15473b815&quot;&gt;SharedArrayBuffer is now enabled for the WPE and GTK
ports&lt;/a&gt;.
&lt;code&gt;SharedArrayBuffer&lt;/code&gt; is exposed when the origin is cross-origin isolated. We have
enabled 35 associated cross-origin isolation tests. Initialization was
designed to work with Android service-launched processes, too.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;graphics-frame-photo&quot;&gt;Graphics &#128444;&#65039;&lt;/h3&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/321633@main&quot;&gt;Fixed a bug with 3D-transformed
elements&lt;/a&gt; that are tilted so far away
from the viewer that part of them ends up behind the camera, where WebKit got
the visible area of the element wrong and computed the hidden part instead. As
a result, the visible part of such elements is no longer left blank in
WebKitGTK and WPE&#8212;painting and hit-testing works properly now.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/321905@main&quot;&gt;Fixed oversized damage regions&lt;/a&gt; for
3D-transformed layers that cross the camera plane, by clipping their projected
polygon against the clip bounds so the damage now matches what the layer
actually paints.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/93249e30523a6281b5f1e9edc4f9e4418f048f61&quot;&gt;GPU renderer small paths now use Skia distance
fields&lt;/a&gt;.
Bitmap atlas entries depended on the transform and subpixel position, causing
animated paths to be re-rasterized and uploaded every frame. With distance
field indexed entries we can reuse them across transforms. We are improving
MotionMark Suits results on Raspberry Pi 4 and desktop.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/321875@main&quot;&gt;Fixed the paint order of &lt;code&gt;preserve-3d&lt;/code&gt;
layers&lt;/a&gt; that cross the camera plane in
the Skia-based compositor. Layer corners behind the camera used to be flipped
to the far side of the screen when projected&#8212;layers were sorted against the
wrong geometry and far layers painted over near ones. Now the part of a layer
that lies behind the camera is clipped away before sorting, which makes
complex 3D scenes like the &lt;a rel=&quot;external&quot; href=&quot;https://keithclark.co.uk/labs/css-fps/&quot;&gt;CSS FPS
demo&lt;/a&gt; render correctly.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/322050@main&quot;&gt;Aligned the filter surface with the device pixel
grid&lt;/a&gt; in the Skia-based compositor, so
layers with CSS filters that end up at fractional device positions are no
longer resampled when the filtered result is drawn. This fixes wrong colors in
the outermost rows and columns of pixels of such layers, which now render the
same as they would without a filter.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/322080@main&quot;&gt;Fixed SMIL-animated &lt;code&gt;viewBox&lt;/code&gt;
changes&lt;/a&gt; being ignored on the
outermost &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; element in the Layer-Based SVG Engine (LBSE), bringing it in
line with the legacy SVG engine.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/321709@main&quot;&gt;Fixed edge artifacts&lt;/a&gt; on scaled or
transformed non-repeating background images in the Skia-based compositor,
which painted all composited background images as if they repeat, so a thin
line of the opposite edge showed up along the border. Only tiles that actually
repeat are painted that way now, which removes the yellow line that showed up
above the gun in the &lt;a rel=&quot;external&quot; href=&quot;https://keithclark.co.uk/labs/css-fps/&quot;&gt;CSS FPS demo&lt;/a&gt;.
This fixes the last known artifact in that demo.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/321578@main&quot;&gt;Fixed rendering artifacts&lt;/a&gt; in
WebKitGTK and WPE WebKit for 3D-transformed layers that extend behind the
camera under a perspective (for example a large element under
&lt;code&gt;rotateX(90deg)&lt;/code&gt;), whose re-composited area came out too small because corners
behind the camera were projected onto the wrong side of the frame, and are now
clipped away before mapping.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;webkitgtk-desktop&quot;&gt;WebKitGTK &#128421;&#65039;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/321593@main&quot;&gt;Fixed touch positions in the GTK
port&lt;/a&gt;, which were offset by the
surface transform, the room left for the client-side decoration shadows,
because it was not subtracted from the raw &lt;code&gt;GdkEvent&lt;/code&gt; position, so every touch
landed away from the finger unless the window was maximized. The same change
cancels the touch sequences that were stranded when the web view is unmapped
or a dialog was shown, which left the page with a finger that was never
released.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;wpe-webkit-pager&quot;&gt;WPE WebKit &#128223;&lt;/h2&gt;
&lt;h3 id=&quot;wpe-platform-api-jigsaw&quot;&gt;WPE Platform API &#129513;&lt;/h3&gt;
&lt;div class=&quot;wip-description&quot;&gt;
&lt;p&gt;New, modern platform API that supersedes usage of libwpe and WPE backends.&lt;/p&gt;
&lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;The &lt;code&gt;ENABLE_WPE_PLATFORM&lt;/code&gt; build option &lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/46991b930d454c74a83eb67b8c3c6aa153c0c6d7&quot;&gt;has been
removed&lt;/a&gt;.
The new WPE Platform API, which was enabled by default since 2.54, is now
always enabled.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;releases-package&quot;&gt;Releases &#128230;&#65039;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;A new security advisory, &lt;code&gt;WSA-2026-0006&lt;/code&gt;, has been published &lt;a rel=&quot;external&quot; href=&quot;https://webkitgtk.org/security/WSA-2026-0006.html&quot;&gt;for
WebKitGTK&lt;/a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https://wpewebkit.org/security/WSA-2026-0006.html&quot;&gt;for
WPE&lt;/a&gt;. This covers issues
fixed in the recent 2.54.0 releases, and for the first time includes security
issues fixed in the bundled &lt;a rel=&quot;external&quot; href=&quot;https://angleproject.org&quot;&gt;ANGLE&lt;/a&gt; and
&lt;a rel=&quot;external&quot; href=&quot;https://skia.org&quot;&gt;Skia&lt;/a&gt; libraries. Updating to the latest stable release is
highly recommended.&lt;/p&gt;
  &lt;/div&gt;
&lt;div class=&quot;wip-end&quot;&gt;
&lt;p&gt;That&#8217;s all for this week!&lt;/p&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Igalia WebKit Team</name>
			<uri>https://blogs.igalia.com/webkit</uri>
		</author>
	</entry>

	<entry>
		<title>Brian Kardell: Ideals</title>
		<link rel="alternate" type="text/html" href="https://bkardell.com/blog/Ideals.html"/>
		<id>https://bkardell.com/blog/Ideals.html</id>
		<updated>2026-09-28T04:00:00+00:00</updated>
		<content type="html">
&lt;h1 class=&quot;contextual-heading&quot;&gt;Ideals&lt;/h1&gt;
	&lt;p class=&quot;segue&quot;&gt;I thought it would be interesting to talk a little bit about the standards process given a few events that lined up last week in my mind...&lt;/p&gt;

	&lt;p&gt;Last week my colleague Rakhi wrote a &lt;a href=&quot;https://www.atbrakhi.dev/blog/browsers-situationship&quot;&gt;great piece&lt;/a&gt; about how standardization at the edges sometimes (maybe even often) works backwards because there are fallable humans all along the way - writing the spec, interpreting the spec, writing tests, and so on.  The very next day, another such case was brought to the CSS Working Group.  A lot of people found this very interesting.&lt;/p&gt; 

	&lt;p&gt;Around the same time, we published a new episode of Igalia Chats about &lt;a href=&quot;https://www.igalia.com/chats/gpc&quot;&gt;Global Privacy Control&lt;/a&gt;, which, at the end of the day, is mainly a boolean header that a browser can send. As we discussed in the Chat, it probably feels suprising to learn that the efforts to do something like this wind up spanning _many years_ (there are some helpful links there to the history of Do Not Track as well) and what makes people believe that this time it will be different (that the pressure kind of came from outside first is a big one).  Anyway, it's kind of fascinating if you don't know any of this stuff.&lt;/p&gt;

	&lt;p&gt;Then, on Thursday, the SpellCheckCustomDictionary proposal advanced to stage 2 in WHATWG. If you're not familliar with it, I wrote a &lt;a href=&quot;https://bkardell.com/blog/EnhancedSpellchecking.html&quot;&gt;short post about it&lt;/a&gt; not too long ago.  The reason I mention this is that it's been stuck for months at stage 1, because we needed to talk a lot about Internationalization concerns.&lt;/p&gt;

	&lt;p&gt;This is a potentially important discussion, to be sure. However, only &quot;potentially&quot; so because while spell check has existed in browsers for more than 10 years, for the most part, the `lang` attribute remains unconsulted.  Where it is, it's not really specified how that should work in terms of general spell checking.&lt;/p&gt;  

	&lt;p&gt;To me, that feels worth talking about, because it sometimes feels like there are impractical gaps that it's not clear how to fill.  On the one hand, it feels unreasonable to expect a small improvement to spell checking to be held to a higher standard than the mature specification and existing implementations.  On the other hand, I fully agree that these are important questions.  The difficulty, at some level, is that all of these uniquely important questions are also somehow dramatically underfunded. Accessibility, Internationalization, Privacy - or even just integrating and normalizing MathML and SVG into &lt;a href=&quot;https://bkardell.com/blog/OnePlatform.html&quot;&gt;One Platform&lt;/a&gt; being just a few obvious examples.&lt;/p&gt;

	&lt;p&gt;It's hard to live up to ideals if we're not funding them well enough, or if they aren't pragmatic enough (for example, demanding the the spec is right).&lt;/p&gt;

	&lt;p&gt;I don't really know how to fix the funding bit except to continue to lobby vendors to allocate more budget to those things (or, in come cases, maybe just any budget at all) and to suggest that we need more experiments in collectively funding and prioritizing those ideals in implementation work.  Lots of features are like fast food or desserts - someone needs to make sure that we eat our vegetables.&lt;/p&gt;                </content>
		<author>
			<name>Brian Kardell</name>
			<uri>http://bkardell.com/</uri>
		</author>
	</entry>

	<entry>
		<title>St&#233;phane Cerveau: Introducing GstPipelineStudio 0.6.0</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/scerveau/introducing-gstpipelinestudio-0-6-0/"/>
		<id>https://blogs.igalia.com/scerveau/introducing-gstpipelinestudio-0-6-0/</id>
		<updated>2026-09-25T00:00:00+00:00</updated>
		<content type="html">
&lt;h1 id=&quot;gstpipelinestudio-0-6-0&quot; tabindex=&quot;-1&quot;&gt;GstPipelineStudio 0.6.0 &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/scerveau/introducing-gstpipelinestudio-0-6-0/&quot;&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id=&quot;let-the-pipeline-build-itself&quot; tabindex=&quot;-1&quot;&gt;Let the Pipeline Build Itself &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/scerveau/introducing-gstpipelinestudio-0-6-0/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://gps.mooday.dev&quot;&gt;GstPipelineStudio 0.6.0&lt;/a&gt; is out! After &lt;a href=&quot;https://blogs.igalia.com/scerveau/introducing-gstpipelinestudio-0-5-1/&quot;&gt;0.5.1&lt;/a&gt;
taught GPS to open dot files, this release teaches it to &lt;strong&gt;suggest&lt;/strong&gt;: the next element for any
free source pad, or even a complete pipeline from a media file.&lt;/p&gt;
&lt;h2 id=&quot;the-right-click-i-always-wanted&quot; tabindex=&quot;-1&quot;&gt;The Right-Click I Always Wanted &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/scerveau/introducing-gstpipelinestudio-0-6-0/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Almost since I started using GStreamer, I have wanted this feature. It comes straight from my
days with &lt;a href=&quot;https://learn.microsoft.com/en-us/windows/win32/directshow/using-graphedit&quot;&gt;GraphEdit&lt;/a&gt;
and DirectShow: connecting black boxes taught me what each filter did, but I was never quite sure
I had picked the best one for a given pin. So I relied on the right-click menu to show me my options.&lt;/p&gt;
&lt;p&gt;GStreamer makes that question even harder. A typical development setup exposes more than 1,500
features, with five or more decoders able to handle H.264 alone. Which one should I use? Can I try
another? Newcomers and seasoned developers alike ask this every day.&lt;/p&gt;
&lt;p&gt;Right-click any free source pad and GPS now offers three choices:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Suggest compatible elements&lt;/strong&gt;: list the elements that can link to this pad&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Auto-select next element&lt;/strong&gt;: let GPS pick the best candidate&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Auto-select all elements&lt;/strong&gt;: let GPS build the whole branch, up to the last compatible element or the sink&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;source type=&quot;image/avif&quot;&gt;&lt;source type=&quot;image/webp&quot;&gt;&lt;source type=&quot;image/png&quot;&gt;&lt;img alt=&quot;Pad context menu with element suggestions&quot; src=&quot;https://blogs.igalia.com/scerveau/img/9BfSSmGG_W-600.png&quot; width=&quot;1200&quot; height=&quot;631&quot; /&gt;&lt;/source&gt;&lt;/source&gt;&lt;/source&gt;&lt;/p&gt;
&lt;p&gt;The same mechanism works from a media file. Open a URI and, much like
&lt;a href=&quot;https://gstreamer.freedesktop.org/documentation/playback/decodebin3.html&quot;&gt;decodebin3&lt;/a&gt;, GPS lays
out a working pipeline with every decode branch. Except here you can see it, and change it. Try it, it&#8217;s
really fun!&lt;/p&gt;
&lt;p&gt;&lt;source type=&quot;image/avif&quot;&gt;&lt;source type=&quot;image/webp&quot;&gt;&lt;source type=&quot;image/png&quot;&gt;&lt;img alt=&quot;Pipeline generated automatically from an MP4 file&quot; src=&quot;https://blogs.igalia.com/scerveau/img/4EzCGYh2Rq-600.png&quot; width=&quot;1200&quot; height=&quot;631&quot; /&gt;&lt;/source&gt;&lt;/source&gt;&lt;/source&gt;&lt;/p&gt;
&lt;h2 id=&quot;a-fresh-living-interface&quot; tabindex=&quot;-1&quot;&gt;A Fresh, Living Interface &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/scerveau/introducing-gstpipelinestudio-0-6-0/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;GPS 0.6.0 has a new look. The panels have been reworked, and
&lt;a href=&quot;https://gnome.pages.gitlab.gnome.org/libadwaita/&quot;&gt;libadwaita&lt;/a&gt; now drives the UI on every
platform, Windows included, so GPS looks and behaves the same wherever you run it.&lt;/p&gt;
&lt;p&gt;Color themes arrive too. Pick the one that suits you: the same pipeline, a different mood.&lt;/p&gt;
&lt;p&gt;&lt;source type=&quot;image/avif&quot;&gt;&lt;source type=&quot;image/webp&quot;&gt;&lt;source type=&quot;image/png&quot;&gt;&lt;img alt=&quot;The suggestion menu with another color theme&quot; src=&quot;https://blogs.igalia.com/scerveau/img/wS6AkvPLqL-600.png&quot; width=&quot;1200&quot; height=&quot;631&quot; /&gt;&lt;/source&gt;&lt;/source&gt;&lt;/source&gt;&lt;/p&gt;
&lt;p&gt;The interface also comes alive during playback. A heartbeat shows at a glance that your pipeline
is running, so you are no longer watching a static diagram but a live system.&lt;/p&gt;
&lt;p&gt;The graph view is also easier to handle. You can now select several elements at once, then move
or delete them in a single batch, which makes large and complex pipelines far easier to reorganize.
The underlying graphmanager library is becoming mature enough to fly on its own soon.&lt;/p&gt;
&lt;h2 id=&quot;a-catalog-of-classic-pipelines&quot; tabindex=&quot;-1&quot;&gt;A Catalog of Classic Pipelines &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/scerveau/introducing-gstpipelinestudio-0-6-0/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Not sure where to start? The new &lt;strong&gt;Pipelines&lt;/strong&gt; tab lists classic GStreamer pipelines, adapted to
your platform: test sources, timestamp overlays, scaling, framerate limiting, tee, compositor and
more. Pick one, and it opens ready to play and tweak.&lt;/p&gt;
&lt;p&gt;&lt;source type=&quot;image/avif&quot;&gt;&lt;source type=&quot;image/webp&quot;&gt;&lt;source type=&quot;image/png&quot;&gt;&lt;img alt=&quot;The Pipelines tab with a timestamp overlay pipeline&quot; src=&quot;https://blogs.igalia.com/scerveau/img/PF4GajlXaS-600.png&quot; width=&quot;1200&quot; height=&quot;631&quot; /&gt;&lt;/source&gt;&lt;/source&gt;&lt;/source&gt;&lt;/p&gt;
&lt;h2 id=&quot;and-more&quot; tabindex=&quot;-1&quot;&gt;And More &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/scerveau/introducing-gstpipelinestudio-0-6-0/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Here are the other improvements in &lt;a href=&quot;https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio/-/releases&quot;&gt;0.6.0&lt;/a&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A much faster logger that keeps up with very verbose output such as
&lt;a href=&quot;https://gstreamer.freedesktop.org/documentation/tutorials/basic/debugging-tools.html&quot;&gt;&lt;code&gt;GST_DEBUG=*:7&lt;/code&gt;&lt;/a&gt;,
laying the groundwork for log filtering&lt;/li&gt;
&lt;li&gt;French and Spanish translations, managed with
&lt;a href=&quot;https://hosted.weblate.org/projects/gstpipelinestudio/&quot;&gt;Weblate&lt;/a&gt;. Contributions for your
language are welcome!&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;what-s-next&quot; tabindex=&quot;-1&quot;&gt;What&#8217;s Next &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/scerveau/introducing-gstpipelinestudio-0-6-0/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Log filtering comes next. It could take GPS to another level, letting you validate a pipeline or
track down a problem from a friendly interface instead of digging through raw logs. Pipeline
statistics and smarter auto-suggestion are also on the way.&lt;/p&gt;
&lt;p&gt;We had a great time building this release, and we hope you&#8217;ll have as much fun playing with it,
and with the fabulous GStreamer framework. Feel free to propose new features with an RFC
&lt;a href=&quot;https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio/-/issues/new&quot;&gt;here&lt;/a&gt; or send merge
requests &lt;a href=&quot;https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio/-/merge_requests&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As usual, if you would like to learn more about GstPipelineStudio, GStreamer, or any other open
multimedia framework, please contact &lt;a href=&quot;https://www.igalia.com/&quot;&gt;us&lt;/a&gt;!&lt;/p&gt;                </content>
		<author>
			<name>St&#233;phane Cerveau</name>
			<uri>https://blogs.igalia.com/scerveau/</uri>
		</author>
	</entry>

	<entry>
		<title>Stephanie Stimac: A Short Update on Designing for Foldable Devices</title>
		<link rel="alternate" type="text/html" href="https://blog.stephaniestimac.com/posts/2026/09/an-update-on-designing-for-foldable-devices/"/>
		<id>https://blog.stephaniestimac.com/posts/2026/09/an-update-on-designing-for-foldable-devices/</id>
		<updated>2026-09-24T00:00:00+00:00</updated>
		<content type="html">
&lt;p&gt;And here we are three years after I wrote about the &lt;a href=&quot;https://blog.stephaniestimac.com/posts/2023/05/design-foldable-devices/&quot;&gt;Google Pixel Fold being announced&lt;/a&gt;, followed now with the announcement of the iPhone Duo...(I have questions about the naming by the way).&lt;/p&gt;
&lt;p&gt;Four years ago I was talking about web primitives in the platform for the Surface Duo. My how time flies.&lt;/p&gt;
&lt;p&gt;There are &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/vertical-viewport-segments&quot;&gt;CSS media features&lt;/a&gt;, a &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Viewport_segments_API&quot;&gt;Viewport Segments API&lt;/a&gt;, a &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Device_Posture_API&quot;&gt;Device Posture API&lt;/a&gt; but Chromium based browsers are the only ones currently supporting these things.&lt;/p&gt;
&lt;p&gt;I haven't been able to find any signal yet on whether Safari will support these things in the web platform as the developer docs focus on application development.&lt;/p&gt;
&lt;p&gt;If you're interested in trying out the platform features, you can emulate the Surface Duo and Galaxy Z Fold in the developer tools.&lt;/p&gt;
&lt;p&gt;And if you're thinking, do I really have to have my website adapt to two screens? The answer is no. Adding a design to an application or dual screen makes sense if you have an experience that has two simulataneous contexts that are useful e.g. a list of email messages/inbox on one screen, an open message, email thread or email composer on the other.&lt;/p&gt;
&lt;p&gt;Here's &lt;a href=&quot;https://www.youtube.com/watch?v=DJZI-C_nrqQ&amp;t&quot;&gt;one of my talks from 2022&lt;/a&gt; if you're interested in learning more about what's available in the browser for dual screen/foldable devices.&lt;/p&gt;
&lt;p&gt;Happy building :)&lt;/p&gt;                </content>
		<author>
			<name>Stephanie Stimac</name>
			<uri>https://blog.stephaniestimac.com</uri>
		</author>
	</entry>

	<entry>
		<title>Ricardo Garc&#237;a: XDC 2025 CTS Talk</title>
		<link rel="alternate" type="text/html" href="https://rg3.name/202609212017.html"/>
		<id>https://rg3.name/202609212017.html</id>
		<updated>2026-09-21T20:17:00+00:00</updated>
		<content type="html">
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;We&amp;#8217;re only one week away from &lt;a href=&quot;https://indico.freedesktop.org/event/12/&quot;&gt;XDC 2026&lt;/a&gt;, which will take place in Toronto from the 28th to the 30th of September.
I&amp;#8217;ll be there one more year together with a sizeable group of &lt;a href=&quot;https://www.igalia.com/&quot;&gt;Igalia&lt;/a&gt; colleagues presenting on a number of different topics related to the open source graphics stack.
See &lt;a href=&quot;https://indico.freedesktop.org/event/12/timetable/#all.detailed&quot;&gt;the full schedule for more details&lt;/a&gt;.
I&amp;#8217;ll open the afternoon lightning talks round on Monday with a &lt;a href=&quot;https://indico.freedesktop.org/event/12/contributions/548/&quot;&gt;brief presentation&lt;/a&gt; about a memory usage problem we recently solved in Vulkan CTS.
Last year I also &lt;a href=&quot;https://indico.freedesktop.org/event/10/contributions/416/&quot;&gt;gave an overview of Vulkan CTS and listed a bunch of tips and tricks about it&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;You can find the slides in the link above but I noticed I never actually embedded my talk in a blog post for posterity, and I didn&amp;#8217;t provide a transcription of the 2025 talk for those more inclined to read than to watch a video.
Please excuse me for being so late.
You can find both the video and the transcription below.
See you in Toronto!&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;sect3&quot;&gt;
&lt;h4 id=&quot;_xdc_2025_recording&quot;&gt;XDC 2025 Recording&lt;/h4&gt;
&lt;div class=&quot;youtube&quot;&gt;
html, body { height: 100%; margin: 0; overflow: hidden; background: #000; } a { position: absolute; inset: 0; } a:focus-visible { outline: 4px solid #fff; outline-offset: -4px; } img { position: absolute; width: 100%; top: 0; bottom: 0; margin: auto; opacity: .25; } span { position: absolute; inset: 0; height: 1.5em; margin: auto; text-align: center; font: 500% sans-serif; color: #fff; }&lt;a href=&quot;https://www.youtube-nocookie.com/embed/lwFtuXq8nc8?autoplay=1&quot;&gt;&lt;img src=&quot;https://rg3.name/img/youtube/lwFtuXq8nc8.jpg&quot; alt=&quot;Play video: Vulkan CTS Tips and Tricks&quot; /&gt;&lt;span&gt;&amp;#x25b6;&lt;/span&gt;&lt;/a&gt;&quot;&gt;
&lt;p class=&quot;youtube-link&quot;&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=lwFtuXq8nc8&quot;&gt;Watch on YouTube: Vulkan CTS Tips and Tricks&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sect3&quot;&gt;
&lt;h4 id=&quot;_talk_slides_and_transcription&quot;&gt;Talk slides and transcription&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-01.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-01-tn.png&quot; alt=&quot;Title Slide: Vulkan CTS Tips and Tricks&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;Thanks everyone! Hello, I&amp;#8217;m Ricardo from Igalia and I&amp;#8217;m going to talk about Vulkan CTS, giving you some general information and some tips and tricks about it.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-02.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-02-tn.png&quot; alt=&quot;Slide 2: About Me&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;I&#8217;ve been contributing to the Vulkan Conformance Test Suite since 2019. It&#8217;s the same project that has  OpenGL tests, but I have almost no contributions to the OpenGL part.
I&#8217;m not the only one at Igalia working on CTS. Our work on this front is being generously funded by Valve.
As part of my job, I frequently interact with Mesa contributors and people at Khronos. There&#8217;s some overlap between both, specially in this room.
So what is my job about?&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-03.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-03-tn.png&quot; alt=&quot;Slide 3: Slide 2 with the house on fire selfie girl meme on top in which the house is labeled Vulkan Drivers and the girl is labeled Me&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;This.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-04.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-04-tn.png&quot; alt=&quot;Slide 4: What is VK-GL-CTS?&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;The project is called VK-GL-CTS and it&#8217;s a Vulkan and OpenGL Conformance Test Suite.
Most people writing Vulkan drivers have had to deal with VK-GL-CTS at some point.
It&#8217;s open source, available on Github under the Apache 2 license.
You can see it has a lot of commits from many different contributors apart from us, but not much community or activity inside Github, for reasons that I will explain later. This is very common with Khronos projects.
Right now it has around 2.8 million Vulkan tests and ~5 million lines of code specific to Vulkan, but when you run a test you also use a lot of code from a common base that&#8217;s shared with OpenGL.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-05.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-05-tn.png&quot; alt=&quot;Slide 5: Vulkan Tests (1)&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;To give you some specific details about the Vulkan tests, if you take a look at the top-level README file, it points you to a second README that&#8217;s specific to Vulkan.
If you follow the quick instructions in that second README and you configure and build the project, you end up with a binary called deqp-vk in some subdirectory of the build directory.
That&#8217;s the base binary that allows you to run Vulkan tests by passing the -n option and indicating a test name, but you can also use asterisks in the name to form a glob that allows you to run multiple tests that match that pattern.
The program will print a summary of the results in the terminal and put a lot more detail about each test in a file called TestResults.qpa.
The tests are organized in a tree, with the leaves of  that tree being the test cases that can be run, and the nodes leading to that leaf being the parent test groups.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-06.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-06-tn.png&quot; alt=&quot;Slide 6: Vulkan Tests (2)&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;One example is this: a Vulkan test that tries to see if copying between images with some given formats works.
dEQP-VK, at the start of the name, is the root node, and there are subgroups to test the core API commands for copying and blitting images, and a subset of those are run for all formats with different image types, like copying from 1D to 2D using the general image layout for both images.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-07.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-07-tn.png&quot; alt=&quot;Slide 7: Build Tips (1)&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;Starting with the first tip: if you dig deeper in the Vulkan CTS README, it mentions a few useful things.
One of them is that, when building the project normally, you build many more things than the deqp-vk binary, like stuff for Vulkan Safety Critical, or some additional extra binaries.
Of course, if you build calling cmake or ninja, you can indicate that you only want to build deqp-vk. You can always create a shell alias, script or whatever to do that, but if you don&#8217;t want to forget about it, there&#8217;s a cmake configure option that you can use when building the project to specify the targets you want to build by default, called SELECTED_BUILD_TARGETS.
You pass a list of target names separated by spaces. If you specify deqp-vk only, only that binary will be built by default, which it&#8217;s much faster than building everything.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-08.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-08-tn.png&quot; alt=&quot;Slide 8: Build Tips (2)&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;Another configuration option that I find particularly useful is DEQP_LOG_NODE_SOURCE. This was added recently to main, so it&#8217;s present in the most recent branches, and requires a modern compiler to work.
If you enable it, the log file will mention, for every test case that is run, where the test case is being added to the tree. This makes it easier to locate the source code of a particular test. We&#8217;ll talk a bit more about that later.
If you use this, there&#8217;s a small performance penalty when creating the test tree in memory, but it&#8217;s probably worth it in many cases. I always use this option.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-09.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-09-tn.png&quot; alt=&quot;Side 9: Build Tips (3)&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;Another thing: the deqp-vk binary is typically around 400MB big in a Debug build, or more depending on some other build options, so it takes a long time to link it. This is specially problematic when you&#8217;re making changes to a single file and rebuilding.
Many Linux distributions still use BFD or Gold as the default linkers, which are very slow for deqp-vk, so my advice is to switch to LLD or Mold.
For example, in my previous laptop, the default linker took 30 seconds to link deqp-vk. With mold, it went down to &amp;lt;2 seconds.
Sometimes you can make them the default linker with update-alternatives but you can also set a link option from LDFLAGS and cmake will pick that up when configuring the project.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-10.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-10-tn.png&quot; alt=&quot;Slide 10: How Changes Are Reviewed&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;Moving on from build tips, I wanted to briefly explain how changes are reviewed and merged to the project.
This is related to the community aspect I mentioned before.
Every change that lands in the project needs to pass an internal review process inside Khronos.
Who&#8217;s reviewing and approving changes to CTS? Typically people who have a Vulkan implementation, that is, a Vulkan driver running on some hardware, but software-only implementations also count.
Some reviewers work on Mesa. For example, Samuel here reviews a lot of changes to make sure they work on RADV.
However, I think it&#8217;s fair to say most reviewers do not really look at the source code for the changes. They only want to check if the tests pass on their driver and, if they don&#8217;t pass, they block the change until they fix the driver, if it&#8217;s a driver bug.
A change cannot be blocked forever in those cases, so typically the result is that changes are merged more or less quickly and all drivers work and are fixed at the same time.
To help with that process, Khronos has an internal Gitlab instance to track proposals for new tests and issue reports.
If you don&#8217;t have Khronos access, you can report issues and submit PRs on Github, and someone will eventually review them and move them to the internal tracker.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-11.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-11-tn.png&quot; alt=&quot;Slide 11: How to Interact with VK-GL-CTS&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;So, again, if you have a Khronos account, go to Gitlab. If you don&#8217;t, use Github.
If days or weeks pass and nobody replies on Github, feel free to mention us, specially if your issue comes from Mesa. No guarantees, of course, but it may help move your issue forward. You have some of our handles in the slide.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-12.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-12-tn.png&quot; alt=&quot;Slide 12: How to Report Issues&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;Some basic stuff about reporting issues.
First, please mention hardware and driver, and if possible one specific case that is giving you trouble.
Maybe mention a larger set of tests if you think all of them are affected by the same problem.
Things that can be reported:
Test mistakes, specially if the problem is reported by the validation layers.
Also lack of coverage if you think something needs to be tested.
A couple of tips about coverage: if you&#8217;ve implemented something new and all related tests seem to be passing, try to break something on purpose inside the driver and see if the tests still pass. You may be surprised.
Also, if you discover a bug in your driver that is quite simple, obvious and it should be easy to reproduce, maybe it can be converted to a CTS test, so think about that.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-13.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-13-tn.png&quot; alt=&quot;Slide 13: How to Report Issues (2)&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;Expanding on the topic of reporting issues, sometimes I get the feeling that people assume some minor pain points that they find are simply there and go &#8220;well, CTS is like that sometimes&#8221;, so I want to mention more things that are fair game and worth reporting.
Configuration step takes too long: at some point a version of the layers was being built by default and the dependencies of the layers were being downloaded during the configuration step, instead of a previous step that fetched external dependencies.
Tests take too long to run: maybe a pathological case of the shader being too slow to compile (this is happening to our Rpi team), or the test hammering the PCI-e bus due to the chosen memory types (this happened to NVK and we introduced a mechanism to more easily select better memory types, and did some fixes to some tests)
And more stuff: tests that take too long  to skip, or fail without giving a hint about where, or explaining why (neither in the terminal nor in the logs), not logging enough information, build or link time worsens a lot, etc.
You don&#8217;t have to assume &#8220;CTS is like that&#8221;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-14.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-14-tn.png&quot; alt=&quot;Slide 14: Dealing with Test Failures&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;More stuff: dealing with test failures. First, if the test logs an image to TestResults.qpa, you can view them with the cherry tool mentioned in the README, but you can also use a self-contained viewer in the scripts subdirectory. It runs entirely in your browser. I have it as a local bookmark in Firefox.
It has some limitations. Images in the test log are logged as PNGs. Drawbacks: color depth, 3D images, etc. Ideally this tool would be much more sophisticated. Images would be logged in a format that was more flexible and the tool would allow you to examine layers of an image and raw values with precision and easily by hovering the mouse over a failing pixel, but we don&#8217;t have that.
You can also run the test in RenderDoc, and you should pass an option for that.
Finally, if the failure message does not mention a line and file in the source code where it&#8217;s failing, which is trivial, please report it as an issue. In the mean time, the log-node-source option that I mentioned before can help.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-15.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-15-tn.png&quot; alt=&quot;Slide 15: Navigating CTS Source Code&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;If you want to check what a test is doing, here are some hints about navigating the CTS source code. I don&#8217;t want to talk too much about this, but some details are worth mentioning.
If you log the node source and it points you to a line that mentions addFunctionCase, you only need to check the functions that are being run.
Otherwise, the source code contains test cases and instances. Test cases are the leaf nodes of the test tree that we mentioned, and have methods to check the requirements to run the test, to generate the shaders that will be used, and another one to create a test instance.
The test instance is the object that runs the actual test, in a method called iterate, and internally they can manage all the resources they need: images, buffers, command buffers, etc.
Test Cases in the tree are kept alive since the start of the process and until it finishes while a Test Instance is short-lived: they&#8217;re created to run the test, they allocate the resources they need, and they&#8217;re destroyed after the test finishes, freeing all resources.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-16.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-16-tn.png&quot; alt=&quot;Slide 16: How to Find Tests That&amp;#8230;&amp;#8203;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;The hard part: finding tests.
If I was given a cent every time someone asks me if we have tests that meet certain criteria, I could amass a small fortune.
We can always grep the source code searching for extension names, feature names, etc, but things can get really complicated.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-17.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-17-tn.png&quot; alt=&quot;Slide 17: How to Find Tests That&amp;#8230;&amp;#8203; (2)&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;Sometimes it&#8217;s not only about Feature X or Format Y, or a given API call.
We want some specific memory types and alignments, or in combination with some other feature, or some other weird and specific requirements that may not be easy to meet.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-18.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-18-tn.png&quot; alt=&quot;Slide 18: How to Find Tests That&amp;#8230;&amp;#8203; (3)&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;Sometimes we look at the source code and find that we do have that coverage.
Some other times we have similar coverage but not quite, and it may be easy or hard to add the requested coverage.
Of course, sometimes we&#8217;re lacking some general coverage and we need to create new tests.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-19.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-19-tn.png&quot; alt=&quot;Slide 19: How to Find Tests That&amp;#8230;&amp;#8203; (4)&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;Unfortunately, in many cases the real answer is that we do need to grep the source code as we mentioned before. However, some of this is being changed nowadays and we&#8217;re making progress towards making test requirements more explicit and, in a sense, declarative.
Ideally, at some point that should let us build a system that could be used to search test cases by features, formats, etc.
You can imagine something similar to Sascha Willems&#8217; GPU info database. We could combine it with logging the node source and make it easy to find the source code of those tests.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;span class=&quot;image&quot;&gt;&lt;a class=&quot;image&quot; href=&quot;https://rg3.name/img/xdc-2025/slide-20.png&quot;&gt;&lt;img src=&quot;https://rg3.name/img/xdc-2025/slide-20-tn.png&quot; alt=&quot;Slide 20: Thanks and Q&amp;A&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;That&#8217;s it. Many thanks! Let me know if you have any questions, or maybe you just want to rant about CTS. If not now, maybe later in the hallway.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sect3&quot;&gt;
&lt;h4 id=&quot;_qa&quot;&gt;Q&amp;amp;A&lt;/h4&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;strong&gt;Q&lt;/strong&gt;: We sometimes see that a particular test case runs on a queue like the graphics queue. Is it possible to run that test on another queue like the compute queue?&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;strong&gt;A&lt;/strong&gt;: That&amp;#8217;s being worked on. There&amp;#8217;s a very old feature request for CTS to basically be able to run every test that is possible on any other queue that&amp;#8217;s available on the device, in general. That&amp;#8217;s one thing. It&amp;#8217;s a hard problem given the state of the source code but people are working on it right now, and I think we will eventually get there, when we can run the tests on, say, the compute queue. Then that begs more questions like, for conformance purposes, do we have to run all the tests on all the queues supported by the device or not? The answer is not simple. The other possible answer is something that we have been doing for some time, as you know, is that we sometimes create specific variants for some tests that we know are tricky to run on the compute queue or on the transfer queue, and we create variants of those for those specific queues.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;strong&gt;Q&lt;/strong&gt;: Question about lists of packages for the linux distributions to be able to build deqp-vk.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;strong&gt;A&lt;/strong&gt;: I misunderstood part of the question as it was asked but later caught up with the person asking and he was genuinely wondering why deqp-vk was failing to build on some systems following the instructions. As a result of that question, we submitted an update to the documentation to be more precise in the list of required packages to build CTS, so that&amp;#8217;s a win!&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;strong&gt;Q&lt;/strong&gt;: Request to parametrize the side of the framebuffer in some tests, which is important for tilers like Turnip, to be able to run the test both using system memory and graphics memory.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;strong&gt;A&lt;/strong&gt;: Ack the request and admit that&amp;#8217;s a hard one (because it would need changes in a lot of tests).&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Ricardo Garc&#237;a</name>
			<uri>https://rg3.name</uri>
		</author>
	</entry>

	<entry>
		<title>Igalia WebKit Team: WebKit Igalia Periodical #78</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/webkit/blog/2026/wip-78/"/>
		<id>https://blogs.igalia.com/webkit/blog/2026/wip-78/</id>
		<updated>2026-09-21T20:15:02+00:00</updated>
		<content type="html">
&lt;p&gt;Update on what happened in WebKit in the week from September 14 to September 21.&lt;/p&gt;
&lt;p&gt;
Following up to last week, we have a handful of exciting fixes
to WebKitGTK and WPE WebKit covering Sysprof, rendering of CSS
&quot;filter&quot; and &quot;backdrop-filter&quot;, and the Layer-Based SVG Engine.
We also have optimizations, stable releases, and new blog posts!
&lt;/p&gt;
&lt;h2 id=&quot;cross-port-cat&quot;&gt;Cross-Port &#128049;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/321234@main&quot;&gt;Fixed the pairing of begin and end marks&lt;/a&gt; in &lt;code&gt;SysprofAnnotator&lt;/code&gt;, which kept only one begin per mark and therefore mistimed recursive, concurrent and overlapping marks, so &lt;a rel=&quot;external&quot; href=&quot;https://apps.gnome.org/Sysprof/&quot;&gt;Sysprof&lt;/a&gt; traces of WebKitGTK and WPE WebKit now show correct durations for nested work.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;graphics-frame-photo&quot;&gt;Graphics &#128444;&#65039;&lt;/h3&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/321515@main&quot;&gt;Fixed CSS &lt;code&gt;filter&lt;/code&gt; and &lt;code&gt;backdrop-filter&lt;/code&gt; rendering&lt;/a&gt; on transformed elements in the Skia compositor used by WebKitGTK and WPE WebKit, where &lt;code&gt;drop-shadow&lt;/code&gt; always fell in the same direction on screen instead of turning with the element, blur was scaled by neither the transform nor the device scale factor, and perspective was not handled at all. The filtered subtree is now painted with the layer transform on the canvas into a surface in the layer's own plane at a fixed scale, with the filter applied there and the result drawn back through the layer transform, as Chromium does.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/321493@main&quot;&gt;Stopped rasterizing the parts of a tile that the clip discards&lt;/a&gt; in the Skia backing store used by the GTK and WPE ports. Both the drawn quad and its source rectangle are now cut down to the clip first, so the rasterizer no longer fills pixels that are immediately thrown away when a tile is larger than the clip.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/321441@main&quot;&gt;Fixed the &lt;code&gt;transform&lt;/code&gt; attribute on the outermost &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; element&lt;/a&gt;, which the legacy SVG engine ignored entirely and the Layer-Based SVG Engine (LBSE) wrongly applied inside &lt;code&gt;viewBox&lt;/code&gt; space. The attribute is now turned into the CSS &lt;code&gt;transform&lt;/code&gt; property, one CSS function per SVG function, so that it transforms the element's CSS box, matching the behaviour of Chromium and Firefox.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;releases-package&quot;&gt;Releases &#128230;&#65039;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;After another six-month development cycle, &lt;a rel=&quot;external&quot; href=&quot;https://webkitgtk.org/2026/09/16/webkitgtk2.54.0-released.html&quot;&gt;WebKitGTK 2.54.0&lt;/a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https://wpewebkit.org/release/wpewebkit-2.54.0.html&quot;&gt;WPE WebKit 2.54.0&lt;/a&gt; have been published. These are the first stable releases of the 2.54 series, that as a highlight include a completely new compositor based on Skia. As it is becoming tradition with each major release, two blog posts go into details of what's &lt;a rel=&quot;external&quot; href=&quot;https://wpewebkit.org/blog/2026-09-16-wpewebkit-2.54.html&quot;&gt;new in WPE WebKit 2.54&lt;/a&gt;, and &lt;a rel=&quot;external&quot; href=&quot;https://webkitgtk.org/2026/09/16/webkitgtk-2.54-highlights.html&quot;&gt;in WebKitGTK 2.54&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This release is a milestone for WPE WebKit: after a couple of years in the incubator, the new &lt;a rel=&quot;external&quot; href=&quot;https://wpewebkit.org/reference/2.54.0/wpe-platform-2.0/&quot;&gt;WPEPlatform embedding API&lt;/a&gt; is now considered stable and recommended for new developments. As part of the stabilization, the WPEPlatform manual now includes &lt;a rel=&quot;external&quot; href=&quot;https://wpewebkit.org/reference/2.54.0/wpe-platform-2.0/tutorial-browser.html&quot;&gt;not one&lt;/a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https://wpewebkit.org/reference/2.54.0/wpe-platform-2.0/tutorial-platform.html&quot;&gt;but two&lt;/a&gt; introductory tutorials, and &lt;a rel=&quot;external&quot; href=&quot;https://wpewebkit.org/reference/2.54.0/wpe-platform-2.0/migrating-from-libwpe.html&quot;&gt;a migration guide&lt;/a&gt; to aid migration from the (now) legacy &lt;code&gt;libwpe&lt;/code&gt;-based embedding API.&lt;/p&gt;
&lt;p&gt;Note that the &lt;code&gt;libwpe&lt;/code&gt;-based legacy API is still available and will be kept in light maintenance mode for the foreseeable future.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;community-events-handshake&quot;&gt;Community &amp;amp; Events &#129309;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Coinciding with the first stable releases, Carlos Garc&#237;a has &lt;a rel=&quot;external&quot; href=&quot;https://blogs.igalia.com/carlosgc/2026/09/21/skia-compositor-for-wpe-webkit-and-webkitgtk/&quot;&gt;written about the new Skia compositor&lt;/a&gt; that is debuting in the 2.54 series. It includes plenty of details on why and how the new compositor has been built to replace the aging TextureMapper, and measurements that demonstrate how it is bringing graphics performance improvements across the board.&lt;/p&gt;
&lt;p&gt;At the same time, Nikolas Zimmermann published a companion article about &lt;a rel=&quot;external&quot; href=&quot;https://blogs.igalia.com/nzimmermann/posts/2026-09-21-skia-compositor-damaging/&quot;&gt;damage handling in the new Skia compositor&lt;/a&gt; that explains how the feature it has been rewritten with a focus on correctness while ensuring that it saves doing unnecessary work without incurring on excessive busywork that would cancel the benefits.&lt;/p&gt;
  &lt;/div&gt;
&lt;div class=&quot;wip-end&quot;&gt;
&lt;p&gt;That&#8217;s all for this week!&lt;/p&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Igalia WebKit Team</name>
			<uri>https://blogs.igalia.com/webkit</uri>
		</author>
	</entry>

	<entry>
		<title>Ricardo Ca&#241;uelo Navarro: Why don't we do a demo? Part 3: developing the user interfaces</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/rcn/posts/20260921-why_dont_we_do_a_demo_part_3/index.html"/>
		<id>https://blogs.igalia.com/rcn/posts/20260921-why_dont_we_do_a_demo_part_3/index.html</id>
		<updated>2026-09-21T10:00:00+00:00</updated>
		<content type="html">
&lt;p&gt;In this instalment of the &#8220;Why don&#8217;t we do a demo?&#8221; series I&#8217;ll
continue through the software development part of the demo and I&#8217;ll end
up with an MVP that will be later shaped into a finished product. Check
out the previous parts (&lt;a href=&quot;https://blogs.igalia.com/rcn/posts/20260317-why_dont_we_do_a_demo_part_1/index.html&quot;&gt;The
plan&lt;/a&gt;, &lt;a href=&quot;https://blogs.igalia.com/rcn/posts/20260330-why_dont_we_do_a_demo_part_2/index.html&quot;&gt;Software
development&lt;/a&gt;) to have more context on how we got here.&lt;/p&gt;
&lt;h3 id=&quot;problem-13-bringing-up-the-touch-display-in-the-console-device&quot;&gt;Problem
13: Bringing up the touch-display in the console device&lt;/h3&gt;
&lt;p&gt;I chose the &lt;a href=&quot;https://docs.zephyrproject.org/latest/boards/shields/buydisplay_3_5_tft_touch_arduino/doc/index.html&quot;&gt;display
hardware&lt;/a&gt; based on what was readily supported in Zephyr so, in
theory, I&#8217;m expecting it to work out of the box. However, things are
rarely that simple.&lt;/p&gt;
&lt;p&gt;There&#8217;s a &lt;a href=&quot;https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/display/lvgl&quot;&gt;basic
LVGL sample&lt;/a&gt; as a starting point to check the hardware. In principle,
if that works, all I have to do then is to design and implement the user
interface. The sample works but, as the docs explain, I&#8217;ll need to do a
small manual tweak in the board:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Touch controller IRQ line is not connected by default. You will need
to solder the 5 INT jumper to use it. You will also need to adjust
driver configuration and its Device Tree entry to make use of it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Besides, while the basic sample works, there are other problems when
I try to draw more complex layouts.&lt;/p&gt;
&lt;h4 id=&quot;solution&quot;&gt;Solution&lt;/h4&gt;
&lt;p&gt;Soldering the jumper isn&#8217;t really an obstacle:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://blogs.igalia.com/rcn/posts/20260921-why_dont_we_do_a_demo_part_3/jumper.jpg&quot; class=&quot;center&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The pads are accessible and big enough to be easy to solder using a
solder pen or silver paste syringe with a steady hand:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://blogs.igalia.com/rcn/posts/20260921-why_dont_we_do_a_demo_part_3/silver_paste.jpg&quot; class=&quot;center&quot; /&gt;&lt;/p&gt;
&lt;p&gt;After soldering, I tested the sample application again and I could
check that the touchscreen works by clicking on the test button:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://blogs.igalia.com/rcn/posts/20260921-why_dont_we_do_a_demo_part_3/lvgl_hello_world.png&quot; class=&quot;center&quot; /&gt;&lt;/p&gt;
&lt;p&gt;But now, if I continue building upon this, creating a proper
interface with more widgets and a more complex layout, even if it&#8217;s just
for testing for now, the display shows a blank screen.&lt;/p&gt;
&lt;p&gt;This is a fairly common problem and it was easy to search for info
about it, everything pointed to the small default size of the memory
region for the LVGL heap (&lt;code&gt;CONFIG_LV_Z_MEM_POOL_SIZE&lt;/code&gt;). After
some experiments I settled on a value that worked for the application
needs. To err on the safe side, the strategy is to allocate as much
memory as possible to LVGL after the memory needs of all the other
subsystems are met. The network stack and web server are the other parts
that need large-ish memory allocations, but the LVGL memory pool will be
the largest by far, at 32 KB.&lt;/p&gt;
&lt;p&gt;Building the application with this configuration shows that I&#8217;m now
using almost all the RAM:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Memory region         Used Size  Region Size  %age Used
           FLASH:      780028 B         1 MB     74.39%
             RAM:      251936 B       256 KB     96.11%
        IDT_LIST:          0 GB        32 KB      0.00%&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But I can continue adding more widgets and creating more complex GUI
layouts.&lt;/p&gt;
&lt;h3 id=&quot;problem-14-touch-display-problems&quot;&gt;Problem 14: Touch-display
problems&lt;/h3&gt;
&lt;p&gt;The initial LVGL &#8220;hello world&#8221; test above works as expected when
tested on the display but, once I start adding more components to the
interface, something seems wrong. Buttons aren&#8217;t pressed when I click on
them, and touching random areas of the display trigger some widgets in
other parts of the screen.&lt;/p&gt;
&lt;p&gt;After a while, I noticed this behavior isn&#8217;t random. When I click
something on the right side, the widget receiving the action is on the
left side. When I click on the top area, the action is triggered at the
bottom. The touch coordinates seem to be flipped. This probably went
unnoticed because the layout of the &#8220;hello world&#8221; sample is just a
single button in the center of the display, that is, it&#8217;s symmetrical in
both axes, so any touch on the button will push it, flipped coordinates
or not.&lt;/p&gt;
&lt;h4 id=&quot;solution-1&quot;&gt;Solution&lt;/h4&gt;
&lt;p&gt;This one&#8217;s really easy, just a matter of removing the pointer axes
inversion properties from the display device tree. &lt;a href=&quot;https://github.com/zephyrproject-rtos/zephyr/commit/e407153fd22b24627ec41e2af9f75ace229c2bf6&quot;&gt;Done
and merged&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;problem-15-gui-design&quot;&gt;Problem 15: GUI design&lt;/h3&gt;
&lt;p&gt;The design and implementation of the graphical interface involves two
different problems:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How to fit all the information and controls in a tiny display and in
a platform like this.&lt;/li&gt;
&lt;li&gt;How to implement it effectively.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In terms of design, I&#8217;m restricted by the screen real state (3.5
inches), but also by the hardware (memory and display speed). I
certainly can&#8217;t make anything as responsive and feature-rich as what
we&#8217;re used to in smartphones, so I need to keep it simple but
functional.&lt;/p&gt;
&lt;p&gt;With regards to implementation, the main obstacle is the complexity
of the &lt;a href=&quot;https://lvgl.io/docs/open/common-widget-features&quot;&gt;LVGL
api&lt;/a&gt; and the amount of trial-and-error needed while tweaking and
testing the layout, which can be very time-consuming, even when testing
on the simulator. While LVGL isn&#8217;t more complex than other graphical
libraries, the amount of widget configuration variables, particularly
related to styling, means I&#8217;ll still need to do a lot of tests to get
the positioning and behavior just right.&lt;/p&gt;
&lt;h4 id=&quot;solution-2&quot;&gt;Solution&lt;/h4&gt;
&lt;p&gt;I started designing the simplest possible layout, a main container
with subcontainers arranged in a single column, where every component is
a widget box containing the controls for a peripheral slot. It&#8217;d look
something like this:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://blogs.igalia.com/rcn/posts/20260921-why_dont_we_do_a_demo_part_3/GUI_mockup.png&quot; class=&quot;center&quot; /&gt;&lt;/p&gt;
&lt;p&gt;When a slot isn&#8217;t connected to any peripheral, I can make everything
except for the &#8220;Status&#8221; label and the &#8220;Scan&#8221; button invisible, I can
shrink the containers vertically. The scrollbar would let us move
through the available slots if they don&#8217;t all fit in the main
container.&lt;/p&gt;
&lt;p&gt;Now I need to grow the initial LVGL example code to implement this
layout. Normally, this would involve a lot of iterations of changing
details in the code, building and testing until I get everything looking
and working the way I want. Fortunately, I found a tool (&lt;a href=&quot;https://www.envox.eu/studio/studio-introduction/&quot;&gt;EEZ Studio&lt;/a&gt;)
that&#8217;ll make part of the process much easier and faster, as it has an
LVGL visual editor and code generator that will let me sketch the layout
visually, do all the style changes and then generate the code. I&#8217;m not
taking the generated code as is, as I need to integrate it into the
application and I&#8217;ll want to do some things differently, but this is a
huge time saver compared to doing the whole process by hand.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://blogs.igalia.com/rcn/posts/20260921-why_dont_we_do_a_demo_part_3/eez_studio.png&quot; class=&quot;center&quot; /&gt;&lt;/p&gt;
&lt;h3 id=&quot;problem-16-display-refresh-speed&quot;&gt;Problem 16: Display refresh
speed&lt;/h3&gt;
&lt;p&gt;The GUI is looking good now, I can test it on the board and control
the peripherals through the display, but I noticed that when the
peripheral controls don&#8217;t fit into one screen and I need to scroll down
to reach the additional controls, the scroll redisplay is really slow.
Normally, re-drawing a label or a button happens fast enough, but
re-drawing the whole screen happens too slowly, you can clearly notice
parts of the screen being updated as you scroll, with the naked eye.
This drags down the responsiveness and makes the display practicaly
unusable in some scenarios.&lt;/p&gt;
&lt;p&gt;All in all, this adds yet another restriction: no scrolling.&lt;/p&gt;
&lt;h4 id=&quot;solution-3&quot;&gt;Solution&lt;/h4&gt;
&lt;p&gt;The best solution I could find for this is to draw a single
controller widget container in the screen at a time, and switch from one
controller to another using tabs. In each controller container, I also
need to make sure all peripheral widgets fit in a single screen so I can
safely disable and avoid scrolling altogether:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://blogs.igalia.com/rcn/posts/20260921-why_dont_we_do_a_demo_part_3/GUI_mockup_2.png&quot; class=&quot;center&quot; /&gt;&lt;/p&gt;
&lt;p&gt;That&#8217;ll do, in theory. Implementing it isn&#8217;t too much of a hassle
after having done the previous, non-tabbed version. The GUI logic is
simple enough, and keeping a hierarchical and instance-based model for
the data structures, where widgets are nested inside containers (nested
within other containers), and certain parts can be modeled and
duplicated, makes it easy to control each widget group and make them
reactive to events. For instance, remove the peripheral widgets of a
controller when the controller isn&#8217;t connected, or disable the &#8220;Scan&#8221;
button while the scan is already ongoing.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void setup_slot(int r, int s)
{
    lv_obj_t *tab = controller_widgets[r].tab;
    struct slot_widget *slot = &amp;amp;controller_widgets[r].slots[s];
    lv_obj_t *label;

    slot-&amp;gt;slot_idx = s;
    slot-&amp;gt;controller_idx = r;

    slot-&amp;gt;slot_cont = lv_obj_create(tab);
    [...]

    slot-&amp;gt;slot_status_cont = lv_obj_create(slot-&amp;gt;slot_cont);
    [...]

    slot-&amp;gt;status_label = lv_label_create(slot-&amp;gt;slot_status_cont);
    lv_obj_set_size(slot-&amp;gt;status_label, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
    lv_label_set_text_fmt(slot-&amp;gt;status_label, &amp;quot;Slot %d: Disconnected&amp;quot;, s + 1);
    slot-&amp;gt;scan_btn = lv_btn_create(slot-&amp;gt;slot_status_cont);
    label = lv_label_create(slot-&amp;gt;scan_btn);
    lv_obj_set_size(label, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
    lv_label_set_text(label, &amp;quot;Scan&amp;quot;);
    lv_obj_add_event_cb(slot-&amp;gt;scan_btn, controller_scan_btn_cb,
        LV_EVENT_CLICKED, (void *)slot);
    [...]
}

void setup_controller(int r)
{
    char controller_str[30];
    lv_obj_t *label_cont;
    lv_obj_t *label;
    lv_obj_t *tab;
    int i;

    snprintf(controller_str, sizeof(controller_str), &amp;quot;Controller %d&amp;quot;, r + 1);
    controller_widgets[r].tab = lv_tabview_add_tab(tabview_container, controller_str);
    tab = controller_widgets[r].tab;
    [...]

    /* Container for label and button */
    controller_widgets[r].label_cont = lv_obj_create(tab);
    label_cont = controller_widgets[r].label_cont;
    lv_obj_set_width(label_cont, LV_PCT(100));
    lv_obj_set_height(label_cont, LV_SIZE_CONTENT);
    [...]

    /* Label and Scan button */
    controller_widgets[r].controller_label = lv_label_create(label_cont);
    lv_label_set_text(controller_widgets[r].controller_label, &amp;quot;Status: Disconnected&amp;quot;);
    controller_widgets[r].scan_btn = lv_btn_create(label_cont);
    lv_obj_set_style_pad_top(controller_widgets[r].scan_btn, 5,
        LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_pad_bottom(controller_widgets[r].scan_btn, 5,
        LV_PART_MAIN | LV_STATE_DEFAULT);
    label = lv_label_create(controller_widgets[r].scan_btn);
    lv_obj_set_size(label, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
    lv_label_set_text(label, &amp;quot;Scan&amp;quot;);
    lv_obj_add_event_cb(controller_widgets[r].scan_btn, console_scan_btn_cb,
        LV_EVENT_CLICKED, (void *)r);

    /* Create slot widgets */
    for (i = 0; i &amp;lt; MAX_PERIPHERALS_PER_CONTROLLER; i++) {
        setup_slot(r, i);
    }
}

void startup_screen(void)
{
    [...]

    /* Main container */
    tabview_container = lv_tabview_create(lv_screen_active());
    lv_obj_set_size(tabview_container, LV_PCT(100), LV_PCT(100));
    lv_tabview_set_tab_bar_position(tabview_container, LV_DIR_TOP);
    lv_tabview_set_tab_bar_size(tabview_container, 28);
    lv_obj_t *content = lv_tabview_get_content(tabview_container);
    lv_obj_clear_flag(content, LV_OBJ_FLAG_SCROLLABLE);

    [...]

    /* Populate tabs */
    for (i = 0; i &amp;lt; MAX_CONTROLLERS; i++) {
        setup_controller(i);
    }

    [...]
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The sketch looks like this on the simulator:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://blogs.igalia.com/rcn/posts/20260921-why_dont_we_do_a_demo_part_3/GUI_tabs.png&quot; class=&quot;center&quot; /&gt;&lt;/p&gt;
&lt;h3 id=&quot;problem-17-battery-management&quot;&gt;Problem 17: Battery
management&lt;/h3&gt;
&lt;p&gt;The peripheral devices are battery powered but so far we&#8217;re just
trusting the the batteries have enough charge and that everything will
just work. At the very least we should periodically monitor the battery
charge, set some operational safety measures in the firmware and
broadcast the battery level to the connected devices.&lt;/p&gt;
&lt;h4 id=&quot;solution-4&quot;&gt;Solution&lt;/h4&gt;
&lt;p&gt;The XIAO nRF54L15 &lt;a href=&quot;https://wiki.seeedstudio.com/xiao_nrf54l15_sense_getting_started/#battery-voltage-detection&quot;&gt;provides
a mechanism&lt;/a&gt; to measure the battery level on demand using a load
switch and an ADC.&lt;/p&gt;
&lt;p&gt;To get a battery voltage measurement I need to enable the load
switch, wait for it to turn on, sample the ADC connected to its output
and convert the value to millivolts, doing the necessary adjustments to
the reading (considering the voltage divider applied at the output).&lt;/p&gt;
&lt;p&gt;Once I have this, there are two things I&#8217;ll want to do with it:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Shutdown the firmware when the voltage is below a safe threshold.
The SoC has a brownout reset generator and a glitch detector, but I&#8217;d
rather detect and manage this via firmware.&lt;/li&gt;
&lt;li&gt;Publish the battery level, in percentage, using the standard &lt;a href=&quot;https://www.bluetooth.com/specifications/specs/bas-1-1/&quot;&gt;BAS
service&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This can be done with very little code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/* Data of ADC io-channels specified in devicetree. */
static const struct adc_dt_spec adc_channels[] = {
    DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), io_channels,
                         DT_SPEC_AND_COMMA)};

/* Battery load switch (for battery level measurement) */
static const struct device *const vbat_reg = DEVICE_DT_GET(DT_NODELABEL(vbat_pwr));

/* ADC data */
uint16_t buf;
struct adc_sequence sequence = {
    .buffer = &amp;amp;buf,
    .buffer_size = sizeof(buf),
};

void shutdown(void)
{
    gpio_remove_callback(button.port, &amp;amp;button_cb_data);
    gpio_remove_callback(button_board.port, &amp;amp;button_board_cb_data);
    led_state = 0;
    gpio_pin_set_dt(&amp;amp;led, led_state);
    gpio_pin_set_dt(&amp;amp;led_board, led_state);
    if (led_indication_enabled &amp;amp;&amp;amp; !atomic_get(&amp;amp;indication_ongoing))
        k_work_schedule(&amp;amp;led_indicate_work, K_NO_WAIT);
    k_sleep(K_SECONDS(5));

    sys_poweroff();
    /* Should never reach here */
    while (1) {
        LOG_ERR(&amp;quot;Shouldn't reach here&amp;quot;);
        k_sleep(K_FOREVER);
    }
}

/* BAS handler */
void battery_voltage_check(struct k_work *work)
{
    int err;
    int32_t val_mv;
    uint8_t val_pct;

    regulator_enable(vbat_reg);
    k_sleep(K_MSEC(100));
    err = adc_read_dt(&amp;amp;adc_channels[ADC_CHANNEL_ID], &amp;amp;sequence);
    if (err &amp;lt; 0) {
        LOG_ERR(&amp;quot;Could not read (%d)&amp;quot;, err);
        return;
    }

    /*
     * If using differential mode, the 16 bit value
     * in the ADC sample buffer should be a signed 2's
     * complement value.
     */
    if (adc_channels[ADC_CHANNEL_ID].channel_cfg.differential)
        val_mv = (int32_t)((int16_t)buf);
    else
        val_mv = (int32_t)buf;
    err = adc_raw_to_millivolts_dt(&amp;amp;adc_channels[ADC_CHANNEL_ID], &amp;amp;val_mv);
    /* conversion to mV may not be supported, skip if not */
    if (err &amp;lt; 0) {
        LOG_ERR(&amp;quot; value in mV not available&amp;quot;);
        return;
    }
    else {
        /* Correct the voltage taking into account the voltage divider */
        val_mv *= 2;
    }
    regulator_disable(vbat_reg);

    if (val_mv &amp;gt;= BATTERY_VOLTAGE_MAX) {
        val_pct = 100;
    } else if (val_mv &amp;lt;= BATTERY_VOLTAGE_MIN) {
        val_pct = 0;
        LOG_ERR(&amp;quot;Critical battery voltage: %d mV - Shutting down!&amp;quot;, val_mv);
        shutdown();
    } else {
        val_pct = ((val_mv - BATTERY_VOLTAGE_MIN) * 100) /
            (BATTERY_VOLTAGE_MAX - BATTERY_VOLTAGE_MIN);
    }

    bt_bas_set_battery_level(val_pct);
    LOG_DBG(&amp;quot;Battery level: %d%%&amp;quot;, val_pct);
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now I only have to schedule the &lt;code&gt;battery_voltage_check()&lt;/code&gt;
function periodically. With this, the controller devices can subscribe
to the peripheral BAS service and get a notification every time the
battery level changes.&lt;/p&gt;
&lt;h3 id=&quot;problem-18-web-gui&quot;&gt;Problem 18: web GUI&lt;/h3&gt;
&lt;p&gt;In the previous blog post I set up a web server on the console board
and ran a basic test. Now that I can control the devices through the
display graphical interface, it&#8217;d be interesting to add a secondary
web-based interface so that we can control them remotely as well.&lt;/p&gt;
&lt;p&gt;The main requirements are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It must be lightweight and simple.&lt;/li&gt;
&lt;li&gt;It must be responsive and hassle-free.&lt;/li&gt;
&lt;li&gt;Both interfaces must be synchronized, i.e.&#160;any change in one of the
interfaces must be updated in the other one in real time.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;solution-5&quot;&gt;Solution&lt;/h4&gt;
&lt;p&gt;The first technical decision I need to take is how I&#8217;ll implement the
web page in terms of the &lt;a href=&quot;https://docs.zephyrproject.org/latest/services/connectivity/networking/api/http_server.html#http-server-interface&quot;&gt;Zephyr
web server api&lt;/a&gt; in a way that&#8217;s both lightweight and simple but also
dynamic. A simple way to design a dynamic page would be to define a
dynamic resource handler that will render different contents depending
on the client requests. That means the firmware will be responsible of
the content generation, which can be a resource-intensive task. Besides,
the client won&#8217;t be aware of the interface changes unless it does a new
request.&lt;/p&gt;
&lt;p&gt;A much better option is to have a live connection between the server
and the client through a websocket. As an additional improvement, I&#8217;ll
offload the formatting and processing to the client as much as possible,
so what the firmware will do is to serve a single template-based web
page and the necessary javascript code for the client to do the
formatting and page updating, and communicate the GUI changes from
server to client and vice-versa using json messages through an
established websocket.&lt;/p&gt;
&lt;p&gt;This will minimize the amount of data to store in the firmware (only
a small html page and some javascript code) and the GUI updates will be
carried out using small json-formatted payloads.&lt;/p&gt;
&lt;p&gt;The html contents (excluding the CSS definitions) can be as small as
this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang=&amp;quot;en&amp;quot;&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset=&amp;quot;UTF-8&amp;quot;&amp;gt;
    &amp;lt;style&amp;gt;
    &amp;lt;!-- css definitions --&amp;gt;
    &amp;lt;/style&amp;gt;
    &amp;lt;script src=&amp;quot;main.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;title&amp;gt;Igalia Zephyr Demo&amp;lt;/title&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;main&amp;gt;
      &amp;lt;h1&amp;gt;Igalia Zephyr Demo&amp;lt;/h1&amp;gt;

      &amp;lt;div id=&amp;quot;controller_container&amp;quot;&amp;gt;
      &amp;lt;/div&amp;gt;

    &amp;lt;/main&amp;gt;
  &amp;lt;/body&amp;gt;

  &amp;lt;template id=&amp;quot;controller_template&amp;quot;&amp;gt;
    &amp;lt;div id=&amp;quot;controller&amp;quot; class=&amp;quot;controller_info&amp;quot;&amp;gt;
      &amp;lt;div style=&amp;quot;display:flex; align-items:center;&amp;quot;&amp;gt;
        &amp;lt;h2&amp;gt;Controller device&amp;lt;/h2&amp;gt;
        &amp;lt;input id=&amp;quot;controller_scan&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Scan&amp;quot; style=&amp;quot;margin-left:20px;&amp;quot;&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;ul&amp;gt;
        &amp;lt;li&amp;gt;
          Connection state: &amp;lt;span id=&amp;quot;controller_state&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
          &amp;lt;span id=&amp;quot;controller_scan_animation&amp;quot; class=&amp;quot;waitdots&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
        &amp;lt;/li&amp;gt;
      &amp;lt;/ul&amp;gt;
      &amp;lt;!-- Slots divs go here --&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/template&amp;gt;

  &amp;lt;template id=&amp;quot;slot_template&amp;quot;&amp;gt;
    &amp;lt;div id=&amp;quot;slot&amp;quot; class=&amp;quot;slot_info&amp;quot;&amp;gt;
      &amp;lt;div style=&amp;quot;display:flex; align-items:center;&amp;quot;&amp;gt;
        &amp;lt;h3&amp;gt;Slot&amp;lt;/h3&amp;gt;
        &amp;lt;input id=&amp;quot;slot_scan&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Scan&amp;quot; style=&amp;quot;margin-left:20px;&amp;quot;&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;ul&amp;gt;
        &amp;lt;li&amp;gt;
          Connection state: &amp;lt;span id=&amp;quot;slot_state&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
          &amp;lt;span id=&amp;quot;slot_scan_animation&amp;quot; class=&amp;quot;waitdots&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
        &amp;lt;/li&amp;gt;
        &amp;lt;li id=&amp;quot;slot_dev_id_li&amp;quot;&amp;gt;
          Id: &amp;lt;span id=&amp;quot;slot_dev_id&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
        &amp;lt;/li&amp;gt;
        &amp;lt;li id=&amp;quot;slot_battery_li&amp;quot;&amp;gt;
          Battery: &amp;lt;span id=&amp;quot;slot_battery&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
        &amp;lt;/li&amp;gt;
        &amp;lt;li id=&amp;quot;slot_led_li&amp;quot;&amp;gt;
          LED state:
          &amp;lt;span id=&amp;quot;slot_led_state&amp;quot; style=&amp;quot;display:inline-block; width:50px&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
          &amp;lt;input id=&amp;quot;slot_toggle_led&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Toggle LED&amp;quot;&amp;gt;
        &amp;lt;/li&amp;gt;
      &amp;lt;/ul&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/template&amp;gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And the javascript code that will run in the client will control the
layout:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;class Controller {
    constructor(idx, container_id) {
        let templ = document.getElementById('controller_template');
        let clone = templ.content.cloneNode(true);
        this.div = clone.querySelector('#controller');
        this.id = `controller_${idx}`;
        this.div.id = this.id;
        this.div.querySelector(&amp;quot;h2&amp;quot;).innerHTML = `Controller ${idx + 1}`;

        this.scan = this.div.querySelector('#controller_scan');
        this.scan.id = `${this.id}_scan`;

        this.state = this.div.querySelector('#controller_state');
        this.state.id = `${this.id}_state`;

        this.dots = this.div.querySelector('#controller_scan_animation');
        this.dots.id = `${this.id}_scan_animation`;

        // Insert controller div in the container
        let container = document.getElementById(container_id);
        container.appendChild(this.div);

        // Create and insert slot divs in the controller div
        this.slots = [
            new Slot(idx, 0),
            new Slot(idx, 1),
            new Slot(idx, 2)
        ];
        for (let s of this.slots) {
            this.div.appendChild(s.div);
        }

        // Initial element states
        this.state.innerHTML = 'Disconnected';
        this.dots.style.display = 'none';

        this.scan.addEventListener('click', (event) =&amp;gt; {
            console.log(`Request scan on ${this.id}`);
            postAction(`{&amp;quot;target&amp;quot;: -1, &amp;quot;action&amp;quot;: ${Action.SCAN}, &amp;quot;param&amp;quot;: ${idx}}`);
        })
    [...]
}

window.addEventListener('DOMContentLoaded', (ev) =&amp;gt; {
    const ws = new WebSocket('/');

    controllers = [
        new Controller(0, &amp;quot;controller_container&amp;quot;),
        new Controller(1, &amp;quot;controller_container&amp;quot;)];

    ws.onmessage = (event) =&amp;gt; {
    const json = JSON.parse(event.data);
        for (let controller_idx in json) {
            if (controller_idx &amp;gt;= controllers.length)
                continue;
            controllers[controller_idx].update(json[controller_idx]);
        }
    }
})&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, I need to define a suitable json schema to format the data
passed between the server and the client. I&#8217;ll be using a fixed-size
buffer in the firmware for the payload, so I need to make sure that the
format produces compact enough messages. For simplicity, I also want
every message to carry the whole peripheral state for all the devices,
rather than partial updates.&lt;/p&gt;
&lt;p&gt;This is the schema I came up with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{
  &amp;quot;$schema&amp;quot;: &amp;quot;https://json-schema.org/draft/2020-12/schema&amp;quot;,
  &amp;quot;type&amp;quot;: &amp;quot;object&amp;quot;,
  &amp;quot;patternProperties&amp;quot;: {
    &amp;quot;^[0-9]+$&amp;quot;: {
      &amp;quot;type&amp;quot;: &amp;quot;object&amp;quot;,
      &amp;quot;description&amp;quot;: &amp;quot;Controller status&amp;quot;,
      &amp;quot;required&amp;quot;: [&amp;quot;state&amp;quot;, &amp;quot;slots&amp;quot;],
      &amp;quot;properties&amp;quot;: {
        &amp;quot;state&amp;quot;: {
          &amp;quot;type&amp;quot;: &amp;quot;integer&amp;quot;,
          &amp;quot;description&amp;quot;: &amp;quot;Current state of the controller&amp;quot;
        },
        &amp;quot;slots&amp;quot;: {
          &amp;quot;type&amp;quot;: &amp;quot;array&amp;quot;,
          &amp;quot;items&amp;quot;: {
            &amp;quot;oneOf&amp;quot;: [
              {
                &amp;quot;type&amp;quot;: &amp;quot;null&amp;quot;
              },
              {
                &amp;quot;type&amp;quot;: &amp;quot;object&amp;quot;,
                &amp;quot;required&amp;quot;: [&amp;quot;state&amp;quot;, &amp;quot;id&amp;quot;, &amp;quot;led&amp;quot;, &amp;quot;bat&amp;quot;],
                &amp;quot;properties&amp;quot;: {
                  &amp;quot;state&amp;quot;: {
                    &amp;quot;type&amp;quot;: &amp;quot;integer&amp;quot;,
                    &amp;quot;description&amp;quot;: &amp;quot;Current state of the slot&amp;quot;
                  },
                  &amp;quot;id&amp;quot;: {
                    &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,
                    &amp;quot;description&amp;quot;: &amp;quot;String identifier of the connected peripheral&amp;quot;
                  },
                  &amp;quot;led&amp;quot;: {
                    &amp;quot;type&amp;quot;: &amp;quot;integer&amp;quot;,
                    &amp;quot;description&amp;quot;: &amp;quot;Peripheral LED state&amp;quot;
                  },
                  &amp;quot;bat&amp;quot;: {
                    &amp;quot;type&amp;quot;: &amp;quot;integer&amp;quot;,
                    &amp;quot;minimum&amp;quot;: 0,
                    &amp;quot;maximum&amp;quot;: 100,
                    &amp;quot;description&amp;quot;: &amp;quot;Peripheral battery level percentage&amp;quot;
                  }
                },
                &amp;quot;additionalProperties&amp;quot;: false
              }
            ]
          },
          &amp;quot;minItems&amp;quot;: 3,
          &amp;quot;maxItems&amp;quot;: 3,
          &amp;quot;description&amp;quot;: &amp;quot;Array containing the status of the controller slots&amp;quot;
        }
      },
      &amp;quot;additionalProperties&amp;quot;: false
    }
  },
  &amp;quot;additionalProperties&amp;quot;: false
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With which I can format a message like this one:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{
    &amp;quot;0&amp;quot;: {
        &amp;quot;state&amp;quot;: 3,
        &amp;quot;slots&amp;quot;: [
            null,
            {
                &amp;quot;state&amp;quot;: 1,
                &amp;quot;id&amp;quot;: &amp;quot;ZD-01&amp;quot;,
                &amp;quot;led&amp;quot;: 1,
                &amp;quot;bat&amp;quot;: 97
            },
            null
        ]
    },
    &amp;quot;1&amp;quot;: {
        &amp;quot;state&amp;quot;: 0,
        &amp;quot;slots&amp;quot;: [null,null,null]
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once up and running, here&#8217;s how the web GUI looks like:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://blogs.igalia.com/rcn/posts/20260921-why_dont_we_do_a_demo_part_3/web_gui.png&quot; class=&quot;center&quot; /&gt;&lt;/p&gt;
&lt;h3 id=&quot;problem-19-ble-security&quot;&gt;Problem 19: BLE security&lt;/h3&gt;
&lt;p&gt;At this point, the application is functionally complete in the sense
that it showcases all the features I planned. However, so far we only
cared about functionalities for a minimum viable product. There are many
things we can improve and do properly rather than just for a simple
demo, the most important of them is to enable BLE security and
privacy.&lt;/p&gt;
&lt;p&gt;Right now, all the BLE services I enabled are open. Anyone can
connect to them using any client, which is a good first approach for
testing and debugging. However, the demo will be installed in a
conference or a fair with thousands of people, and it&#8217;d be totally
vulnerable to any user that (maliciously or not) wants to interact with
it without permission.&lt;/p&gt;
&lt;p&gt;What I want to do is to allow the demo devices to establish
connections between each other only, preventing other devices from
joining. I don&#8217;t care much about data privacy, although that&#8217;d be an
added bonus.&lt;/p&gt;
&lt;h4 id=&quot;solution-6&quot;&gt;Solution&lt;/h4&gt;
&lt;p&gt;For these requirements, what I need to do is to enforce &lt;a href=&quot;https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-5-bluetooth-le-security-fundamentals/topic/security-modes/&quot;&gt;BLE
security&lt;/a&gt; in all connections, which will give us protection to MITM
attacks if I set up a way to require human interaction during the
pairing process.&lt;/p&gt;
&lt;p&gt;The basic security strategy I&#8217;ll implement is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All BLE services provided require authentication.&lt;/li&gt;
&lt;li&gt;Connection between any pair of devices requires L4 security
(pairing).&lt;/li&gt;
&lt;li&gt;Pairing requires human interaction on the target device.&lt;/li&gt;
&lt;li&gt;The pairing process is allowed only during a limited time window.
Additional pairing requests can be started manually.&lt;/li&gt;
&lt;li&gt;The amount of paired devices in each device is limited.&lt;/li&gt;
&lt;li&gt;Connection requires device proximity.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Since the only interactive user interface I have in the peripherals
is a button (4 buttons in the controller devices), which I&#8217;m already
using to toggle the LEDs, I need to multiplex it somehow to allow using
it as a &#8220;keypress&#8221; for pairing confirmation, and also to start a pairing
advertising process and, optionally, to &#8220;forget&#8221; all previous pairings,
in case we ever need to do that. I chose to encode the different actions
based on the duration of the button press. That way, a short press is
normally used for toggling the LED, but it&#8217;s also used as a pairing
confirmation during the pairing process. A long press is used to restart
the advertising process, and a very long press to forget all previous
pairings.&lt;/p&gt;
&lt;p&gt;The LED also needs to encode the current status of the device. Since
the advertising and pairing processes are only temporary, I&#8217;m setting
the LED to blink during both of them: slowly during advertising and fast
during the pairing window, where the user needs to press the button to
confirm the pairing.&lt;/p&gt;
&lt;p&gt;Implementing these security features means the connection handling is
considerably more complex than before. Fortunately, the
state-machine-based architecture I had in place is easy to extend and
modify to incorporate the changes.&lt;/p&gt;
&lt;p&gt;This should be enough to keep the application secure. Maybe even too
paranoid, but I&#8217;d rather have no surprises during the deployment. For
convenience, I&#8217;ll pre-pair all the devices so that they&#8217;ll be ready to
work right after booting. A possible improvement for this setup would be
to use directed advertising to reconnect to previously bond devices, but
I&#8217;ll leave that for future iterations.&lt;/p&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;p&gt;With this we&#8217;re done with the firmware / software part of the
project, thanks for reading this far! The next thing to do is to turn
this into a presentable demo and figure out the materials, assembly
method and the setup logistics. I&#8217;ll go through the details in the next
post of this series.&lt;/p&gt;                </content>
		<author>
			<name>Ricardo Ca&#241;uelo Navarro</name>
			<uri>https://blogs.igalia.com/rcn</uri>
		</author>
	</entry>

	<entry>
		<title>Carlos Garc&#237;a Campos: Skia compositor for WPE WebKit and WebKitGTK</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/carlosgc/2026/09/21/skia-compositor-for-wpe-webkit-and-webkitgtk/?pk_campaign=feed&amp;pk_kwd=skia-compositor-for-wpe-webkit-and-webkitgtk"/>
		<id>https://blogs.igalia.com/carlosgc/?p=1080</id>
		<updated>2026-09-21T08:40:26+00:00</updated>
		<content type="html">
                &lt;img class=&quot;face&quot; src=&quot;/images/cgarcia.png&quot; width=&quot;73&quot; height=&quot;96&quot; alt=&quot;&quot; align=&quot;right&quot; style=&quot;float: right&quot; /&gt;
&lt;p&gt;&lt;a href=&quot;https://wpewebkit.org/release/wpewebkit-2.54.0.html&quot;&gt;WPE WebKit&lt;/a&gt; and &lt;a href=&quot;https://webkitgtk.org/2026/09/16/webkitgtk2.54.0-released.html&quot;&gt;WebKitGTK&lt;/a&gt; 2.54 have been released with &lt;a href=&quot;https://wpewebkit.org/blog/2026-09-16-wpewebkit-2.54.html&quot;&gt;a bunch of improvements and new APIs&lt;/a&gt; as usual, but there&#8217;s one point that kept the Igalia WebKit graphics team busy for the whole cycle: the new &lt;a href=&quot;https://skia.org/&quot;&gt;Skia&lt;/a&gt;-based compositor. The replacement of Cairo with Skia for content rendering has been a success and it&#8217;s already well integrated and optimized. We thought we could try to use Skia for the composition too and replace TextureMapper with Skia. TextureMapper was &lt;a href=&quot;https://commits.webkit.org/640ce4cb41c00e7c87b101d0a77d48192227ffeb&quot;&gt;introduced in 2010 for the Qt port&lt;/a&gt; and later adopted by other ports. It uses the OpenGL ES API and maintains a collection of shader programs to paint different content. Nowadays TextureMapper is mostly the same code and shader programs, and it&#8217;s unmaintained and missing features. However, the performance was good and it has served us really well all these years. So, this time the goal was not to get better results in benchmarks, but to modernize the implementation, reduce the amount of code to maintain ourselves (like all shader programs) and make it easier to implement the missing features and fix existing bugs. This post is a summary of all the work we have done this cycle to implement the new Skia compositor.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;SkiaCompositingLayer&lt;/h2&gt;



&lt;p&gt;The first step was adding an &lt;a href=&quot;https://commits.webkit.org/311425@main&quot;&gt;&lt;code&gt;SkiaCompositingLayer&lt;/code&gt; class&lt;/a&gt; to replace &lt;code&gt;TextureMapperLayer&lt;/code&gt; and adapt all the code to use one or the other depending on an environment variable. The initial implementation was based on the TextureMapper one for the things that are common like iterating the layer tree, computing transformations, etc. The way layers produced their contents didn&#8217;t change, so we were receiving textures for tiled content, video buffers, WebGL, accelerated 2D canvas, etc. &lt;code&gt;SkiaCompositingLayer&lt;/code&gt; created a Ganesh Skia surface to draw those textures using &lt;code&gt;SkCanvas::drawImageRect()&lt;/code&gt;. This initial implementation was enough to run the default &lt;a href=&quot;https://browserbench.org/MotionMark1.3.1/&quot;&gt;MotionMark test suite&lt;/a&gt;, since it doesn&#8217;t use other composition features. Even though performance was not the goal, we had to make sure we didn&#8217;t regress. This initial implementation was neutral in MotionMark. We needed tests to implement those features and measure performance at the same time, so we decided to add &lt;a href=&quot;https://commits.webkit.org/311061@main&quot;&gt;a new set of tests to MotionMark&lt;/a&gt;, just extending the existing tests to require composition, which makes sure that filters, masks, path clipping, transformations, etc. were done by the compositor.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Filters&lt;/h2&gt;



&lt;p&gt;We first tried implementing filters using an intermediate surface like TextureMapper does. It worked, but the MotionMark score in the filters test was much worse. We realized that with Skia we could implement most of the filters without using an intermediate surface. All filter types except blur and drop shadow can be simplified to an &lt;code&gt;SkColorFilter&lt;/code&gt; with &lt;code&gt;SkImageFilter::asAColorFilter()&lt;/code&gt; which can be implemented without an intermediate surface, just by setting the color filter in the &lt;code&gt;SkPaint&lt;/code&gt; we pass to &lt;code&gt;SkCanvas::drawImageRect()&lt;/code&gt;. This not only fixed the performance regression, but also gave better results than TextureMapper, which always needs an intermediate surface.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Masks&lt;/h2&gt;



&lt;p&gt;There are two different kinds of masks: image mask, where the source mask is an image already, and clip path, where the mask is represented by a path to be clipped. In TextureMapper both are implemented the same way using intermediate surfaces. The mask is painted into a surface and then the masked layer creates an intermediate surface where its contents are first painted and then the mask contents on top using &lt;code&gt;DstIn&lt;/code&gt; blend mode. Skia has APIs that allowed us to implement both cases in a much simpler and more efficient way. In the case of image masks, where we already have an image, we paint the mask contents once and keep it cached, and then the masked layer creates an &lt;code&gt;SkShader&lt;/code&gt; for the image mask that is passed to &lt;code&gt;SkCanvas::clipShader()&lt;/code&gt; without having to paint into an intermediate surface. Clip path masks are even easier, because we can just take the path we get and build an &lt;code&gt;SkPath&lt;/code&gt; we can pass to &lt;code&gt;SkCanvas::clipPath()&lt;/code&gt;, without having to paint the mask as an image at all or use any other intermediate surface. Once again, masks were not only easier to implement but they ended up being more performant too.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-large&quot;&gt;&lt;a href=&quot;https://blogs.igalia.com/carlosgc/files/2026/09/01-switch-on-plot@2x.png&quot;&gt;&lt;img width=&quot;940&quot; height=&quot;640&quot; src=&quot;https://blogs.igalia.com/carlosgc/files/2026/09/01-switch-on-plot@2x-940x640.png&quot; alt=&quot;Grouped bar chart of ten MotionMark composition subtests, comparing TextureMapper with the Skia compositor. Filters, clipping and mask tests are three to four times faster with Skia; the three leaves tests are about 20% slower.&quot; class=&quot;wp-image-1104&quot; /&gt;&lt;/a&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;MotionMark composition suite, WPE with GPU rendering on a Raspberry Pi 4, comparing TextureMapper (312400@main) with the Skia compositor (313600@main). TextureMapper never implemented blend modes, so its high score on bouncing blend circles is the score for not doing the work.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;p&gt;&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;3D contexts&lt;/h2&gt;



&lt;p&gt;The implementation of 3D layer contexts is fairly independent of TextureMapper and OpenGL, so we could just take it almost as it was, using &lt;code&gt;SkPath&lt;/code&gt; to build the clips and a few other adaptations. We could also fix existing bugs like the z&lt;a href=&quot;https://commits.webkit.org/318066@main&quot;&gt;-ordering that has always been broken in TextureMapper&lt;/a&gt;.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-large&quot;&gt;&lt;a href=&quot;https://blogs.igalia.com/carlosgc/files/2026/09/06-3d-zorder-plot@2x.png&quot;&gt;&lt;img width=&quot;940&quot; height=&quot;754&quot; src=&quot;https://blogs.igalia.com/carlosgc/files/2026/09/06-3d-zorder-plot@2x-940x754.png&quot; alt=&quot;Two screenshots side by side of the same page. Under TextureMapper a small red box sits flat on top of a green plane rotated in 3D. Under the Skia compositor the red box is much taller and is cut by the plane: a sliver shows past the left edge, the middle is hidden behind the plane, and the right part is drawn in front of it.&quot; class=&quot;wp-image-1105&quot; /&gt;&lt;/a&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;The same page rendered by TextureMapper (left) and by the Skia compositor (right), WPE on the same build. The red box intersects the rotated green plane. TextureMapper draws the box flat against the plane, so the intersection is lost; the Skia compositor splits it, drawing the part in front of the plane and hiding the part behind it.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Blend modes&lt;/h2&gt;



&lt;p&gt;TextureMapper never supported blend modes and they were &lt;a href=&quot;https://commits.webkit.org/311943@main&quot;&gt;easy to implement with Skia just using the &lt;code&gt;SkPaint&lt;/code&gt; property&lt;/a&gt; for it. This made several layout tests start passing.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Batched painting&lt;/h2&gt;



&lt;p&gt;After implementing all the features we were at a point in which we had the same or better performance in all tests except for three MotionMark compositing tests that were giving much worse results. Those tests use small layers and give a high result which means we end up adding a lot of layers to the scene before we start skipping frames. The root cause was the large number of layers filling the command queue of Ganesh. Skia Ganesh queues the GL drawing operations instead of sending them to the GPU right away. When the surface is flushed for whatever reason, the queued GL drawing operations are then processed and sent to the GPU. This allows Skia to apply nice optimizations like merging several tasks and reducing the amount of draw operations we end up sending to the GPU. In those tests where a lot of layers are created and painted to the compositor Skia surface the internal command queue ends up being huge too. Processing and analyzing such a long queue to optimize what we send to the GPU required more CPU work than what we save by optimizing the GL draw operations. &lt;a href=&quot;https://commits.webkit.org/314626@main&quot;&gt;Skia provides an API that allows us to do the batching ourselves&lt;/a&gt;. Since the compositor already has information to decide what operations could be merged together, we could reduce the internal queue size in many cases. We can merge &lt;code&gt;SkCanvas::drawImageRect()&lt;/code&gt; operations as long as they share the same color filter, blend modes and sampling options. In the best case scenario we could reduce the whole internal queue to just one operation. This time the change improved the results of those tests getting them to about 93% of the TextureMapper score, but still a bit behind.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Promise images&lt;/h2&gt;



&lt;p&gt;The Skia Ganesh backend requires that an &lt;code&gt;SkImage&lt;/code&gt; backed by a texture is created for the current thread &lt;code&gt;GrDirectContext&lt;/code&gt;, even if it&#8217;s borrowing an existing texture. In WebKit all textures are created with a sharing GL context so that they can be accessed and destroyed from different threads with the same sharing GL context. So, for a layer whose content is an image we had to create a texture in the compositing thread to upload the pixels if the image was not accelerated, or for accelerated images get the texture identifier of the image, and then create another &lt;code&gt;SkImage&lt;/code&gt; from the compositing thread borrowing the texture for the current &lt;code&gt;GrDirectContext&lt;/code&gt;. The Skia Ganesh backend provides &lt;a href=&quot;https://commits.webkit.org/315529@main&quot;&gt;an API to create promise images&lt;/a&gt;, which can be created from any thread but targeting a specific thread, providing a fulfill callback that will be called on the target thread when the &lt;code&gt;SkImage&lt;/code&gt; is first used to retrieve the wrapped texture. This way we can create the &lt;code&gt;SkImage&lt;/code&gt; from the main thread for the compositing thread without using OpenGL at creation time. For non-accelerated images we realized we don&#8217;t need to manually create the texture and upload the pixels in the compositor, we can just pass the unaccelerated &lt;code&gt;SkImage&lt;/code&gt; to the compositor &lt;code&gt;SkCanvas&lt;/code&gt; and Skia will handle it internally much more efficiently than we did. And this change improved those compositing tests much further than we expected. The reason turned out to be the batching from the previous section: Skia merges the entries of an image set by comparing texture proxy pointers, and until now we were wrapping the texture in a new &lt;code&gt;SkImage&lt;/code&gt; on every frame for every layer, so hundreds of layers drawing the very same image produced hundreds of different proxies that Skia could not merge. Passing the same &lt;code&gt;SkImage&lt;/code&gt; every time collapses all of them into a single draw operation, which is the best case we described above. With batched painting and promise images together we could beat TextureMapper significantly.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-large&quot;&gt;&lt;a href=&quot;https://blogs.igalia.com/carlosgc/files/2026/09/02-leaves-recovery-plot@2x.png&quot;&gt;&lt;img width=&quot;940&quot; height=&quot;457&quot; src=&quot;https://blogs.igalia.com/carlosgc/files/2026/09/02-leaves-recovery-plot@2x-940x457.png&quot; alt=&quot;Line chart of the three MotionMark leaves subtests by WebKit revision. All three step up sharply at revision 314626 when batched painting landed, and again at revision 315529 when promise images landed.&quot; class=&quot;wp-image-1106&quot; /&gt;&lt;/a&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;MotionMark composition suite, leaves subtests, WPE with GPU rendering. Score per revision; higher is better. The same two steps appear with CPU rendering.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Deferred Display Lists (DDL)&lt;/h2&gt;



&lt;p&gt;When we switched to Skia for painting, we kept the threaded rendering model, just using a separate smaller queue for GPU rendering workers. The GPU workers created their own &lt;code&gt;GrDirectContext&lt;/code&gt; to paint the layer tiles. The resulting textures were re-wrapped in the compositing thread for the compositor &lt;code&gt;GrDirectContext&lt;/code&gt; using fences for the proper synchronization. We knew this was not the recommended way to use Skia Ganesh from multiple threads, but with TextureMapper we had no other option. However, with the Skia compositor we can do it the recommended way by using a single &lt;code&gt;GrDirectContext&lt;/code&gt; in the compositing thread and use &lt;a href=&quot;https://commits.webkit.org/315027@main&quot;&gt;Deferred Display Lists (DDL) and promise images to paint the tiles&lt;/a&gt;. With DDL, GPU workers no longer use GL at all and they don&#8217;t need a &lt;code&gt;GrDirectContext&lt;/code&gt;, they paint tiles into a display list that records the GL drawing operations, but without touching GL. For image drawing operations recorded into the DDL, promise images are used too. Since this is now all CPU work we can remove the smaller GPU worker queue and use a single queue with more workers. The compositor replays the DDL into an &lt;code&gt;SkSurface&lt;/code&gt; that is then passed to the compositor &lt;code&gt;SkCanvas&lt;/code&gt;.&lt;/p&gt;



&lt;p&gt;This change fixed rendering glitches on Android and was performance neutral for the whole composition suite and for most of the MotionMark tests, but in MotionMark 1.3 at 15fps it cost 29% in Suits and 14% in Leaves, while improving Images by 9%. Correctness and the other benefits of DDL made us accept those regressions.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-large&quot;&gt;&lt;a href=&quot;https://blogs.igalia.com/carlosgc/files/2026/09/03-ddl-suits-plot@2x.png&quot;&gt;&lt;img width=&quot;940&quot; height=&quot;443&quot; src=&quot;https://blogs.igalia.com/carlosgc/files/2026/09/03-ddl-suits-plot@2x-940x443.png&quot; alt=&quot;Line chart of the MotionMark suits score by WebKit revision. The score drops from about 470 to about 335 when deferred display lists are enabled, returns to 470 when they are disabled, and drops again when they are re-enabled, staying there.&quot; class=&quot;wp-image-1107&quot; /&gt;&lt;/a&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;MotionMark 1.3 at 15fps, suits subtest, WPE with GPU rendering on a Raspberry Pi 4. Shaded regions are where deferred display lists were enabled by default. CPU rendering moves less than 1% at all three switches, since it has no GPU worker threads for DDL to change.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Damage&lt;/h2&gt;



&lt;p&gt;TextureMapper already supported using damage information to optimize the painting while compositing, but it has always been disabled at run time because there were issues we never managed to fix. With the Skia compositor we decided to start from scratch and properly handle the damage information while compositing to render only the parts of the frame that actually changed. I&amp;#8217;m not going to go into detail here because &lt;a href=&quot;https://blogs.igalia.com/nzimmermann&quot;&gt;Nikolas Zimmermann&lt;/a&gt; has written &lt;a href=&quot;https://blogs.igalia.com/nzimmermann/posts/2026-09-21-skia-compositor-damaging/&quot;&gt;an amazing blog post&lt;/a&gt; about it with all the details.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Current situation&lt;/h2&gt;



&lt;p&gt;The Skia compositor is finished and &lt;a href=&quot;https://commits.webkit.org/313297@main&quot;&gt;enabled by default in 2.54&lt;/a&gt;. Even though it was not the main goal, it performs better than TextureMapper in most of the benchmarks we run: the composition suite we added is 45% faster, and MotionMark 1.3.1 is 35% faster. The exception is MotionMark 1.3 at 15fps with GPU rendering, which comes out flat, because the Suits and Leaves tests are still about 26% and 10% behind due to the deferred display lists trade-off described above.&lt;/p&gt;



&lt;p&gt;We are already working on fixing existing issues in composition that we never fixed in TextureMapper. In the main branch TextureMapper is now &lt;a href=&quot;https://commits.webkit.org/320146@main&quot;&gt;disabled by default at build time&lt;/a&gt;, and support will be removed soon for the GTK and WPE ports. In 2.54 it&#8217;s still a run-time decision so if you find any issue with 2.54, you can check if it&#8217;s a Skia compositor regression by trying TextureMapper with &lt;code&gt;WEBKIT_USE_SKIA_FOR_COMPOSITION=0&lt;/code&gt; environment variable.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-large&quot;&gt;&lt;a href=&quot;https://blogs.igalia.com/carlosgc/files/2026/09/04-overall-vs-texturemapper-plot@2x.png&quot;&gt;&lt;img width=&quot;940&quot; height=&quot;347&quot; src=&quot;https://blogs.igalia.com/carlosgc/files/2026/09/04-overall-vs-texturemapper-plot@2x-940x347.png&quot; alt=&quot;Bar chart of overall benchmark scores today relative to the TextureMapper baseline. The composition suite is 45% ahead with GPU rendering, MotionMark 1.3.1 is 35% ahead, and MotionMark 1.3 at 15fps is level with GPU rendering and 10% ahead with CPU rendering.&quot; class=&quot;wp-image-1108&quot; /&gt;&lt;/a&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Overall (geometric mean) score, WPE on a Raspberry Pi 4: 320000@main and later against the TextureMapper baseline at 312400-313296@main. Bars start at the baseline. Part of the gain in the MotionMark suites is Skia rendering work rather than the compositor.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;figure class=&quot;wp-block-image size-large&quot;&gt;&lt;a href=&quot;https://blogs.igalia.com/carlosgc/files/2026/09/05-15fps-subtests-plot@2x.png&quot;&gt;&lt;img width=&quot;940&quot; height=&quot;568&quot; src=&quot;https://blogs.igalia.com/carlosgc/files/2026/09/05-15fps-subtests-plot@2x-940x568.png&quot; alt=&quot;Bar chart of MotionMark 1.3 at 15fps subtests, showing the change from the TextureMapper baseline to today. Suits is 26% behind and leaves 10% behind with GPU rendering, while both are well ahead with CPU rendering; every other subtest is level or ahead.&quot; class=&quot;wp-image-1109&quot; /&gt;&lt;/a&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;WPE on a Raspberry Pi 4, change from the TextureMapper baseline (312400-313296@main) to 320000@main and later. Suits and leaves are the deferred display lists trade-off, not the compositor switch, which was neutral in this suite.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Future plans&lt;/h2&gt;



&lt;p&gt;We are already working on further improvements like using promise images for all external textures we have to pass to the compositor. We will explore the possibility of using Vulkan with the Ganesh backend instead of GL and eventually try the new Graphite backend. And of course we will continue fixing any existing issues related to the compositor.&lt;/p&gt;
&lt;img src=&quot;https://stats.igalia.com/piwik.php?idsite=39&amp;rec=1&amp;url=https%3A%2F%2Fblogs.igalia.com%2Fcarlosgc%2F2026%2F09%2F21%2Fskia-compositor-for-wpe-webkit-and-webkitgtk%2F%3Fpk_campaign%3Dfeed%26pk_kwd%3Dskia-compositor-for-wpe-webkit-and-webkitgtk&amp;action_name=Skia%20compositor%20for%20WPE%20WebKit%20and%20WebKitGTK&amp;urlref=https%3A%2F%2Fblogs.igalia.com%2Fcarlosgc%2Ffeed%2F&quot; width=&quot;0&quot; height=&quot;0&quot; alt=&quot;&quot; /&gt;                </content>
		<author>
			<name>carlos garcia campos</name>
			<uri>https://blogs.igalia.com/carlosgc</uri>
		</author>
	</entry>

	<entry>
		<title>Nikolas Zimmermann: Bringing damage to the Skia compositor</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/nzimmermann/posts/2026-09-21-skia-compositor-damaging/"/>
		<id>https://blogs.igalia.com/nzimmermann/posts/2026-09-21-skia-compositor-damaging/</id>
		<updated>2026-09-21T00:00:00+00:00</updated>
		<content type="html">
Teaching the new Skia compositor to recomposite only what changed                </content>
		<author>
			<name>Nikolas Zimmermann</name>
			<uri>https://blogs.igalia.com/nzimmermann/</uri>
		</author>
	</entry>

	<entry>
		<title>Danylo Piliaiev: Turnip&#8217;s evolution over the years, supporting flat-screen and VR games</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/"/>
		<id>https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective</id>
		<updated>2026-09-20T22:00:00+00:00</updated>
		<content type="html">
&lt;h4 class=&quot;nav__title&quot;&gt;&lt;i class=&quot;fas fa-file-alt&quot;&gt;&lt;/i&gt; Table of Contents &lt;/h4&gt;
    
&lt;ol id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#challenges&quot; id=&quot;markdown-toc-challenges&quot;&gt;Challenges&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#2021&quot; id=&quot;markdown-toc-2021&quot;&gt;2021&lt;/a&gt;    &lt;ol&gt;
      &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#dxvk-time&quot; id=&quot;markdown-toc-dxvk-time&quot;&gt;DXVK Time!&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#measuring-performance&quot; id=&quot;markdown-toc-measuring-performance&quot;&gt;Measuring Performance&lt;/a&gt;&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#2022&quot; id=&quot;markdown-toc-2022&quot;&gt;2022&lt;/a&gt;    &lt;ol&gt;
      &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#low-resolution-z-lrz&quot; id=&quot;markdown-toc-low-resolution-z-lrz&quot;&gt;Low Resolution Z (LRZ)&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#gpu-hangs&quot; id=&quot;markdown-toc-gpu-hangs&quot;&gt;GPU Hangs&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#turnip-supports-vulkan-13&quot; id=&quot;markdown-toc-turnip-supports-vulkan-13&quot;&gt;Turnip supports Vulkan 1.3&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#reviewing-vk_ext_fragment_density_map&quot; id=&quot;markdown-toc-reviewing-vk_ext_fragment_density_map&quot;&gt;Reviewing VK_EXT_fragment_density_map&lt;/a&gt;&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#2023&quot; id=&quot;markdown-toc-2023&quot;&gt;2023&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#2024&quot; id=&quot;markdown-toc-2024&quot;&gt;2024&lt;/a&gt;    &lt;ol&gt;
      &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#android-wastelands&quot; id=&quot;markdown-toc-android-wastelands&quot;&gt;Android (Waste)Lands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#turnip-is-vulkan-14-conformant-and-preemption-support&quot; id=&quot;markdown-toc-turnip-is-vulkan-14-conformant-and-preemption-support&quot;&gt;Turnip Is Vulkan 1.4 Conformant and Preemption Support&lt;/a&gt;&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#2025&quot; id=&quot;markdown-toc-2025&quot;&gt;2025&lt;/a&gt;    &lt;ol&gt;
      &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#more-vr-extensions&quot; id=&quot;markdown-toc-more-vr-extensions&quot;&gt;More VR Extensions&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#half-life-alyx&quot; id=&quot;markdown-toc-half-life-alyx&quot;&gt;Half-Life: Alyx&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#are-we-performant-yet&quot; id=&quot;markdown-toc-are-we-performant-yet&quot;&gt;Are We Performant Yet?&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#preventing-regressions&quot; id=&quot;markdown-toc-preventing-regressions&quot;&gt;Preventing Regressions&lt;/a&gt;&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#2026&quot; id=&quot;markdown-toc-2026&quot;&gt;2026&lt;/a&gt;    &lt;ol&gt;
      &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#performance&quot; id=&quot;markdown-toc-performance&quot;&gt;Performance&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#d3d12-woes&quot; id=&quot;markdown-toc-d3d12-woes&quot;&gt;D3D12 Woes&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#alyx--rare-gpu-hangs&quot; id=&quot;markdown-toc-alyx--rare-gpu-hangs&quot;&gt;Alyx &#9734; Rare GPU Hangs&lt;/a&gt;&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-my-5y-retrospective/#present&quot; id=&quot;markdown-toc-present&quot;&gt;Present&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

  


&lt;p&gt;It&#8217;s been more than 5 years since I started working on Turnip, the open source Mesa 3D driver for Adreno GPUs, with Igalia&#8217;s graphics team. Looking back, it&#8217;s amazing how much we have achieved together, and how much the driver has improved since then. Here&#8217;s my take on the evolution through those years, some of the challenges we faced and how we overcame them. Before I start, I want to thank all those great people from Igalia, Valve, and the Mesa community I&#8217;ve had the pleasure to work with.&lt;/p&gt;

&lt;p&gt;This post is a bit one-sided as it contains my particular view of the evolution of Turnip through those years and it doesn&#8217;t touch on &lt;em&gt;a lot&lt;/em&gt; of important features implemented, issues debugged, and improvements made by others.&lt;/p&gt;

&lt;h2 id=&quot;challenges&quot;&gt;Challenges&lt;/h2&gt;

&lt;p&gt;There are several overarching challenges that the Turnip driver has had and still has to this day:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;There was no hardware documentation, we had to reverse engineer everything, with the most painful part being hardware bugs that necessitate workarounds. I cannot say I became as good as I would have wanted in all that, but I&#8217;m grateful that in Turnip we had people with absolutely amazing HW reverse-engineering skills!&lt;/li&gt;
  &lt;li&gt;Hardware wasn&#8217;t really built to run desktop games, at least at first. It became much better in A7XX generation, but there are still some bumpy parts. Running desktop games is specially important for hardware like the Steam Frame and others.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;2021&quot;&gt;2021&lt;/h2&gt;

&lt;p&gt;Way back, when I started to contribute to the Turnip driver, we were fixing CTS tests, running &#8220;trivial&#8221;, by today&#8217;s standards, applications like &#8220;Genshin Impact&#8221;, &#8220;TauCeti Vulkan Technology Benchmark&#8221;, &#8220;3DMark&#8221;. I have a few posts describing some issues debugged back then:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnips-in-the-wild-part-1/&quot;&gt;Turnips in the wild (Part 1)&lt;/a&gt; - Fixing &#8220;Genshin Impact&#8221;;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnips-in-the-wild-part-2/&quot;&gt;Turnips in the wild (Part 2)&lt;/a&gt; - Fixing &#8220;Genshin Impact&#8221; and &#8220;TauCeti Benchmark&#8221;.&lt;/li&gt;
&lt;/ul&gt;

&lt;figure class=&quot;&quot;&gt;
  &lt;img src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/turnip-real-world-rendering/tauceti_benchmark_field_without_fix.jpg&quot; alt=&quot;Screenshot of the benchmark with grass/dirt field which looks more like a patchwork&quot; /&gt;&lt;figcaption&gt;
      

    &lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;If you&#8217;d asked me back then about running AAA PC games, I would have nervously laughed at best =)&lt;/p&gt;

&lt;h3 id=&quot;dxvk-time&quot;&gt;DXVK Time!&lt;/h3&gt;

&lt;p&gt;But soon, we found a way to at least test how PC games render on Adreno GPUs with Turnip; we weren&#8217;t able to run games on our development boards, but the driver, after a bit of massaging, had enough features to work with &lt;a href=&quot;https://github.com/doitsujin/DXVK&quot;&gt;DXVK&lt;/a&gt; (Vulkan-based translation layer for Direct3D 8/9/10/11). So the solution at that time was to run the game on the PC, record Vulkan API calls with &lt;a href=&quot;https://github.com/LunarG/gfxreconstruct&quot;&gt;GFXReconstruct&lt;/a&gt; and a Vulkan profile that constrained the desktop GPU&#8217;s capabilities to those of the Adreno GPU.&lt;/p&gt;

&lt;p&gt;A bit later I was able to &#8220;play&#8221; simple DirectX games on the development board by playing the game on a PC and in real-time replaying translated Vulkan API calls on the board. You can read more on this in &lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/gfxreconstruct-test-mobile-gpus/&quot;&gt;&#8220;Testing Vulkan drivers with games that cannot run on the target device&#8221;&lt;/a&gt;.&lt;/p&gt;

&lt;video controls=&quot;&quot;&gt;
  &lt;source src=&quot;https://blogs.igalia.com/dpiliaiev/assets/video/gfxreconstruct-test-mobile-gpus/spelunky_2_remote_vk_replay.webm&quot; type=&quot;video/webm&quot;&gt;
&lt;/source&gt;&lt;/video&gt;

&lt;p&gt;That was a great start; we weren&#8217;t able to run games directly on our development boards, but we were now able to test them and begin to implement more features necessary for DXVK.&lt;/p&gt;

&lt;h3 id=&quot;measuring-performance&quot;&gt;Measuring Performance&lt;/h3&gt;

&lt;p&gt;In parallel with trying to support DXVK, fixing issues, and reverse engineering hardware features, we found ourselves needing to better understand performance. We chose to support Mesa&#8217;s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;u_trace&lt;/code&gt; framework and integrate with &lt;a href=&quot;https://perfetto.dev/&quot;&gt;Perfetto&lt;/a&gt;. At that time the performance measurement support in Mesa was rough, with only Freedreno (OpenGL driver for Adreno GPUs) supporting &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;u_trace&lt;/code&gt;. Spoiler: as of now, most Mesa drivers either support or are in the process of merging support for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;u_trace&lt;/code&gt;/Perfetto integration.&lt;/p&gt;

&lt;figure class=&quot;&quot;&gt;
  &lt;img src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/turnip-my-5y-retrospective/2021_perfetto.png&quot; alt=&quot;Screenshot of Perfetto with a minimal amount of tracepoints supported&quot; /&gt;&lt;figcaption&gt;
      

    &lt;/figcaption&gt;&lt;/figure&gt;

&lt;h2 id=&quot;2022&quot;&gt;2022&lt;/h2&gt;

&lt;p&gt;At the end of 2021 Turnip &lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-1-1-conformance/&quot;&gt;became Vulkan 1.1 conformant&lt;/a&gt;. We also started testing lots of single frame D3D11 captures of games we had, which uncovered plenty of new issues.&lt;/p&gt;

&lt;p&gt;With more testing came more issues!&lt;/p&gt;

&lt;p&gt;At that point I met our &lt;del&gt;three&lt;/del&gt; two main adversaries over the years, in full force:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/adreno-lrz/&quot;&gt;Low-Resolution-Z (LRZ)&lt;/a&gt; depth optimization;&lt;/li&gt;
  &lt;li&gt;GPU hangs, with the worst of them completely shutting down the SoC.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;low-resolution-z-lrz&quot;&gt;Low Resolution Z (LRZ)&lt;/h3&gt;

&lt;p&gt;Low-Resolution-Z is an extremely important optimization to get right in order to get reasonable performance out of our GPU (especially for VR games), but I believe it&#8217;s also one of the most complicated (at least from a software POV) depth-related hardware optimizations across various GPUs.&lt;/p&gt;





&lt;figure class=&quot;lrz-player&quot;&gt;
  &lt;div class=&quot;lrz-player__frame&quot;&gt;
    &lt;img class=&quot;lrz-player__image&quot; src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/turnip-my-5y-retrospective/lrz/lrz-animation.webp&quot; width=&quot;1000&quot; height=&quot;850&quot; alt=&quot;LRZ binning, tiled rendering, and overdraw comparison&quot; /&gt;
  &lt;/div&gt;

  
    &lt;ol class=&quot;lrz-player__metadata&quot;&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
        &lt;li&gt;&lt;/li&gt;
      
    &lt;/ol&gt;

    &lt;div class=&quot;lrz-player__controls&quot;&gt;
      &lt;button class=&quot;lrz-player__play&quot; type=&quot;button&quot;&gt;Play&lt;/button&gt;
      &lt;input class=&quot;lrz-player__range&quot; type=&quot;range&quot; value=&quot;0&quot; /&gt;
      1 / 16
    &lt;/div&gt;

    &lt;p class=&quot;lrz-player__status&quot;&gt;&lt;/p&gt;
  
&lt;/figure&gt;

&lt;p&gt;Conceptually it&#8217;s relatively simple - create a low resolution depth buffer during primitive binning pre-pass, throw out primitives that completely fail LRZ tests during binning. While during tiling, prevent a lot of overdraw by testing against this already formed low resolution depth buffer. But, in practice, there are lots of implicit restrictions on what can be done without disabling LRZ (to prevent correctness issues), and being too pessimistic when disabling LRZ can lead to unacceptable performance.&lt;/p&gt;

&lt;h3 id=&quot;gpu-hangs&quot;&gt;GPU Hangs&lt;/h3&gt;

&lt;p&gt;GPU hangs, on the other hand, are a plague that every graphics driver developer is intimately familiar with. However, at that time there were also unrecoverable hangs, which, due to certain issues in firmware or GPU HW itself, caused the entire SoC to shut down. They were an extreme pain to debug.&lt;/p&gt;

&lt;p&gt;I tried many methods over time to debug them:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;At first &lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/google-flight-recorder/&quot;&gt;I tried Vulkan-level breadcrumbs via &#8220;Graphics Flight Recorder&#8221;&lt;/a&gt;, it was useful at that time but far from perfect and abandoned by Google;&lt;/li&gt;
  &lt;li&gt;Later, &lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/debugging-unrecoverable-hangs/&quot;&gt;I implemented driver-level breadcrumbs&lt;/a&gt; that allowed finding the source of hangs at a finer level, and more importantly, synchronously going through breadcrumbs to debug unrecoverable hangs;&lt;/li&gt;
  &lt;li&gt;Prototyped editing a captured submission to the GPU.&lt;/li&gt;
&lt;/ul&gt;

&lt;figure class=&quot;&quot;&gt;
  &lt;img src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/debugging-unrecoverable-hangs/breadcrumbs_with_cpu_gpu_sync.svg&quot; alt=&quot;&quot; /&gt;&lt;figcaption&gt;
      

    &lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;That made debugging somewhat bearable.&lt;/p&gt;

&lt;h3 id=&quot;turnip-supports-vulkan-13&quot;&gt;Turnip supports Vulkan 1.3&lt;/h3&gt;

&lt;p&gt;Meanwhile &lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/turnip-vulkan-1-3/&quot;&gt;Turnip gained Vulkan 1.3&lt;/a&gt; support! It was necessary for DXVK and VKD3D-Proton.&lt;/p&gt;



&lt;h3 id=&quot;reviewing-vk_ext_fragment_density_map&quot;&gt;Reviewing VK_EXT_fragment_density_map&lt;/h3&gt;

&lt;p&gt;The third Harbinger of the Apocalypse has arrived: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;VK_EXT_fragment_density_map&lt;/code&gt;, the first stepping stone of the extensions essential for VR, was implemented by Connor Abbott. Since then I have been on the hook reviewing increasingly complicated interactions between &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;VK_EXT_fragment_density_map&lt;/code&gt; and the growing host of extensions.&lt;/p&gt;

&lt;p&gt;The fragment density map (Foveated Rendering) explanation can be found in the following blog posts from Qualcomm and Meta:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://developers.meta.com/horizon/documentation/unity/unity-eye-tracked-foveated-rendering/&quot;&gt;Eye Tracked Foveated Rendering&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.qualcomm.com/developer/blog/2022/08/improving-foveated-rendering-fragment-density-map-offset-extension-vulkan&quot;&gt;Improving Foveated Rendering with the Fragment Density Map Offset Extension for Vulkan&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;2023&quot;&gt;2023&lt;/h2&gt;

&lt;p&gt;Turnip began to support Adreno 7XX GPUs; previously we only supported the single 6XX generation, albeit with several sub-generations. The proprietary driver supported Vulkan since the 4XX generation, but it was only Vulkan 1.0, and 4XX/5XX generations were not powerful enough and didn&#8217;t have enough features to support anything with Vulkan.&lt;/p&gt;

&lt;figure class=&quot;&quot;&gt;
  &lt;img src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/turnip-my-5y-retrospective/a7xx_bringup_vulkanscene_issue.png&quot; alt=&quot;&quot; /&gt;&lt;figcaption&gt;
      

    &lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;New generation means more issues to fix!&lt;/p&gt;

&lt;p&gt;To help with that I implemented:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rddecompiler&lt;/code&gt; which makes it possible to decompile captured raw submissions to the GPU into editable C code, coupled with the ability to replay them, print from shaders, and print from the command stream - &lt;a href=&quot;https://blogs.igalia.com/dpiliaiev/debugging-by-editing-gpu-packets/&quot;&gt;resulted in a much faster debug loop&lt;/a&gt;;&lt;/li&gt;
  &lt;li&gt;A debug option that helps find where we use stale register values &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TU_DEBUG_STALE_REGS_RANGE&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/* pkt4: GRAS_SC_SCREEN_SCISSOR[0].TL = { X = 0 | Y = 0 } */
pkt4(cs, REG_A6XX_GRAS_SC_SCREEN_SCISSOR_TL(0), (2), 0);
/* pkt4: GRAS_SC_SCREEN_SCISSOR[0].BR = { X = 32767 | Y = 32767 } */
pkt(cs, 2147450879);
/* pkt4: VFD_INDEX_OFFSET = 0 */
pkt4(cs, REG_A6XX_VFD_INDEX_OFFSET, (2), 0);
/* pkt4: VFD_INSTANCE_START_OFFSET = 0 */
pkt(cs, 0);
/* pkt4: SP_FS_OUTPUT[0].REG = { REGID = r0.x } */
pkt4(cs, REG_A6XX_SP_FS_OUTPUT_REG(0), (1), 0);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;After a lot of command stream and shader reverse-engineering - at the end of the year the Adreno 7XX generation was in decent shape in Turnip.&lt;/p&gt;

&lt;h2 id=&quot;2024&quot;&gt;2024&lt;/h2&gt;

&lt;p&gt;Work continued with Adreno 750 now being the main target. We had a lot of issues to debug and fix:&lt;/p&gt;

&lt;figure class=&quot;&quot;&gt;
  &lt;img src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/turnip-my-5y-retrospective/a_hat_in_time_misrendering.jpg&quot; alt=&quot;&quot; /&gt;&lt;figcaption&gt;
      A Hat In Time

    &lt;/figcaption&gt;&lt;/figure&gt;

&lt;figure class=&quot;&quot;&gt;
  &lt;img src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/turnip-my-5y-retrospective/farming_simulator_misrendering.jpg&quot; alt=&quot;&quot; /&gt;&lt;figcaption&gt;
      Farming Simulator

    &lt;/figcaption&gt;&lt;/figure&gt;

&lt;figure class=&quot;&quot;&gt;
  &lt;img src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/turnip-my-5y-retrospective/ds3_renderdoc_misrendering.jpg&quot; alt=&quot;&quot; /&gt;&lt;figcaption&gt;
      Inspecting Dark Souls 3

    &lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;And many, many more games.&lt;/p&gt;

&lt;h3 id=&quot;android-wastelands&quot;&gt;Android (Waste)Lands&lt;/h3&gt;

&lt;p&gt;While Turnip, as far as I can remember, was officially only used on some Google Chromebooks, there apparently was a dedicated community of people who tried and actually ran desktop games on Android via Termux. The community has grown since then, but it was great to have a real user already using the driver to play games and having better outcomes than with the proprietary driver, which often doesn&#8217;t get updated after a phone&#8217;s release.&lt;/p&gt;



&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;While fascinating, those Android setups were hard to debug, so we used them only a few times.&lt;/p&gt;

&lt;h3 id=&quot;turnip-is-vulkan-14-conformant-and-preemption-support&quot;&gt;Turnip Is Vulkan 1.4 Conformant and Preemption Support&lt;/h3&gt;

&lt;p&gt;Not my achievements at all, but two major milestones for Turnip were:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;We caught up with the Vulkan releases and were &lt;a href=&quot;https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32437&quot;&gt;day 1 conformant to Vulkan 1.4 on A7XX&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Preemption support - this is a crucial feature for VR and needed by the Steam Frame. The VR compositor has to be able to preempt games that are being rendered at that moment, otherwise we can miss a frame or several, which feels extremely bad for a user moving their head in the VR environment. An Adreno GPU can be preempted at two boundaries: at the drawcall/dispatch boundary in direct (sysmem) rendering, and at the tile boundary in tiling (gmem) rendering.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;2025&quot;&gt;2025&lt;/h2&gt;

&lt;h3 id=&quot;more-vr-extensions&quot;&gt;More VR Extensions&lt;/h3&gt;

&lt;p&gt;Even more extensions came in from Connor: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;VK_QCOM_multiview_per_view_viewports&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;VK_QCOM_multiview_per_view_render_areas&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;VK_VALVE_fragment_density_map_layered&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;VK_QCOM_fragment_density_map_offset&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;VK_QCOM_subpass_shader_resolve&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;VK_EXT_custom_resolve&lt;/code&gt;. Those are essential for pushing VR performance to its limit. The biggest issue with FDM related extensions is that they don&#8217;t have good CTS tests; the complexity comes from the fact that a conforming driver implementation may simply choose not to reduce quality in regions specified by the density map. Even the size of those regions is not known to a game using those extensions!&lt;/p&gt;

&lt;p&gt;As a result I wrote lots of tests that exercise various combinations of those extensions and require visual inspection for them to pass &#129760;&#129760;&#129760;.&lt;/p&gt;

&lt;figure class=&quot;&quot;&gt;
  &lt;img src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/turnip-my-5y-retrospective/fdm_both_eyes.jpg&quot; alt=&quot;&quot; /&gt;&lt;figcaption&gt;
      Result of one of FDM tests (Notice lower resolution at the edges of both eyes)

    &lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Those tests also measured performance, which helped us fix disparities with the proprietary driver.&lt;/p&gt;

&lt;h3 id=&quot;half-life-alyx&quot;&gt;Half-Life: Alyx&lt;/h3&gt;

&lt;p&gt;What is going to use the above extensions to push Steam Frame to its limits? Of course, Half-Life: Alyx.&lt;/p&gt;

&lt;p&gt;Even with previously mentioned tests in place, Half-Life: Alyx found plenty of both rendering and performance issues.&lt;/p&gt;

&lt;figure class=&quot;&quot;&gt;
  &lt;img src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/turnip-my-5y-retrospective/hl_alyx.jpg&quot; alt=&quot;&quot; /&gt;&lt;figcaption&gt;
      That&#8217;s how I felt when a new issue was found

    &lt;/figcaption&gt;&lt;/figure&gt;

&lt;h3 id=&quot;are-we-performant-yet&quot;&gt;Are We Performant Yet?&lt;/h3&gt;

&lt;p&gt;We already had feedback from Android users running games that Turnip performance is sometimes better than the proprietary driver, but sometimes noticeably worse. But how to compare them? Turnip has Perfetto support, the proprietary driver has Snapdragon Profiler, but it&#8217;s hard to use and even then - we&#8217;d just see that some particular renderpass is faster or not. There could be hundreds or thousands of draw calls in a renderpass!&lt;/p&gt;

&lt;p&gt;Staring at the command stream from the proprietary driver stopped yielding any insights, so the next step was to take a game trace that can run both on Turnip and Qualcomm&#8217;s driver and compare them draw by draw, measuring all performance counters along the way. It was done by lots of command stream patching, but the end result was an ability to compare key registers at every draw and every performance counter in existence.&lt;/p&gt;

&lt;figure class=&quot;&quot;&gt;
  &lt;img src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/turnip-my-5y-retrospective/turnip_vs_blob_perf_comparison.png&quot; alt=&quot;&quot; /&gt;&lt;figcaption&gt;
      Turnip VS Qualcomm&#8217;s driver draw by draw comparison

    &lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;The resulting table was huge:&lt;/p&gt;

&lt;video controls=&quot;&quot; width=&quot;100%&quot;&gt;
  &lt;source src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/turnip-my-5y-retrospective/turnip_vs_blob_perf_comparison.webm&quot; type=&quot;video/webm&quot;&gt;
  Your browser does not support the video element.
&lt;/source&gt;&lt;/video&gt;

&lt;p&gt;This helped us to close several gaps in performance, however the most useful part of the comparison was not the counters, but the register comparison. The counters, aside from execution time and LRZ stats, were surprisingly hard to convert into any useful insight.&lt;/p&gt;

&lt;h3 id=&quot;preventing-regressions&quot;&gt;Preventing Regressions&lt;/h3&gt;

&lt;p&gt;With the driver gaining capabilities, but not gaining many more users, we needed a way to prevent regressions while introducing more and more complex features. And while Vulkan Conformance Test Suite is being tirelessly improved upon year after year, it&#8217;s still far from enough.&lt;/p&gt;

&lt;p&gt;It was time to introduce a CI system that would be able to detect visual regressions in rendering and performance regressions. We already had a number of d3d11 and d3d9 captures to start working with, and so it came to be:&lt;/p&gt;

&lt;video controls=&quot;&quot; width=&quot;100%&quot;&gt;
  &lt;source src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/turnip-my-5y-retrospective/ci_runs_diff.webm&quot; type=&quot;video/webm&quot;&gt;
  Your browser does not support the video element.
&lt;/source&gt;&lt;/video&gt;

&lt;p&gt;Above, you can see one of the results where the rendering regressed. In most cases we run only a single frame capture instead of longer multi-frame traces. This was an explicit choice due to the observation that it&#8217;s better to have a wider selection of captures, than trying to cover any single game better (VR games are an exception here). In many cases only one or two captures out of hundreds regressed due to some issue; the regression was caused by some very specific pattern the game had, which wouldn&#8217;t appear in others.&lt;/p&gt;

&lt;p&gt;Every night we test several driver configurations:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Fixed DXVK/VKD3D versions + forced direct (sysmem) rendering;&lt;/li&gt;
  &lt;li&gt;Fixed DXVK/VKD3D versions + forced tiling (gmem) rendering;&lt;/li&gt;
  &lt;li&gt;Upstream DXVK/VKD3D versions;&lt;/li&gt;
  &lt;li&gt;Turnip compiled with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ubsan&lt;/code&gt; (undefined behaviour sanitizer).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We also run important MRs through that CI to find regressions early on.&lt;/p&gt;

&lt;figure class=&quot;&quot;&gt;
  &lt;img src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/turnip-my-5y-retrospective/ci_perf_graph.jpeg&quot; alt=&quot;&quot; /&gt;&lt;figcaption&gt;
      

    &lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Every nightly run generates a performance datapoint, so we can see the line going down day by day. Don&#8217;t mind the bump where we had concurrent binning &#8220;optimization&#8221; enabled &#129760; (that&#8217;s a sad tale of an incredibly complicated HW feature which failed to deliver performance gains).&lt;/p&gt;

&lt;p&gt;At the moment we are testing more than 600 different game frames per driver configuration; the APIs span D3D8-D3D12, Vulkan, and OpenGL. A single configuration runs in under an hour on just two Adreno 750 devices.&lt;/p&gt;

&lt;p&gt;With CI in place we became increasingly confident in making changes to the driver.&lt;/p&gt;

&lt;p&gt;See more in my XDC 2025 talk:&lt;/p&gt;



&lt;h2 id=&quot;2026&quot;&gt;2026&lt;/h2&gt;

&lt;p&gt;Steam Frame was announced at the end of 2025; now we still had plenty of things to polish.&lt;/p&gt;

&lt;h3 id=&quot;performance&quot;&gt;Performance&lt;/h3&gt;

&lt;p&gt;We were now working much more on performance, and the main culprit in bad performance is often Low-Resolution-Z being fully or partially disabled, especially in VR. We improved Perfetto tracepoints a lot: added new ones, fixed tracepoints with complex renderpass suspend-resume setups, and added performance warnings:&lt;/p&gt;

&lt;figure class=&quot;&quot;&gt;
  &lt;img src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/turnip-my-5y-retrospective/perfetto_warnings.jpeg&quot; alt=&quot;&quot; /&gt;&lt;figcaption&gt;
      

    &lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Now it was much nicer to work with, and something external developers could reasonably use.&lt;/p&gt;

&lt;p&gt;As a result, while working on the performance of Half-Life: Alyx and some other VR games, we improved LRZ support a lot.&lt;/p&gt;

&lt;p&gt;We&#8217;ve also compared Turnip against Qualcomm&#8217;s driver on a new &lt;a href=&quot;https://gitlab.freedesktop.org/mesa/gpu-ratemeter&quot;&gt;GPU Performance Microbenchmark (gpu-ratemeter)&lt;/a&gt; to squash the rest of the performance differences.&lt;/p&gt;

&lt;p&gt;There was also a lot of compiler work, done by great compiler engineers working on Turnip.&lt;/p&gt;

&lt;h3 id=&quot;d3d12-woes&quot;&gt;D3D12 Woes&lt;/h3&gt;

&lt;p&gt;As we have been testing more D3D12 games running through VKD3D-Proton, we started to find interesting issues. Those generally are: implicit D3D12 features/requirements, or some behaviour out of the D3D12 spec but which all desktop GPUs do, or in one case Turnip having a &lt;em&gt;higher&lt;/em&gt; limit than desktop drivers. We saw at least:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;UE5 not working correctly with wave128 (only Adreno has such wide waves) up until a few months ago: &lt;a href=&quot;https://github.com/HansKristian-Work/vkd3d-proton/pull/3265&quot;&gt;vkd3d-proton PR #3265&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;D3D12 not having a proper query/limit for number of elements in buffers, implicitly supporting more than Turnip advertises: &lt;a href=&quot;https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41477&quot;&gt;mesa MR !41477&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;One game relying on &#8220;fair&#8221; execution of dispatches when implementing its own spin locks in compute shaders: &lt;a href=&quot;https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41562&quot;&gt;mesa MR !41562&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;UE5 relying on higher memory allocation alignment than Turnip has: &lt;a href=&quot;https://github.com/HansKristian-Work/vkd3d-proton/pull/3231&quot;&gt;vkd3d-proton PR #3231&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Games not checking for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;D3D12_FEATURE_DATA_D3D12_OPTIONS21::ExecuteIndirectTier&lt;/code&gt; before using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;D3D12_EXECUTE_INDIRECT_TIER_1_1&lt;/code&gt; commands&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;alyx--rare-gpu-hangs&quot;&gt;Alyx &#9734; Rare GPU Hangs&lt;/h3&gt;

&lt;p&gt;It&#8217;s &#8220;good&#8221; when the GPU hangs at a predictable place, it&#8217;s bad when the GPU hangs randomly, and it&#8217;s even worse when the GPU stops hanging when you try to isolate the issue in any way to debug it.&lt;/p&gt;

&lt;p&gt;One of such hangs happened in Half-Life: Alyx, when moving through a specific location the GPU hung, sometimes, and sometimes it didn&#8217;t for a long while. I&#8217;ve tried:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;At first it seemed to happen only on the stable Turnip branch, so I&#8217;ve tried to bisect the issue;&lt;/li&gt;
  &lt;li&gt;After a while I found out that it happened in &lt;em&gt;any&lt;/em&gt; branch;&lt;/li&gt;
  &lt;li&gt;I tried to stare at GPU coredumps - no luck;&lt;/li&gt;
  &lt;li&gt;Tried to get a gfxreconstruct trace to reproduce the hang; it might hang once or twice out of many replays.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What is almost impossible to do in such cases is test whether disabling a certain driver feature helps; you always have doubts - it didn&#8217;t hang this time because of the feature I disabled, or I&#8217;m just unlucky. This happened several times during the investigation, the hang would disappear for an hour, and then reproduce several times in a row.&lt;/p&gt;

&lt;p&gt;Previously I wrote that we have a mechanism to capture and replay raw submissions that are sent to the GPU. Yes, I tried that too, we can capture the submission that hanged the GPU. Guess what? The captured submission executed absolutely normally and didn&#8217;t hang, not on the first execution, nor on thousands&#8230;.&lt;/p&gt;

&lt;p&gt;At that point I still didn&#8217;t have a single clue what&#8217;s going wrong, aside from some kind of hardware errata being involved. It was time to improve the debug tooling even further. Before, the captured &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.rd&lt;/code&gt; submission could be replayed once with one &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;replay&lt;/code&gt; invocation, but the issue at hand demanded lots of iterations, and more ergonomic editing of the command stream than we previously had. So I&#8217;ve made improvements (they still are work-in-progress) to:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Loop specific submission any number of times;&lt;/li&gt;
  &lt;li&gt;Quickly disable specific draw call ranges in the submission;&lt;/li&gt;
  &lt;li&gt;Automatically bisect which draw/dispatch causes hang/fault.&lt;/li&gt;
&lt;/ul&gt;

&lt;figure class=&quot;&quot;&gt;
  &lt;img src=&quot;https://blogs.igalia.com/dpiliaiev/assets/images/turnip-my-5y-retrospective/rd_debugger.jpg&quot; alt=&quot;&quot; /&gt;&lt;figcaption&gt;
      

    &lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Only with each bisection step doing 50000 iterations was I able to narrow things down to a few draw calls. Looking at them closely still yielded only more head scratches though. However, with things narrowed down that far, I had something to poke other, more knowledgeable people with.&lt;/p&gt;

&lt;p&gt;After some back and forth, it appeared that I hadn&#8217;t thoroughly checked all shader debug options we had, or rather, I checked the option, but due to the rarity of the hang I misidentified it as not helpful!&lt;/p&gt;

&lt;p&gt;In the end it appeared that there were &lt;a href=&quot;https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/43255&quot;&gt;two hardware errata that needed to be implemented&lt;/a&gt; in our shader compiler. And we got &#8220;lucky&#8221; that they were revealed by one of the most important games to run on the headset.&lt;/p&gt;

&lt;h2 id=&quot;present&quot;&gt;Present&lt;/h2&gt;

&lt;p&gt;Driver work never ends, there are still games to debug, features to implement, and VR performance to improve. The fact that Steam Frame runs Linux, is based on open-source software, and isn&#8217;t locked down means that Steam Frame would be used in many ways unforeseen by us. I hope that Steam Frame release would bring improvements to the VR ecosystem and spearhead PC gaming on Linux running on ARM platforms.&lt;/p&gt;                </content>
		<author>
			<name>Danylo Piliaiev</name>
			<uri>https://blogs.igalia.com/dpiliaiev/</uri>
		</author>
	</entry>

	<entry>
		<title>Igalia WebKit Team: WebKit Igalia Periodical #77</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/webkit/blog/2026/wip-77/"/>
		<id>https://blogs.igalia.com/webkit/blog/2026/wip-77/</id>
		<updated>2026-09-14T19:07:43+00:00</updated>
		<content type="html">
&lt;p&gt;Update on what happened in WebKit in the week from September 7 to September 14.&lt;/p&gt;
&lt;p&gt;
In this week's edition, the PNG image decoder received a much
needed cleanup, as well as another swipe of unassorted graphics
improvements, most notably in the Layer-Based SVG Engine. Finally,
we also have an exciting and informative article about how to use
the WPE Platform API on Raspberry Pi.
&lt;/p&gt;
&lt;h2 id=&quot;cross-port-cat&quot;&gt;Cross-Port &#128049;&lt;/h2&gt;
&lt;h3 id=&quot;graphics-frame-photo&quot;&gt;Graphics &#128444;&#65039;&lt;/h3&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320960@main&quot;&gt;Cleaned up the PNG image decoder&lt;/a&gt; a little bit, by removing conditional code that was used to support &lt;code&gt;libpng&lt;/code&gt; versions older than 1.5.0, and requiring that as the minimum version. Given that version 1.5.0 was released back in 2011, it is expected that every system where current WebKit works will have much newer versions of &lt;code&gt;libpng&lt;/code&gt; anyway.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320988@main&quot;&gt;Fixed an assertion failure&lt;/a&gt; for an outermost &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; with non-visible &lt;code&gt;overflow&lt;/code&gt; in the Layer-Based SVG Engine (LBSE) by refreshing its scroll dimensions at the end of layout, a first step towards reworking &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; scrolling, which is not yet spec compliant.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320797@main&quot;&gt;Fixed an assertion failure&lt;/a&gt; when computing filter outsets for &lt;code&gt;&amp;lt;feGaussianBlur&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;feDropShadow&amp;gt;&lt;/code&gt; with a negative &lt;code&gt;stdDeviation&lt;/code&gt;, which turns the primitive off but was still passed on to the outset calculation, affecting both SVG filters and CSS reference filters.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320622@main&quot;&gt;Stopped reporting damage every frame&lt;/a&gt; for composited layers that use CSS &lt;code&gt;filter&lt;/code&gt; in the Skia based compositor, so a blurred or drop-shadowed element is now only repainted when its subtree, or the applied (possibly animated) filter value, actually changed.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320634@main&quot;&gt;Fixed&lt;/a&gt; the bug that composited layers with clipping or masking and fully covered by opaque child layers were treated as opaque layers.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Fixed two debug assertion failures in the Layer-Based SVG Engine (LBSE), one where an SVG &lt;code&gt;transform&lt;/code&gt; change &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320722@main&quot;&gt;left ancestor layer repaint rects stale&lt;/a&gt; and one where &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320757@main&quot;&gt;repainting on a compositing change during layout&lt;/a&gt; tripped an over-strict check on the paint offset cache.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320811@main&quot;&gt;Fixed&lt;/a&gt; the white noised image issue on the combination of i915 driver and Intel Arc after &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/308458@main&quot;&gt;308458@main&lt;/a&gt; introduced image atlas uploading.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;community-events-handshake&quot;&gt;Community &amp;amp; Events &#129309;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Published a &lt;a rel=&quot;external&quot; href=&quot;https://blogs.igalia.com/plampe/trying-wpe-platform-api-on-raspberry-pi/&quot;&gt;blog post&lt;/a&gt; describing the steps to try WPE Platform API on Raspberry Pi with latest WebKit &lt;code&gt;main&lt;/code&gt; branch.&lt;/p&gt;
  &lt;/div&gt;
&lt;div class=&quot;wip-end&quot;&gt;
&lt;p&gt;That&#8217;s all for this week!&lt;/p&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Igalia WebKit Team</name>
			<uri>https://blogs.igalia.com/webkit</uri>
		</author>
	</entry>

	<entry>
		<title>Hironori Fujii: Asynchronous scrolling for touch events in WPE and WebKitGTK</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/"/>
		<id>https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/</id>
		<updated>2026-09-13T00:00:00+00:00</updated>
		<content type="html">
&lt;ul&gt;
&lt;li&gt;Bug: &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=318938&quot;&gt;318938 &#8211; Support touch event asynchronous scrolling&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Commit: &lt;a href=&quot;https://commits.webkit.org/319347@main&quot;&gt;319347@main&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The WPE and GTK ports have supported touch events for a long time, but
asynchronous scrolling only worked for wheel events. Scrolling driven by touch
still depended on the web process main thread. This change puts touch events on
the asynchronous scrolling path too.&lt;/p&gt;
&lt;p&gt;Let&#8217;s start with the background: what asynchronous scrolling is and why it needs
to be built differently here.&lt;/p&gt;
&lt;h2 id=&quot;what-is-asynchronous-scrolling&quot; tabindex=&quot;-1&quot;&gt;What is asynchronous scrolling? &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;why-it-is-needed&quot; tabindex=&quot;-1&quot;&gt;Why it is needed &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A naive implementation of scrolling looks like this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The UI process receives an input event (wheel or touch).&lt;/li&gt;
&lt;li&gt;It sends the event to the web process main thread.&lt;/li&gt;
&lt;li&gt;The main thread runs the page&#8217;s JavaScript event listeners.&lt;/li&gt;
&lt;li&gt;If nothing called &lt;code&gt;preventDefault()&lt;/code&gt;, the scroll position is updated.&lt;/li&gt;
&lt;li&gt;The page is rendered at the new scroll position.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Step 3 is the problem. The main thread is easily blocked for hundreds of
milliseconds by JavaScript execution or layout, and scrolling is frozen for that
whole time. Your finger moves, the screen does not. That is what synchronous
scrolling feels like.&lt;/p&gt;
&lt;p&gt;Asynchronous scrolling moves the work off the main thread: the &lt;strong&gt;scrolling
thread&lt;/strong&gt; updates the scroll position, and the &lt;strong&gt;compositor thread&lt;/strong&gt; composites
and presents the frame. Neither needs the main thread, so scrolling keeps running
at 60fps even when the main thread is busy.&lt;/p&gt;
&lt;h3 id=&quot;the-scrolling-tree-and-event-regions&quot; tabindex=&quot;-1&quot;&gt;The scrolling tree and event regions &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Two data structures make this possible.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;scrolling tree&lt;/strong&gt; is a tree of the scrollable areas of a page. The main
frame, &lt;code&gt;overflow: scroll&lt;/code&gt; elements, &lt;code&gt;position: fixed&lt;/code&gt;/&lt;code&gt;sticky&lt;/code&gt; elements and so on
each become a node holding its own scroll position and a reference to its layer.
The scrolling thread updates scroll positions by looking only at this tree, and
the compositor thread then draws the layers at their new positions &#8212; the main
thread is not involved in either step.&lt;/p&gt;
&lt;p&gt;But there are places where scrolling on its own would be wrong, because the page
might call &lt;code&gt;preventDefault()&lt;/code&gt; from an &lt;code&gt;addEventListener(&amp;quot;touchstart&amp;quot;, ...)&lt;/code&gt;
handler. That is what &lt;strong&gt;event regions&lt;/strong&gt; are for.&lt;/p&gt;
&lt;p&gt;An event region records, per layer and at rendering time, &#8220;this rectangle has a
listener for this kind of event&#8221;. &lt;code&gt;EventRegion&lt;/code&gt; keeps separate regions for
&lt;code&gt;touchstart&lt;/code&gt;, &lt;code&gt;touchmove&lt;/code&gt;, &lt;code&gt;pointerdown&lt;/code&gt;, &lt;code&gt;mousedown&lt;/code&gt; and friends, and for any
given point it yields a &lt;code&gt;TrackingType&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-cpp&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-cpp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;enum&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;TrackingType&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token base-clause&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;uint8_t&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    NotTracking &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;   &lt;span class=&quot;token comment&quot;&gt;// No listener. The event does not even need to be delivered.&lt;/span&gt;&lt;br /&gt;    Asynchronous &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// Passive listeners only. Scroll now, notify the page later.&lt;/span&gt;&lt;br /&gt;    Synchronous &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;    &lt;span class=&quot;token comment&quot;&gt;// A non-passive listener may call preventDefault(). We must wait.&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The passive distinction is what makes &lt;code&gt;Asynchronous&lt;/code&gt; possible.
&lt;code&gt;preventDefault()&lt;/code&gt; cancels an event only if the listener was registered with
&lt;code&gt;passive: false&lt;/code&gt;; from a passive listener it does nothing. And on &lt;code&gt;window&lt;/code&gt;,
&lt;code&gt;document&lt;/code&gt; and &lt;code&gt;document.body&lt;/code&gt;, &lt;code&gt;touchstart&lt;/code&gt;/&lt;code&gt;touchmove&lt;/code&gt; (and &lt;code&gt;wheel&lt;/code&gt;) default to
&lt;code&gt;passive: true&lt;/code&gt; &#8212; see
&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#using_passive_listeners&quot;&gt;MDN: Using passive listeners&lt;/a&gt;.
So &lt;code&gt;Asynchronous&lt;/code&gt; is the case &#8220;there are listeners, but none of them can cancel
the scroll&#8221;: start scrolling now, deliver the event to the main thread
afterwards.&lt;/p&gt;
&lt;p&gt;Because this information travels to the scrolling thread along with the layer
tree, an incoming input event can be classified without waking the main thread.
That is the heart of asynchronous scrolling.&lt;/p&gt;
&lt;h3 id=&quot;why-the-ios-implementation-could-not-be-reused&quot; tabindex=&quot;-1&quot;&gt;Why the iOS implementation could not be reused &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The iOS port already implements asynchronous scrolling for touch events, but it
could not be reused, because the process layout is different.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;iOS:
  UI process:  platform layer tree + scrolling tree + touch event input
  Web process: main thread (DOM, layout)

WPE / GTK (Coordinated Graphics):
  UI process:  touch event input only
  Web process: main thread (DOM, layout)
               + EventDispatcher thread / scrolling thread
               + platform layer tree + scrolling tree
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On iOS both the platform layer tree and the scrolling tree live in the UI
process &#8212; the very process that receives touch events &#8212; so the classification
and the scroll both happen right there. On WPE and GTK we use Coordinated
Graphics, and both trees live in the web process instead. The classification
therefore has to happen &lt;em&gt;after&lt;/em&gt; sending the event to the web process, but
&lt;em&gt;before&lt;/em&gt; touching the main thread.&lt;/p&gt;
&lt;p&gt;Fortunately the same problem was already solved for wheel events. The web
process has an &lt;strong&gt;EventDispatcher thread&lt;/strong&gt; that receives wheel events from the UI
process without going through the main thread and consults the scrolling tree
directly. This change builds the same shape for touch events.&lt;/p&gt;
&lt;h3 id=&quot;how-a-touch-becomes-a-scroll-in-wpe&quot; tabindex=&quot;-1&quot;&gt;How a touch becomes a scroll in WPE &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;One more piece of background: in WPE a touch does not scroll the page directly.
Touch events are first offered to the page; only if the page does not consume
them does the UI process turn the touch sequence into scrolling.&lt;/p&gt;
&lt;p&gt;The decision point is &lt;code&gt;PageClientImpl::doneWithTouchEvent()&lt;/code&gt;. If the page handled
the event, gesture detection is cancelled with
&lt;code&gt;wpe_gesture_controller_cancel()&lt;/code&gt; so the engine does not also act on it. If it
was not handled, the event is fed to the WPE platform gesture controller via
&lt;code&gt;ViewPlatform::handleGesture()&lt;/code&gt;, and a recognized &lt;code&gt;WPE_GESTURE_DRAG&lt;/code&gt; is turned
into a synthetic scroll event pushed back into the page as a wheel event:&lt;/p&gt;
&lt;pre class=&quot;language-cpp&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-cpp&quot;&gt;GRefPtr&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;WPEEvent&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; simulatedScrollEvent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;adoptGRef&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;wpe_event_scroll_new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;br /&gt;    m_wpeView&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; WPE_INPUT_SOURCE_TOUCHSCREEN&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token generic-function&quot;&gt;&lt;span class=&quot;token function&quot;&gt;static_cast&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;WPEModifiers&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; dx&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; dy&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; TRUE&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; FALSE&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; x&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; y&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token function&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;handleNativeWheelEvent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;WebKit&lt;span class=&quot;token double-colon punctuation&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;NativeWebWheelEvent&lt;/span&gt;&lt;span class=&quot;token double-colon punctuation&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;simulatedScrollEvent&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; phase&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That &lt;code&gt;TRUE&lt;/code&gt; is &lt;code&gt;precise_deltas&lt;/code&gt;: touch-driven scrolling in WPE reaches the engine
as precise-delta wheel events, which becomes relevant later.&lt;/p&gt;
&lt;p&gt;The important consequence is this: &lt;strong&gt;the UI process cannot start scrolling until
it knows whether the page is going to consume the touch.&lt;/strong&gt; That answer used to
come from the web process main thread &#8212; so when the main thread was busy,
scrolling did not start. That is the problem this change fixes.&lt;/p&gt;
&lt;h2 id=&quot;the-change&quot; tabindex=&quot;-1&quot;&gt;The change &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;enabling-touch-event-regions&quot; tabindex=&quot;-1&quot;&gt;Enabling touch event regions &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A new &lt;code&gt;ENABLE(COORDINATED_TOUCH_EVENTS)&lt;/code&gt; is introduced in &lt;code&gt;PlatformEnableGlib.h&lt;/code&gt;,
and it turns on &lt;code&gt;ENABLE(TOUCH_EVENT_REGIONS)&lt;/code&gt; whenever touch events are enabled
on WPE/GTK. The &lt;code&gt;AlwaysUseTouchEventRegions&lt;/code&gt; preference now defaults to &lt;code&gt;true&lt;/code&gt;
under that flag, so &lt;code&gt;Document::shouldUseTouchEventRegions()&lt;/code&gt; returns true and
touch regions are actually recorded on the layers during rendering.&lt;/p&gt;
&lt;h3 id=&quot;ui-process-send-to-the-eventdispatcher-instead-of-the-main-thread&quot; tabindex=&quot;-1&quot;&gt;UI process: send to the EventDispatcher instead of the main thread &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The old &lt;code&gt;WebPageProxy::handleTouchEvent()&lt;/code&gt; consulted a &lt;code&gt;touchEventTracking&lt;/code&gt; state
kept in the UI process and sent &lt;code&gt;Messages::WebPage::TouchEvent&lt;/code&gt;, i.e. straight to
the web process main thread.&lt;/p&gt;
&lt;p&gt;The new version delegates all classification to the web process and only queues
events and delivers answers. One event is in flight at a time; the next is sent
when the reply arrives. The flood of &lt;code&gt;touchmove&lt;/code&gt; events produced while a finger
moves is coalesced into the newest queued event when that is also a &lt;code&gt;touchmove&lt;/code&gt;,
and the coalesced events are flushed to &lt;code&gt;doneWithTouchEvent()&lt;/code&gt; together with the
reply.&lt;/p&gt;
&lt;p&gt;The destination is now &lt;code&gt;Messages::EventDispatcher::TouchEvent&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&quot;web-process-classification-on-the-eventdispatcher-thread&quot; tabindex=&quot;-1&quot;&gt;Web process: classification on the EventDispatcher thread &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;EventDispatcher::touchEvent()&lt;/code&gt; runs on the &lt;code&gt;EventDispatcher&lt;/code&gt; thread, where it
looks up the page&#8217;s scrolling tree, asks it for a &lt;code&gt;TrackingType&lt;/code&gt;, and splits
three ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;NotTracking&lt;/strong&gt; &#8212; no listeners. Reply &lt;code&gt;handled = false&lt;/code&gt; immediately, without
bothering the main thread at all. The UI process can start scrolling right
away.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Asynchronous&lt;/strong&gt; &#8212; passive listeners only, so nothing can cancel the event.
Reply &lt;code&gt;handled = false&lt;/code&gt; first so scrolling starts, then deliver the event to the main thread.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Synchronous&lt;/strong&gt; &#8212; a non-passive listener may call &lt;code&gt;preventDefault()&lt;/code&gt;, so wait
for the main thread result as before.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Replying without a main thread round trip is possible because the new
&lt;code&gt;TouchEvent&lt;/code&gt; message is declared &lt;code&gt;AnyThread&lt;/code&gt; in &lt;code&gt;EventDispatcher.messages.in&lt;/code&gt;.
The iOS equivalent is &lt;code&gt;MainThreadCallback&lt;/code&gt;, which always replies from the main
thread.&lt;/p&gt;
&lt;p&gt;If there is no scrolling tree for the page yet, the event goes to the main
thread as before.&lt;/p&gt;
&lt;h3 id=&quot;classifying-a-touch-in-the-scrolling-tree&quot; tabindex=&quot;-1&quot;&gt;Classifying a touch in the scrolling tree &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The classification itself is
&lt;code&gt;ScrollingTreeCoordinated::eventTrackingTypeForTouchEvent()&lt;/code&gt;. It works in two
stages.&lt;/p&gt;
&lt;p&gt;First, for each newly pressed touch point: convert the point from view to contents coordinates,
hit test the layer tree down from the root contents layer, take the frontmost
layer whose event region contains the point, and query that region. It is queried
for many event types, because a touch fires more than the DOM &lt;code&gt;touch*&lt;/code&gt; events &#8212;
&lt;code&gt;pointer*&lt;/code&gt;, compatibility mouse events and &lt;code&gt;gesture*&lt;/code&gt; too, and a non-passive
listener for any of them forces synchronous handling. The results are folded into
a small &lt;code&gt;TouchEventTracking&lt;/code&gt; struct with four fields: start, move, end and
force-change.&lt;/p&gt;
&lt;p&gt;Second, the tracking type of the event as a whole is derived from the touch point
states, merging the per-field values. Merging picks the stronger of two types
(&lt;code&gt;NotTracking&lt;/code&gt; &amp;lt; &lt;code&gt;Asynchronous&lt;/code&gt; &amp;lt; &lt;code&gt;Synchronous&lt;/code&gt;), so if any single point needs
synchronous handling, the whole event is synchronous.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;TouchEventTracking&lt;/code&gt; persists for the lifetime of a touch sequence and is reset
once all points are released, so the hit test done at &lt;code&gt;touchstart&lt;/code&gt; is reused for
the following &lt;code&gt;touchmove&lt;/code&gt;/&lt;code&gt;touchend&lt;/code&gt;. That guarantees a sequence never flips from
synchronous to asynchronous halfway through just because a finger moved off a
listener&#8217;s area.&lt;/p&gt;
&lt;h3 id=&quot;input-type-range&quot; tabindex=&quot;-1&quot;&gt;&lt;code&gt;&amp;lt;input type=range&amp;gt;&lt;/code&gt; &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A slider handles touches internally even with no JavaScript listener, so looking
at the event region alone would classify it as &lt;code&gt;NotTracking&lt;/code&gt;.
&lt;code&gt;HTMLInputElement::updateTouchEventHandler()&lt;/code&gt; now sets the
&lt;code&gt;HasInternalTouchEventHandling&lt;/code&gt; flag on &lt;code&gt;EventTarget&lt;/code&gt; for range inputs, and
&lt;code&gt;StyleAdjuster&lt;/code&gt; turns that flag into the full set of touch region types for the
element.&lt;/p&gt;
&lt;h3 id=&quot;keeping-the-animation-running-on-the-scrolling-thread&quot; tabindex=&quot;-1&quot;&gt;Keeping the animation running on the scrolling thread &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The last piece is in &lt;code&gt;ScrollingEffectsController::handleWheelEvent()&lt;/code&gt;. As shown
above, WPE synthesizes wheel events from touch gestures with precise deltas.
Precise-delta events only need &lt;code&gt;immediateScrollBy()&lt;/code&gt; to move the scroll
position &#8212; but then nothing drives screen updates while the main thread is busy.&lt;/p&gt;
&lt;p&gt;The fix is that, while a scroll gesture is in progress, a scroll animation is
also started &#8212; from one ULP short of the destination (&lt;code&gt;std::nextafter()&lt;/code&gt;) to the
destination. Visually it finishes instantly &#8212; the
real scroll is still done by &lt;code&gt;immediateScrollBy()&lt;/code&gt; &#8212; but a scroll animation is
now running, which starts display link monitoring and keeps compositing driven
regardless of the main thread.&lt;/p&gt;
&lt;h2 id=&quot;the-event-flow-summarized&quot; tabindex=&quot;-1&quot;&gt;The event flow, summarized &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Before:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://blogs.igalia.com/fujii/img/touch-async-scrolling-before.svg&quot; alt=&quot;The UI process sends the touch event to the web process main thread, which may
be blocked by JavaScript or layout. Only after the reply arrives does gesture
recognition synthesize a wheel event and scrolling
start.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After (no listeners, or passive listeners only):&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://blogs.igalia.com/fujii/img/touch-async-scrolling-after.svg&quot; alt=&quot;The UI process sends the touch event to the EventDispatcher thread of the web
process, which asks the scrolling tree and replies immediately without the main
thread, so gesture recognition synthesizes a wheel event and scrolling starts
right away. If passive listeners exist, the event is also delivered to the main
thread afterwards.&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Where a non-passive listener exists, we still wait for the main thread as before.
The spec requires &lt;code&gt;preventDefault()&lt;/code&gt; to be honoured, so that is unavoidable.&lt;/p&gt;
&lt;h2 id=&quot;layout-test-updates&quot; tabindex=&quot;-1&quot;&gt;Layout test updates &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As a side effect, the tests under &lt;code&gt;fast/events/touch/&lt;/code&gt; had to be updated.&lt;/p&gt;
&lt;p&gt;Event regions are &lt;strong&gt;computed during a rendering update and propagated to the
scrolling tree via the platform layer tree&lt;/strong&gt;. Which means a test like this:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;target&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;touchstart&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; handler&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token function&quot;&gt;tapSoon&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;   &lt;span class=&quot;token comment&quot;&gt;// &#8592; the region has not been updated yet!&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;taps immediately after registering the listener, while the scrolling tree still
believes there is no listener and returns &lt;code&gt;NotTracking&lt;/code&gt;. The event never reaches
the main thread and the test fails.&lt;/p&gt;
&lt;p&gt;A new &lt;code&gt;UIHelper.renderingComplete()&lt;/code&gt; was added for this:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;renderingComplete&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token comment&quot;&gt;// Wait for the platform layer tree to be updated&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; UIHelper&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;animationFrame&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; UIHelper&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;animationFrame&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Two animation frames are needed because the first one runs the rendering update
that computes the regions, and a second is needed for the result to reach the
layer tree.&lt;/p&gt;
&lt;h2 id=&quot;summary&quot; tabindex=&quot;-1&quot;&gt;Summary &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;On WPE and GTK both the layer tree and the scrolling tree live in the web
process (Coordinated Graphics), so the iOS touch asynchronous scrolling
implementation could not be reused directly.&lt;/li&gt;
&lt;li&gt;Instead, touch events were given the same shape that already works for wheel
events: ask the scrolling tree from the EventDispatcher thread.&lt;/li&gt;
&lt;li&gt;The keys were enabling touch event regions, and making the IPC reply
&lt;code&gt;AnyThread&lt;/code&gt; so it can be sent without waiting for the main thread.&lt;/li&gt;
&lt;li&gt;Anywhere the page has no non-passive listener, scrolling
now starts regardless of what the main thread is doing.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;acknowledgements&quot; tabindex=&quot;-1&quot;&gt;Acknowledgements &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/fujii/asynchronous-scrolling-for-touch-events-in-wpe-and-webkitgtk/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Many thanks to Alejandro G. Castro and Carlos Garcia Campos for their insightful
reviews of this work, and to Claude for writing this blog post.&lt;/p&gt;                </content>
		<author>
			<name>Hironori Fujii</name>
			<uri>https://blogs.igalia.com/fujii/fujii</uri>
		</author>
	</entry>

	<entry>
		<title>Alejandro Garc&#237;a Castro: WPE WebKit on Android, now with WPEPlatform</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/alex/2026/09/11/wpe-webkit-on-android-now-with-wpeplatform/?pk_campaign=feed&amp;pk_kwd=wpe-webkit-on-android-now-with-wpeplatform"/>
		<id>https://blogs.igalia.com/alex/?p=238</id>
		<updated>2026-09-11T17:23:31+00:00</updated>
		<content type="html">
&lt;p&gt;It has been a while since I wrote a post here. The last one was from December 2012, almost fourteen years, which is a bit embarrassing for someone who is still hacking on WebKit. I need to try to fix it, and this post is the first attempt.&lt;/p&gt;



&lt;div class=&quot;wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex&quot;&gt;
&lt;p&gt;I would like to write a summary of the work we have been doing in &lt;strong&gt;wpe-android&lt;/strong&gt; in the last year, where this port of WPE comes from and where it is now. The details deserve their own posts and I plan to write more about specifics. Now that &lt;strong&gt;WPEPlatform&lt;/strong&gt; is going to be released as stable in the next few days seems a good example of how to use it, we have been actively using to test the API in the last months.&lt;/p&gt;
&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;wpe-android&lt;/strong&gt; started in 2017 as an experiment of running WPE WebKit on Android. The engine communicated with the system through libwpe, the abstraction library WPE used before &lt;strong&gt;WPEPlatform&lt;/strong&gt;. It used an Android backend living in its own separate library, libWPEBackend-android, and the Java side exposed the API with the &lt;code&gt;WPEView&lt;/code&gt;, &lt;code&gt;WPEContext&lt;/code&gt; and the other proxy classes. It was a useful experiment. It was enough to show the engine running in a phone. The problem is a good part of the Android specific code, in particular the rendering path sending buffers to a &lt;code&gt;SurfaceControl&lt;/code&gt;, was placed in the application side instead of in the platform layer of the engine. Also Android developers had to learn an API that did not look like anything they already had in the platform, it was close to the Linux WPE API.&lt;/p&gt;



&lt;p&gt;Since then we have been implementing &lt;strong&gt;WPEPlatform&lt;/strong&gt;, a new platform abstraction that has been added inside WebKit. It gave us the chance to fix both problems at the same time. During this spring we implemented a proper Android backend on top of it, so now the display system of Android looks like a regular WPE platform to the engine. &lt;code&gt;WPEDisplayAndroid&lt;/code&gt; registers as a display extension point and sets up an &lt;code&gt;AHardwareBuffer&lt;/code&gt; configuration, &lt;code&gt;WPEToplevelAndroid&lt;/code&gt; follows the &lt;code&gt;ANativeWindow&lt;/code&gt; lifecycle from the SurfaceHolder callbacks, &lt;code&gt;WPEViewAndroid&lt;/code&gt; submits the frames with &lt;code&gt;SurfaceTransaction&lt;/code&gt; and explicit sync fences, and &lt;code&gt;WPEScreenSyncObserverAndroid&lt;/code&gt; uses &lt;code&gt;AChoreographer&lt;/code&gt; so the engine renders aligned with vsync. On top of that we added a thin JNI bridge that mirrors the WebKit and &lt;strong&gt;WPEPlatform&lt;/strong&gt; objects in Java, and a new convenience API that looks like &lt;code&gt;android.webkit.WebView&lt;/code&gt;, with &lt;code&gt;WebView&lt;/code&gt;, &lt;code&gt;WebContext&lt;/code&gt;, &lt;code&gt;WebSettings&lt;/code&gt;, &lt;code&gt;CookieManager&lt;/code&gt;, &lt;code&gt;WebViewClient&lt;/code&gt; and &lt;code&gt;WebChromeClient&lt;/code&gt;. This way people can reuse the Android documentation and the knowledge they already have instead of learning something new.&lt;/p&gt;



&lt;p&gt;We ported the tools used to the new API, the MiniBrowser, the media player sample, the instrumented tests and WebDriver. We were able to delete the legacy stack.&lt;/p&gt;



&lt;p&gt;After that, the only thing keeping libwpe in the build was process management: Android cannot simply &lt;code&gt;fork()&lt;/code&gt; and &lt;code&gt;exec()&lt;/code&gt;, since auxiliary processes are Android services that need to be launched explicitly. To solve this, we implemented a &lt;code&gt;WPEProcessManager&lt;/code&gt; API for &lt;strong&gt;WPEPlatform&lt;/strong&gt; inside WebKit, which landed upstream and is now used by the port.&lt;/p&gt;



&lt;p&gt;With that in place, we were able to remove libwpe entirely, and WPE WebKit now talks to Android the same way it talks to any other platform. In parallel, we kept improving other parts of the platform, implementing new API features and fixing bugs along the way. One notable example is a scroll jank issue on the Mali driver, which was resolved largely thanks to the Skia DDL architecture upstream (a story that deserves its own write-up).&lt;/p&gt;



&lt;p&gt;There is still plenty work to do, for our small team this project is still a very valuable experiment and we would like to keep exploring the options.&lt;/p&gt;



&lt;p&gt;The code is here if you want to give it a try or help:&lt;/p&gt;



&lt;p&gt;&lt;a href=&quot;https://github.com/Igalia/wpe-android&quot;&gt;https://github.com/Igalia/wpe-android&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;I will try to write about our work around WebKit and wpe-android in more detail in the next weeks, hopefully the next post will not take another fourteen years &amp;#8230;&lt;/p&gt;



&lt;figure class=&quot;wp-block-image aligncenter size-large is-resized&quot;&gt;&lt;a href=&quot;https://blogs.igalia.com/alex/files/2026/09/wpe-screenshot.png&quot;&gt;&lt;img width=&quot;461&quot; height=&quot;1024&quot; src=&quot;https://blogs.igalia.com/alex/files/2026/09/wpe-screenshot-461x1024.png&quot; alt=&quot;&quot; class=&quot;wp-image-239&quot; /&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;img src=&quot;https://stats.igalia.com/piwik.php?idsite=40&amp;rec=1&amp;url=https%3A%2F%2Fblogs.igalia.com%2Falex%2F2026%2F09%2F11%2Fwpe-webkit-on-android-now-with-wpeplatform%2F%3Fpk_campaign%3Dfeed%26pk_kwd%3Dwpe-webkit-on-android-now-with-wpeplatform&amp;action_name=WPE%20WebKit%20on%20Android%2C%20now%20with%20WPEPlatform&amp;urlref=https%3A%2F%2Fblogs.igalia.com%2Falex%2Ffeed%2F&quot; width=&quot;0&quot; height=&quot;0&quot; alt=&quot;&quot; /&gt;                </content>
		<author>
			<name>alex</name>
			<uri>https://blogs.igalia.com/alex</uri>
		</author>
	</entry>

	<entry>
		<title>Pawel Lampe: Trying WPE Platform API on Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/plampe/trying-wpe-platform-api-on-raspberry-pi/"/>
		<id>https://blogs.igalia.com/plampe/trying-wpe-platform-api-on-raspberry-pi/</id>
		<updated>2026-09-08T00:00:00+00:00</updated>
		<content type="html">
&lt;p&gt;WPE Platform API (also known as &#8220;new API&#8221;) is a redesigned, GObject-based platform-integration layer for WPE WebKit that replaces the older &lt;code&gt;libwpe&lt;/code&gt; backend model. A few months ago, &lt;a href=&quot;https://blogs.igalia.com/klee&quot;&gt;Kate&lt;/a&gt; and
&lt;a href=&quot;https://simonpena.com/&quot;&gt;Simon&lt;/a&gt; published two closely related blog posts about it. The &lt;a href=&quot;https://blogs.igalia.com/klee/building-a-custom-html-context-menu-with-the-new-wpeplatform-api/&quot;&gt;first one&lt;/a&gt; focuses more on the API and browser
implementation details, while the &lt;a href=&quot;https://simonpena.com/blog/2026/03/20/getting-started-with-wpe-webkit/&quot;&gt;second one&lt;/a&gt; focuses more on writing and integrating the browser within Linux distribution.&lt;/p&gt;
&lt;p&gt;This article builds on top of the above ones, and showcases how to build and try a minimal WPE browser using WPE Platform API on &lt;a href=&quot;https://www.raspberrypi.com/&quot;&gt;Raspberry Pi&lt;/a&gt;. Moreover, as the WPE Platform API still evolves to some degree, this article
also explains how to use and stick to the latest WPE WebKit from &lt;code&gt;main&lt;/code&gt; branch. This way one can play with all the latest features straight on embedded hardware.&lt;/p&gt;
&lt;p&gt;Before going further, one should be aware that in case of a simple release build (instead of one using latest &lt;code&gt;main&lt;/code&gt; branch) it&#8217;s better to follow &lt;a href=&quot;https://github.com/Igalia/meta-webkit/wiki/RPi&quot;&gt;official instructions&lt;/a&gt; instead of this article.&lt;/p&gt;
&lt;h2 id=&quot;setup&quot; tabindex=&quot;-1&quot;&gt;Setup &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/plampe/trying-wpe-platform-api-on-raspberry-pi/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This article focuses on a certain setup using &lt;a href=&quot;https://www.raspberrypi.com/products/raspberry-pi-3-model-b/&quot;&gt;Raspberry Pi 3B&lt;/a&gt; but it should be fairly easy to adapt the config to any other Raspberry Pi model.&lt;/p&gt;
&lt;p&gt;As for the work environment: the Linux-based host with ability to run containers was used along with &lt;a href=&quot;https://github.com/Igalia/wkdev-sdk&quot;&gt;WebKit Container SDK&lt;/a&gt;. The SDK version was precisely &lt;code&gt;2.53-v6-d535e88&lt;/code&gt; as it uses
&lt;code&gt;Ubuntu 24.04.4 LTS&lt;/code&gt; that works well with Yocto &lt;code&gt;scarthgap&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The Yocto &lt;code&gt;scarthgap&lt;/code&gt; has been used to increase the chances that the config and commands demonstrated in this article will remain buildable for many years to follow.&lt;/p&gt;
&lt;h2 id=&quot;preparing-the-image&quot; tabindex=&quot;-1&quot;&gt;Preparing the image &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/plampe/trying-wpe-platform-api-on-raspberry-pi/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The preparation of the image starts with a series of commands that create a main directory and clone important Yocto repositories along with some meta layer repositories. At this point already, &lt;strong&gt;it&#8217;s important to have the working directory shared
between host and SDK&lt;/strong&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# host&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token function&quot;&gt;mkdir&lt;/span&gt; wpe-upstream&lt;br /&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; wpe-upstream&lt;br /&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone https://git.yoctoproject.org/git/poky &lt;span class=&quot;token parameter variable&quot;&gt;-b&lt;/span&gt; scarthgap&lt;br /&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone git@github.com:openembedded/meta-openembedded.git &lt;span class=&quot;token parameter variable&quot;&gt;-b&lt;/span&gt; scarthgap&lt;br /&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone https://git.yoctoproject.org/git/meta-raspberrypi &lt;span class=&quot;token parameter variable&quot;&gt;-b&lt;/span&gt; scarthgap&lt;br /&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone https://github.com/Igalia/meta-webkit &lt;span class=&quot;token parameter variable&quot;&gt;-b&lt;/span&gt; scarthgap&lt;br /&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;source&lt;/span&gt; poky/oe-init-build-env build&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once the &lt;code&gt;build&lt;/code&gt; directory is created, it&#8217;s necessary to configure the meta layers in the &lt;code&gt;build/conf/bblayers.conf&lt;/code&gt; file the following way:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# changes incompatibly&lt;/span&gt;&lt;br /&gt;POKY_BBLAYERS_CONF_VERSION &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;2&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;BBPATH &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${TOPDIR}&lt;/span&gt;&quot;&lt;/span&gt;&lt;br /&gt;BSPDIR :&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${@os.path.abspath(os.path.dirname(d.getVar('FILE'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; True)) + '&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;..&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;..')}&lt;/span&gt;&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;BBFILES ?&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;br /&gt;BBLAYERS ?&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot; \&lt;br /&gt;  &lt;span class=&quot;token variable&quot;&gt;${BSPDIR}&lt;/span&gt;/poky/meta \&lt;br /&gt;  &lt;span class=&quot;token variable&quot;&gt;${BSPDIR}&lt;/span&gt;/poky/meta-poky \&lt;br /&gt;  &lt;span class=&quot;token variable&quot;&gt;${BSPDIR}&lt;/span&gt;/poky/meta-yocto-bsp \&lt;br /&gt;  &lt;span class=&quot;token variable&quot;&gt;${BSPDIR}&lt;/span&gt;/meta-openembedded/meta-oe \&lt;br /&gt;  &lt;span class=&quot;token variable&quot;&gt;${BSPDIR}&lt;/span&gt;/meta-openembedded/meta-multimedia \&lt;br /&gt;  &lt;span class=&quot;token variable&quot;&gt;${BSPDIR}&lt;/span&gt;/meta-openembedded/meta-python \&lt;br /&gt;  &lt;span class=&quot;token variable&quot;&gt;${BSPDIR}&lt;/span&gt;/meta-raspberrypi \&lt;br /&gt;  &lt;span class=&quot;token variable&quot;&gt;${BSPDIR}&lt;/span&gt;/meta-webkit \&lt;br /&gt;  &quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With the above, the recipes from the meta layers cloned earlier will be considered by bitbake.&lt;/p&gt;
&lt;p&gt;Next, the most important configuration step is appending the following to &lt;code&gt;build/conf/local.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;MACHINE &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;raspberrypi3-64&quot;&lt;/span&gt; &lt;br /&gt;MACHINE_FEATURES:append &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot; vc4graphics&quot;&lt;/span&gt;&lt;br /&gt;GPU_MEM_256 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;128&quot;&lt;/span&gt;&lt;br /&gt;GPU_MEM_512 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;196&quot;&lt;/span&gt;&lt;br /&gt;GPU_MEM_1024 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;396&quot;&lt;/span&gt;&lt;br /&gt;DISTRO_FEATURES:append &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot; opengl egl wayland&quot;&lt;/span&gt;&lt;br /&gt;EXTRA_IMAGE_FEATURES &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;debug-tweaks&quot;&lt;/span&gt;&lt;br /&gt;IMAGE_FEATURES:append &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot; ssh-server-dropbear hwcodecs&quot;&lt;/span&gt;&lt;br /&gt;IMAGE_INSTALL:append &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot; wpewebkit wpe-browser&quot;&lt;/span&gt;&lt;br /&gt;PREFERRED_VERSION_wpewebkit &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;latest&quot;&lt;/span&gt;&lt;br /&gt;LICENSE_FLAGS_ACCEPTED &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;synaptics-killswitch&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With that, &lt;strong&gt;wpewebkit latest&lt;/strong&gt; will be preferred and installed in the image along with a dummy browser called &lt;strong&gt;wpe-browser&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;To make the &lt;strong&gt;wpewebkit latest&lt;/strong&gt; work, one needs to create &lt;code&gt;meta-webkit/recipes-browser/wpewebkit/wpewebkit_latest.bb&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;SUMMARY &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Lightweight WebKit port for embedded devices with OpenGL-ES acceleration&quot;&lt;/span&gt;&lt;br /&gt;DESCRIPTION &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;WPE WebKit port pairs the WebKit engine with OpenGL-ES (OpenGL for Embedded Systems), \&lt;br /&gt;               allowing embedders to create simple and performant systems based on Web platform technologies. \&lt;br /&gt;               It is designed with hardware acceleration in mind, relying on EGL, and OpenGL ES.&quot;&lt;/span&gt;&lt;br /&gt;HOMEPAGE &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;https://wpewebkit.org/&quot;&lt;/span&gt;&lt;br /&gt;BUGTRACKER &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;https://bugs.webkit.org/&quot;&lt;/span&gt;&lt;br /&gt;LICENSE &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;BSD-2-Clause &amp;amp; LGPL-2.0-or-later&quot;&lt;/span&gt;&lt;br /&gt;LIC_FILES_CHKSUM &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;file://Source/WebCore/LICENSE-LGPL-2.1;md5=a778a33ef338abbaf8b8a7c36b6eec80 &quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;REQUIRED_DISTRO_FEATURES &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;opengl&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;DEPENDS:append &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot; \&lt;br /&gt;    libsoup \&lt;br /&gt;    bison-native gperf-native harfbuzz-native libxml2-native ccache-native ninja-native ruby-native \&lt;br /&gt;    fontconfig freetype glib-2.0 harfbuzz icu jpeg pcre sqlite3 zlib libpng libtasn1 \&lt;br /&gt;    libwebp libxml2 libxslt virtual/egl virtual/libgles2 libepoxy libgcrypt \&lt;br /&gt;    unifdef-native \&lt;br /&gt;&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;inherit cmake features_check pkgconfig perlnative python3native&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt; WK_USE_CCACHE &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;NO&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;PACKAGECONFIG ??&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;accessibility avif dfg-jit gbm gpu-process \&lt;br /&gt;                   jit jpegxl libbacktrace \&lt;br /&gt;                   mediasource mediastream \&lt;br /&gt;                   remote-inspector \&lt;br /&gt;                   sysprof \&lt;br /&gt;                   &lt;span class=&quot;token variable&quot;&gt;${@' system-sysprof' \&lt;br /&gt;                       if bb.utils.contains('BBFILE_COLLECTIONS'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; 'meta-gnome'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; True&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; False&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; d) \&lt;br /&gt;                       else '' }&lt;/span&gt; \&lt;br /&gt;                   unified-builds video webaudio woff2 wpe-platform \&lt;br /&gt;                   &lt;span class=&quot;token variable&quot;&gt;${@bb.utils.contains('DISTRO_FEATURES'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; 'systemd'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; 'journald'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; '' &lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt;d)}&lt;/span&gt; \&lt;br /&gt;                  &quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;reduce-size&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DCMAKE_BUILD_TYPE=MinSizeRel,-DCMAKE_BUILD_TYPE=Release,,&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;release-with-debug-info&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DCMAKE_BUILD_TYPE=RelWithDebInfo,-DCMAKE_BUILD_TYPE=Release,,&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# WPE features&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;accessibility&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DUSE_ATK=ON,-DUSE_ATK=OFF,atk at-spi2-atk&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;avif&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DUSE_AVIF=ON,-DUSE_AVIF=OFF,libavif&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;bubblewrap&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_BUBBLEWRAP_SANDBOX=ON -DBWRAP_EXECUTABLE=&lt;span class=&quot;token variable&quot;&gt;${bindir}&lt;/span&gt;/bwrap -DDBUS_PROXY_EXECUTABLE=&lt;span class=&quot;token variable&quot;&gt;${bindir}&lt;/span&gt;/xdg-dbus-proxy,-DENABLE_BUBBLEWRAP_SANDBOX=OFF,bubblewrap xdg-dbus-proxy libseccomp&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;developer-mode&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DDEVELOPER_MODE=ON,-DDEVELOPER_MODE=OFF,wayland-native wayland-protocols wpebackend-fdo&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;deviceorientation&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_DEVICE_ORIENTATION=ON,-DENABLE_DEVICE_ORIENTATION=OFF,&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;dfg-jit&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_DFG_JIT=ON,-DENABLE_DFG_JIT=OFF,&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;documentation&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_DOCUMENTATION=ON,-DENABLE_DOCUMENTATION=OFF, gi-docgen-native gi-docgen&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;encryptedmedia&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_ENCRYPTED_MEDIA=ON,-DENABLE_ENCRYPTED_MEDIA=OFF,libgcrypt&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;experimental-features&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_EXPERIMENTAL_FEATURES=ON,-DENABLE_EXPERIMENTAL_FEATURES=OFF,libavif libjxl&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;gamepad&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_GAMEPAD=ON,-DENABLE_GAMEPAD=OFF,libmanette&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;gbm&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DUSE_GBM=ON,-DUSE_GBM=OFF,libdrm&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;geolocation&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_GEOLOCATION=ON,-DENABLE_GEOLOCATION=OFF,geoclue&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;gpu-process&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_GPU_PROCESS=ON,-DENABLE_GPU_PROCESS=OFF,&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;hyphen&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DUSE_LIBHYPHEN=ON,-DUSE_LIBHYPHEN=OFF,hyphen&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;introspection&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_INTROSPECTION=ON,-DENABLE_INTROSPECTION=OFF, gobject-introspection-native&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;jit&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_JIT=ON -DENABLE_C_LOOP=OFF,-DENABLE_JIT=OFF -DENABLE_C_LOOP=ON,&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;jpegxl&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DUSE_JPEGXL=ON,-DUSE_JPEGXL=OFF,libjxl&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;journald&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_JOURNALD_LOG=ON,-DENABLE_JOURNALD_LOG=OFF,&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;lcms&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DUSE_LCMS=ON,-DUSE_LCMS=OFF,&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;spellcheck&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_SPELLCHECK=ON,-DENABLE_SPELLCHECK=OFF,enchant&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;wpe-legacy-api&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_WPE_LEGACY_API=ON,-DENABLE_WPE_LEGACY_API=OFF,libwpe virtual/wpebackend,&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;libbacktrace&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DUSE_LIBBACKTRACE=ON,-DUSE_LIBBACKTRACE=OFF,libbacktrace&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;minibrowser&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_MINIBROWSER=ON,-DENABLE_MINIBROWSER=OFF,wayland-native wayland-protocols wpebackend-fdo&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;mediasource&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_MEDIA_SOURCE=ON,-DENABLE_MEDIA_SOURCE=OFF,gstreamer1.0 gstreamer1.0-plugins-good&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;mediastream&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_MEDIA_STREAM=ON,-DENABLE_MEDIA_STREAM=OFF,gstreamer1.0 gstreamer1.0-plugins-bad&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;pdfjs&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_PDFJS=ON,-DENABLE_PDFJS=OFF,&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;speech-synthesis&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_SPEECH_SYNTHESIS=ON,-DENABLE_SPEECH_SYNTHESIS=OFF,flite&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;sysprof&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DUSE_SYSPROF_CAPTURE=ON, -DUSE_SYSPROF_CAPTURE=OFF,&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;system-sysprof&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DUSE_SYSTEM_SYSPROF_CAPTURE=ON, -DUSE_SYSTEM_SYSPROF_CAPTURE=OFF, sysprof&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;video&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_VIDEO=ON,-DENABLE_VIDEO=OFF,gstreamer1.0 gstreamer1.0-plugins-base&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;webaudio&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_WEB_AUDIO=ON,-DENABLE_WEB_AUDIO=OFF,gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;woff2&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DUSE_WOFF2=ON,-DUSE_WOFF2=OFF,woff2&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;remote-inspector&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_REMOTE_INSPECTOR=ON,-DENABLE_REMOTE_INSPECTOR=OFF,&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;webrtc&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_WEB_RTC=ON,-DENABLE_WEB_RTC=OFF,libvpx libevent libopus openh264&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;qtwpe&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_WPE_QT_API=ON &lt;span class=&quot;token variable&quot;&gt;${CMAKE_QT_OECONF}&lt;/span&gt;,-DENABLE_WPE_QT_API=OFF,qtbase-native qtbase qtdeclarative libepoxy wpebackend-fdo &lt;span class=&quot;token variable&quot;&gt;${QT_BUILD_DEPS}&lt;/span&gt;&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;unified-builds&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_UNIFIED_BUILDS=ON,-DENABLE_UNIFIED_BUILDS=OFF,&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;thunder&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_THUNDER=ON,-DENABLE_THUNDER=OFF,virtual/open-cdm&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;webxr&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_WEBXR=ON,-DENABLE_WEBXR=OFF,openxr&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# Build option for WPE API 1.1&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;wpe-1-1-api&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_WPE_1_1_API:BOOL=ON,-DENABLE_WPE_1_1_API:BOOL=OFF,&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# Build option for WPE platform API&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;wpe-platform&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-DENABLE_WPE_PLATFORM=ON,-DENABLE_WPE_PLATFORM=OFF,libinput libxkbcommon wayland-native&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;EXTRA_OECMAKE &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot; -DPORT=WPE -G Ninja&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# TODO: documentation and introspection are disabled by default because the are&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# causing cross-compiling build errors&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# PACKAGECONFIG:append = &quot; ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'documentation', '' ,d)} introspection&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# If SSE code compiles, assume it runs successfully (it can't actually run&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# because of cross compiling)&lt;/span&gt;&lt;br /&gt;EXTRA_OECMAKE:append:x86 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot; -DHAVE_SSE2_EXTENSIONS_EXITCODE=0&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# Javascript JIT is not supported on ppc/arm/RISCV32/mips64&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG:remove:powerpc &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;jit&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG:remove:powerpc64 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;jit&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG:remove:powerpc64le &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;jit&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG:remove:armv4 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;jit&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG:remove:armv5 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;jit&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG:remove:armv6 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;jit&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG:remove:armv7a &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;jit&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG:remove:armv7ve &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;jit&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG:remove:riscv32 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;jit&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG:remove:riscv64 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;jit&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG:remove:mipsarchn64 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;jit&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG:remove:mipsarchn32 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;jit&quot;&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG:remove:loongarch64 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;jit&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# Javascript JIT is not supported on x86&lt;/span&gt;&lt;br /&gt;PACKAGECONFIG:remove:x86 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;jit&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;LDFLAGS:append:riscv64 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot; -pthread&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;FULL_OPTIMIZATION:remove &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-g&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;LEAD_SONAME &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;libWPEWebKit.so&quot;&lt;/span&gt;&lt;br /&gt;PACKAGES &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;+ &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${PN}&lt;/span&gt;-web-inspector-plugin &lt;span class=&quot;token variable&quot;&gt;${PN}&lt;/span&gt;-qtwpe-qml-plugin&quot;&lt;/span&gt;&lt;br /&gt;FILES:&lt;span class=&quot;token variable&quot;&gt;${PN}&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${libdir}&lt;/span&gt;/wpe-webkit*/injected-bundle/libWPEInjectedBundle.so&quot;&lt;/span&gt;&lt;br /&gt;FILES:&lt;span class=&quot;token variable&quot;&gt;${PN}&lt;/span&gt;-web-inspector-plugin &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${datadir}&lt;/span&gt;/wpe-webkit-*/inspector.gresource&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# nooelint: oelint.vars.insaneskip - ignored for convenience. We need to recheck if problem persist&lt;/span&gt;&lt;br /&gt;INSANE_SKIP:&lt;span class=&quot;token variable&quot;&gt;${PN}&lt;/span&gt;-web-inspector-plugin &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;dev-so&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# nooelint: oelint.vars.insaneskip - ignored for convenience. We need to recheck if problem persist&lt;/span&gt;&lt;br /&gt;INSANE_SKIP:&lt;span class=&quot;token variable&quot;&gt;${PN}&lt;/span&gt;-qtwpe-qml-plugin &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;dev-so&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# JSC JIT on ARMv7 is better supported with Thumb2 instruction set.&lt;/span&gt;&lt;br /&gt;ARM_INSTRUCTION_SET:armv7a &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;thumb&quot;&lt;/span&gt;&lt;br /&gt;ARM_INSTRUCTION_SET:armv7r &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;thumb&quot;&lt;/span&gt;&lt;br /&gt;ARM_INSTRUCTION_SET:armv7m &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;thumb&quot;&lt;/span&gt;&lt;br /&gt;ARM_INSTRUCTION_SET:armv7ve &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;thumb&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# Extra runtime depends&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# nooelint: oelint.vars.dependsordered - ignored for convenience&lt;/span&gt;&lt;br /&gt;RDEPENDS:&lt;span class=&quot;token variable&quot;&gt;${PN}&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;\&lt;br /&gt;    &lt;span class=&quot;token variable&quot;&gt;${@bb.utils.contains('PACKAGECONFIG'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; 'remote-inspector'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; '${PN}&lt;/span&gt;-web-inspector-plugin', '', d)} \&lt;br /&gt;    &lt;span class=&quot;token variable&quot;&gt;${@bb.utils.contains('PACKAGECONFIG'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; 'gst_gl'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; 'gstreamer1.0-plugins-base-opengl'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; ''&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; d)}&lt;/span&gt; \&lt;br /&gt;    &lt;span class=&quot;token variable&quot;&gt;${@bb.utils.contains('PACKAGECONFIG'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; 'mediasource'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; 'gstreamer1.0-plugins-good-isomp4'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; ''&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; d)}&lt;/span&gt; \&lt;br /&gt;    &lt;span class=&quot;token variable&quot;&gt;${@bb.utils.contains('PACKAGECONFIG'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; 'webaudio'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; 'gstreamer1.0-plugins-good-wavparse'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; ''&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; d)}&lt;/span&gt; \&lt;br /&gt;    &lt;span class=&quot;token variable&quot;&gt;${@bb.utils.contains('PACKAGECONFIG'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; 'video'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; 'gstreamer1.0-plugins-base-app \&lt;br /&gt;                                                    gstreamer1.0-plugins-base-audioconvert \&lt;br /&gt;                                                    gstreamer1.0-plugins-base-audioresample \&lt;br /&gt;                                                    gstreamer1.0-plugins-base-gio \&lt;br /&gt;                                                    gstreamer1.0-plugins-base-playback \&lt;br /&gt;                                                    gstreamer1.0-plugins-base-typefindfunctions \&lt;br /&gt;                                                    gstreamer1.0-plugins-base-videoconvertscale \&lt;br /&gt;                                                    gstreamer1.0-plugins-base-volume \&lt;br /&gt;                                                    gstreamer1.0-plugins-good-audiofx \&lt;br /&gt;                                                    gstreamer1.0-plugins-good-audioparsers \&lt;br /&gt;                                                    gstreamer1.0-plugins-good-autodetect \&lt;br /&gt;                                                    gstreamer1.0-plugins-good-avi \&lt;br /&gt;                                                    gstreamer1.0-plugins-good-deinterlace \&lt;br /&gt;                                                    gstreamer1.0-plugins-good-interleave \&lt;br /&gt;                                                    '&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; ''&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; d)}&lt;/span&gt; \&lt;br /&gt;    libgles2 \&lt;br /&gt;&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;RDEPENDS:&lt;span class=&quot;token variable&quot;&gt;${PN}&lt;/span&gt;-web-inspector-plugin &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;\&lt;br /&gt;    shared-mime-info \&lt;br /&gt;&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# Extra runtime recommends&lt;/span&gt;&lt;br /&gt;RRECOMMENDS:&lt;span class=&quot;token variable&quot;&gt;${PN}&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;\&lt;br /&gt;    ca-certificates \&lt;br /&gt;    ttf-dejavu-sans \&lt;br /&gt;    ttf-dejavu-sans-mono \&lt;br /&gt;    ttf-dejavu-serif \&lt;br /&gt;    &lt;span class=&quot;token variable&quot;&gt;${PN}&lt;/span&gt;-qtwpe-qml-plugin \&lt;br /&gt;    &lt;span class=&quot;token variable&quot;&gt;${@bb.utils.contains('PACKAGECONFIG'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; 'video'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; 'gstreamer1.0-plugins-base-meta gstreamer1.0-plugins-good-meta gstreamer1.0-plugins-bad-meta'&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; ''&lt;span class=&quot;token operator&quot;&gt;,&lt;/span&gt; d)}&lt;/span&gt; \&lt;br /&gt;&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;DEFAULT_PREFERENCE &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;FILESEXTRAPATHS:prepend :&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${THISDIR}&lt;/span&gt;/&lt;span class=&quot;token variable&quot;&gt;${PN}&lt;/span&gt;:&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# https://commits.webkit.org/319279@main&lt;/span&gt;&lt;br /&gt;PR &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;r319279&quot;&lt;/span&gt;&lt;br /&gt;SRCREV &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;93472ec12ee947b30c7ec3c176ca0e2fb6ba6ace&quot;&lt;/span&gt;&lt;br /&gt;SRC_URI &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;git://github.com/WebKit/WebKit.git;protocol=https;branch=main \&lt;br /&gt;           file://0001-libpas-Only-include-stdatomic.h-when-compiling-with.patch \&lt;br /&gt;           file://0002-WebDriver-Guard-LOG_CHANNEL-check-with-LOG_DISABLED.patch \&lt;br /&gt;           &quot;&lt;/span&gt;&lt;br /&gt;S &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${WORKDIR}&lt;/span&gt;/git&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This file is self-contained on purpose; the idea is not to rely on any includes so that unpredictable behavior doesn&#8217;t happen in the future.&lt;/p&gt;
&lt;p&gt;While the above file contains a lot of interesting details, the most interesting practical part is the last few lines. The &lt;code&gt;SRCREV&lt;/code&gt; is set to point to the latest commit from the &lt;a href=&quot;https://github.com/WebKit/WebKit&quot;&gt;WebKit&lt;/a&gt; &lt;code&gt;main&lt;/code&gt; branch (at the time
of writing). Along with that comes &lt;code&gt;SRC_URI&lt;/code&gt; that specifies two patches required to make WPE WebKit compile.&lt;/p&gt;
&lt;p&gt;The problem with the patches is that advancing &lt;code&gt;SRCREV&lt;/code&gt; will likely make them unusable due to merge conflicts. Therefore, when advancing the revision, it&#8217;s recommended to remove patches from &lt;code&gt;SRC_URI&lt;/code&gt; and face the compilation problems from scratch as
it&#8217;s very likely there will be new compilation problems anyway. Fortunately, nowadays LLMs can be used to fix any compilation problems by preparing custom patches just like the below ones (created by LLM as well). For example, most of the modern
models should manage to prepare proper patches just by pointing them to the above recipe and the &lt;code&gt;temp&lt;/code&gt; directory with the latest logs from build commands.&lt;/p&gt;
&lt;p&gt;Assuming one uses the &lt;code&gt;wpewebkit_latest.bb&lt;/code&gt; above, the first patch needs to be created in: &lt;code&gt;meta-webkit/recipes-browser/wpewebkit/wpewebkit/0001-libpas-Only-include-stdatomic.h-when-compiling-with.patch&lt;/code&gt; with the following content:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Pawel Lampe &amp;lt;plampe@igalia.com&amp;gt;
Date: Mon, 17 Aug 2026 00:00:00 +0000
Subject: [PATCH] [libpas] Only include stdatomic.h when compiling with Clang

Some libpas .c files (e.g. jit_heap.c) are compiled as C++ via
set_source_files_properties(... PROPERTIES LANGUAGE CXX) in
Source/bmalloc/CMakeLists.txt, for TZone heap support. pas_utils.h
unconditionally does `#include &amp;lt;stdatomic.h&amp;gt;`, but GCC's own
&amp;lt;stdatomic.h&amp;gt; relies on the C11-only `_Atomic` keyword and has no
support for being included from C++ translation units (this was only
addressed in much newer GCC releases). Compiling any of the
CXX-tagged libpas .c files with GCC 13 therefore fails with:

    error: '_Atomic' does not name a type

The header is only actually needed here for the Clang-specific
__c11_atomic_* intrinsics guarded by `#elif PAS_COMPILER(CLANG)`
further down in this file; the non-Clang (GCC) path uses the
__atomic_* builtins instead and does not need any of the types or
macros from &amp;lt;stdatomic.h&amp;gt;. Guard the include accordingly so GCC
builds (both plain C and the CXX-tagged libpas sources) are
unaffected by GCC's non-C++-aware &amp;lt;stdatomic.h&amp;gt;.

Upstream-Status: Pending
Signed-off-by: Pawel Lampe &amp;lt;plampe@igalia.com&amp;gt;
---
 Source/bmalloc/libpas/src/libpas/pas_utils.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Source/bmalloc/libpas/src/libpas/pas_utils.h b/Source/bmalloc/libpas/src/libpas/pas_utils.h
index 962634080930..9b98fda54f43 100644
--- a/Source/bmalloc/libpas/src/libpas/pas_utils.h
+++ b/Source/bmalloc/libpas/src/libpas/pas_utils.h
@@ -42,7 +42,15 @@
 #endif
 
 #include &amp;lt;limits.h&amp;gt;
+#if PAS_COMPILER(CLANG)
+/* GCC's &amp;lt;stdatomic.h&amp;gt; relies on the C-only _Atomic keyword and is not
+ * usable when this header is included from a translation unit compiled
+ * as C++ (some libpas .c files are compiled as C++, see bmalloc's
+ * CMakeLists.txt). It is only needed here for the Clang-specific
+ * __c11_atomic_* intrinsics below; the GCC path uses __atomic_* builtins
+ * instead. */
 #include &amp;lt;stdatomic.h&amp;gt;
+#endif
 #include &amp;lt;stdbool.h&amp;gt;
 #include &amp;lt;stdint.h&amp;gt;
 #include &amp;lt;string.h&amp;gt;
--
2.43.0


&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The second patch should be: &lt;code&gt;meta-webkit/recipes-browser/wpewebkit/wpewebkit/0002-WebDriver-Guard-LOG_CHANNEL-check-with-LOG_DISABLED.patch&lt;/code&gt; with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Pawel Lampe &amp;lt;plampe@igalia.com&amp;gt;
Date: Mon, 17 Aug 2026 00:00:00 +0000
Subject: [PATCH] [WebDriver] Guard LOG_CHANNEL check with
 LOG_DISABLED/RELEASE_LOG_DISABLED

WebDriverService::handleRequest() unconditionally checks
LOG_CHANNEL(WebDriverClassic).state to decide whether it is worth
building the request/response log strings. However,
Source/WebDriver/Logging.h only declares the WebDriverClassic (and
other WebDriver) log channels inside:

    #if !LOG_DISABLED || !RELEASE_LOG_DISABLED

On a release build (NDEBUG, so LOG_DISABLED is true) without journald
support and without OS_LOG/Android (so RELEASE_LOG_DISABLED is also
true) - the common configuration for an embedded Linux build without
the &amp;quot;journald&amp;quot; PACKAGECONFIG - that guard is false, so the channel is
never declared, and this direct, unguarded use of LOG_CHANNEL() fails
to compile:

    error: 'LOG_CHANNEL_PREFIXWebDriverClassic' was not declared in this scope

RELEASE_LOG_INFO() itself already collapses to a no-op in that
configuration (see wtf/Assertions.h), so guard this manual
LOG_CHANNEL() state check with the same condition used to declare the
channel in Logging.h.

Upstream-Status: Pending
Signed-off-by: Pawel Lampe &amp;lt;plampe@igalia.com&amp;gt;
---
 Source/WebDriver/WebDriverService.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Source/WebDriver/WebDriverService.cpp b/Source/WebDriver/WebDriverService.cpp
index 07ae385f33f4..2612d239a611 100644
--- a/Source/WebDriver/WebDriverService.cpp
+++ b/Source/WebDriver/WebDriverService.cpp
@@ -381,6 +381,7 @@ bool WebDriverService::findCommand(HTTPMethod method, const String&amp;amp; path, Comman
 void WebDriverService::handleRequest(HTTPRequestHandler::Request&amp;amp;&amp;amp; request, Function&amp;lt;void (HTTPRequestHandler::Response&amp;amp;&amp;amp;)&amp;gt;&amp;amp;&amp;amp; replyHandler)
 {
     Function&amp;lt;void (HTTPRequestHandler::Response&amp;amp;&amp;amp;)&amp;gt; actualReplyHandler = WTF::move(replyHandler);
+#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
     if (LOG_CHANNEL(WebDriverClassic).state != WTFLogChannelState::Off) {
         RELEASE_LOG_INFO(WebDriverClassic, &amp;quot;HTTP request %s %s (body=%zu bytes)&amp;quot;, request.method.utf8().data(), request.path.utf8().data(), request.dataLength);
         actualReplyHandler = [startTime = MonotonicTime::now(), replyHandler = WTF::move(actualReplyHandler)](HTTPRequestHandler::Response&amp;amp;&amp;amp; response) mutable {
@@ -388,6 +389,7 @@ void WebDriverService::handleRequest(HTTPRequestHandler::Request&amp;amp;&amp;amp; request, Func
             replyHandler(WTF::move(response));
         };
     }
+#endif
 
     auto method = toCommandHTTPMethod(request.method);
     if (!method) {
--
2.43.0

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once the patches are added, &lt;strong&gt;wpewebkit latest&lt;/strong&gt; should build correctly. However, to make use of it one needs a browser.&lt;/p&gt;
&lt;p&gt;To demonstrate how easy the browser for WPE WebKit with Platform API can be, a very minimalistic one will be prepared below.&lt;/p&gt;
&lt;p&gt;The first step is to create a directory:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;mkdir&lt;/span&gt; meta-webkit/recipes-browser/wpe-browser/&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then a file: &lt;code&gt;meta-webkit/recipes-browser/wpe-browser/main.cpp&lt;/code&gt; that implements the whole browser:&lt;/p&gt;
&lt;pre class=&quot;language-cpp&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-cpp&quot;&gt;&lt;span class=&quot;token macro property&quot;&gt;&lt;span class=&quot;token directive-hash&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;token directive keyword&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&amp;lt;wpe/webkit.h&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;int&lt;/span&gt; argc&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;argv&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token function&quot;&gt;g_autoptr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;GMainLoop&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; loop &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;g_main_loop_new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;nullptr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token function&quot;&gt;g_autoptr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;WebKitWebView&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; view &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;WEBKIT_WEB_VIEW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;g_object_new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;WEBKIT_TYPE_WEB_VIEW&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;token keyword&quot;&gt;nullptr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token function&quot;&gt;webkit_web_view_load_uri&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;view&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;argc &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; argv&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;https://wpewebkit.org&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token function&quot;&gt;g_main_loop_run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;loop&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; EXIT_SUCCESS&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then a file: &lt;code&gt;meta-webkit/recipes-browser/wpe-browser/CMakeLists.txt&lt;/code&gt; that describes how to build it:&lt;/p&gt;
&lt;pre class=&quot;language-cmake&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-cmake&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;cmake_minimum_required&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;VERSION&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3.16&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;project&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;wpe-browser CXX&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;CMAKE_CXX_STANDARD&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;GNUInstallDirs&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;find_package&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PkgConfig REQUIRED&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# The Wayland WPE Platform already depends on wpe-platform-2.0&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token function&quot;&gt;pkg_check_modules&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;WebKitDeps REQUIRED&lt;br /&gt;    IMPORTED_TARGET&lt;br /&gt;    wpe-webkit-&lt;span class=&quot;token number&quot;&gt;2.0&lt;/span&gt;&lt;br /&gt;    wpe-platform-wayland-&lt;span class=&quot;token number&quot;&gt;2.0&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;add_executable&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;wpe-browser main.cpp&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;target_link_libraries&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;wpe-browser&lt;br /&gt;    &lt;span class=&quot;token namespace&quot;&gt;PRIVATE&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;token inserted class-name&quot;&gt;PkgConfig::WebKitDeps&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token keyword&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;TARGETS wpe-browser RUNTIME DESTINATION &lt;span class=&quot;token punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;CMAKE_INSTALL_BINDIR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and finally a recipe file: &lt;code&gt;meta-webkit/recipes-browser/wpe-browser/wpe-browser_1.0.bb&lt;/code&gt; that allows bitbake to build the browser and install it in the image:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;SUMMARY &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Minimal WPE WebKit browser launcher&quot;&lt;/span&gt;&lt;br /&gt;DESCRIPTION &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;A minimal launcher built on the WPE Platform API, displaying \&lt;br /&gt;               a URL given as its only argument (defaults to https://wpewebkit.org). \&lt;br /&gt;               Based on https://simonpena.com/blog/2026/03/20/getting-started-with-wpe-webkit/&quot;&lt;/span&gt;&lt;br /&gt;HOMEPAGE &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;https://simonpena.com/blog/2026/03/20/getting-started-with-wpe-webkit/&quot;&lt;/span&gt;&lt;br /&gt;LICENSE &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;MIT&quot;&lt;/span&gt;&lt;br /&gt;LIC_FILES_CHKSUM &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;file://&lt;span class=&quot;token variable&quot;&gt;${COMMON_LICENSE_DIR}&lt;/span&gt;/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;FILESEXTRAPATHS:prepend :&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${THISDIR}&lt;/span&gt;:&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SRC_URI &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;file://main.cpp \&lt;br /&gt;           file://CMakeLists.txt \&lt;br /&gt;          &quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;S &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&lt;span class=&quot;token variable&quot;&gt;${WORKDIR}&lt;/span&gt;&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;DEPENDS &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;wpewebkit&quot;&lt;/span&gt;&lt;br /&gt;RDEPENDS:&lt;span class=&quot;token variable&quot;&gt;${PN}&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;wpewebkit&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;inherit cmake pkgconfig features_check&lt;br /&gt;&lt;br /&gt;REQUIRED_DISTRO_FEATURES &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;opengl wayland&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After all those steps, everything is ready to perform a build. This time the commands are executed in the &lt;strong&gt;SDK&lt;/strong&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;source&lt;/span&gt; poky/oe-init-build-env build&lt;br /&gt;bitbake core-image-weston&lt;br /&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; tmp/deploy/images/raspberrypi3-64/&lt;br /&gt;&lt;span class=&quot;token comment&quot;&gt;# flash to SD card based on preference&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;trying-the-image&quot; tabindex=&quot;-1&quot;&gt;Trying the image &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/plampe/trying-wpe-platform-api-on-raspberry-pi/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Once the image is built and flashed to SD card, and the SD card has been used to boot the Raspberry Pi, one can SSH into it, basically by:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;ssh&lt;/span&gt; root@&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;IP&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then, the browser should work out of the box. The first command to try is the one that doesn&#8217;t need the network and therefore is the simplest:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;&lt;span class=&quot;token environment constant&quot;&gt;XDG_RUNTIME_DIR&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;/run/user/1000 &lt;span class=&quot;token assign-left variable&quot;&gt;WAYLAND_DISPLAY&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;wayland-1 wpe-browser &lt;span class=&quot;token string&quot;&gt;'webkit://gpu/stdout'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If the network is available, it&#8217;s worth starting simple and loading some HTTP page:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;&lt;span class=&quot;token environment constant&quot;&gt;XDG_RUNTIME_DIR&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;/run/user/1000 &lt;span class=&quot;token assign-left variable&quot;&gt;WAYLAND_DISPLAY&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;wayland-1 wpe-browser &lt;span class=&quot;token string&quot;&gt;'http://info.cern.ch'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If that works as well, one can try the HTTPS one:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;&lt;span class=&quot;token environment constant&quot;&gt;XDG_RUNTIME_DIR&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;/run/user/1000 &lt;span class=&quot;token assign-left variable&quot;&gt;WAYLAND_DISPLAY&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;wayland-1 wpe-browser &lt;span class=&quot;token string&quot;&gt;'https://igalia.com'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If there&#8217;s an issue with certificates, it&#8217;s likely due to broken date/time, so the correct one needs to be set using a command like:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;date&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-s&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;'2026-09-02 22:34:56'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;conclusions&quot; tabindex=&quot;-1&quot;&gt;Conclusions &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/plampe/trying-wpe-platform-api-on-raspberry-pi/&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Since the Platform API is the future of WPE, it&#8217;s worth using it already. As the above sections demonstrate, it hasn&#8217;t ever been easier to create a WPE-powered browser for embedded hardware. Moreover, nowadays as LLMs are at play,
using latest sources from &lt;code&gt;main&lt;/code&gt; branch and quickly patching on demand is a possibility worth utilizing. With that, a broad sea of experimenting possibilities becomes wide open. However, it must not be forgotten that while &lt;code&gt;main&lt;/code&gt; branch
is great for testing new web platform features implemented in WebKit, it&#8217;s not necessarily ideal for testing performance. In such case, it&#8217;s better to rely on releases and proper browser engine fine tuning for particular hardware one
plays with.&lt;/p&gt;                </content>
		<author>
			<name>Pawel Lampe</name>
			<uri>https://blogs.igalia.com/plampe/</uri>
		</author>
	</entry>

	<entry>
		<title>Igalia WebKit Team: WebKit Igalia Periodical #76</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/webkit/blog/2026/wip-76/"/>
		<id>https://blogs.igalia.com/webkit/blog/2026/wip-76/</id>
		<updated>2026-09-07T23:43:23+00:00</updated>
		<content type="html">
&lt;p&gt;Update on what happened in WebKit in the week from August 31 to September 7.&lt;/p&gt;
&lt;p&gt;
This was another week focused on ironing out graphics issues in preparation
for the upcoming 2.54.x release series. Did we say release? Here we have
another set of packaged release candidates as well!
&lt;/p&gt;
&lt;h2 id=&quot;cross-port-cat&quot;&gt;Cross-Port &#128049;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;The &#8220;paint flushing&#8221; feature of the Web Inspector that shows the areas of the
layers that were painted &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320494@main&quot;&gt;is now
available&lt;/a&gt;. On the other hand, setting
&lt;code&gt;WEBKIT_SHOW_DAMAGE=1&lt;/code&gt; in the environment will show the areas of the window
that were rendered. For example, if the page is scrolled a little, the whole
window is rendered, but no layer has to be repainted.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;graphics-frame-photo&quot;&gt;Graphics &#128444;&#65039;&lt;/h3&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Fixed &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320490@main&quot;&gt;visible pixel snapping&lt;/a&gt; in the
GTK and WPE ports' Skia compositor by choosing linear instead of
nearest-neighbor sampling for backing store tiles whenever a layer's transform
no longer maps tile pixels onto screen pixels 1:1, matching what the Texture
Mapper backend already got from its always-linear OpenGL code path.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320607@main&quot;&gt;Fixed&lt;/a&gt; a clipping bug in the
Skia-based compositor that caused layers with &lt;code&gt;overflow: hidden&lt;/code&gt; set to
not clip blur and box-shadow filter outsets.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320398@main&quot;&gt;Fixed a repaint bug&lt;/a&gt; where content
changing behind an element with a software-rendered filter such as &lt;code&gt;blur()&lt;/code&gt;
could leave stale pixels on screen, as with the glow effect that YouTube draws
around videos in dark/ambient mode. The fix restores proper tracking of which
layers act as the repaint container for a pixel-moving filter, so the repaint
area is expanded correctly again on WPE, GTK and macOS.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;A &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320612@main&quot;&gt;few&lt;/a&gt;
&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320617@main&quot;&gt;problems&lt;/a&gt; with Offscreen Canvas have
been fixed.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;releases-package&quot;&gt;Releases &#128230;&#65039;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Release candidates &lt;a rel=&quot;external&quot; href=&quot;https://webkitgtk.org/2026/09/02/webkitgtk2.53.92-released.html&quot;&gt;WebKitGTK
2.53.92&lt;/a&gt; and
&lt;a rel=&quot;external&quot; href=&quot;https://wpewebkit.org/release/wpewebkit-2.53.92.html&quot;&gt;WPE WebKit 2.53.92&lt;/a&gt; have
been published, and they include polishing and a number of fixes that ensure
that there will not be noticeable regressions brought in by the new Skia-based
compositor and the damage tracking support&#8212;two of the main features of the
upcoming stable release series. As the stable release dates approaches, we
encourage people who try these preview versions to &lt;a rel=&quot;external&quot; href=&quot;https://bugs.webkit.org/&quot;&gt;report issues in
Bugzilla&lt;/a&gt;.&lt;/p&gt;
  &lt;/div&gt;
&lt;div class=&quot;wip-end&quot;&gt;
&lt;p&gt;That&#8217;s all for this week!&lt;/p&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Igalia WebKit Team</name>
			<uri>https://blogs.igalia.com/webkit</uri>
		</author>
	</entry>

	<entry>
		<title>Miyoung Shin: Extension Migration Progress Update &#8211; Part 2</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/mshin/2026/09/07/extension-migration-progress-update-part-2/?pk_campaign=feed&amp;pk_kwd=extension-migration-progress-update-part-2"/>
		<id>https://blogs.igalia.com/mshin/?p=171</id>
		<updated>2026-09-07T05:52:51+00:00</updated>
		<content type="html">
&lt;p&gt;This post walks through the process of bringing back an extension-focused &lt;code&gt;//extensions/shell&lt;/code&gt; in Chromium and enabling the &lt;strong&gt;&#8220;Add to Chrome&#8221;&lt;/strong&gt; button on the Chrome Web Store.&lt;/p&gt;



&lt;p&gt;If you haven&#8217;t read it yet, I recommend starting with &lt;strong&gt;&lt;a href=&quot;https://blogs.igalia.com/mshin/2026/04/02/extension-migration-progress-update-part-1/&quot;&gt;Extension Migration Progress Update &#8211; Part 1&lt;/a&gt;&lt;/strong&gt;, where I described the initial stage of migrating extension installation formats and APIs out of the &lt;code&gt;//chrome&lt;/code&gt; layer.&lt;/p&gt;



&lt;p&gt;After migrating the extension installation formats &#8212; CRX, ZIP, and Unpacked &#8212; into the &lt;code&gt;//extensions&lt;/code&gt; layer, the next natural step was to enable embedders to install extensions directly from the Chrome Web Store.&lt;/p&gt;



&lt;p&gt;To achieve this, the &lt;strong&gt;Web Store Private APIs&lt;/strong&gt; were an essential piece of the puzzle.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Migrating Web Store Private APIs&lt;/h2&gt;



&lt;p&gt;The Web Store Private APIs had a relatively large dependency on &lt;code&gt;//chrome&lt;/code&gt;. We started by migrating the relevant files and gradually replacing Chrome-specific dependencies with alternative implementations where necessary.&lt;/p&gt;



&lt;p&gt;In some cases, this meant introducing new interfaces, while in others it meant moving code to a more appropriate layer.&lt;/p&gt;



&lt;p&gt;After working through these dependencies, the final changes were eventually landed upstream: &lt;a href=&quot;https://source.chromium.org/chromium/chromium/src/+/599148a4fd877e26351c56b567a4a325375bf493?utm_source=chatgpt.com&quot;&gt;Chromium CL &#8211; Web Store Private API migration&lt;/a&gt;.&lt;/p&gt;



&lt;p&gt;The changes are included in &lt;strong&gt;M152&lt;/strong&gt;.&lt;/p&gt;



&lt;p&gt;However, after this migration was completed, we encountered an unexpected obstacle.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Where did &lt;code&gt;extensions/shell&lt;/code&gt; go?&lt;/h2&gt;



&lt;p&gt;Chromium originally had a lightweight embedder called &lt;code&gt;//extensions/shell&lt;/code&gt;, previously built as the &lt;code&gt;app_shell&lt;/code&gt; target.&lt;/p&gt;



&lt;p&gt;The idea was simple: provide an environment where extensions could be installed and run without bringing up the entire Chrome browser.&lt;/p&gt;



&lt;p&gt;However, the shell had originally been created about a decade ago for a different purpose. It was intended to provide an independent environment for ChromeOS platform applications without requiring the full Chrome browser.&lt;/p&gt;



&lt;p&gt;Platform apps were eventually deprecated, and the shell was later repurposed primarily as a lightweight environment for extension browser tests.&lt;/p&gt;



&lt;p&gt;Over time, the extension browser tests were moved into the &lt;code&gt;//chrome&lt;/code&gt; layer. The shell was no longer used by any real product, and maintaining it became technical debt. As a result, &lt;code&gt;app_shell&lt;/code&gt; was eventually removed upstream.&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;Why were the browser tests moved from &lt;code&gt;//extensions&lt;/code&gt; to &lt;code&gt;//chrome&lt;/code&gt;?&lt;/h3&gt;



&lt;p&gt;I asked an Extension owner about the reasoning behind this change.&lt;/p&gt;



&lt;p&gt;The key point was that the old shell-based browser tests did not provide a sufficiently realistic environment for testing extensions.&lt;/p&gt;



&lt;p&gt;There were two major problems.&lt;/p&gt;



&lt;p&gt;First, many extension APIs delegate part of their implementation to the embedder through interfaces such as &lt;code&gt;ExtensionsApiClient&lt;/code&gt;. Testing only the &lt;code&gt;//extensions&lt;/code&gt; implementation with the shell meant that the actual embedding logic was not exercised. Bugs in the delegated implementation could therefore go unnoticed.&lt;/p&gt;



&lt;p&gt;Second, extensions depend on much more than the &lt;code&gt;//extensions&lt;/code&gt; layer itself. UI, networking, rendering, process management, and other browser functionality all affect how extensions behave. The &lt;code&gt;//chrome&lt;/code&gt; layer provides an important part of that environment.&lt;/p&gt;



&lt;p&gt;Therefore, the upstream direction was to move extension browser tests into the real Chrome browser environment rather than maintaining a separate shell.&lt;/p&gt;



&lt;p&gt;That reasoning makes sense for &lt;strong&gt;testing&lt;/strong&gt;.&lt;/p&gt;



&lt;p&gt;In fact, we agreed that bringing the old shell back simply as a test environment would not be the right approach.&lt;/p&gt;



&lt;p&gt;&lt;/p&gt;



&lt;p&gt;But I had a different question:&lt;/p&gt;



&lt;blockquote class=&quot;wp-block-quote is-layout-flow wp-block-quote-is-layout-flow&quot;&gt;
&lt;p&gt;What if we use a lightweight shell not as a test environment, but as a reference implementation and a demo environment for embedders?&lt;/p&gt;
&lt;/blockquote&gt;



&lt;p&gt;The answer was that Chromium currently does not plan to maintain such an embedder. The concern is that a simplified shell could itself become an inaccurate reference implementation. If its behavior diverged from the real Chrome integration, it could create more confusion rather than provide useful guidance.&lt;/p&gt;



&lt;p&gt;The suggested direction was instead to use &lt;strong&gt;extension-based Web Platform Tests (WPT)&lt;/strong&gt; to provide consistency, while considering actual browsers as the reference implementations.&lt;/p&gt;



&lt;p&gt;That approach makes sense from the upstream perspective.&lt;/p&gt;



&lt;p&gt;However, for our migration work, we still needed something slightly different.&lt;/p&gt;



&lt;p&gt;We needed a small, working environment where we could demonstrate that extensions can actually be supported &lt;strong&gt;outside of the &lt;code&gt;//chrome&lt;/code&gt; layer&lt;/strong&gt;.&lt;/p&gt;



&lt;p&gt;So we decided to bring back an extension-focused shell &#8212; not as an upstream testing framework, but as a practical environment for integration and demonstration.&lt;/p&gt;



&lt;p&gt;Although this shell is not part of upstream Chromium, we are currently maintaining the implementation internally in the Igalia repository, with plans to open-source it in the future. It serves as a lightweight environment for demonstrating and validating Extension support outside of the //chrome layer, rather than as a replacement for Chromium&amp;#8217;s browser tests or an upstream reference implementation.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Rebuilding the Extension Shell&lt;/h2&gt;



&lt;p&gt;The first step was to establish the basic structure of the shell.&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;1. Building the skeleton&lt;/h3&gt;



&lt;p&gt;We created a custom &lt;code&gt;ShellBrowserContext&lt;/code&gt; directly derived from &lt;code&gt;content::BrowserContext&lt;/code&gt;, bootstrapped the Views environment, and added a simple placeholder window.&lt;/p&gt;



&lt;p&gt;On top of that, we connected the extension system through:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;&lt;code&gt;ShellExtensionsBrowserClient&lt;/code&gt; &#8212; the entry point for implementing embedder-specific Extensions behavior for the shell.&lt;/li&gt;



&lt;li&gt;&lt;code&gt;ShellExtensionSystem&lt;/code&gt; &#8212; the service responsible for core extension management, including loading and unloading extensions and parsing manifests.&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;This gave us the basic environment needed to initialize Chromium&#8217;s extension infrastructure without depending on the full Chrome browser.&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;2. Building the installation pipeline&lt;/h3&gt;



&lt;p&gt;Next, the shell needed to actually install extensions.&lt;/p&gt;



&lt;p&gt;We connected &lt;code&gt;ExtensionExternalInstaller&lt;/code&gt;, which orchestrates the overall installation flow &#8212; including downloading, unpacking, and manifest validation &#8212; to support CRX and ZIP installation.&lt;/p&gt;



&lt;p&gt;We also implemented &lt;code&gt;ShellContentUtilityClient&lt;/code&gt;, which registers the sandboxed utility-process service needed to safely handle untrusted data, such as ZIP decompression, out of process.&lt;/p&gt;



&lt;p&gt;We then completed the renderer-side wiring so that an installed Manifest V3 extension could actually execute its service worker and access &lt;code&gt;chrome-extension://&lt;/code&gt; resources.&lt;/p&gt;



&lt;p&gt;Several pieces of the extension installation infrastructure also needed to be connected, including:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;&lt;code&gt;Blocklist&lt;/code&gt; &#8212; a &lt;code&gt;KeyedService&lt;/code&gt; that tracks which extensions are blocklisted, backed by Safe Browsing.&lt;/li&gt;



&lt;li&gt;&lt;code&gt;InstallStageTracker&lt;/code&gt; &#8212; tracks installation stages and failure events specifically for policy force-installed extensions.&lt;/li&gt;



&lt;li&gt;&lt;code&gt;InstallTracker&lt;/code&gt; &#8212; broadcasts installation start, completion, and failure events to observers.&lt;/li&gt;



&lt;li&gt;&lt;code&gt;InstallVerifier&lt;/code&gt; &#8212; confirms that an installed extension is either verified through a Web Store signature or allowlisted by enterprise policy.&lt;/li&gt;



&lt;li&gt;&lt;code&gt;SharedModuleService&lt;/code&gt; &#8212; supports the import/export mechanism that extensions use to pull in shared modules from other extensions.&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;At this point, we had a shell that could actually install and initialize extensions.&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;3. Making it look like a browser&lt;/h3&gt;



&lt;p&gt;The next step was to make the shell usable as an actual browser rather than just an extension test environment.&lt;/p&gt;



&lt;p&gt;We used the existing &lt;code&gt;content/shell&lt;/code&gt; implementation and &lt;code&gt;ShellPlatformDelegateViews&lt;/code&gt; as references, without directly depending on them.&lt;/p&gt;



&lt;p&gt;The shell now has a basic browser UI with:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Back&lt;/li&gt;



&lt;li&gt;Forward&lt;/li&gt;



&lt;li&gt;Reload&lt;/li&gt;



&lt;li&gt;Stop&lt;/li&gt;



&lt;li&gt;Address bar&lt;/li&gt;



&lt;li&gt;A &lt;code&gt;views::WebView&lt;/code&gt; containing a real &lt;code&gt;content::WebContents&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;This allowed us to browse normal web pages as well as run installed extensions.&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;4. Enforcing network-level policies&lt;/h3&gt;



&lt;p&gt;With the browser environment in place, we also started validating extension APIs that operate at the network level.&lt;/p&gt;



&lt;p&gt;In particular, we tested &lt;code&gt;declarativeNetRequest&lt;/code&gt; and &lt;code&gt;webRequest&lt;/code&gt;, which uncovered a few issues that needed to be fixed in the shell integration.&lt;/p&gt;



&lt;p&gt;After these steps, the basic foundation of an &lt;strong&gt;embedder that can install and run extensions&lt;/strong&gt; was finally becoming stable.&lt;/p&gt;



&lt;p&gt;And that naturally led to the next question:&lt;/p&gt;



&lt;blockquote class=&quot;wp-block-quote is-layout-flow wp-block-quote-is-layout-flow&quot;&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Can we install an extension directly from the Chrome Web Store?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;



&lt;p&gt;The answer was initially &lt;strong&gt;no&lt;/strong&gt;.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Enabling the &#8220;Add to Chrome&#8221; Button&lt;/h2&gt;



&lt;p&gt;When opening an extension page on the Chrome Web Store, the &lt;strong&gt;&#8220;Add to Chrome&#8221;&lt;/strong&gt; button was disabled.&lt;/p&gt;



&lt;p&gt;The reason was another missing piece of Chrome-specific functionality.&lt;/p&gt;



&lt;p&gt;The Web Store uses the &lt;code&gt;chrome.webstorePrivate&lt;/code&gt; extension API to perform the installation flow.&lt;/p&gt;



&lt;p&gt;Behind this API is &lt;code&gt;WebstorePrivateAPIDelegate&lt;/code&gt;, which delegates browser-specific operations to the embedder. These operations include things such as installation approval, login state, Safe Browsing checks, and the installation confirmation UI.&lt;/p&gt;



&lt;p&gt;Since our shell was not Chrome, these pieces were not implemented.&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;Implementing the missing pieces&lt;/h3&gt;



&lt;p&gt;To make the Web Store installation flow work, we implemented the required delegate functionality with safe defaults and added the necessary extension infrastructure to the shell.&lt;/p&gt;



&lt;p&gt;This included:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;&lt;code&gt;WebstorePrivateAPIDelegate&lt;/code&gt; &#8212; provides the embedder-specific implementation required by the &lt;code&gt;chrome.webstorePrivate&lt;/code&gt; API to handle Web Store extension installation.&lt;/li&gt;



&lt;li&gt;&lt;code&gt;ShellExtensionsAPIClient&lt;/code&gt; &#8212; provides shell-specific implementations of browser-level services required by extension APIs.&lt;/li&gt;



&lt;li&gt;&lt;code&gt;ShellExtensionInstallPromptClient&lt;/code&gt; &#8212; provides the shell-specific UI handling for extension installation prompts.&lt;/li&gt;



&lt;li&gt;&lt;code&gt;WebstorePrivateAPI&lt;/code&gt; factory &#8212; creates and provides the &lt;code&gt;WebstorePrivateAPI&lt;/code&gt; service for extensions running in the shell.&lt;/li&gt;



&lt;li&gt;&lt;code&gt;ManagementAPI&lt;/code&gt; factory &#8212; creates and provides the &lt;code&gt;ManagementAPI&lt;/code&gt; service, which exposes extension management functionality to extensions.&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;The shell also needed to provide appropriate User-Agent metadata, which was delegated through:&lt;/p&gt;



&lt;p&gt;&lt;code&gt;embedder_support::GetUserAgentMetadata()&lt;/code&gt;.&lt;/p&gt;



&lt;p&gt;After wiring these pieces together, the Chrome Web Store was finally able to recognize our shell as an environment capable of handling extension installation.&lt;/p&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;Demo&lt;/h2&gt;



&lt;p&gt;And this is where things became much more interesting.&lt;/p&gt;



&lt;p&gt;The &lt;strong&gt;&#8220;Add to Chrome&#8221;&lt;/strong&gt; button is now enabled, and clicking it can trigger the extension installation flow in our extension shell.&lt;/p&gt;



&lt;figure class=&quot;wp-block-video&quot;&gt;&lt;video controls=&quot;controls&quot; src=&quot;https://blogs.igalia.com/mshin/files/2026/08/demo_for_webstore.mp4&quot;&gt;&lt;/video&gt;&lt;/figure&gt;



&lt;p&gt;This is an important milestone for the migration.&lt;/p&gt;



&lt;p&gt;We now have a lightweight browser environment that can:&lt;/p&gt;



&lt;ol start=&quot;1&quot; class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;Launch independently of Chrome.&lt;/li&gt;



&lt;li&gt;Browse normal web pages.&lt;/li&gt;



&lt;li&gt;Install extensions.&lt;/li&gt;



&lt;li&gt;Run Manifest V3 extensions.&lt;/li&gt;



&lt;li&gt;Exercise extension APIs.&lt;/li&gt;



&lt;li&gt;Install an extension directly from the Chrome Web Store.&lt;/li&gt;
&lt;/ol&gt;



&lt;h2 class=&quot;wp-block-heading&quot;&gt;What&#8217;s next?&lt;/h2&gt;



&lt;p&gt;Getting an extension installed is only part of the story.&lt;/p&gt;



&lt;p&gt;The next step is making the installed extensions behave like they do in a real browser.&lt;/p&gt;



&lt;p&gt;There are still several APIs that have traditionally depended on the &lt;code&gt;//chrome&lt;/code&gt; layer. Permissions, cookies, and other browser integration points are among the areas that need to be migrated or provided by the embedder.&lt;/p&gt;



&lt;p&gt;Once these pieces are migrated, we should be able to go beyond simply installing an extension from the Web Store and demonstrate a more complete end-to-end experience:&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Chrome Web Store &#8594; Extension installation &#8594; Extension startup &#8594; Extension API usage&lt;/strong&gt;&lt;/p&gt;



&lt;p&gt;This is the next stage of the migration work.&lt;/p&gt;



&lt;p&gt;I&#8217;ll continue documenting the progress as more of these APIs move into the &lt;code&gt;//extensions&lt;/code&gt; layer and the extension shell becomes a more complete demonstration environment for embedders.&lt;/p&gt;
&lt;img src=&quot;https://stats.igalia.com/piwik.php?idsite=19&amp;rec=1&amp;url=https%3A%2F%2Fblogs.igalia.com%2Fmshin%2F2026%2F09%2F07%2Fextension-migration-progress-update-part-2%2F%3Fpk_campaign%3Dfeed%26pk_kwd%3Dextension-migration-progress-update-part-2&amp;action_name=Extension%20Migration%20Progress%20Update%20%E2%80%93%20Part%202&amp;urlref=https%3A%2F%2Fblogs.igalia.com%2Fmshin%2Ffeed%2F&quot; width=&quot;0&quot; height=&quot;0&quot; alt=&quot;&quot; /&gt;                </content>
		<author>
			<name>mshin</name>
			<uri>https://blogs.igalia.com/mshin</uri>
		</author>
	</entry>

	<entry>
		<title>Mauricio Faria de Oliveira: FOSForums 2026: talking about page_owner</title>
		<link rel="alternate" type="text/html" href="https://mfo.dev.br/posts/2026-09-02-fosforums-2026-talking-about-page_owner/"/>
		<id>https://mfo.dev.br/posts/2026-09-02-fosforums-2026-talking-about-page_owner/</id>
		<updated>2026-09-02T00:00:00+00:00</updated>
		<content type="html">
&lt;p&gt;Last week I attended FOSForums 2026 and presented about Linux &lt;code&gt;page_owner&lt;/code&gt;.&lt;/p&gt;
&lt;h1 id=&quot;the-conference&quot;&gt;
 &lt;a class=&quot;header-link&quot; href=&quot;https://mfo.dev.br/tags/igalia/index.xml#the-conference&quot;&gt;
 The conference
 &lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;&lt;a href=&quot;https://fosforums.org&quot;&gt;FOSForums&lt;/a&gt; (Free and Open Source Forums) is a free conference focused on free and open source software, hardware, and the communities around them.&lt;/p&gt;
&lt;p&gt;Now in its 4th edition, since 2023 it has been held at the Institute of Computing at Unicamp &amp;ndash; one of Brazil&amp;rsquo;s top public research universities &amp;ndash; and has featured speakers from Igalia, Red Hat, Linaro, RISC-V International, Toradex, Unicamp (State University of Campinas), USP (University of S&#227;o Paulo), Eldorado Research Institute, and others.&lt;/p&gt;
&lt;p&gt;The partners of the conference for this year are &lt;a href=&quot;https://riscv.org&quot;&gt;RISC-V International&lt;/a&gt;, &lt;a href=&quot;https://www.unicamp.br/en/&quot;&gt;Unicamp&lt;/a&gt; and its &lt;a href=&quot;https://ic.unicamp.br/en/&quot;&gt;Institute of Computing&lt;/a&gt; and &lt;a href=&quot;https://www.ictl.org.br/en/&quot;&gt;Institute for the Conservation of Free Technologies&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s still a relatively new and small conference &amp;ndash; around 30 attendees this year &amp;ndash; but a notably high share of them are students, both undergraduate and graduate. That makes it an especially relevant place to share knowledge, identify talent, and support people early in their tech careers &amp;ndash; contributing back to the community.&lt;/p&gt;
&lt;p&gt;This year&amp;rsquo;s schedule covered the FinOps Foundation, open science, continuous integration with RISC-V/Linux/KernelCI, Linux filesystem performance on flash devices, and Linux &lt;code&gt;page_owner&lt;/code&gt; (my talk), plus a hands-on session with BitDogLab (an open-source educational hardware platform). A talk on turning bug reports into kernel patches was also planned but unfortunately couldn&amp;rsquo;t be delivered &amp;ndash; keep an eye on Heitor&amp;rsquo;s &lt;a href=&quot;https://blog.ctrlbyte.com&quot;&gt;blog&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://mfo.dev.br/images/fosforums-2026/fosforums-2026-picture-board-logo.jpg&quot; alt=&quot;FOSForums 2026: BitDogLab&amp;rsquo;s board and conference logo&quot; /&gt;&lt;/p&gt;
&lt;h1 id=&quot;the-talk&quot;&gt;
 &lt;a class=&quot;header-link&quot; href=&quot;https://mfo.dev.br/tags/igalia/index.xml#the-talk&quot;&gt;
 The talk
 &lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Picking up the thread on &lt;code&gt;page_owner&lt;/code&gt; (see the blog post &lt;a href=&quot;https://mfo.dev.br/tags/page_owner/&quot;&gt;series&lt;/a&gt;), I wanted to put together a more introductory, user-friendly version of the talk &lt;em&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=qFdjO3t5F9I&quot;&gt;Improving &lt;code&gt;page_owner&lt;/code&gt; for profiling and monitoring memory usage per allocation stack trace&lt;/a&gt;&lt;/em&gt; presented at &lt;a href=&quot;https://lpc.events/event/19/contributions/2202/&quot;&gt;Linux Plumbers Conference 2025&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I opened with an introduction about Igalia &amp;ndash; &lt;em&gt;who we are&lt;/em&gt;, &lt;em&gt;what we work with&lt;/em&gt;, and &lt;em&gt;what we do&lt;/em&gt; &amp;ndash; and how to &lt;em&gt;join us&lt;/em&gt; through our &lt;a href=&quot;https://www.igalia.com/jobs&quot;&gt;open positions&lt;/a&gt; and our &lt;a href=&quot;https://www.igalia.com/coding-experience&quot;&gt;Coding Experience&lt;/a&gt; program.&lt;/p&gt;
&lt;p&gt;The technical part covered the problem at hand, &amp;ldquo;&lt;em&gt;Where is memory going?&lt;/em&gt;&amp;rdquo;, and then walked through &lt;code&gt;page_owner&lt;/code&gt; from definition to application: what it is, what it is &lt;em&gt;for&lt;/em&gt;, how it works, how to use it, then basic and advanced examples.&lt;/p&gt;
&lt;p&gt;The session recording is available on YouTube (currently within the &lt;a href=&quot;https://www.youtube.com/live/Uq6HAXrwA_Q?t=28077s&quot;&gt;live stream&lt;/a&gt;; later in the FOSForums 2026 &lt;a href=&quot;https://www.youtube.com/playlist?list=PLe8NBbBrwvJ4&quot;&gt;playlist&lt;/a&gt;), and the slides are available &lt;a href=&quot;https://mfo.dev.br/slides/fosforums-2026-page_owner.pdf&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://mfo.dev.br/images/fosforums-2026/fosforums-2026-picture-mfo-talk.jpg&quot; alt=&quot;FOSForums 2026: mfo&amp;rsquo;s talk; photo by mhcerri@igalia.com&quot; /&gt;&lt;/p&gt;
&lt;h1 id=&quot;acknowledgments&quot;&gt;
 &lt;a class=&quot;header-link&quot; href=&quot;https://mfo.dev.br/tags/igalia/index.xml#acknowledgments&quot;&gt;
 Acknowledgments
 &lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Thank you to the FOSForums organizing committee for the great conference, and Igalia for the opportunity to present this work.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://mfo.dev.br/images/fosforums-2026/fosforums-2026-picture-igalia-backpack.jpg&quot; alt=&quot;FOSForums 2026: Igalia backpack and audience&quot; /&gt;&lt;/p&gt;                </content>
		<author>
			<name>Mauricio Faria de Oliveira</name>
			<uri>https://mfo.dev.br/tags/igalia/</uri>
		</author>
	</entry>

	<entry>
		<title>Igalia WebKit Team: WebKit Igalia Periodical #75</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/webkit/blog/2026/wip-75/"/>
		<id>https://blogs.igalia.com/webkit/blog/2026/wip-75/</id>
		<updated>2026-08-31T20:12:08+00:00</updated>
		<content type="html">
&lt;p&gt;Update on what happened in WebKit in the week from August 24 to August 31.&lt;/p&gt;
&lt;p&gt;
After such a packed edition last week, we can relax with an even more
packed installment this week! The team has been moving full steam ahead
with the Layer-Based SVG Engine, and graphics improvements in general,
but we also had a handful of other updates, such as SDK updates, a new
WebsitePolicies API, and more.
&lt;/p&gt;
&lt;h2 id=&quot;cross-port-cat&quot;&gt;Cross-Port &#128049;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320069@main&quot;&gt;Add&lt;/a&gt; new ChildChange types for moveBefore(). This addresses issues with the in-progress moveBefore() implementation where scripts would sometimes execute erroneously.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/pull/72789&quot;&gt;Added&lt;/a&gt; &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/color#alpha&quot;&gt;alpha channel&lt;/a&gt; support to color input choosers.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/8ce95bb31076b2a39f7450cb0018f30da1294a58&quot;&gt;Fixed&lt;/a&gt; Service Worker &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/InstallEvent/addRoutes&quot;&gt;static routes&lt;/a&gt; on non-Apple ports.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/b2678ccf7efb04a68ae229eff8edfc8c98ed402e&quot;&gt;Added&lt;/a&gt; a &lt;code&gt;WebsitePolicies:upgrade-to-https-policy&lt;/code&gt; property. When enabled this policy will automatically try using HTTPS even for HTTP websites (excluding localhost or IPs). The policy can be configured either to allow automatically falling back to HTTP if that fails, or to consider all HTTPS failures fatal for the best security.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;graphics-frame-photo&quot;&gt;Graphics &#128444;&#65039;&lt;/h3&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319445@main&quot;&gt;Fixed SVG text being rasterized for the wrong resolution&lt;/a&gt; in zoomed standalone SVG documents in the Layer-Based SVG Engine (LBSE). &lt;code&gt;vector-effect: non-scaling-stroke&lt;/code&gt; on &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt; no longer comes out too thick, and the resulting metrics match the legacy SVG engine.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320045@main&quot;&gt;Fixed viewport clipping&lt;/a&gt; in the Layer-Based SVG Engine (LBSE), where a nested &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; or a &lt;code&gt;&amp;lt;marker&amp;gt;&lt;/code&gt; applied its viewport clip even when its content already fitted inside, and since that clip is not pixel-snapped its edge could fall between two device pixels and cut into whatever was drawn right at the viewport border. Painting now skips a clip that removes nothing, which eliminates a class of subtle pixel differences against the legacy SVG engine.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319773@main&quot;&gt;Fixed opacity animations not damaging descendant layers&lt;/a&gt; in the GTK and WPE ports, where a descendant that paints outside its parent's bounds kept its stale pixels on screen. The mask-specific damage handling was generalized into a single group-property path shared by &lt;code&gt;opacity&lt;/code&gt;, filters, mask blend modes and replicas, which now damages the layer plus the overlap region of its whole subtree.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320143@main&quot;&gt;Added a &lt;code&gt;cycle-analysis&lt;/code&gt; subcommand&lt;/a&gt; to &lt;code&gt;webkit-sysprof&lt;/code&gt;, which draws every frame cycle of a capture as a bar of cells colored by the mark covering that moment on the main thread, showing whether a slow frame stalled on layout, a long timer or rasterization instead of only reporting that it was slow.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320144@main&quot;&gt;Removed redundant text updates&lt;/a&gt; for the text children of elements using &lt;code&gt;display: contents&lt;/code&gt;, which previously got one on every style resolution regardless of whether their style actually changed. This removes dozens of useless updates per style recalculation in Web Component applications, where every &lt;code&gt;&amp;lt;slot&amp;gt;&lt;/code&gt; uses &lt;code&gt;display: contents&lt;/code&gt;.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319866@main&quot;&gt;Fixed tile image caching&lt;/a&gt; in the Skia compositor by regenerating the cached &lt;code&gt;SkImage&lt;/code&gt; whenever a a tile's contents are updated and by adding a texture release callback that keeps the texture valid for as long as the image references it.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319943@main&quot;&gt;Switched video DMA-BUF buffers to Skia promise images&lt;/a&gt; in the Skia compositor, so the texture backing a video frame is only created at the point Skia actually draws it, which works for these buffers because the underlying &lt;code&gt;DMABufBuffer&lt;/code&gt; can be kept alive until the promise image is released.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319850@main&quot;&gt;Fixed a hang&lt;/a&gt; in the Layer-Based SVG Engine (LBSE) when two SVG &lt;code&gt;&amp;lt;pattern&amp;gt;&lt;/code&gt; elements reference each other through &lt;code&gt;href&lt;/code&gt;, or one references itself: collecting the inherited pattern attributes now remembers which patterns it has already visited, the same cycle detection that gradients have always had. The walk also resolves every reference in the tree scope of the pattern it started from, so a pattern referenced from inside a shadow tree now inherits the right attributes.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319545@main&quot;&gt;Skipped anchor-positioning bookkeeping&lt;/a&gt; during style resolution when a document uses no anchor positioning at all, avoiding two hash lookups per styled element.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319468@main&quot;&gt;Cached the SVG viewport size&lt;/a&gt; used to resolve lengths in the Layer-Based SVG Engine (LBSE), instead of recomputing the nearest &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; element's view box rectangle once per shape per frame. The viewport is invariant across a flush and identical for every shape under the same &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt;, so caching removes redundant work.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319940@main&quot;&gt;Removed the code path for GPU rendering without Deferred Display Lists (DDL)&lt;/a&gt; in the Skia compositor, so accelerated painting always records into a display list and no longer needs to create GL contexts on worker threads.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/320152@main&quot;&gt;Fixed red and blue appearing swapped&lt;/a&gt; in non-accelerated video with the Skia compositor, by allocating the video frame's &lt;code&gt;BitmapTexture&lt;/code&gt; with the BGRA layout flag and applying that flag when the buffer is turned into a Skia image.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;infrastructure-construction-site&quot;&gt;Infrastructure &#127959;&#65039;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319870@main&quot;&gt;Bumped the GTK and WPE developer SDK&lt;/a&gt; from v9 to v11, bringing GStreamer 1.28.5, sparkle-cdm 2026.2 and libsoup 3.7.2. Be sure to update your local wkdev-sdk container using &lt;code&gt;wkdev-update&lt;/code&gt; to make sure your development environment matches what the CI is testing.&lt;/p&gt;
  &lt;/div&gt;
&lt;div class=&quot;wip-end&quot;&gt;
&lt;p&gt;That&#8217;s all for this week!&lt;/p&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Igalia WebKit Team</name>
			<uri>https://blogs.igalia.com/webkit</uri>
		</author>
	</entry>

	<entry>
		<title>Alicia Boya: Getting perf to work on ARM32 Linux: Part 3, the ABIs</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/aboya/2026/08/27/getting-perf-to-work-on-arm32-linux-part-3-the-abis/?pk_campaign=feed&amp;pk_kwd=getting-perf-to-work-on-arm32-linux-part-3-the-abis"/>
		<id>https://blogs.igalia.com/aboya/?p=123</id>
		<updated>2026-08-27T16:59:31+00:00</updated>
		<content type="html">
&lt;p&gt;In &lt;a href=&quot;https://blogs.igalia.com/aboya/?p=112&quot;&gt;Part 2&lt;/a&gt; I explained how ARM32 has two ISAs available (ARM and Thumb), how their feature sets differ in important ways and how software can and often does make use of both even in the same program.&lt;/p&gt;



&lt;p&gt;Today we&amp;#8217;re going one level higher and look at the &lt;em&gt;ABI&lt;/em&gt;s (&lt;em&gt;Application Binary Interface&lt;/em&gt;). Whereas an ISA defines what bit sequences make the CPU do what operations, an ABI is a &lt;strong&gt;set of conventions software is meant to follow&lt;/strong&gt; so that it is interoperable with other software targetting the same ABI.&lt;/p&gt;



&lt;p&gt;An ABI is adopted by compilers and operating systems. The designers of the instruction set &lt;em&gt;often&lt;/em&gt; define some &lt;em&gt;base ABI&lt;/em&gt; that compilers only need to extend to define a few missing bits.&lt;/p&gt;



&lt;p&gt;One of the biggest underlying reasons getting &lt;code&gt;perf&lt;/code&gt;  to work in ARM32 is hard is that ARM has&lt;strong&gt; deprecated &lt;/strong&gt;and gone over&lt;strong&gt; multiple base ABIs&lt;/strong&gt; in its lifetime. Furthermore: the &lt;strong&gt;details&lt;/strong&gt; on how &lt;strong&gt;frame pointers&lt;/strong&gt; should work used to be completely &lt;strong&gt;non-standard&lt;/strong&gt; and that has created &lt;strong&gt;fragmentation&lt;/strong&gt;.&lt;/p&gt;



&lt;p&gt;As of writing, these are the standard base ABIs defined for ARM:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;~1987: &lt;a href=&quot;https://developer.arm.com/documentation/dui0041/c/ARM-Procedure-Call-Standard?lang=en&quot;&gt;APCS&lt;/a&gt; (&lt;em&gt;Arm Procedure Call Standard&lt;/em&gt; (obsolete)). Only applies to ARM.&lt;/li&gt;



&lt;li&gt;~1997: &lt;a href=&quot;https://developer.arm.com/documentation/dui0041/c/Thumb-Procedure-Call-Standard?lang=en&quot;&gt;TPCS&lt;/a&gt; (&lt;em&gt;Thumb Procedure Call Standard&lt;/em&gt; (obsolete)). Thumb-only counterpart of APCS.&lt;/li&gt;



&lt;li&gt;1998: &lt;a href=&quot;https://developer.arm.com/documentation/espc0002/latest/&quot;&gt;ATPCS&lt;/a&gt; (&lt;em&gt;ARM-THUMB Procedure Call Standard&lt;/em&gt;). Unified ABI for both ARM and Thumb.&lt;/li&gt;



&lt;li&gt;2003: &lt;a href=&quot;https://github.com/ARM-software/abi-aa/blob/8e73a1c3fd788fe325a3644c2129e2cfa3e3f688/aapcs32/aapcs32.rst&quot;&gt;AAPCS&lt;/a&gt; (&lt;em&gt;Procedure Call Standard for the Arm&#174; Architecture&lt;/em&gt;). The current base ABI. It applies to both ARM and Thumb.&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;In this post we&amp;#8217;ll learn some typical examples of features an ABI would standardize, ultimately landing in frame pointers as one of such features.&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;The stack&lt;/h3&gt;



&lt;p&gt;At its most basic, a CPU does not need to have a concept of a stack. The ARM ISA exemplifies this well: the &lt;a href=&quot;https://support.arm.com/documentation/ddi0597/2026-06/Base-Instructions/STMDB--STMFD--Store-Multiple-Decrement-Before--Full-Descending--?lang=en&quot;&gt;instructions used for stack manipulation&lt;/a&gt; are extremely generic&#8212;they can work on any register, support any kind of stack (&lt;a href=&quot;https://support.arm.com/documentation/ddi0597/2026-06/Base-Instructions/STMDB--STMFD--Store-Multiple-Decrement-Before--Full-Descending--?lang=en&quot;&gt;full descending&lt;/a&gt;, &lt;a href=&quot;https://support.arm.com/documentation/ddi0597/2026-06/Base-Instructions/STMIB--STMFA--Store-Multiple-Increment-Before--Full-Ascending--&quot;&gt;full ascending&lt;/a&gt;, &lt;a href=&quot;https://support.arm.com/documentation/ddi0597/2026-06/Base-Instructions/STMDA--STMED--Store-Multiple-Decrement-After--Empty-Descending--&quot;&gt;empty descending&lt;/a&gt;, &lt;a href=&quot;https://support.arm.com/documentation/ddi0597/2026-06/Base-Instructions/STM--STMIA--STMEA--Store-Multiple--Increment-After--Empty-Ascending--?lang=en&quot;&gt;empty ascending&lt;/a&gt;) and also work as general &#8220;write multiple registers to memory pointed by register&#8221; instructions.&lt;/p&gt;



&lt;p&gt;But of course, a stack is a very useful abstraction that any non-trivial program will need as it allows to free up registers by saving their data for later use. Different pieces of code (e.g. functions) need to &lt;strong&gt;agree on a definition for the stack&lt;/strong&gt; and rules to use it so they don&amp;#8217;t accidentally overwrite each other&amp;#8217;s data.&lt;/p&gt;



&lt;p&gt;As such, ABIs define the stack; namely: what register points to the current top of the stack, whether it grows towards greater adresses (&lt;em&gt;ascending stack&lt;/em&gt;) or toward lower adresses (&lt;em&gt;descending stack&lt;/em&gt;), whether the &#8220;&lt;em&gt;top of the stack&lt;/em&gt;&#8221; should be understood as &#8220;the last element pushed&#8221; (&lt;em&gt;full stack&lt;/em&gt;) or &#8220;the position a newly pushed element would use&#8221; (&lt;em&gt;empty stack&lt;/em&gt;), any alignment requirements, and rules for writing to the stack&#8212;for example: writes outside of the stack may be considered undefined behavior even in the absence of function calls so that interrupt handlers can make use of the same stack.&lt;/p&gt;



&lt;p&gt;On ARM32, virtually all the ABIs&lt;sup class=&quot;fn&quot;&gt;&lt;a href=&quot;https://blogs.igalia.com/aboya/feed/#39983882-7b2f-4807-bbc7-f9822cb05116&quot; id=&quot;39983882-7b2f-4807-bbc7-f9822cb05116-link&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; agree on using a &lt;strong&gt;full-descending stack&lt;/strong&gt;, whose top position is tracked by the &lt;strong&gt;r13 register&lt;/strong&gt;, which for this reason is also give the alias &lt;code&gt;sp&lt;/code&gt; (&lt;em&gt;stack pointer&lt;/em&gt;). The stack is 4 byte (32 bit) aligned. The AAPCS ABI further requires 8 byte alignment at the public interface (e.g. when calling a library function). Storing data outside of the valid region of the stack (i.e. in addresses lower than &lt;code&gt;sp&lt;/code&gt;) is undefined behavior.&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;Function calls&lt;/h3&gt;



&lt;p&gt;An ABI defines what a function call is under the hood; namely: how arguments are passed and how are values returned. This part of ABIs is important enough to have its own name: &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Calling_convention&quot;&gt;calling convention&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;



&lt;h4 class=&quot;wp-block-heading&quot;&gt;Function arguments&lt;/h4&gt;



&lt;p&gt;A simple calling convention could require all function arguments be to pushed into the stack. The callee could then access them by addressing the stack pointer. Notably, the &lt;a href=&quot;https://bugaevc.github.io/asmwall/?cdecl&quot;&gt;&lt;em&gt;cdecl&lt;/em&gt;&lt;/a&gt; and &lt;a href=&quot;https://bugaevc.github.io/asmwall/?stdcall&quot;&gt;&lt;em&gt;stdcall&lt;/em&gt;&lt;/a&gt; calling conventions used in MS Windows 32-bit x86 work in this manner.&lt;/p&gt;



&lt;p&gt;Modern calling conventions&#8212;&lt;strong&gt;including ARM32 AAPCS&lt;/strong&gt; and all x86-64 calling conventions&#8212;&lt;strong&gt;use registers in addition to the stack for passing arguments&lt;/strong&gt;, trading complexity in the ABI for better performance. This is especially a win for functions with few arguments. In many cases, programmers and compilers can strategically do computations directly in the same registers that will be later used as arguments, further reducing the overhead of function calls.&lt;/p&gt;



&lt;p&gt;In AAPCS, &lt;strong&gt;r0-r3 are filled with the first few arguments&lt;/strong&gt;. Arguments with types smaller than 32 bit (e.g. &lt;code&gt;char&lt;/code&gt;, &lt;code&gt;int16_t&lt;/code&gt;) are extended to 32 bits before the call. When an argument has a 64-bit type, it takes two consecutive registers. For more details, see &lt;a href=&quot;https://github.com/ARM-software/abi-aa/blob/2982a9f3b512a5bfdc9e3fea5d3b298f9165c36b/aapcs32/aapcs32.rst#65parameter-passing&quot;&gt;section 6.5, &lt;em&gt;Parameter Passing&lt;/em&gt; in the AAPCS specification&lt;/a&gt;. Remaining arguments are pushed into the stack.&lt;/p&gt;



&lt;h4 class=&quot;wp-block-heading&quot;&gt;Callee-saved and caller-saved registers&lt;/h4&gt;



&lt;p&gt;ABIs often separate user registers in two groups:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;&lt;em&gt;Callee-saved registers&lt;/em&gt;&lt;/li&gt;



&lt;li&gt;&lt;em&gt;Caller-saved registers&lt;/em&gt;, also known as &lt;em&gt;scratch registers&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;A function is allowed to write to &lt;strong&gt;callee-saved&lt;/strong&gt; registers at any point, but it &lt;strong&gt;must ensure they have their original value on return&lt;/strong&gt;. This is normally accomplished by pushing (&lt;em&gt;saving&lt;/em&gt;) the previous value to the stack before writing and popping it before return, hence the name &#171;&lt;em&gt;callee-saved&lt;/em&gt;&#187;.&lt;/p&gt;



&lt;p&gt;On the other hand, a function is allowed to freely write (&lt;em&gt;&lt;strong&gt;scratch&lt;/strong&gt;&lt;/em&gt;) any and all &lt;strong&gt;caller-saved registers&lt;/strong&gt; &lt;strong&gt;without preserving their old value&lt;/strong&gt; anywhere. This also means that, before doing any function call, you must be careful to save any important data in these registers, hence the name &#171;&lt;em&gt;caller-saved&lt;/em&gt;&#187;.&lt;/p&gt;



&lt;p&gt;Having a healthy mix of callee-saved and caller-saved is good for performance, as it reduces the number of stack manipulation operations necessary in typical functions.&lt;/p&gt;



&lt;p&gt;In AAPCS, &lt;strong&gt;r0-r3 and r12 are caller-saved&lt;/strong&gt; (i.e. scratch registers). &lt;strong&gt;All other general purpose registers are callee-saved&lt;/strong&gt;.&lt;/p&gt;



&lt;h4 class=&quot;wp-block-heading&quot;&gt;Returning from a function: return pointers&lt;/h4&gt;



&lt;p&gt;The calling convention also needs to specify how returning from a function works. The &lt;strong&gt;caller&lt;/strong&gt; must store a &lt;em&gt;&lt;strong&gt;return pointer&lt;/strong&gt;&lt;/em&gt; (an address to executable code immediately following the function call) in a well-defined place.&lt;/p&gt;



&lt;p&gt;In many calling conventions, including the common ones for x86 and x86-64, the return pointer is passed in the stack. ARM calling conventions are a bit smarter: instead they place the return pointer in a so-called &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Link_register&quot;&gt;&lt;strong&gt;link register&lt;/strong&gt;&lt;/a&gt;&lt;/em&gt; (&lt;code&gt;lr&lt;/code&gt;). This means that simple &lt;strong&gt;leaf&lt;/strong&gt; functions (functions that do not call other functions) can operate on their arguments and return a value &lt;strong&gt;without ever touching the stack&lt;/strong&gt;.&lt;/p&gt;



&lt;p&gt;All ARM calling conventions use &lt;code&gt;r14&lt;/code&gt; as the link register.&lt;/p&gt;



&lt;p&gt;Of course, many functions will need to call to other functions before returning, so how does a link register handle this? Quite simply: &lt;strong&gt;&lt;code&gt;lr&lt;/code&gt; is a callee-saved register&lt;/strong&gt;! A function that will perform function calls will typically store &lt;code&gt;lr&lt;/code&gt; in the stack somewhere in its preamble, do as many function calls as it wants, then restore the old value of &lt;code&gt;lr&lt;/code&gt; from the stack.&lt;/p&gt;



&lt;p&gt;The &lt;code&gt;l&lt;/code&gt; in the &lt;a href=&quot;https://support.arm.com/documentation/ddi0597/2026-06/Base-Instructions/BL--BLX--immediate---Branch-with-Link-and-optional-Exchange--immediate--&quot;&gt;&lt;code&gt;bl&lt;/code&gt; and &lt;code&gt;blx&lt;/code&gt;&lt;/a&gt; branch instructions in ARM stands for &amp;#8220;link&amp;#8221;. It means that the current value of &lt;code&gt;pc&lt;/code&gt; will be loaded in &lt;code&gt;lr&lt;/code&gt; before the branch. This is the most common way to do function calls in ARM and Thumb.&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;Special purpose registers&lt;/h3&gt;



&lt;p&gt;An ABI may reserve certain CPU registers for specific purposes, even if those registers would otherwise be general purpose registers according to the ISA. Compilers do to take this into account when generating code.&lt;/p&gt;



&lt;p&gt;AAPCS leaves r9 free to use for any ABI extending AAPCS (e.g. for a specific operating system).&lt;/p&gt;



&lt;p&gt;AAPCS defines r12 as the &lt;em&gt;Intra-Procedure-call scratch register&lt;/em&gt; (&lt;code&gt;ip&lt;/code&gt;). Functions are allowed to use it as a regular scratch register, but its real purpose is to enable writing simple &lt;em&gt;veneers&lt;/em&gt; without needing stack manipulation.&lt;/p&gt;



&lt;h4 class=&quot;wp-block-heading&quot;&gt;Side-tangent: Veneers&amp;#8230;? What is a veneer?&lt;/h4&gt;



&lt;p&gt;&lt;em&gt;(You can safely skip this section If you just want to understand the minimum concepts necessary for frame pointers. Keep reading if you have a more general interest in ARM assembly.)&lt;/em&gt;&lt;/p&gt;



&lt;p&gt;Instructions in ARM have a &lt;strong&gt;fixed size&lt;/strong&gt; of 32 bits which is as wide as pointer. A consequence of this is that calling functions in arbitrary locations of the program requires a &lt;strong&gt;variable number of instructions&lt;/strong&gt;. Most &lt;strong&gt;branches&lt;/strong&gt; in ARM are done with &lt;strong&gt;signed offsets&lt;/strong&gt; with a range of &#177;32 MiB (26 bits, of which only the most significant 24 bits are actually encoded in the instruction because ARM instructions are 4-byte-aligned). &lt;strong&gt;Thumb&lt;/strong&gt; is even scrappier: the typical Thumb &lt;a href=&quot;https://support.arm.com/documentation/ddi0597/2026-06/Base-Instructions/BL--BLX--immediate---Branch-with-Link-and-optional-Exchange--immediate--?lang=en#iclass_t1&quot;&gt;&lt;code&gt;bl&lt;/code&gt; (branch with link)&lt;/a&gt; instruction only supports offsets of &#177;4MiB encoded in 22 bits, which is already more than the 16 bits per instruction of Thumb-1 and it is only possible because the &lt;em&gt;bl&lt;/em&gt; ASM instruction gets turned into &lt;em&gt;two&lt;/em&gt; machine Thumb-1 instructions designed for this purpose, each containing half of the offset).&lt;/p&gt;



&lt;p&gt;Compilers and linkers cope with this limitation by &lt;strong&gt;assuming calls will be near enough for the offset to fit&lt;/strong&gt;. When the offset does not fit, they synthesize some code (the &lt;em&gt;veneer&lt;/em&gt;, also sometimes called a &lt;em&gt;trampoline&lt;/em&gt; or &lt;em&gt;range extension thunk&lt;/em&gt;) in a location close enough for the offset to fit. The veneer will then load the entire address in some register&#8212;likely &lt;code&gt;ip&lt;/code&gt;&#8212; and then use a &#171;branch to address in register&#187; instruction (e.g. &lt;code&gt;&lt;a href=&quot;https://support.arm.com/documentation/ddi0597/2026-03/Base-Instructions/BX--Branch-and-Exchange-&quot;&gt;bx&lt;/a&gt; ip&lt;/code&gt;).&lt;/p&gt;



&lt;p&gt;From this example the utility of having a scratch register not used for argument passing (&lt;code&gt;ip&lt;/code&gt;) becomes apparent: if a scratch register like &lt;code&gt;ip&lt;/code&gt; did not exist, the veneer would need to spill some callee-saved register to the stack just to build an address for the &lt;code&gt;bx&lt;/code&gt; instruction. Furthermore, the callee couldn&amp;#8217;t return directly into the original caller, but it would have to return back into the veneer so that the values from the stack could be restored.&lt;/p&gt;



&lt;p&gt;Also of note is that is the fact that the &lt;code&gt;&lt;strong&gt;blx&lt;/strong&gt;&lt;/code&gt; instruction (&lt;span&gt;b&lt;/span&gt;ranch with &lt;span&gt;l&lt;/span&gt;ink and e&lt;span&gt;x&lt;/span&gt;change ISA, provided an offset or register) &lt;strong&gt;did not exist until ARMv5&lt;/strong&gt;. Before, there was only &lt;strong&gt;&lt;code&gt;bx&lt;/code&gt;&lt;/strong&gt; (&lt;span&gt;b&lt;/span&gt;ranch and e&lt;span&gt;x&lt;/span&gt;change ISA), which operated on a register. This resulted in a different number of instructions required for the branch depending on the ISA of the target (which may not be known until run-time in the case of shared libraries), and by extension made veneers necessary for &lt;strong&gt;&lt;em&gt;interworking&lt;/em&gt;&lt;/strong&gt; between ARM and Thumb.&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;Frame pointers&lt;/h3&gt;



&lt;p&gt;A &lt;em&gt;&lt;strong&gt;stack frame&lt;/strong&gt;&lt;/em&gt; is the chunk of the stack used by a specific function call, not including nested calls.&lt;/p&gt;



&lt;p&gt;A &lt;em&gt;&lt;strong&gt;frame pointer&lt;/strong&gt;&lt;/em&gt; points to a fixed location (e.g. the start or end) of the stack frame. When we say that a program uses frame pointers, we refer to that program dedicating a register&#8212;the &lt;em&gt;&lt;strong&gt;frame pointer register&lt;/strong&gt;&lt;/em&gt; (usually shortened as &lt;code&gt;fp&lt;/code&gt;)&#8212;to store the frame pointer at all times.&lt;/p&gt;



&lt;p&gt;Having a frame pointer allows assembly code to refer to locations in the stack with simple offset from the frame pointer. So, for example, a certain variable saved in the stack will be at &lt;code&gt;fp-4&lt;/code&gt; and will remain at &lt;code&gt;fp-4&lt;/code&gt; even if code later pushes to the stack. This is more useful for humans than compilers, since it&amp;#8217;s possible to access the same data from &lt;code&gt;sp&lt;/code&gt; as long as you keep track of the required offset changing every time something is pushed or popped.&lt;/p&gt;



&lt;p&gt;Something much more useful occurs if code always pushes the old value of the frame pointer register and the return pointer to the stack at call boundaries: &lt;strong&gt;it becomes possible to inspect the stack at runtime&lt;/strong&gt;: the frame pointer register points to the current frame record, from which the previous frame pointer and return pointer are accessible in a fixed offset. This process can be repeated, traversing the stack like a linked list, one stack frame at a time. Before &lt;code&gt;main()&lt;/code&gt;, a sentinel value (typically a null pointer) should be pushed instead of a frame pointer so that the end of the linked list can be detected.&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Note that the usage of frame pointers is an ABI matter:&lt;/strong&gt; The above breaks if you call a function in a library that doesn&amp;#8217;t use the same exact convention for frame pointers. If that function skips updating the frame pointer register, its stack frames will become invisible. Or worse: if it writes some random value to it, &lt;strong&gt;the entire chain of callers will no longer be recoverable&lt;/strong&gt;.&lt;/p&gt;



&lt;p&gt;In x86 ABIs, the &lt;em&gt;Base Pointer&lt;/em&gt; register (&lt;code&gt;bp&lt;/code&gt; in 16-bit, &lt;code&gt;ebp&lt;/code&gt; in 32-bit, &lt;code&gt;rbp&lt;/code&gt; in 64-bits) is commonly used to store the frame pointer.&lt;/p&gt;



&lt;p&gt;Frame pointers were important for obtaining backtraces in early debuggers, but this is less necessary in modern toolchains. Nowadays compilers can generate debug information (&lt;em&gt;&lt;strong&gt;debuginfo&lt;/strong&gt;)&lt;/em&gt; in a format like &lt;a href=&quot;https://dwarfstd.org/&quot;&gt;DWARF&lt;/a&gt; that debuggers can use to map any value of the &lt;code&gt;pc&lt;/code&gt; register to what function it is part of and how deep in the stack the return pointer is at that particular instruction. This is &lt;strong&gt;the same process they use to map local variables&lt;/strong&gt; to positions in the stack. The process can be repeated until the entire stack trace is obtained.&lt;/p&gt;



&lt;p&gt;Since frame pointers became less necessary for debuggers, compiler &lt;strong&gt;optimizations that skip updating the frame pointer register&lt;/strong&gt; or even &lt;strong&gt;use it as a general-purpose register&lt;/strong&gt; have become very common. Omitting frame pointers as an optimization &lt;a href=&quot;https://github.com/gcc-mirror/gcc/commit/c5a0877cf372229f139344b957f27174c8f67b68&quot;&gt;has been the default in gcc for all platforms since 2017&lt;/a&gt;, after it had been enabled in most target platforms individually. &lt;a href=&quot;https://github.com/gcc-mirror/gcc/commit/c17f64ccf22e11f747dec2fb47d1176c80398942#diff-5b792a13a7bf5b952680de5a119d2c12643befdc7ce73ef49bc3f14aef57286dR294&quot;&gt;ARM32 already had this enabled in 2010&lt;/a&gt; and earlier.&lt;/p&gt;



&lt;p&gt;While debuginfo is a good alternative to frame pointers to get backtraces in a debugger, other development tools are not so lucky. Recovering &lt;strong&gt;call chains from frame pointers is a very lightweight affair&lt;/strong&gt;: it&amp;#8217;s a singly linked list traversal where all the nodes are within consecutive memory. On the other hand, getting a call chain through debuginfo requires having separate debuginfo sections for each object file (e.g. &lt;code&gt;.so&lt;/code&gt; library) mapped in memory, search the wanted &lt;code&gt;pc&lt;/code&gt; value in their tables and decode the debug tags info to find the address of the return pointer; then repeat this for every other stack frame.&lt;/p&gt;



&lt;p&gt;Some tools have tried to adapt to this new normal of not having frame-pointers by adding support for DWARF unwinding. perf is one of them. This is however still unsatisfactory on low-end hardware: &lt;code&gt;perf record -g --call-graph=dwarf cog about:blank&lt;/code&gt; will bring a Raspberry Pi 3 to its knees, freezing the entire system until it dies on the hands of the OOM killer. High-end hardware, like desktop PCs, can usually handle using DWARF, but it still &lt;a href=&quot;https://rwmj.wordpress.com/2023/02/14/frame-pointers-vs-dwarf-my-verdict/&quot;&gt;results in much higher overhead&lt;/a&gt;.&lt;/p&gt;



&lt;p&gt;&lt;a href=&quot;https://www.brendangregg.com/blog/2024-03-17/the-return-of-the-frame-pointers.html&quot;&gt;Omitting frame pointers as an optimization has been &lt;strong&gt;increasingly reconsidered in recent years&lt;/strong&gt;&lt;/a&gt;, with &lt;a href=&quot;https://fedoraproject.org/wiki/Changes/fno-omit-frame-pointer&quot;&gt;Fedora 38+&lt;/a&gt;, &lt;a href=&quot;https://ubuntu.com/blog/ubuntu-performance-engineering-with-frame-pointers-by-default&quot;&gt;Ubuntu 24.04+&lt;/a&gt; and &lt;a href=&quot;https://gitlab.archlinux.org/archlinux/rfcs/-/merge_requests/26&quot;&gt;Arch Linux&lt;/a&gt; modifying their build recipes to attempt to &lt;strong&gt;build all packages with frame &lt;code&gt;-fno-omit-frame-pointer&lt;/code&gt;&lt;/strong&gt;. Modern CPUs (especially 64-bit CPUs) have enough registers that dedicating one for this purpose is not the hit to performance it once was. Some people would argue that even if there is a slight performance hit, &lt;a href=&quot;https://pagure.io/fesco/issue/2817#comment-824507&quot;&gt;the gains from users and developers being able to use profilers greatly outweight it&lt;/a&gt;.&lt;/p&gt;



&lt;p&gt;With this modern understanding of what frame pointers are, we will also try to build all packages with frame pointers enabled in an ARM32 environment, so that we can also use a profiler there.&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;Problem: what are the ARM32 frame pointer ABIs, really?&lt;/h3&gt;



&lt;h4 class=&quot;wp-block-heading&quot;&gt;APCS frames&lt;/h4&gt;



&lt;p&gt;The (old and deprecated) APCS spec specified an optional frame pointer ABI. When you pass the (now deprecated) &lt;code&gt;-mapcs-frame&lt;/code&gt; flag to gcc, you tell it to use the frame pointer structures defined in APCS. Here is a descriptive diagram from page 629 of the &lt;a href=&quot;https://www.4corn.co.uk/archimedes.php&quot;&gt;Acorn Archimedes&lt;/a&gt;&amp;#8216; &lt;a href=&quot;https://www.4corn.co.uk/archive/docs/Archimedes%20Programmer's%20Reference%20Manual%20-%20Volume%202-opt.pdf&quot;&gt;Programmer Reference Manual&lt;/a&gt; (1987), whose Appendix C is &lt;em&gt;&#8220;ARM Procedure Call Standard&#8221;&lt;/em&gt;:&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img width=&quot;741&quot; height=&quot;421&quot; src=&quot;https://blogs.igalia.com/aboya/files/2025/09/APCS_frame_pointers.png&quot; alt=&quot;At the instant of an external procedure call, the value in fp is zero or it points to a data structure that gives information about the sequence of outstanding procedure calls. This structure is in the following format: fp register points to (in decreasing address order): save mask pointer, return link value, return sp value, return fp value&quot; class=&quot;wp-image-151&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Note: &amp;#8220;save mask pointer&amp;#8221; is meant point to the instruction that pushed this structure (ostensibly at the beginning of the function). Because in ARM you can push many registers in the stack in a single instruction, that instruction effectively contains a mask of all the registers that have been saved in the stack, hence the name &#8220;save mask&#8221;. &lt;/figcaption&gt;&lt;/figure&gt;



&lt;p&gt;Here is a simple function that we will use to compare the frame pointer ABIs:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code&quot;&gt;&lt;code&gt;extern void show_sum(int a);
extern void show_diff(int b);

int do_operations(int a, int b) {
    int sum = a + b;
    show_sum(sum);
    int diff = a - b;
    show_diff(diff);
    int xor = a ^ b;
    return xor;
}&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;This is the assembly generated by gcc:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code&quot;&gt;&lt;code&gt;$ arm-linux-gcc -mcpu=cortex-a53 -marm -mapcs-frame -gdwarf-4 -fno-omit-frame-pointer -O2 -g -c add.c &amp;amp;&amp;amp; arm-linux-gnu-objdump -S example.o
int do_operations(int a, int b) {
   0:	e1a0c00d 	mov	ip, sp
   4:	e92dd830 	push	{r4, r5, fp, ip, lr, pc}
   8:	e1a04001 	mov	r4, r1
   c:	e1a05000 	mov	r5, r0
  10:	e24cb004 	sub	fp, ip, #4
    int sum = a + b;
    show_sum(sum);
  14:	e0800001 	add	r0, r0, r1
  18:	ebfffffe 	bl	0 &amp;lt;show_sum&amp;gt;
    int diff = a - b;
    show_diff(diff);
  1c:	e0450004 	sub	r0, r5, r4
  20:	ebfffffe 	bl	0 &amp;lt;show_diff&amp;gt;
    int xor = a ^ b;
    return xor;
}
  24:	e0250004 	eor	r0, r5, r4
  28:	e89da830 	ldm	sp, {r4, r5, fp, sp, pc}&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Here &lt;code&gt;ip&lt;/code&gt; is used as a temporary to hold the value of &lt;code&gt;sp&lt;/code&gt; before the &lt;code&gt;push&lt;/code&gt;. The resulting stack matches the one in the old APCS document as we could expect:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code&quot;&gt;&lt;code&gt;fp points here: | pc at time of push (i.e. savemask pointer) |
                | saved lr                                   |
                | ip (i.e. the saved sp before the push)     |
                | saved fp                                   |&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;We can obtain the call chain by looking at the &lt;em&gt;fp&lt;/em&gt; register and traversing the linked list of frame records: the saved &lt;em&gt;lr&lt;/em&gt; contains the return function for that stack frame, and by extension, who called that function. We continue traversing the stack upwards until we find a NULL pointer indicating the end of the linked list.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full&quot;&gt;&lt;img width=&quot;480&quot; height=&quot;608&quot; src=&quot;https://blogs.igalia.com/aboya/files/2026/01/stack_frame_pointers_apcs.png&quot; alt=&quot;&quot; class=&quot;wp-image-170&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Stack diagram of APCS frame records. The &lt;em&gt;fp&lt;/em&gt; register points to the saved &lt;em&gt;pc&lt;/em&gt;. &#171;&lt;em&gt;saved fp&lt;/em&gt;&#187; is the previous value of &lt;em&gt;fp&lt;/em&gt;, and hence points to a previous &lt;em&gt;saved pc&lt;/em&gt; in the stack. Since the saved registers are specified to appear always in the same number and order, the call chain can be traversed like a linked list. The linked list ends when we encounter a null &lt;em&gt;fp&lt;/em&gt;.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;h4 class=&quot;wp-block-heading&quot;&gt;AAPCS frames, clang&lt;/h4&gt;



&lt;p&gt;It may seem weird that I just spend that much time above showing a very old ABI (APCS). Especially because if you look at the modern &lt;a href=&quot;https://github.com/ARM-software/abi-aa/blob/c51addc3dc03e73a016a1e4edf25440bcac76431/aapcs32/aapcs32.rst#the-frame-pointer&quot;&gt;AAPCS spec today&lt;/a&gt; you&amp;#8217;ll see frame pointers also defined.&lt;/p&gt;



&lt;p&gt;However, if you scroll to the &lt;em&gt;&lt;a href=&quot;https://github.com/ARM-software/abi-aa/blob/c51addc3dc03e73a016a1e4edf25440bcac76431/aapcs32/aapcs32.rst#212change-history&quot;&gt;change history&lt;/a&gt;&lt;/em&gt;, you&amp;#8217;ll also notice it was only added in January 2020, whereas AAPCS had been around for 17 years before. &lt;strong&gt;This is the real source of problems:&lt;/strong&gt; as far as I can tell, during these &lt;strong&gt;17 years&lt;/strong&gt; compilers had &lt;strong&gt;no official guidance on any frame pointer ABI for AAPCS&lt;/strong&gt;.&lt;/p&gt;



&lt;p&gt;Making things worse, &lt;strong&gt;GCC and clang ended up with similar but mutually incompatible frame pointer ABIs&lt;/strong&gt;. The official AAPCS frame pointer ABI sided with clang&amp;#8217;s. It looks like this:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code&quot;&gt;&lt;code&gt;$ clang -target arm-linux-gnueabihf -g -gdwarf-4 -mcpu=cortex-a53 -c -O2 -fno-omit-frame-pointer -c example.c &amp;amp;&amp;amp; arm-linux-gnu-objdump -S example.o
int do_operations(int a, int b) {
   0:	e92d4830 	push	{r4, r5, fp, lr}
   4:	e28db008 	add	fp, sp, #8
   8:	e1a05000 	mov	r5, r0
    int sum = a + b;
   c:	e0810000 	add	r0, r1, r0
  10:	e1a04001 	mov	r4, r1
    show_sum(sum);
  14:	ebfffffe 	bl	0 &amp;lt;show_sum&amp;gt;
    int diff = a - b;
  18:	e0450004 	sub	r0, r5, r4
    show_diff(diff);
  1c:	ebfffffe 	bl	0 &amp;lt;show_diff&amp;gt;
    int xor = a ^ b;
  20:	e0240005 	eor	r0, r4, r5
    return xor;
  24:	e8bd8830 	pop	{r4, r5, fp, pc}&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Only two words are pushed in the stack: &lt;em&gt;fp&lt;/em&gt; and &lt;em&gt;lr&lt;/em&gt;. The &lt;em&gt;fp&lt;/em&gt; register is updated to point to the the most recently saved &lt;em&gt;fp&lt;/em&gt; in the stack.&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full is-resized&quot;&gt;&lt;img width=&quot;750&quot; height=&quot;850&quot; src=&quot;https://blogs.igalia.com/aboya/files/2026/01/stack_frame_pointers_aapcs.png&quot; alt=&quot;&quot; class=&quot;wp-image-171&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Stack diagram of AAPCS frame records. The &lt;em&gt;fp&lt;/em&gt; register points directly to the previous &lt;em&gt;saved fp&lt;/em&gt; in the stack. Adjacent to it is the &lt;em&gt;saved lr&lt;/em&gt; containing the return address of the calling function.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;h4 class=&quot;wp-block-heading&quot;&gt;GCC frames&lt;/h4&gt;



&lt;p&gt;If you pass &lt;code&gt;-marm -fno-omit-frame-pointer&lt;/code&gt; to gcc (as of 15.2), this is what the resulting frame pointer ABI looks like:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code&quot;&gt;&lt;code&gt;$ arm-linux-gcc -mcpu=cortex-a53 -marm -gdwarf-4 -fno-omit-frame-pointer -O2 -g -c example.c &amp;amp;&amp;amp; arm-linux-gnu-objdump -S example.o
int do_operations(int a, int b) {
   0:	e92d4830 	push	{r4, r5, fp, lr}
   4:	e1a04001 	mov	r4, r1
   8:	e1a05000 	mov	r5, r0
   c:	e28db00c 	add	fp, sp, #12
    int sum = a + b;
    show_sum(sum);
  10:	e0800001 	add	r0, r0, r1
  14:	ebfffffe 	bl	0 &amp;lt;show_sum&amp;gt;
    int diff = a - b;
    show_diff(diff);
  18:	e0450004 	sub	r0, r5, r4
  1c:	ebfffffe 	bl	0 &amp;lt;show_diff&amp;gt;
    int xor = a ^ b;
    return xor;
}
  20:	e0250004 	eor	r0, r5, r4
  24:	e8bd8830 	pop	{r4, r5, fp, pc}&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;This is very similar to what ended up becoming the official AAPCS frame pointer ABI and to what clang does &lt;em&gt;&lt;strong&gt;except that fp points to the saved lr&lt;/strong&gt;&lt;/em&gt;, rather than to the saved &lt;em&gt;fp&lt;/em&gt; directly. This is what it ends up looking like:&lt;/p&gt;



&lt;figure class=&quot;wp-block-image size-full is-resized&quot;&gt;&lt;img width=&quot;750&quot; height=&quot;850&quot; src=&quot;https://blogs.igalia.com/aboya/files/2026/01/stack_frame_pointers_gcc_arm.png&quot; alt=&quot;&quot; class=&quot;wp-image-172&quot; /&gt;&lt;figcaption class=&quot;wp-element-caption&quot;&gt;Stack diagram of GCC frame records when building for ARM32 with &lt;code&gt;-fno-omit-frame-pointer&lt;/code&gt;.  The &lt;em&gt;fp&lt;/em&gt; register points to the &lt;em&gt;saved lr&lt;/em&gt; in the stack.&lt;/figcaption&gt;&lt;/figure&gt;



&lt;h4 class=&quot;wp-block-heading&quot;&gt;What about Thumb?&lt;/h4&gt;



&lt;p&gt;While I&amp;#8217;ve learned a lot about Thumb while working on this, I would be very cautious trying to make use of frame pointers in Thumb. They&amp;#8217;re even messier and currently broken in GCC. For more details, you can keep reading this section.&lt;/p&gt;



&lt;h5 class=&quot;wp-block-heading&quot;&gt;r7 as frame pointer register&lt;/h5&gt;



&lt;p&gt;Thumb in stack traces complicates things significantly. Note that &lt;strong&gt;r11 is a &#8220;high register&#8221;&lt;/strong&gt; in Thumb, which limits in how many different instructions it can be used efficiently. This is &lt;strong&gt;especially a problem in the original Thumb-1&lt;/strong&gt;, which doesn&amp;#8217;t have an instruction to push/pop low registers directly and you would typically need 3 additional instructions in the prologue and 3 additional instructions in the epilogue.&lt;/p&gt;



&lt;p&gt;The above is much less of a concern with the now ubiquitous Thumb-2, which has 32-bit instructions for push/pop and arithmetic on high registers. However, as a consequence of this historical problem, you will see that in a default Linux setup &lt;strong&gt;both gcc and clang use r7 as frame pointer register in Thumb code&lt;/strong&gt;.&lt;/p&gt;



&lt;pre class=&quot;wp-block-code&quot;&gt;&lt;code&gt;$ clang -target arm-linux-gnueabihf -mcpu=cortex-a53 -mthumb -gdwarf-4 -fno-omit-frame-pointer -O2 -g -c example.c &amp;amp;&amp;amp; arm-linux-gnu-objdump -S example.o
int do_operations(int a, int b) {
   0:	b5b0      	push	{r4, r5, r7, lr}
   2:	af02      	add	r7, sp, #8
   4:	4605      	mov	r5, r0
    int sum = a + b;
   6:	4408      	add	r0, r1
   8:	460c      	mov	r4, r1
    show_sum(sum);
   a:	f7ff fffe 	bl	0 &amp;lt;show_sum&amp;gt;
    int diff = a - b;
   e:	1b28      	subs	r0, r5, r4
    show_diff(diff);
  10:	f7ff fffe 	bl	0 &amp;lt;show_diff&amp;gt;
    int xor = a ^ b;
  14:	ea84 0005 	eor.w	r0, r4, r5
    return xor;
  18:	bdb0      	pop	{r4, r5, r7, pc}&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;The layout clang uses is the &lt;strong&gt;same as the official AAPCS ABI, but using r7 instead of the r11&lt;/strong&gt;. Assuming there is no mixing of ARM and Thumb &#8212; the call chain can be recovered with the same traversal algorithm.&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;On GCC, however, Thumb frame pointers are unviable for call chain recovery&lt;/strong&gt;, as the GCC &lt;a href=&quot;https://bugs.llvm.org/show_bug.cgi?id=18505#c5&quot;&gt;sets r7 to the most recent position in the stack&lt;/a&gt;, which makes it impossible to know the position of the saved lr and the previous node pointer within the stack without additional information.&lt;/p&gt;



&lt;h5 class=&quot;wp-block-heading&quot;&gt;Using r11 for both ARM and Thumb&lt;/h5&gt;



&lt;p&gt;Using different frame pointer registers for different modes is problematic, as code in one mode (typically ARM) will &lt;strong&gt;frequently clobber the register used by the other mode&lt;/strong&gt; (typically Thumb). Both r7 and r11 are caller-saved registers, so the information is there in the stack, but the stack and register values is not enough to locate them.&lt;/p&gt;



&lt;p&gt;A simpler approach is to use r11 for both modes, which is much less awkward in Thumb-2. This is what the official AAPCS spec specifies. Recent versions of &lt;strong&gt;clang&lt;/strong&gt; can be told to do this with &lt;code&gt;&lt;strong&gt;-mframe-chain=aapcs&lt;/strong&gt;&lt;/code&gt; (or alternatively, &lt;code&gt;-mframe-chain=aapcs+leaf&lt;/code&gt; if frame pointers on leaf functions are also desired).&lt;/p&gt;



&lt;pre class=&quot;wp-block-code&quot;&gt;&lt;code&gt;$ clang -target arm-linux-gnueabihf -mcpu=cortex-a53 -mthumb -gdwarf-4 -fno-omit-frame-pointer -mframe-chain=aapcs -O2 -g -c example.c &amp;amp;&amp;amp; arm-linux-gnu-objdump -S example.o
int do_operations(int a, int b) {
   0:	e92d 4830 	stmdb	sp!, {r4, r5, fp, lr}
   4:	f10d 0b08 	add.w	fp, sp, #8
   8:	4605      	mov	r5, r0
    int sum = a + b;
   a:	4408      	add	r0, r1
   c:	460c      	mov	r4, r1
    show_sum(sum);
   e:	f7ff fffe 	bl	0 &amp;lt;show_sum&amp;gt;
    int diff = a - b;
  12:	1b28      	subs	r0, r5, r4
    show_diff(diff);
  14:	f7ff fffe 	bl	0 &amp;lt;show_diff&amp;gt;
    int xor = a ^ b;
  18:	ea84 0005 	eor.w	r0, r4, r5
    return xor;
  1c:	e8bd 8830 	ldmia.w	sp!, {r4, r5, fp, pc}&lt;/code&gt;&lt;/pre&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;Frame pointer sadness&lt;/h3&gt;



&lt;p&gt;There are problems with frame pointers in ARM other than the incompatible ABIs. In fact, I kept finding more and more sadness the more I worked on this post.&lt;/p&gt;



&lt;h4 class=&quot;wp-block-heading&quot;&gt;GCC frames can&amp;#8217;t be unwinded in leaf functions&lt;/h4&gt;



&lt;p&gt;While &lt;code&gt;-fno-omit-frame-pointer&lt;/code&gt; will make GCC push &lt;em&gt;fp&lt;/em&gt; to the stack, it doesn&amp;#8217;t disable the &#8220;link register save elimination&#8221; optimization. This messes up with leaf functions. Consider the following trivial function:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code&quot;&gt;&lt;code&gt;void simple_nop(void) {
    __asm__(&quot;nop&quot;);
}&lt;/code&gt;&lt;/pre&gt;



&lt;pre class=&quot;wp-block-code&quot;&gt;&lt;code&gt;$ arm-linux-gcc -mcpu=cortex-a53 -marm -gdwarf-4 -fno-omit-frame-pointer -O2 -g -c simple_nop.c -S &amp;amp;&amp;amp; cat simple_nop.s
simple_nop:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, &amp;#091;sp, #-4]!
	add	fp, sp, #0
	.syntax divided
@ 31 &quot;example.c&quot; 1
	nop
@ 0 &quot;&quot; 2
	.arm
	.syntax unified
	add	sp, fp, #0
	@ sp needed
	ldr	fp, &amp;#091;sp], #4
	bx	lr
	.size	simple_nop, .-simple_nop&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Notice that, unlike in the previously shown GCC frames, here the &lt;em&gt;fp&lt;/em&gt; register is made to point to the saved &lt;em&gt;fp&lt;/em&gt; in the stack, rather than the saved &lt;em&gt;lr&lt;/em&gt;. This means that an unwinder will &lt;strong&gt;(1)&lt;/strong&gt; &lt;strong&gt;wrongly read&lt;/strong&gt; a &lt;em&gt;next node&lt;/em&gt; pointer instead of the function return address that it would expect, &lt;strong&gt;(2)&lt;/strong&gt; will interpret &lt;strong&gt;whatever random variable&lt;/strong&gt; was pushed in the stack immediately before as the &lt;em&gt;next node&lt;/em&gt; in the call chain.&lt;/p&gt;



&lt;p&gt;I&amp;#8217;m surprised I only caught this long after having written an unwinder for GCC frames and having seen it produce sensible flamecharts, but I&amp;#8217;m pretty sure this is not just a synthetic problem, since I can see the same problematic assembly by objdump&amp;#8217;ing GStreamer libraries.&lt;/p&gt;



&lt;p&gt;The deprecated APCS frames (&lt;code&gt;-mapcs-frame&lt;/code&gt;) are not affected by this bug.&lt;/p&gt;



&lt;h4 class=&quot;wp-block-heading&quot;&gt;Getting the top frame is racy during the prologue&lt;/h4&gt;



&lt;p&gt;At the top of a stack trace you expect to see the currently running function, at the currently running instruction. This is normally obtained by reading the value of the &lt;em&gt;pc&lt;/em&gt; register. Then, by looking at the &lt;em&gt;fp&lt;/em&gt; register and inspecting the topmost frame record we can see who called this function and traverse the chain.&lt;/p&gt;



&lt;p&gt;However, this also means there is a small window of time from the moment a call is done with &lt;code&gt;bl&lt;/code&gt; and until the &lt;em&gt;fp&lt;/em&gt; register is updated to point to the newly created frame record in which the &lt;em&gt;pc&lt;/em&gt; register points to the callee and the caller is recorded in the &lt;em&gt;lr&lt;/em&gt; register, but hasn&amp;#8217;t been put in a frame record yet.&lt;/p&gt;



&lt;p&gt;This results on the caller function seemingly disappearing from the stack trace for a brief moment, as seen here in a instruction-per-instruction simulation:&lt;/p&gt;



&lt;pre class=&quot;wp-block-code&quot;&gt;&lt;code&gt;* 1000(main+0)
* 1004(main+4)
* 1008(main+8)
* 1012(main+12)
* 2000(leaf1+0)
* 2004(leaf1+4)
* 1012(main+12) &amp;lt;- 2008(leaf1+8)
* 1012(main+12) &amp;lt;- 2012(leaf1+12)
* 1012(main+12) &amp;lt;- 2016(leaf1+16)&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;I can&amp;#8217;t think of an alternative call chain traversal algorithm that solves this problem using only the stack and registers. While it seems tempting to also make use of the &lt;em&gt;lr&lt;/em&gt; register directly to reconstruct the missing frame, that causes other problems later when the callee returns. &lt;a href=&quot;https://developers.redhat.com/articles/2024/10/30/limitations-frame-pointer-unwinding#function_prologues_and_epilogues&quot;&gt;I&amp;#8217;m also not the first person to point out this problem.&lt;/a&gt;&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;Conclusions&lt;/h3&gt;



&lt;p&gt;Frame pointers in ARM32 are messy &#8212; especially compared to ARM64 or x86_64. A standard ABI for them has only been specified few years ago, with support for it is pretty spotty and divided into incompatible alternatives.&lt;/p&gt;



&lt;p&gt;The status of frame pointers for ARM32 in GCC is much worse than I thought when I started working on this: my impression now is that the ostensibly deprecated &lt;code&gt;-mapcs-frame&lt;/code&gt; is the only frame pointer ABI GCC handles in a reliable way, and I wouldn&amp;#8217;t be too surprised if it turned out that any usefulness of the non-APCS frame pointers in ARM32 with GCC is coincidental rather than intentional. This is certainly not helped by the long lasting specification void in this area.&lt;/p&gt;



&lt;p&gt;The default frame pointer ABI of GCC is only reliable during non-leaf functions and as long as Thumb is not used. With that big caveat, they&amp;#8217;re still potentially useful. Furthermore, the GCC-specific deficiencies I&amp;#8217;ve explained here could be fixed, especially now that there is some official ABI guidance.&lt;/p&gt;



&lt;p&gt;Clang has positively surprised me during my investigation. I started looking at it only for comparison, but was happy to see support for the new AAPCS frame pointer ABI in Thumb as well, as well as a general good handling of edge cases.&lt;/p&gt;



&lt;p&gt;On top of that, seeing the limitations of frame pointers has also made me a bit curious about the alternative approaches for improved accuracy. Most of those require lookup tables and therefore are generally going to be slower, but how much they can be optimized is still an area of ongoing research.&lt;/p&gt;



&lt;h3 class=&quot;wp-block-heading&quot;&gt;Additional resources&lt;/h3&gt;



&lt;p&gt;Analyzing code that uses the stack by hand is error prone, so eventually I &lt;a href=&quot;https://gist.github.com/ntrrgc/250fbc28607d8e0057115165c13313ac&quot;&gt;wrote a simulator&lt;/a&gt; for testing frame pointer ABIs and the algorithms to traverse them.&lt;/p&gt;



&lt;p&gt;If you want to look at the compiler sources, you&amp;#8217;ll be mostly intersted in:&lt;/p&gt;



&lt;ul class=&quot;wp-block-list&quot;&gt;
&lt;li&gt;clang: &lt;code&gt;llvm/lib/Target/ARM/ARMFrameLowering.cpp&lt;/code&gt;. Contains the code for generating prologues and epilogues. Search &lt;code&gt;FramePtr&lt;/code&gt; to find the relevant code.&lt;/li&gt;



&lt;li&gt;gcc: &lt;code&gt;gcc/config/arm/arm.c&lt;/code&gt;. Look for &lt;code&gt;HARD_FRAME_POINTER_REGNUM&lt;/code&gt;. The prologue contents are emitted in &lt;code&gt;arm_expand_prologue()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;



&lt;hr class=&quot;wp-block-separator has-alpha-channel-opacity&quot; /&gt;


&lt;ol class=&quot;wp-block-footnotes&quot;&gt;&lt;li id=&quot;39983882-7b2f-4807-bbc7-f9822cb05116&quot;&gt;The earliest variant of APCS&#8212;referred to as APCS-A&#8212;mapped sp to r12 instead of r13. fp was also mapped to r10 instead of r11. This is explained in page 1762 of the &lt;a href=&quot;https://www.4corn.co.uk/archive/docs/RISC%20OS%20Programmer's%20Reference%20Manual%20-%20Volume%204-opt.pdf&quot;&gt;RISC OS Programmer Reference Manual (1989)&lt;/a&gt;, which describes what would &lt;a href=&quot;https://www.cl.cam.ac.uk/~fms27/teaching/2001-02/arm-project/02-sort/apcs.txt&quot;&gt;later&lt;/a&gt; be called APCS-2.&lt;br /&gt;I&amp;#8217;m also leaving aside many complexities of APCS variants, most notably &lt;em&gt;chunked stacks&lt;/em&gt;, where the program stack wouldn&amp;#8217;t be in contiguous memory, but instead in a linked list of chunks, useful for multi-threading in processors without a &lt;a href=&quot;https://en.wikipedia.org/wiki/Memory_management_unit&quot;&gt;Memory Management Unit&lt;/a&gt;. &lt;a href=&quot;https://blogs.igalia.com/aboya/feed/#39983882-7b2f-4807-bbc7-f9822cb05116-link&quot;&gt;&lt;img src=&quot;https://s.w.org/images/core/emoji/16.0.1/72x72/21a9.png&quot; alt=&quot;&#8617;&quot; class=&quot;wp-smiley&quot; /&gt;&#65038;&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;img src=&quot;https://stats.igalia.com/piwik.php?idsite=57&amp;rec=1&amp;url=https%3A%2F%2Fblogs.igalia.com%2Faboya%2F2026%2F08%2F27%2Fgetting-perf-to-work-on-arm32-linux-part-3-the-abis%2F%3Fpk_campaign%3Dfeed%26pk_kwd%3Dgetting-perf-to-work-on-arm32-linux-part-3-the-abis&amp;action_name=Getting%20perf%20to%20work%20on%20ARM32%20Linux%3A%20Part%203%2C%20the%20ABIs&amp;urlref=https%3A%2F%2Fblogs.igalia.com%2Faboya%2Ffeed%2F&quot; width=&quot;0&quot; height=&quot;0&quot; alt=&quot;&quot; /&gt;                </content>
		<author>
			<name>aboya</name>
			<uri>https://blogs.igalia.com/aboya</uri>
		</author>
	</entry>

	<entry>
		<title>Igalia WebKit Team: WebKit Igalia Periodical #74</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/webkit/blog/2026/wip-74/"/>
		<id>https://blogs.igalia.com/webkit/blog/2026/wip-74/</id>
		<updated>2026-08-24T23:30:34+00:00</updated>
		<content type="html">
&lt;p&gt;Update on what happened in WebKit in the week from August 17 to August 24.&lt;/p&gt;
&lt;p&gt;
Another periodical packed with updates on the graphics, multimedia, and
tooling fronts. Which sure has to do with preparing for the upcoming 2.54.x
release series, that now has release candidates published. Also, do not miss
a new stable release being published with fixes for security issues, and
make sure to update.
&lt;/p&gt;
&lt;h2 id=&quot;cross-port-cat&quot;&gt;Cross-Port &#128049;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://bugs.webkit.org/show_bug.cgi?id=207209&quot;&gt;Fixed&lt;/a&gt;
&lt;a rel=&quot;external&quot; href=&quot;https://bugs.webkit.org/show_bug.cgi?id=315925&quot;&gt;flakiness&lt;/a&gt; in the Web
Inspector heap snapshot tests.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319307@main&quot;&gt;Extended&lt;/a&gt; the &lt;code&gt;webkit-sysprof analyze&lt;/code&gt;
tool cover the remaining marks emitted along the rendering pipeline, from
&lt;code&gt;RenderTreeBuild&lt;/code&gt; and &lt;code&gt;CompositingUpdate&lt;/code&gt; through &lt;code&gt;FinalizeRenderingUpdate&lt;/code&gt;,
&lt;code&gt;RenderLayerTree&lt;/code&gt; and &lt;code&gt;WaitForCompositionCompletion&lt;/code&gt; down to the individual
tile marks, pulling the tile count and the dirty region out of the mark
messages as statistics next to the durations. The statistics tables also gained
mean and median columns, so a captured trace now shows where the time in a
frame actually goes.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://bugs.webkit.org/show_bug.cgi?id=225423&quot;&gt;Fixed&lt;/a&gt; test
&lt;code&gt;fast/canvas/canvas-composite-text-alpha.html&lt;/code&gt;, and improved the state of
several other tests which relied on &lt;code&gt;setTimeout()&lt;/code&gt;.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319475@main&quot;&gt;Implemented moving steps&lt;/a&gt; for
&lt;code&gt;&amp;lt;option&amp;gt;&lt;/code&gt; elements.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319347@main&quot;&gt;Add support for asynchronous scrolling with touch
events&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Touch events are now dispatched to the &lt;code&gt;EventDispatcher&lt;/code&gt; thread in the Web
Process, enabling smooth scrolling even when the main thread is busy.
Additionally, this change fixed a bug where precise scrolling delta wheel
events, dispatched by touchpads, failed to trigger asynchronous scrolling.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Fixed several accessibility related tests and added support for missing
keywords in the GLib-based ports (GTK &amp;amp; WPE):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://bugs.webkit.org/show_bug.cgi?id=213874&quot;&gt;[GLIB] accessibility/keyevents-posted-for-increment-actions.html times out&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://bugs.webkit.org/show_bug.cgi?id=322020&quot;&gt;[GLIB][a11y] WTR: Add missing implementation of takeFocus&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://bugs.webkit.org/show_bug.cgi?id=322007&quot;&gt;[GLIB][a11y] WTR: Add missing implementation of dismiss&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://bugs.webkit.org/show_bug.cgi?id=322094&quot;&gt;[GLIB][a11y] WTR: Add missing implementation of focusableAncestor&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;


&lt;h3 id=&quot;multimedia-movie-camera&quot;&gt;Multimedia &#127909;&lt;/h3&gt;
&lt;div class=&quot;wip-description&quot;&gt;
&lt;p&gt;GStreamer-based multimedia support for WebKit, including (but not limited to) playback, capture, WebAudio, WebCodecs, and WebRTC.&lt;/p&gt;
&lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/pull/70123&quot;&gt;Ensure&lt;/a&gt; that multimedia on pages
restored from the back-forward cache is correctly processed without errors or
reloading.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;The robustness level is now &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319531@main&quot;&gt;queried from the
CDM&lt;/a&gt; (if supported) when using
Encrypted Media Extensions (EME).&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Added video rendering &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319367@main&quot;&gt;support for Qualcomm hardware-accelerated
decoders&lt;/a&gt; when the Skia compositor is
in use, complementing the &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/307174@main&quot;&gt;earlier TextureMapper-only
support&lt;/a&gt; that left such videos blank
with the new compositor.&lt;/p&gt;
&lt;p&gt;Video frame processing now relies on the driver's implicit YUV to RGB
conversion, steered by the colour space and sample range hints taken from the
frame colorimetry, with a hint-free import as fallback.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;graphics-frame-photo&quot;&gt;Graphics &#128444;&#65039;&lt;/h3&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319388@main&quot;&gt;Fixed how &lt;code&gt;&amp;lt;feImage&amp;gt;&lt;/code&gt; paints its referenced
element&lt;/a&gt; in the Layer-Based SVG Engine
(LBSE), which still used a helper written for the legacy SVG engine, where SVG
content never had layers, so it used to paint renderers directly and skipped
any child that owns a &lt;code&gt;RenderLayer&lt;/code&gt; under LBSE, silently dropping its
&lt;code&gt;opacity&lt;/code&gt;, mask, filter or 3D transform. The referenced content is now painted
through the layer tree, the way &lt;code&gt;&amp;lt;mask&amp;gt;&lt;/code&gt;,&lt;code&gt;&amp;lt;clipPath&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;pattern&amp;gt;&lt;/code&gt; and
&lt;code&gt;&amp;lt;marker&amp;gt;&lt;/code&gt; content already is.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Made SVG &lt;code&gt;mask&lt;/code&gt; &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319390@main&quot;&gt;no longer force a
&lt;code&gt;RenderLayer&lt;/code&gt;&lt;/a&gt; in the Layer-Based SVG
Engine (LBSE), mirroring the &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318375@main&quot;&gt;earlier change for
&lt;code&gt;clip-path&lt;/code&gt;&lt;/a&gt;. A mask is now applied
during painting by &lt;code&gt;SVGNonLayerClippingAndMaskingScope&lt;/code&gt;, which opens one
transparency layer capturing the renderer's foreground and composites the mask
over it afterwards, and which also absorbed the clips that cannot be expressed
as a path. A container with a mask keeps its layer, since the mask covers its
whole subtree, while a leaf stays layer-free. This further reduces the layer
overhead that has been holding LBSE back against the legacy SVG engine.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319306@main&quot;&gt;Skipped scroll coordination&lt;/a&gt; for
composited layers that have no scrolling role, where the per-layer update
previously walked every branch to detach roles the layer had never registered
for, only to hand back the parent node ID unchanged. Cutting that work out
shortens every compositing update, which matters for composition-heavy
workloads.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319284@main&quot;&gt;Fixed rendering of an outermost &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; with an empty
&lt;code&gt;viewBox&lt;/code&gt;&lt;/a&gt; in the Layer-Based SVG
Engine (LBSE), which per the &lt;a rel=&quot;external&quot; href=&quot;https://www.w3.org/TR/SVG2/coords.html#ViewBoxAttribute&quot;&gt;SVG
specification&lt;/a&gt; should
disable painting when the width or height is zero, matching what the legacy
engine already did.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319306@main&quot;&gt;Skipped scroll coordination work for layers that have no scrolling
role&lt;/a&gt; during compositing updates, where
&lt;code&gt;updateScrollCoordinationForLayer&lt;/code&gt; previously walked every branch to detach
roles the layer had never registered for, only to hand back the unchanged
parent node ID.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;releases-package&quot;&gt;Releases &#128230;&#65039;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://webkitgtk.org/2026/08/19/webkitgtk2.52.6-released.html&quot;&gt;WebKitGTK
2.52.6&lt;/a&gt; and
&lt;a rel=&quot;external&quot; href=&quot;https://wpewebkit.org/release/wpewebkit-2.52.6.html&quot;&gt;WPE WebKit 2.52.6&lt;/a&gt; have
been released, including a number of fixes for security issues covered in the
accompanying security advisory &lt;code&gt;WSA-2026-0005&lt;/code&gt;
(&lt;a rel=&quot;external&quot; href=&quot;https://webkitgtk.org/security/WSA-2026-0005.html&quot;&gt;GTK&lt;/a&gt;,
&lt;a rel=&quot;external&quot; href=&quot;https://wpewebkit.org/security/WSA-2026-0005.html&quot;&gt;WPE&lt;/a&gt;). It is recommended
for everybody to update to these stable releases.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Stabilization for the upcoming 2.54.x release series for both the GTK and WPE
ports is ongoing, with the first stable release, 2.54.0, expected around
mid-September 2026. In the meantime release candidates &lt;a rel=&quot;external&quot; href=&quot;https://webkitgtk.org/2026/08/21/webkitgtk2.53.91-released.html&quot;&gt;WebKitGTK
2.53.91&lt;/a&gt; and
&lt;a rel=&quot;external&quot; href=&quot;https://wpewebkit.org/release/wpewebkit-2.53.91.html&quot;&gt;WPE WebKit 2.53.91&lt;/a&gt; have
been released.&lt;/p&gt;
&lt;p&gt;Those interested in previewing the work done by the team in the last half year,
including the new Skia-based compositor that is expected to eventually replace
the aging TextureMapper, may want to give them a try and &lt;a rel=&quot;external&quot; href=&quot;https://bugs.webkit.org&quot;&gt;report any issues
found in Bugzilla&lt;/a&gt;.&lt;/p&gt;
  &lt;/div&gt;
&lt;div class=&quot;wip-end&quot;&gt;
&lt;p&gt;That&#8217;s all for this week!&lt;/p&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Igalia WebKit Team</name>
			<uri>https://blogs.igalia.com/webkit</uri>
		</author>
	</entry>

	<entry>
		<title>Brian Kardell: Enhanced Spell Checking on the Web</title>
		<link rel="alternate" type="text/html" href="https://bkardell.com/blog/EnhancedSpellchecking.html"/>
		<id>https://bkardell.com/blog/EnhancedSpellchecking.html</id>
		<updated>2026-08-18T04:00:00+00:00</updated>
		<content type="html">
&lt;h1 class=&quot;contextual-heading&quot;&gt;Enhanced Spell Checking on the Web&lt;/h1&gt;
  
  
  
  
  &lt;p class=&quot;segue&quot;&gt;Here's some interesting stuff about browsers you might not know, and a new API proposal that might interest you...&lt;/p&gt;

  &lt;p&gt;You probably already know that if you have an editable area in a page with the &lt;code&gt;spellcheck=true&lt;/code&gt; attribute set on it, then when a user clicks inside that area, it marks words as spelling errors, and you can style spelling errors with CSS. What you might not know is that feature is carefully designed and implemnted to avoid the huge fingerprinting risk of letting people know what's in your dictionary. A lot of the actual details are left to implementations and this means that not only will each OS/language highlight different spelling errors, but so will different browsers on the same machine, or even different profiles in the same browser!&lt;/p&gt; 
  
  &lt;p&gt;But, if you think about websites and apps, they are highly likely to be accepting input related to something fairly &lt;em&gt;specific&lt;/em&gt;, and highly unlikely to be in a common dictionary. Right? Online education is a great example where you'll find students writing words in different domains that are very common in that domain, but aren't in the common dictionary. Mathematics has its own words, so does chemistry, astronomy, and law. But schools are just one example. There are sites related to the stock market - lots of things there might look like gibberish otherwise. Or your hospital and doctor reports. The sites and apps for wine afficianados, or coffee lovers. There are sites where you submit fan fiction. There are forums where you discuss web development or cloud infrastructure. &lt;em&gt;All of these will have common words that aren't in a general purpose dictionary.&lt;/em&gt;&lt;/p&gt;
  
  &lt;p&gt; That's a problem because it means we're marking lots of words as misspelled, but they aren't. Too many false positives and we easily overlook the ones that really are missspelled. In fact, in some cases it can even feel like more of an annoyance than a help.&lt;/p&gt;
  
  &lt;p&gt;So, there is a &lt;a href=&quot;https://github.com/Igalia/explainers/blob/main/spell-check-dictionary/README.md&quot;&gt;proposal currently in HTML for a new API called SpellCheck Custom Dictionary&lt;/a&gt;. For v1 the proposal is dead simple. It introduces a new &lt;code&gt;document.spellCheckCustomDictionary&lt;/code&gt; with exactly two methods: &lt;code&gt;.addWords(listOfWords)&lt;/code&gt; and &lt;code&gt;.removeWords(listOfWords)&lt;/code&gt; - where &lt;code&gt;listOfWords&lt;/code&gt; is an array of Strings. Those words are simply added to (or removed from) a Set internally which is consulted before consulting any other dictionaries (remember, there can be several) &lt;em&gt;for the lifetime of that document&lt;/em&gt;. It doesn't affect other pages or the profile dictionary, or the browser dictionary or the OS dictionary, or any other things. &lt;/p&gt;
  
  &lt;p&gt;&lt;em&gt;This is currently implemented by Igalia, with funding from Bloomberg Tech. It is currently available in Chrome Canary behind the experimental web platform features flag, and is scheduled to be shipping in on September 8, 2026 behind the same flag.&lt;/em&gt;&lt;/p&gt;

  &lt;p&gt;Because of its simplicity, it also works with JSON pretty nicely, you can just fetch a JSON array and call &lt;code&gt;.addWords&lt;/code&gt; with the result.  Of course, in practice you'll probably want to do this as a kind of progressive enhancement,  not load the JSON immediately, and maybe handle and report various errors.  For a whole lot of developers and use cases, it seems to me that a declarative API would be ideal. But we're not there yet. We have more to figure out with regard to how to express more than exact matches and so on. So, we'll get there... I hope.&lt;/p&gt;

  &lt;p&gt;In the meantime, however, I've made a tiny, but handy &lt;a href=&quot;https://github.com/bkardell/words#domain-dictionaries&quot;&gt;library which speculatively polyfills the basic outline of a declarative form in a safe way&lt;/a&gt;. With this, you just include the script and then you can add
    a &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; tag (or tags) pointing to JSON serializations of arrays of words, and adorn them with a &lt;code&gt;data-spellcheck-dictionary&lt;/code&gt; marker-attribute.&lt;/p&gt;

  &lt;pre&gt;&lt;code class=&quot;language-html&quot;&gt;&amp;lt;script src=&quot;dist/spellcheck-dictionary-loader.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;link href=&quot;terms/domain-terms.json&quot; data-spellcheck-dictionary&amp;gt;
&amp;lt;link href=&quot;terms/stocks.json&quot; data-spellcheck-dictionary&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;p&gt;The script will wait until the initial parse is complete and then check for support. If the browser supports the custom dictionary API, it will load and add the words.&lt;/p&gt;

  &lt;p&gt;There is a &lt;code&gt;/src&lt;/code&gt; and &lt;code&gt;/dist&lt;/code&gt; version of this and it's very tiny (441 bytes over the wire with Brotli) and I expect it works for most common stuff.&lt;/p&gt;
  &lt;p&gt;It's &quot;rough&quot; though and not exactly how we'd probably expect a real implementation to work. For example, if you remove the link, it doesn't remove the words. If you change the &lt;code&gt;href&lt;/code&gt;, it doesn't do anything, and so on. A real implementation would probably do those things. So, if you're interested in playing with something more complete, I've also included a &lt;code&gt;-complete&lt;/code&gt; version of each:  &lt;code&gt;src/spellcheck-dictionary-loader-complete.js&lt;/code&gt; and &lt;code&gt;dist/spellcheck-dictionary-loader-complete.min.js&lt;/code&gt;. The latter is still only &lt;code&gt;770&lt;/code&gt; bytes over the wire with Brotli, but it's up to you how important that use is to you.&lt;/p&gt;
  
  &lt;p&gt;You can get all of the versions from &lt;a href=&quot;https://github.com/bkardell/words#domain-dictionaries&quot;&gt;this repo&lt;/a&gt; where there is also a start on several domain dictionaries to play with. What I think would be really great is to have some shared dictionaries that we work on together, so feel free to send PRs for additional words, this is really only a mostly generated starting list for demonstration purposes.&lt;/p&gt;

  &lt;p&gt;Please, let us know what you think - and thanks again to Bloomberg Tech for the funding!&lt;/p&gt;                </content>
		<author>
			<name>Brian Kardell</name>
			<uri>http://bkardell.com/</uri>
		</author>
	</entry>

	<entry>
		<title>Igalia WebKit Team: WebKit Igalia Periodical #73</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/webkit/blog/2026/wip-73/"/>
		<id>https://blogs.igalia.com/webkit/blog/2026/wip-73/</id>
		<updated>2026-08-17T19:08:35+00:00</updated>
		<content type="html">
&lt;p&gt;Update on what happened in WebKit in the week from August 10 to August 17.&lt;/p&gt;
&lt;p&gt;
Following an extra packed periodical, this week we get back to a more
regular pace with two nice bugfixes, and a new tool to analyze WebKit
performance on Linux!
&lt;/p&gt;
&lt;h2 id=&quot;cross-port-cat&quot;&gt;Cross-Port &#128049;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/pull/70333&quot;&gt;webkit-sysprof toolkit&lt;/a&gt; landed in &lt;code&gt;main&lt;/code&gt; thus introducing a set of tools for processing &lt;a rel=&quot;external&quot; href=&quot;https://gitlab.gnome.org/GNOME/sysprof&quot;&gt;Sysprof&lt;/a&gt; &lt;code&gt;.syscap&lt;/code&gt; capture files recorded from WebKit (GTK/WPE ports). It extracts marks (timeline events) and counters (time-series metrics) from a capture and lets one dump, summarize, analyze, or plot delta-time histograms for them.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;graphics-frame-photo&quot;&gt;Graphics &#128444;&#65039;&lt;/h3&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319121@main&quot;&gt;Fixed filters specified on the outermost &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; element&lt;/a&gt; in the Layer-Based SVG Engine (LBSE), where a &lt;code&gt;filter: url(...)&lt;/code&gt; reference on an SVG root was silently dropped because the layer code skipped it, as the legacy engine used to apply it by itself. The filter region is now resolved against the SVG root's border box in its container's coordinate system, since the outermost &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; is a replaced element in the CSS box tree, not part of the SVG user space its children live in.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/319280@main&quot;&gt;Avoided serializing gradient and pattern transforms&lt;/a&gt; just to answer a presence check in the Layer-Based SVG Engine (LBSE). Asking &lt;code&gt;hasAttribute()&lt;/code&gt; whether &lt;code&gt;gradientTransform&lt;/code&gt; or &lt;code&gt;patternTransform&lt;/code&gt; was specified forced the transform list to be serialized into the attribute map whenever the base value was changed through the SVG DOM, even though that string is never read back, so the check is now answered directly from the typed accessor.&lt;/p&gt;
  &lt;/div&gt;
&lt;div class=&quot;wip-end&quot;&gt;
&lt;p&gt;That&#8217;s all for this week!&lt;/p&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Igalia WebKit Team</name>
			<uri>https://blogs.igalia.com/webkit</uri>
		</author>
	</entry>

	<entry>
		<title>Igalia WebKit Team: WebKit Igalia Periodical #72</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/webkit/blog/2026/wip-72/"/>
		<id>https://blogs.igalia.com/webkit/blog/2026/wip-72/</id>
		<updated>2026-08-10T18:51:04+00:00</updated>
		<content type="html">
&lt;p&gt;Update on what happened in WebKit in the week from July 28 to August 10.&lt;/p&gt;
&lt;p&gt;
Quite a packed pair of weeks this time! The range of updates is big, but some
highlights are the handful of Layer-Based SVG Engine updates, performance
improvements, and the new WPE APIs. Finally, the Web Engines Hackfest
recordings are now published!
&lt;/p&gt;
&lt;h2 id=&quot;cross-port-cat&quot;&gt;Cross-Port &#128049;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/31a2484dd863a7a449323c3c222b47e028c2acf1&quot;&gt;Fixed&lt;/a&gt; &lt;code&gt;webkit_website_data_get_size()&lt;/code&gt; looking up sizes for localStorage, indexedDB, and the DOM Cache.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Enabled support for the &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/File_System_API&quot;&gt;File System&lt;/a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Storage_API&quot;&gt;Storage&lt;/a&gt; APIs.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Added &lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/bc363a82cf22f21fbe5472135e5bafc9b67b0bb3&quot;&gt;WEBKIT_WEBSITE_DATA_FILE_SYSTEM&lt;/a&gt; API to enable fetching/clearing File System data sites use.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;multimedia-movie-camera&quot;&gt;Multimedia &#127909;&lt;/h3&gt;
&lt;div class=&quot;wip-description&quot;&gt;
&lt;p&gt;GStreamer-based multimedia support for WebKit, including (but not limited to) playback, capture, WebAudio, WebCodecs, and WebRTC.&lt;/p&gt;
&lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Landed a &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318708@main&quot;&gt;follow-up fix for the h264 edit list support&lt;/a&gt; to prevent regressions on YouTube MSE Conformance Tests 2019 when using older versions of GStreamer.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318859@main&quot;&gt;Avoided a spurious seek to zero&lt;/a&gt; when seeking to the end of an audio/video when playback starts.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;graphics-frame-photo&quot;&gt;Graphics &#128444;&#65039;&lt;/h3&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318856@main&quot;&gt;Recovered a MotionMark compositing regression&lt;/a&gt; in the Skia backend, where respecting damage information during compositing cost about 20% on the composition suite and more than 50% on two of its tests. Restricting a draw to the damaged area means splitting it into source-rect-to-destination-rect pieces or drawing it under a device-space clip, and neither is needed when the damage already covers the whole draw, which is the common case in those tests because a composited layer is much smaller than a damage grid cell. Those draws are now issued exactly as they would be with damage turned off, avoiding a clip path that flushed the image set batch and left it an order of magnitude smaller, and with the regressions gone, using damage information for compositing was &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318857@main&quot;&gt;enabled again&lt;/a&gt; along with unifying damaged regions that are sent to the system compositor.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318440@main&quot;&gt;Skipped a per-frame visual overflow recomputation&lt;/a&gt; in the container paint cull of the Layer-Based SVG Engine (LBSE). The cull used a cached overflow rect that was recomputed by unioning all descendant bounds on a miss, which happened every frame for containers with an animated transform. It now only runs when the rect is already cached.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318410@main&quot;&gt;Skipped the outline paint pass&lt;/a&gt; for SVG renderers without an &lt;code&gt;outline&lt;/code&gt; in the Layer-Based SVG Engine (LBSE). Every shape used to be painted twice per frame, the second pass being a no-op in the common outline-free case, so guarding it behind &lt;code&gt;hasOutline()&lt;/code&gt; removes a redundant traversal from every frame.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318816@main&quot;&gt;Fixed masked SVG content being cut off&lt;/a&gt; at the edges in the Layer-Based SVG Engine (LBSE), where the mask image was sized over the enclosing integer rect of the mask content bounds in device space while the transparency layer clip was computed differently, losing the outermost pixels. An SVG renderer that is a box (&lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;foreignObject&amp;gt;&lt;/code&gt;) also used the CSS mask clip rect derived from the border box, which leaves out SVG content spilling outside it, and now uses the visual overflow rect instead&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318817@main&quot;&gt;Fixed most of the remaining &lt;code&gt;&amp;lt;mask&amp;gt;&lt;/code&gt; issues&lt;/a&gt; in the Layer-Based SVG Engine (LBSE): masks were displaced on targets whose children carry transforms, the mask region given by &lt;code&gt;x&lt;/code&gt;, &lt;code&gt;y&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; was ignored so content reaching past it was not cut off, and the cached mask image was never dropped on layout, leaving a resized viewport masking with an image rasterized for the old size.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318873@main&quot;&gt;Stopped rebuilding &lt;code&gt;objectBoundingBox&lt;/code&gt; gradients&lt;/a&gt; on every layout size change in the Layer-Based SVG Engine (LBSE), which used to discard the cached gradient and re-collect its attributes (serializing every animated property back to a string, including &lt;code&gt;gradientTransform&lt;/code&gt;) on the next paint. That work is wasted for &lt;code&gt;objectBoundingBox&lt;/code&gt; units, whose coordinates resolve against the object bounding box with the userspace transform recomputed on every paint anyway, so only the clients are repainted now, while &lt;code&gt;userSpaceOnUse&lt;/code&gt; gradients resolve against the viewport and are still invalidated as before.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318882@main&quot;&gt;Cached the SVG fill and stroke paint server directly on the renderer&lt;/a&gt; in the Layer-Based SVG Engine (LBSE), instead of in the shared referenced-resources table living in a renderer's rar data, where every fill and every stroke paid the cost of a hash map lookup just to reach the cache, which gives a small win on the MotionMark/Suits performance test. It also fixed a shape referencing a paint server that does not exist yet, which kept painting unfilled once an element finally took that id, because the shape registered itself as a pending resource under the full resolved URL while the lookups used the bare fragment identifier.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318411@main&quot;&gt;Sped up mapping the paint dirty rect&lt;/a&gt; through transforms in the Layer-Based SVG Engine (LBSE). Transformed SVG paints inverted the full 4x4 matrix on every paint, and now use the cheaper inverse of the 2x3 affine transform whenever the transform is affine, falling back to the 4x4 inverse only for 3D transforms.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Made SVG &lt;code&gt;clip-path&lt;/code&gt; no longer force a &lt;code&gt;RenderLayer&lt;/code&gt; in the Layer-Based SVG Engine (LBSE). A bare clip is now applied during painting through a shared &lt;code&gt;ClipPathPaintScope&lt;/code&gt;, a scope object that sets up the clip in its constructor and tears it down afterwards, handling CSS basic-shape and box clips as well as SVG clipper resources so both regular CSS boxes and SVG content share one path. This is a further step in &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318375@main&quot;&gt;removing the intrinsic need for layers&lt;/a&gt; on SVG renderers, continuing the effort to close the performance gap between LBSE and the legacy SVG engine.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318669@main&quot;&gt;Fixed dynamic &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; updates&lt;/a&gt; on SVG &lt;code&gt;&amp;lt;foreignObject&amp;gt;&lt;/code&gt; elements, which stopped taking effect after the viewport geometry started being derived from the resolved style. The &lt;code&gt;x&lt;/code&gt;, &lt;code&gt;y&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; attributes are presentation attributes mapped to the CSS &lt;code&gt;x&lt;/code&gt;, &lt;code&gt;y&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; properties, but only &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; marked the presentational hint style as dirty when they changed, so a style recalc never ran for &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; and layout kept reading stale values. All four geometry attributes now invalidate the presentational hint style, matching how &lt;code&gt;&amp;lt;rect&amp;gt;&lt;/code&gt; handles its geometry, so setting &lt;code&gt;x.baseVal.value&lt;/code&gt; from script repositions the &lt;code&gt;&amp;lt;foreignObject&amp;gt;&lt;/code&gt; as expected.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318412@main&quot;&gt;Added support for external and &lt;code&gt;data:&lt;/code&gt; URL references&lt;/a&gt; to &lt;code&gt;clip-path&lt;/code&gt;, markers and paint servers (gradients and patterns) in the Layer-Based SVG Engine (LBSE). Until now the LBSE resource resolvers only looked for the referenced fragment inside the local document, so markup like &lt;code&gt;url(file.svg#id)&lt;/code&gt; silently resolved to nothing, while filters already worked and the legacy SVG engine handled all of these since a few weeks.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/318751@main&quot;&gt;Fixed SVG filters vanishing&lt;/a&gt; on elements with a very large bounding box in the Layer-Based SVG Engine (LBSE). The filter region was seeded with the element's object bounding box and then united with each referenced &lt;code&gt;&amp;lt;filter&amp;gt;&lt;/code&gt; region, but a referenced &lt;code&gt;&amp;lt;filter&amp;gt;&lt;/code&gt; brings its own region, and that region alone decides where the filter paints, so the union could grow far past the image buffer limits and get clamped down to scale that made the output disappear. When every function in the chain is a &lt;code&gt;&amp;lt;filter&amp;gt;&lt;/code&gt; reference the bounding box is now dropped and only the referenced regions are kept, matching what the legacy SVG engine does, while &lt;code&gt;objectBoundingBox&lt;/code&gt; filter units still resolve exactly as before and HTML/CSS filters are untouched.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;wpe-webkit-pager&quot;&gt;WPE WebKit &#128223;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/0496fa627ebfc60e411c0a52009387ca10b4e584&quot;&gt;Add&lt;/a&gt; the &lt;code&gt;WebView::run-color-chooser&lt;/code&gt; API to WPE to allow applications to show color choosers, similar to WebKitGTK's API.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;The WPE port can now &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/317752@main&quot;&gt;use libsecret for persistent credential storage&lt;/a&gt;, reusing the implementation from the WebKitGTK port. This is disabled by default and can be toggled passing &lt;code&gt;-DUSE_LIBSECRET=ON&lt;/code&gt; to CMake when configuring the build.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/WebKit/WebKit/commit/062e3932bff008ef3a6c1069e561b372ad534547&quot;&gt;Add&lt;/a&gt; the &lt;code&gt;WebKitClipboardPermissionRequest&lt;/code&gt; API to WPE, allowing support for the clipboard permission similar to WebKItGTK.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;community-events-handshake&quot;&gt;Community &amp;amp; Events &#129309;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;The videos of the &lt;a rel=&quot;external&quot; href=&quot;https://webengineshackfest.org/&quot;&gt;Web Engines Hackfest&lt;/a&gt; 2026 talks have been &lt;a rel=&quot;external&quot; href=&quot;https://www.youtube.com/playlist?list=PL4sEzdAGvRgDkOXbVAbnOWCaIOV_evSfo&quot;&gt;published&lt;/a&gt;, including the sessions from the new WPE WebKit track. This year the following WebKit-related talks have been recorded:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://www.youtube.com/watch?v=-68_9Sg2VWk&quot;&gt;From libwpe to WPEPlatform: Building Embedded Browser on RPi with New WPE API&lt;/a&gt;, by Kate Lee, about new embedding API that is planned to be deemed stable for the 2.54 release series.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://www.youtube.com/watch?v=qVc0I1Z1ZKU&quot;&gt;Refactoring composition in WPE with Skia&lt;/a&gt;, by Carlos Garc&#237;a Campos, about the new Skia-based compositor currently in development that has been recently featured in our weekly dispatches.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://www.youtube.com/watch?v=W2pfbFeV1Pk&quot;&gt;Techniques for reducing GPU usage in WPE&lt;/a&gt;, by  Pawe&#322; Lampe, which is exactly what reads in the tin and how to balance CPU and GPU usage.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://www.youtube.com/watch?v=rX6y219m3OU&quot;&gt;Speeding up WPEWebKit and WebKitGTK with Profile-Guided Optimization&lt;/a&gt;, by Lauro Moura, because everybody likes to squeeze performance out of an existing codebase without rewriting it thanks to compiler techniques.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://www.youtube.com/watch?v=dnZ4jNKZzcY&quot;&gt;No QA, No WPE: Catch Regressions Before You Do&lt;/a&gt;, by Claudio Saavedra and Nikolas Zimmermann, about how continuous integration and quality assurance has been improved (and continues to) to improve stability and performance in the GTK and WPE WebKit ports.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://www.youtube.com/watch?v=f6fM0B0kcPk&quot;&gt;WPEPlatform API for Android&lt;/a&gt;, by Alejandro G. Castro, which is not only this year's update on WPE Android but also covers how the platform-dependent components have been partially rewritten and migrated to the WPEPlatform API.&lt;/p&gt;
&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;


&lt;div class=&quot;wip-end&quot;&gt;
&lt;p&gt;That&#8217;s all for this week!&lt;/p&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Igalia WebKit Team</name>
			<uri>https://blogs.igalia.com/webkit</uri>
		</author>
	</entry>

	<entry>
		<title>Jasmine Tang: Un-sandboxing sccache with SCCACHE_BASEDIRS in sandboxing build systems</title>
		<link rel="alternate" type="text/html" href="https://badumbatish.github.io/posts/wa_sandbox_build_sccache"/>
		<id>https://badumbatish.github.io/blog/wa_sandbox_build_sccache</id>
		<updated>2026-08-08T00:00:00+00:00</updated>
		<content type="html">
Jasmine turbo-mods the hell out of sccache to achieve crazy gains in a sandboxing build system                </content>
		<author>
			<name>Jasmine Tang</name>
			<uri>https://badumbatish.github.io/blog/rss.xml</uri>
		</author>
	</entry>

	<entry>
		<title>Umang Jain: Gentle introduction xHCI debug capabilities</title>
		<link rel="alternate" type="text/html" href="https://dev.uajain.com/blog/xhci-debug-capabilites/"/>
		<id>https://dev.uajain.com/blog/xhci-debug-capabilites/</id>
		<updated>2026-08-02T07:25:18+00:00</updated>
		<content type="html">
&lt;h2 id=&quot;introduction&quot;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;The XHCI specification has a optional debugging capabilities that is available
via the extended capabilities set. This set could be enabled by vendor to pass
along additional information around the hardware - especially information that
would help in debugging. In this post, we are going to identify a USB controller
(on a target) that supports this debug capability and try to enable/verify it
on the host side. At last, we are going to also look at the debug capabilites
associated with early boot phase of the kernel&lt;/p&gt;
&lt;h2 id=&quot;requirements&quot;&gt;Requirements&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;USB 3.1 Superspeed cable A-A or A-C cable&lt;/li&gt;
&lt;li&gt;Target with supported xHCI debug capability&lt;/li&gt;
&lt;li&gt;Host machine&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;checking-if-xhci-debug-capability-is-supported&quot;&gt;Checking if xHCI debug capability is supported&lt;/h2&gt;
&lt;p&gt;We need to verify if the target machine has xHCI debug capability supported.
We can simply find out by peeking into our sysfs device information:&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;($) find &quot;/sys/devices&quot; -type f -name &quot;dbc&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If this command returns a device, we can be sure that the xHCI controller
is present with debug capability.&lt;/p&gt;
&lt;h2 id=&quot;enable-the-xhci-debug-capability-on-target&quot;&gt;Enable the xHCI debug capability on target&lt;/h2&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;($) sudo bash -c &quot;echo enable &amp;gt; /sys/devices/pci0000:00/0000:00:0d.0/dbc&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You should expect the following confirmation via &lt;code&gt;dmesg&lt;/code&gt; on the target:&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;[ 3400.545281] xhci_hcd 0000:04:00.3: DbC connected
[ 3400.905302] xhci_hcd 0000:04:00.3: DbC configured
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;On the host machine which is connected via the USB 3.1 SuperSpeed cable,
we can verify that the USB host controller recognises the debug device.
Running &lt;code&gt;dmesg&lt;/code&gt; on host:&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;[110351.933236] usb 4-2: new SuperSpeed USB device number 6 using xhci_hcd
[110351.944701] usb 4-2: New USB device found, idVendor=1d6b, idProduct=0010, bcdDevice= 0.10
[110351.944732] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[110351.944742] usb 4-2: Product: Linux USB Debug Target
[110351.944750] usb 4-2: Manufacturer: Linux Foundation
[110351.944756] usb 4-2: SerialNumber: 0001
[110351.990401] usbcore: registered new interface driver usb_debug
[110351.990438] usbserial: USB Serial support registered for debug
[110351.990452] usbserial: USB Serial support registered for xhci_dbc
[110351.990502] usb_debug 4-2:1.0: xhci_dbc converter detected
[110351.990786] usb 4-2: xhci_dbc converter now attached to ttyUSB0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can attach any serial console utility to interact with target device
using xHCI debug capabilities.&lt;/p&gt;
&lt;h2 id=&quot;linux-kernel-early-boot-setup&quot;&gt;Linux kernel early boot setup&lt;/h2&gt;
&lt;p&gt;xHCI is also helpful to output early kernel boot stage logs. This phase is the
intialization process just after the bootloaders hands over control. To enable
early kernel debug, we need to configure the kernel with proper kconfig and
pass debug parameters in the kernel commandline.&lt;/p&gt;
&lt;p&gt;Build the kernel with following kconfig enabled:&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;CONFIG_EARLY_PRINTK_USB_XDBC
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And for the kernel commandline, append:&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;earlyprintk=xdbc
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;early-boot-io-remap&quot;&gt;Early boot IO remap&lt;/h2&gt;
&lt;p&gt;Now that you have had gentle introduction to this debugging capability, we
are going briefly mention about fixed boot-time mappings known as fixmaps.
The early boot has a special set of operations that are carried out before
the standard virtual memory and device drivers are active. In this phase, hardware
registers are allowed to be accessed via fixed boot time mapping and page tables.&lt;/p&gt;
&lt;p&gt;Generally the xHCI debug capability reside under the extended capabilities given
by vendor and can be mapped in fixed boot time mappings. However, we have such
devices coming up, that have extended capabilites size much bigger than the fixmaps.&lt;/p&gt;
&lt;p&gt;In this case, the PCIe memory range would fail to get IO remapped using
early_ioremap() call.&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;     kernel: xhci_dbc:early_xdbc_parse_parameter: dbgp_num: 0
     kernel: ------------[ cut here ]------------
    ay 19 13:42:57  kernel: WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:139 __early_ioremap+0xae/0x180
     kernel: Modules linked in:
     kernel: CPU: 0 UID: 0 PID: 0 Comm: swapper Not tainted 6.18.25-valve1-gcab630e7af50 #13 PREEMPT(undef)  4b70872d9de6788b7f2d10dce46ada89e6cd177b
     kernel: RIP: 0010:__early_ioremap+0xae/0x180
     kernel: Code: 60 ba 3f a0 4c 89 ca 48 81 e3 00 f0 ff ff 48 81 e2 00 f0 ff ff 48 29 d3 48 89 14 24 48 89 da 48 c1 ea 0c 89 d5 83 fa 40 76 04 &amp;lt;0f&amp;gt; 0b eb a2 6b c0 c0 4d 89 ce 41 81 e6 ff 0f 00 00 44 8d b8 ff 05
     kernel: RSP: 0000:ffffffff9fa03cb8 EFLAGS: 00010006 ORIG_RAX: 0000000000000000
     kernel: RAX: 0000000000000000 RBX: 0000000000100000 RCX: 0000000000100000
     kernel: RDX: 0000000000000100 RSI: 0000000000100000 RDI: 0000000080200000
     kernel: RBP: 0000000000000100 R08: 0000000000000000 R09: 0000000080200000
     kernel: R10: 0000000000000004 R11: ffffffff9fa03ad0 R12: 8000000000000163
     kernel: R13: 0000000000000000 R14: 0000000080200000 R15: 0000000000000000
     kernel: FS:  0000000000000000(0000) GS:0000000000000000(0000) knlGS:0000000000000000
     kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
     kernel: CR2: ffff888000000413 CR3: 000000020ed02000 CR4: 00000000000000b0
     kernel: Call Trace:
     kernel:  &amp;lt;TASK&amp;gt;
     kernel:  ? early_xdbc_parse_parameter+0x32c/0x360
     kernel:  ? setup_early_printk+0x4f5/0x520
     kernel:  ? do_early_param+0x44/0x70
     kernel:  ? parse_args+0x233/0x420
     kernel:  ? __pfx_do_early_param+0x10/0x10
     kernel:  ? parse_early_options+0x29/0x30
     kernel:  ? __pfx_do_early_param+0x10/0x10
     kernel:  ? parse_early_param+0x64/0xc0
     kernel:  ? setup_arch+0x542/0xbc0
     kernel:  ? _printk+0x6b/0x90
     kernel:  ? start_kernel+0x66/0x9a0
     kernel:  ? x86_64_start_reservations+0x24/0x30
     kernel:  ? x86_64_start_kernel+0xcc/0xd0
     kernel:  ? common_startup_64+0x13e/0x141
     kernel:  &amp;lt;/TASK&amp;gt;
     kernel: ---[ end trace 0000000000000000 ]---
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And this is the exact place that is triggered at in &lt;code&gt;mm/early_ioremap.c&lt;/code&gt;&lt;/p&gt;
&lt;pre tabindex=&quot;0&quot;&gt;&lt;code&gt;	/*
	 * Mappings have to fit in the FIX_BTMAP area.
	 */
	nrpages = size &amp;gt;&amp;gt; PAGE_SHIFT;
	if (WARN_ON(nrpages &amp;gt; NR_FIX_BTMAPS))
		return NULL;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;We shall call this issue as extra extended capabilities issue for lack of
a better work!&lt;/p&gt;
&lt;h2 id=&quot;solution-to-extra-extended-capbilities-for-xhci&quot;&gt;Solution to extra extended capbilities for xHCI&lt;/h2&gt;
&lt;p&gt;Now that we are seeing such hardware in the market where the fixmaps can be
a limiting factor, we have to find a solution for it. This has been a focus
of my work and after a few iterations, we have 
&lt;a href=&quot;https://lore.kernel.org/all/20260720191249.1272328-1-uajain@igalia.com/&quot;&gt;this patch&lt;/a&gt;
 for review! Feel
free for review comments or follow it for curiousity. There might be few more
followups on this particular approach &amp;ndash; so stay tuned for that.&lt;/p&gt;
&lt;p&gt;Thank you for reading!&lt;/p&gt;                </content>
		<author>
			<name>email@uajain.com (Umang Jain)</name>
			<uri>https://dev.uajain.com/blog/</uri>
		</author>
	</entry>

	<entry>
		<title>Igalia WebKit Team: WebKit Igalia Periodical #71</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/webkit/blog/2026/wip-71/"/>
		<id>https://blogs.igalia.com/webkit/blog/2026/wip-71/</id>
		<updated>2026-07-28T01:04:26+00:00</updated>
		<content type="html">
&lt;p&gt;Update on what happened in WebKit in the week from July 14 to July 27.&lt;/p&gt;
&lt;p&gt;
This two-week update includes plenty of changes to the Skia compositor,
changes to multimedia support, three blog posts, and assorted improvements.
&lt;/p&gt;
&lt;h2 id=&quot;cross-port-cat&quot;&gt;Cross-Port &#128049;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;The Web Inspector &#8220;Layout &amp;amp; Rendering&#8221; timeline &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/317302@main&quot;&gt;now shows a &lt;code&gt;Layout Invalidated&lt;/code&gt; event for &lt;em&gt;every&lt;/em&gt; element&lt;/a&gt;
that needs relayout, not just the layout root (with the old root-only event
renamed to &lt;code&gt;Layout Scheduled&lt;/code&gt;). This unveils why some layouts take much longer
than others. No more guessing which of dozens of nodes is actually to blame!&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;The &lt;code&gt;webkit://gpu&lt;/code&gt; page has &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/317610@main&quot;&gt;gained a dark
style&lt;/a&gt;, which will be used when the
system settings indicate that dark mode is preferred by the user.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;multimedia-movie-camera&quot;&gt;Multimedia &#127909;&lt;/h3&gt;
&lt;div class=&quot;wip-description&quot;&gt;
&lt;p&gt;GStreamer-based multimedia support for WebKit, including (but not limited to) playback, capture, WebAudio, WebCodecs, and WebRTC.&lt;/p&gt;
&lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;The experimental GstWebRTC backend was
&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/317849@main&quot;&gt;removed&lt;/a&gt; and &lt;em&gt;libwebrtc&lt;/em&gt; usage was
&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/317767@main&quot;&gt;enabled&lt;/a&gt; in the &lt;code&gt;main&lt;/code&gt; branch. We hope
to enable WebRTC support by default in the 2.56 series, scheduled around March
2027.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/317765@main&quot;&gt;MP4 edit lists support&lt;/a&gt; was enabled in
the MSE backend, improving timestamp accuracy, specially when handling of
B-frames.&lt;/p&gt;
  &lt;/div&gt;
&lt;h3 id=&quot;graphics-frame-photo&quot;&gt;Graphics &#128444;&#65039;&lt;/h3&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/317256@main&quot;&gt;Split the compositing walk&lt;/a&gt; in the
Skia compositor into a damage pass and a paint pass, so the frame damage is
known before the first draw. The damage pass walks the layer tree with a
&lt;code&gt;SkNoDrawCanvas&lt;/code&gt; in place of the real canvas, so every draw is discarded and
only the damage is collected. Both passes run from a single &lt;code&gt;paint()&lt;/code&gt; that
applies animations and computes the transforms once, so the two see the same
tree. Knowing the damage up front is what lets the compositor eventually paint
only the parts of a frame that actually changed.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/317400@main&quot;&gt;Wired up damage-driven compositing&lt;/a&gt; on
the Skia compositor, so a frame re-composites only the region that actually
changed instead of the whole surface, when the
&lt;code&gt;UseDamagingInformationForCompositing&lt;/code&gt; feature is enabled (not yet on by
default). Each frame's damage is combined with what each swap-chain target
still needs to redraw since it was last drawn into, and the clear and every
draw are clipped to that region, which is a milestone towards no longer
repainting untouched pixels every frame.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Made the root layer &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/317343@main&quot;&gt;collect the frame damage
itself&lt;/a&gt; in the Skia compositor, instead
of having each layer report its own changes. Reporting leaves a gap whenever a
layer is in no position to report, e.g. a destroyed one took its painted rectangle
with it, so what it had drawn stayed on screen. The root now holds one rectangle per
layer and compares it against what each frame's walk finds, so a layer that
moved is repainted in both places, and a layer the walk never reaches is
repainted where it used to be and dropped. Nothing has to notice anything for
the pixels it left behind to be repainted, which is what makes it safe to
restrict composition to the damaged region by default in future commits.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/317387@main&quot;&gt;Limited every content draw to the target's repaint
region&lt;/a&gt; in the Skia compositor, so a
composited frame can redraw only the pixels that actually changed. Each content
type restricts itself to the region's rectangles rather than clipping the
canvas, since a multi-rectangle clip cannot be a hardware scissor and would make
Skia build a mask and break batching. This is the groundwork for damage-driven
compositing, which stays off by default behind the damage-tracking feature
flag, as the compositor still passes no region and nothing is restricted yet.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Made each swap-chain target &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/317342@main&quot;&gt;track its own
damage&lt;/a&gt; since it was last current.
Repainting only what changed is correct only when drawing into the target that
holds the previous frame, but the swap chain hands back whichever target is
free, and that one is a frame or more behind. Each frame's damage is now added
to every target as it is recorded and cleared from a target when that target is
presented, instead of being built as a side effect of reading it.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Taught the tile and image draws in the Skia compositor to &lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/317247@main&quot;&gt;split themselves by
damage rectangle&lt;/a&gt;, so a frame only repaints
the parts of a layer that actually changed. A new &lt;code&gt;SkiaDamageRegion&lt;/code&gt; holds the
frame's damage in device space and is built once per frame, and each draw is
restricted to it: skipped when it touches no damage, split into one sub-draw
per damage rectangle it overlaps, or drawn under a device-space clip when a rotated
or skewed transform rules out working with rectangles. Nothing feeds a damage region
in yet, so every draw still paints in full&#8212;this prepares for future patches
enabling using damage information in the composition&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://commits.webkit.org/317142@main&quot;&gt;Fixed missing repaints&lt;/a&gt; when
compositor-applied layer state changes dynamically in the Coordinated Graphics
backend. A layer recorded damage when its backing store re-rendered or a new
contents buffer arrived, but the compositor also handles filters, masks, clip
path changes, the contents rectangle, the contents tiling, the blend mode and
contents visibility, and changing any of those alters the pixels it produces
without dirtying a tile. Those setters now damage the whole layer, so a
compositor that repaints only the damaged rectangles no longer leaves the previous
frame's pixels on screen.&lt;/p&gt;
  &lt;/div&gt;
&lt;h2 id=&quot;community-events-handshake&quot;&gt;Community &amp;amp; Events &#129309;&lt;/h2&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Nikolas Zimmermann has written a two-part blog series about the current the new
Layer-Based SVG Engine (LBSE), with the first post covering &lt;a rel=&quot;external&quot; href=&quot;https://blogs.igalia.com/nzimmermann/posts/2026-07-14-lbse-conditional-layers/&quot;&gt;the effort to
reduce layer
overhead&lt;/a&gt;
using layers conditionally, and the second about &lt;a rel=&quot;external&quot; href=&quot;https://blogs.igalia.com/nzimmermann/posts/2026-07-22-lbse-paint-order-segments/&quot;&gt;how compositing is being
implemented&lt;/a&gt;
and the complications introduced due to paint ordering rules.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;wip-item&quot;&gt;
&lt;p&gt;Lo&#239;c Le Page has published a &lt;a rel=&quot;external&quot; href=&quot;https://blogs.igalia.com/llepage/the-wpe-platform-api/&quot;&gt;blog
post&lt;/a&gt; explaining how to
use the new &lt;a rel=&quot;external&quot; href=&quot;https://wpewebkit.org/reference/2.53.3/wpe-platform-2.0/&quot;&gt;WPEPlatform
API&lt;/a&gt; to implement a
custom WPE integration. While presented example uses
&lt;a rel=&quot;external&quot; href=&quot;https://www.glfw.org/&quot;&gt;GLFW&lt;/a&gt; and EGL to show Web content on an X11 window, the
concepts are useful for anyone looking into embedding WPE.&lt;/p&gt;
  &lt;/div&gt;
&lt;div class=&quot;wip-end&quot;&gt;
&lt;p&gt;That&#8217;s all for this week!&lt;/p&gt;
&lt;/div&gt;                </content>
		<author>
			<name>Igalia WebKit Team</name>
			<uri>https://blogs.igalia.com/webkit</uri>
		</author>
	</entry>

	<entry>
		<title>Nikolas Zimmermann: Implementing compositing in LBSE</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/nzimmermann/posts/2026-07-22-lbse-paint-order-segments/"/>
		<id>https://blogs.igalia.com/nzimmermann/posts/2026-07-22-lbse-paint-order-segments/</id>
		<updated>2026-07-22T00:00:00+00:00</updated>
		<content type="html">
Keeping paint order correct with paint order segments                </content>
		<author>
			<name>Nikolas Zimmermann</name>
			<uri>https://blogs.igalia.com/nzimmermann/</uri>
		</author>
	</entry>

	<entry>
		<title>Lo&#239;c Le Page: The WPE Platform API</title>
		<link rel="alternate" type="text/html" href="https://blogs.igalia.com/llepage/the-wpe-platform-api/"/>
		<id>https://blogs.igalia.com/llepage/the-wpe-platform-api/</id>
		<updated>2026-07-21T00:00:00+00:00</updated>
		<content type="html">
&lt;p&gt;In the past, when you needed to adapt &lt;strong&gt;WPE WebKit&lt;/strong&gt; to a new platform, or integrate it with your own system/application
not based on Wayland, you had to develop a specific backend. I wrote two blog posts in the past about this topic
(One about the &lt;a href=&quot;https://blogs.igalia.com/llepage/the-process-of-creating-a-new-wpe-backend/&quot;&gt;process of creating a new WPE backend&lt;/a&gt; and another about
&lt;a href=&quot;https://blogs.igalia.com/llepage/use-eglstreams-in-a-wpe-webkit-backend/&quot;&gt;using EGLStreams in a WPE backend&lt;/a&gt;) and, to be honest, it was not really
straightforward.&lt;/p&gt;
&lt;p&gt;Since &lt;strong&gt;WPE WebKit&lt;/strong&gt; 2.50, a new system has been designed to replace all this by a more modern and intuitive approach,
making a lot easier to integrate &lt;strong&gt;WPE WebKit&lt;/strong&gt; into your application. The new API is called &lt;strong&gt;WPE Platform&lt;/strong&gt; and
allows you to define the equivalent of the old backend system into your own executable. At the moment of this post
(version 2.52), the &lt;strong&gt;WPE Platform&lt;/strong&gt; is still in development and the official release is foreseen for the next stable
version 2.54. Nevertheless, it is already stable enough to start playing with it.&lt;/p&gt;
&lt;p&gt;This post is going to explain step by step how you can use &lt;strong&gt;WPE WebKit&lt;/strong&gt; as a web view inside a simple X11 window using
EGL with full hardware acceleration and zero-copy of the graphical hardware buffers while avoiding the complexity of
writing an external backend. The X11/EGL window itself will be managed by the &lt;a href=&quot;https://www.glfw.org/&quot;&gt;GLFW&lt;/a&gt; library.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;N.B.&lt;/strong&gt; GLFW is only used here as a convenient, cross-platform way of creating a window and an EGL context with a
minimal amount of code. It is not the topic of this post. What matters here is the generic contract to follow
to implement a custom &lt;strong&gt;WPE Platform&lt;/strong&gt;. It consists basically in three &lt;code&gt;GObject&lt;/code&gt; classes and a small set of virtual
methods that would look exactly the same if we had chosen SDL, Qt, or directly a raw X11 Window instead of GLFW.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The reference project for this post is
&lt;a href=&quot;https://github.com/neodesys/blog-the-wpe-platform-api&quot;&gt;blog-the-wpe-platform-api&lt;/a&gt;. It implements a complete and
minimal &lt;strong&gt;WPE Platform&lt;/strong&gt; taking into account the basic user&#8217;s interactions (keyboard, scrolling, mouse, etc&#8230;).&lt;/p&gt;
&lt;p&gt;The version &lt;a href=&quot;https://github.com/neodesys/blog-the-wpe-platform-api/blob/v0.0/src/main.c&quot;&gt;0.0&lt;/a&gt; of this code implements
the bases to initialize a web view using &lt;strong&gt;WPE&lt;/strong&gt; (it will need a Wayland compositor to run). While the version
&lt;a href=&quot;https://github.com/neodesys/blog-the-wpe-platform-api/blob/v1.0/src/main.c&quot;&gt;1.0&lt;/a&gt; also integrates all the components
needed to implement the &lt;strong&gt;WPE Platform&lt;/strong&gt;. From the implementation point of view, the only difference is the usage of
a custom &lt;code&gt;WPEDisplay&lt;/code&gt; instead of the default one:&lt;/p&gt;
&lt;pre class=&quot;language-c&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-c&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Create and connect our GLFW-backed WPE display&lt;/span&gt;
WPEDisplay&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; display &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;wpe_glfw_display_new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
GError&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; error &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;wpe_display_connect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;display&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; EXIT_FAILURE&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create the WebKitWebView&lt;/span&gt;
WebKitWebView&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; web_view &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;WEBKIT_WEB_VIEW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;g_object_new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;WEBKIT_TYPE_WEB_VIEW&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;display&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; display&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;building-and-running-the-example-project&quot; tabindex=&quot;-1&quot;&gt;Building and running the example project &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/llepage/the-wpe-platform-api/#building-and-running-the-example-project&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If your operating system has a development package for &lt;code&gt;libWPEWebKit-2.0&lt;/code&gt; version 2.52 or above, the easiest way is to
install this package from your distribution. Else, you can build &lt;strong&gt;WPE WebKit&lt;/strong&gt; by yourself:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;or by using the &lt;a href=&quot;https://github.com/Igalia/webkit-container-sdk&quot;&gt;webkit-container-sdk&lt;/a&gt; reading the instructions
provided on the project,&lt;/li&gt;
&lt;li&gt;or by building the library locally.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you already have &lt;strong&gt;WPE WebKit&lt;/strong&gt; installed, you can go directly to
&lt;a href=&quot;https://blogs.igalia.com/llepage/the-wpe-platform-api/#build-the-example-project&quot;&gt;the build of the example project&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;build-wpe-webkit-locally&quot; tabindex=&quot;-1&quot;&gt;Build WPE WebKit locally &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/llepage/the-wpe-platform-api/#build-wpe-webkit-locally&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The following instructions are for building the library locally out of any container. You first need to clone the
&lt;strong&gt;WPE WebKit&lt;/strong&gt; project, version 2.52 or above:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;mkdir&lt;/span&gt; wpe-webkit
&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; wpe-webkit
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone &lt;span class=&quot;token parameter variable&quot;&gt;--depth&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-b&lt;/span&gt; wpewebkit-2.52.5 https://github.com/WebKit/WebKit.git&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then install &lt;code&gt;clang&lt;/code&gt; and all the needed development dependencies by calling: &lt;code&gt;./WebKit/Tools/wpe/install-dependencies&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Download the &lt;a href=&quot;https://blogs.igalia.com/llepage/the-wpe-platform-api/build-wpe.sh&quot;&gt;build-wpe.sh&lt;/a&gt; and &lt;a href=&quot;https://blogs.igalia.com/llepage/the-wpe-platform-api/set_dev_env.sh&quot;&gt;set_dev_env.sh&lt;/a&gt;
scripts and copy them to your working folder containing the &lt;em&gt;WebKit&lt;/em&gt; source code. Then execute:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;chmod&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;755&lt;/span&gt; ./build-wpe.sh ./set_dev_env.sh
./build-wpe.sh &lt;span class=&quot;token parameter variable&quot;&gt;--configure&lt;/span&gt;
./set_dev_env.sh&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It will build and install &lt;strong&gt;WPE WebKit&lt;/strong&gt; into &lt;em&gt;./dist-wpe&lt;/em&gt;. The &lt;code&gt;set_dev_env.sh&lt;/code&gt; script will set the environment
variables to use the files in &lt;em&gt;./dist-wpe&lt;/em&gt; for &lt;code&gt;pkg-config&lt;/code&gt; and for the runtime.&lt;/p&gt;
&lt;h3 id=&quot;build-the-example-project&quot; tabindex=&quot;-1&quot;&gt;Build the example project &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/llepage/the-wpe-platform-api/#build-the-example-project&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Clone the example project:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone https://github.com/neodesys/blog-the-wpe-platform-api.git wpe-glfw-platform&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Install the GLFW development dependency (package &lt;code&gt;libglfw3-dev&lt;/code&gt; on Ubuntu/Debian).&lt;/p&gt;
&lt;p&gt;Configure and build it:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; wpe-glfw-platform
meson setup build
ninja &lt;span class=&quot;token parameter variable&quot;&gt;-C&lt;/span&gt; build&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can now run it by calling &lt;code&gt;./build/wpe-glfw [url]&lt;/code&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;N.B.&lt;/strong&gt; In the version 2.52.5 of &lt;strong&gt;WPE WebKit&lt;/strong&gt;, the Skia multithreaded hardware-accelerated compositor is not fully
stable with some specific GPUs. In particular, with NVidia graphic cards, it may crash when the allocated surfaces
are resized to resolutions bigger than HD. If this is your case, you can disable the Skia hardware-accelerated
compositor by setting the environment variable &lt;code&gt;WEBKIT_SKIA_ENABLE_CPU_RENDERING=1&lt;/code&gt;. In some cases, you don&#8217;t need to
disable the whole hardware-acceleration for the compositor. Sometimes just configuring the hardware compositor to use
only one thread is enough. You can do that by setting the environment variable &lt;code&gt;WEBKIT_SKIA_PAINTING_THREADS=1&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;from-a-wpe-backend-to-a-wpe-platform&quot; tabindex=&quot;-1&quot;&gt;From a WPE Backend to a WPE Platform &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/llepage/the-wpe-platform-api/#from-a-wpe-backend-to-a-wpe-platform&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A &lt;strong&gt;WPE Backend&lt;/strong&gt; sits at the crossroads between the &lt;em&gt;WPEWebProcess&lt;/em&gt;, in charge of running the &lt;code&gt;ThreadedCompositor&lt;/code&gt;,
and the application process, which presents the resulting frames. Both processes must load the same backend shared
library, and that library has to implement an IPC layer to move each handle from one process to the other.&lt;/p&gt;
&lt;pre class=&quot;mermaid&quot;&gt;graph LR;&amp;#10;    subgraph SA[&amp;lt;b&amp;gt;WPEWebProcess&amp;lt;/b&amp;gt;]&amp;#10;        A(ThreadedCompositor)&amp;#10;    end&amp;#10;    subgraph SB[&amp;lt;b&amp;gt;Application Process&amp;lt;/b&amp;gt;]&amp;#10;        C(User Application)&amp;#10;    end&amp;#10;    A --&amp;gt;|draw| B([WPE Backend shared library&amp;lt;br/&amp;gt;Loaded by both processes]) --&amp;gt; C&amp;#10;&lt;/pre&gt;
&lt;p&gt;The &lt;strong&gt;WPE Platform API&lt;/strong&gt; removes this shared library and all the IPC burden. &lt;strong&gt;WPE WebKit&lt;/strong&gt; still spawns a
&lt;em&gt;WPEWebProcess&lt;/em&gt; to run the &lt;code&gt;ThreadedCompositor&lt;/code&gt; but the transfer of the rendered frames from the &lt;em&gt;WPEWebProcess&lt;/em&gt; to the
application process is now handled internally by &lt;strong&gt;WPE WebKit&lt;/strong&gt; itself. As an application developer, you no longer need
to implement any IPC: you only receive a ready-to-use &lt;code&gt;WPEBuffer&lt;/code&gt; object, backed by a DMA buffer or by shared memory,
directly into your application process.&lt;/p&gt;
&lt;pre class=&quot;mermaid&quot;&gt;graph LR;&amp;#10;    subgraph SA[&amp;lt;b&amp;gt;WPEWebProcess&amp;lt;/b&amp;gt;]&amp;#10;        A(ThreadedCompositor)&amp;#10;    end&amp;#10;    subgraph SB[&amp;lt;b&amp;gt;Application Process&amp;lt;/b&amp;gt;]&amp;#10;        B[WPEDisplay&amp;lt;br/&amp;gt;WPEToplevel&amp;lt;br/&amp;gt;WPEView]&amp;#10;        C(User Application)&amp;#10;    end&amp;#10;    A --&amp;gt;|&amp;quot;WPEBuffer (handled internally)&amp;quot;| B --&amp;gt; C&amp;#10;&lt;/pre&gt;
&lt;p&gt;What used to be a shared library exposing five &lt;em&gt;libwpe&lt;/em&gt; interfaces is now just three plain
&lt;a href=&quot;https://docs.gtk.org/gobject/&quot;&gt;GObject&lt;/a&gt; classes (&lt;code&gt;WPEDisplay&lt;/code&gt;, &lt;code&gt;WPEToplevel&lt;/code&gt; and &lt;code&gt;WPEView&lt;/code&gt;) that you need to subclass
and link directly into your application binary.&lt;/p&gt;
&lt;h2 id=&quot;the-three-pillars-of-a-wpe-platform&quot; tabindex=&quot;-1&quot;&gt;The three pillars of a WPE Platform &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/llepage/the-wpe-platform-api/#the-three-pillars-of-a-wpe-platform&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/neodesys/blog-the-wpe-platform-api/blob/v1.0/src/wpe-glfw-display.c&quot;&gt;WPEDisplay&lt;/a&gt;&lt;/strong&gt; is the entry
point. It owns the connection to the native graphical system (here, an EGL display bootstrapped through GLFW) and
acts as a factory for the toplevel window and the web views.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/neodesys/blog-the-wpe-platform-api/blob/v1.0/src/wpe-glfw-toplevel.c&quot;&gt;WPEToplevel&lt;/a&gt;&lt;/strong&gt; is roughly
the equivalent of a native window. It owns the actual GLFW window, translates native window events (keyboard, mouse,
scroll, focus and resize) into &lt;code&gt;WPEEvent&lt;/code&gt; instances, and exposes the usual window operations to the
&lt;strong&gt;WPE Platform API&lt;/strong&gt; (resizing, setting the window title and switching to fullscreen).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/neodesys/blog-the-wpe-platform-api/blob/v1.0/src/wpe-glfw-view.c&quot;&gt;WPEView&lt;/a&gt;&lt;/strong&gt; is where the web
page is actually drawn. It receives a new &lt;code&gt;WPEBuffer&lt;/code&gt; each time the &lt;code&gt;ThreadedCompositor&lt;/code&gt; has produced a frame and is
responsible for presenting it on screen.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;mermaid&quot;&gt;graph TB;&amp;#10;    subgraph SA[&amp;lt;b&amp;gt;WPEGLFWDisplay&amp;lt;/b&amp;gt;]&amp;#10;        A[&amp;quot;connect(): create the EGL display through GLFW&amp;quot;]&amp;#10;    end&amp;#10;    A --&amp;gt;|create_toplevel| B[&amp;lt;b&amp;gt;WPEGLFWToplevel&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;owns the GLFW window]&amp;#10;    A --&amp;gt;|create_view| C[&amp;lt;b&amp;gt;WPEGLFWView&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;renders one WPEBuffer per frame]&amp;#10;    B -.attach view and broadcast window events.-&amp;gt; C&amp;#10;&lt;/pre&gt;
&lt;p&gt;A single &lt;code&gt;WPEDisplay&lt;/code&gt; can create several toplevel windows, and a toplevel window can have several views attached to it
(think of tabs sharing one native window). In our example application we only create a single toplevel window with a
single view.&lt;/p&gt;
&lt;h2 id=&quot;implementing-wpeglfwdisplay-bootstrapping-egl-through-glfw&quot; tabindex=&quot;-1&quot;&gt;Implementing WPEGLFWDisplay: bootstrapping EGL through GLFW &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/llepage/the-wpe-platform-api/#implementing-wpeglfwdisplay-bootstrapping-egl-through-glfw&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The
&lt;a href=&quot;https://github.com/neodesys/blog-the-wpe-platform-api/blob/v1.0/src/wpe-glfw-display.c#L45-L119&quot;&gt;WPEGLFWDisplay::connect(&#8230;)&lt;/a&gt;
override is called only once, when &lt;code&gt;wpe_display_connect(...)&lt;/code&gt; is invoked from &lt;code&gt;main()&lt;/code&gt;. It initializes GLFW, requests
an EGL/GLES2 context for every window that will be created afterwards, and creates a tiny hidden bootstrap window used
only to force GLFW to set up its EGL connection:&lt;/p&gt;
&lt;pre class=&quot;language-c&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-c&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Request EGL + GLES 2 context for all subsequent window creations&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;glfwWindowHint&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;GLFW_CONTEXT_CREATION_API&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; GLFW_EGL_CONTEXT_API&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;glfwWindowHint&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;GLFW_CLIENT_API&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; GLFW_OPENGL_ES_API&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;glfwWindowHint&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;GLFW_CONTEXT_VERSION_MAJOR&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;glfwWindowHint&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;GLFW_CONTEXT_VERSION_MINOR&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;glfwWindowHint&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;GLFW_VISIBLE&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; GLFW_FALSE&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create a tiny hidden window so GLFW can initialize its EGL connection&lt;/span&gt;
self&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;init_window &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;glfwCreateWindow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;
self&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;egl_display &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;glfwGetEGLDisplay&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If we want to be able to transfer the frames with zero-copy, keeping them in the GPU memory, we will need a valid
&lt;code&gt;WPEDRMDevice&lt;/code&gt;. It is also initialized during the display connection, using the &lt;code&gt;EGL_EXT_device_query&lt;/code&gt; extension to
fetch the device associated with the current EGL display:&lt;/p&gt;
&lt;pre class=&quot;language-c&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-c&quot;&gt;EGLDeviceEXT egl_device &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; EGL_NO_DEVICE_EXT&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;eglQueryDisplayAttribEXT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;self&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;egl_display&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; EGL_DEVICE_EXT&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;EGLAttrib&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;egl_device&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
    egl_device &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; EGL_NO_DEVICE_EXT&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; drm_device &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;eglQueryDeviceStringEXT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;egl_device&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; EGL_DRM_DEVICE_FILE_EXT&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; drm_render_node &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;eglQueryDeviceStringEXT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;egl_device&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; EGL_DRM_RENDER_NODE_FILE_EXT&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    self&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;drm_device &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;wpe_drm_device_new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;drm_device&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; drm_render_node&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If &lt;a href=&quot;https://github.com/neodesys/blog-the-wpe-platform-api/blob/v1.0/src/wpe-glfw-display.c#L132-L139&quot;&gt;WPEGLFWDisplay::get_drm_device(&#8230;)&lt;/a&gt;
returns &lt;code&gt;NULL&lt;/code&gt;, the produced frames will be transferred to the application using shared memory, which implies copying
the frames content back and forth between the GPU and the CPU.&lt;/p&gt;
&lt;h2 id=&quot;implementing-wpeglfwtoplevel-the-window-and-its-events&quot; tabindex=&quot;-1&quot;&gt;Implementing WPEGLFWToplevel: the window and its events &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/llepage/the-wpe-platform-api/#implementing-wpeglfwtoplevel-the-window-and-its-events&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;WPEGLFWToplevel&lt;/code&gt; is where the actual GLFW window is created. It is important to manage this creation in the
&lt;a href=&quot;https://github.com/neodesys/blog-the-wpe-platform-api/blob/v1.0/src/wpe-glfw-toplevel.c#L476-L509&quot;&gt;WPEGLFWToplevel::constructed(&#8230;)&lt;/a&gt;
override rather than in the &lt;code&gt;init()&lt;/code&gt; function because &lt;code&gt;WPEToplevel::constructed(...)&lt;/code&gt; is resetting the toplevel
registered dimensions.&lt;/p&gt;
&lt;pre class=&quot;language-c&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-c&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;wpe_glfw_toplevel_constructed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;GObject&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; object&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// It is important to initialize the window in the `constructed` virtual&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// method and not in the `init` method because the parent class&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// (WPETopLevel) resets the toplevel window size in this call.&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;G_OBJECT_CLASS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;wpe_glfw_toplevel_parent_class&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;constructed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;object&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    WPEGLFWToplevel&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; self &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;WPE_GLFW_TOPLEVEL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;object&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// All window hints have already been configured by the display&lt;/span&gt;
    self&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;window &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;glfwCreateWindow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;DEFAULT_WIDTH&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; DEFAULT_HEIGHT&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Communicate the initial window size to the WPETopLevel, so when&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// the WPEView is attached, it can be resized immediately to the correct&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// dimensions.&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;wpe_toplevel_resized&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WPE_TOPLEVEL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;self&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; DEFAULT_WIDTH&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; DEFAULT_HEIGHT&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once the window exists, each GLFW events callback (for the keyboard, mouse, window resizing, etc&#8230;) is translating the
window events into the corresponding &lt;code&gt;WPEEvent&lt;/code&gt; and broadcasts those events to every view currently attached to this
toplevel window.&lt;/p&gt;
&lt;p&gt;The collection and dispatch of the GLFW events themselves are ensured by calling &lt;code&gt;glfwPollEvents()&lt;/code&gt;. As this function
is managing the events for all the GLFW windows, it is configured in the
&lt;a href=&quot;https://github.com/neodesys/blog-the-wpe-platform-api/blob/v1.0/src/wpe-glfw-display.c#L107-L113&quot;&gt;WPEGLFWDisplay&lt;/a&gt; as
a Glib source. This way all GLFW window events are collected, dispatched, translated into &lt;code&gt;WPEEvent&lt;/code&gt; and broadcasted to
each view from the main application thread running the Glib main loop.&lt;/p&gt;
&lt;p&gt;The rest of the class is a set of straightforward virtual method overrides mapping &lt;strong&gt;WPE&lt;/strong&gt; window operations onto GLFW
calls to allow the &lt;strong&gt;WPE Platform API&lt;/strong&gt; to set the window title, change the toplevel window size or switch to
fullscreen.&lt;/p&gt;
&lt;h2 id=&quot;implementing-wpeglfwview-turning-a-wpebuffer-into-pixels&quot; tabindex=&quot;-1&quot;&gt;Implementing WPEGLFWView: turning a WPEBuffer into pixels &lt;a class=&quot;header-anchor&quot; href=&quot;https://blogs.igalia.com/llepage/the-wpe-platform-api/#implementing-wpeglfwview-turning-a-wpebuffer-into-pixels&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;WPEGLFWView&lt;/code&gt; is the class doing the actual OpenGL ES drawing. The main interesting override is
&lt;a href=&quot;https://github.com/neodesys/blog-the-wpe-platform-api/blob/v1.0/src/wpe-glfw-view.c#L227-L321&quot;&gt;render_buffer(&#8230;)&lt;/a&gt;,
called by &lt;strong&gt;WPE WebKit&lt;/strong&gt; every time a new frame is ready to be presented. The rest of the code is basically some
boilerplate used to render a texture on a plane.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;WPEBuffer&lt;/code&gt; provided by &lt;strong&gt;WPE WebKit&lt;/strong&gt; can be a wrapper for a DMA buffer allowing to draw the frame without copying
it to the main memory, or it can be the wrapper of a classical block of shared memory if the DRM device was not
available in
&lt;a href=&quot;https://github.com/neodesys/blog-the-wpe-platform-api/blob/v1.0/src/wpe-glfw-display.c#L132-L139&quot;&gt;WPEGLFWDisplay::get_drm_device(&#8230;)&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So, when drawing, we first try to get the &lt;code&gt;EGLImage&lt;/code&gt; wrapped by the &lt;code&gt;WPEBuffer&lt;/code&gt; and, if not available, we fall back to
the shared memory:&lt;/p&gt;
&lt;pre class=&quot;language-c&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-c&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Try to import the WPEView content through an EGLImage to allow a&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// zero-copy transfer. This is only going to work if the EGLDisplay is&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// associated with a valid DRM device returned by&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// WPEDisplay::get_drm_device().&lt;/span&gt;
gpointer egl_image &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;wpe_buffer_import_to_egl_image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;buffer&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;egl_image&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    self&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;glEGLImageTargetTexture2DOES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;GL_TEXTURE_2D&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;GLeglImageOES&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;egl_image&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;glUniform1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;self&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;uniform_swap_rb&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Else, fall back to the SHM buffer. In this case the WPEView content&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// is copied through the CPU into shared memory.&lt;/span&gt;
    GBytes&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; pixels &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;wpe_buffer_import_to_pixels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;buffer&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;shm_err&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;
    gconstpointer data &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;g_bytes_get_data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;pixels&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;glTexImage2D&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;GL_TEXTURE_2D&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; GL_RGBA&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;GLsizei&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;buf_w&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;GLsizei&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;buf_h&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; GL_RGBA&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; GL_UNSIGNED_BYTE&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; data&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token function&quot;&gt;glUniform1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;self&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;uniform_swap_rb&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1.f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;All the resources (the &lt;code&gt;EGLImage&lt;/code&gt; or the &lt;code&gt;GBytes&lt;/code&gt; pixels array) are held by the &lt;strong&gt;WPE WebKit&lt;/strong&gt; &lt;code&gt;ThreadedCompositor&lt;/code&gt; and
so, once the drawing is finished, we must signal that the buffer has been rendered and can be recycled:&lt;/p&gt;
&lt;pre class=&quot;language-c&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-c&quot;&gt;&lt;span class=&quot;token function&quot;&gt;wpe_view_buffer_rendered&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;view&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; buffer&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;wpe_view_buffer_released&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;view&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; buffer&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The first call (&lt;code&gt;wpe_view_buffer_rendered(...)&lt;/code&gt;) triggers the rendering of the next frame, while the second call
(&lt;code&gt;wpe_view_buffer_released(...)&lt;/code&gt;) informs that the internal &lt;code&gt;EGLImage&lt;/code&gt; or &lt;code&gt;GBytes&lt;/code&gt; pixels array can be re-used for a
future frame content, avoiding the allocation of new buffers for each new frame.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;N.B.&lt;/strong&gt; The drawing loop in the example is very simplified for the purpose of this post because we are not
repainting the window content when it is damaged for example. We are only doing the drawing sequentially at one place
when receiving a new frame from the web view. In a real application, we may want to keep the current &lt;code&gt;WPEBuffer&lt;/code&gt; for
intermediate repainting, until receiving the next frame. In this case, we would call &lt;code&gt;wpe_view_buffer_rendered(...)&lt;/code&gt;
for buffer &lt;strong&gt;A&lt;/strong&gt; once it has been drawn but we would call &lt;code&gt;wpe_view_buffer_released(...)&lt;/code&gt; only after receiving buffer
&lt;strong&gt;B&lt;/strong&gt; with the next frame content. So, buffer &lt;strong&gt;A&lt;/strong&gt; may be used more than once to repaint the window content like
shown in the following sequence diagram.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;mermaid&quot;&gt;sequenceDiagram&amp;#10;    participant A as WPEWebProcess&amp;#10;    participant B as Application Process&amp;#10;    activate A&amp;#10;    A -&amp;gt;&amp;gt; A: Render frame 1 in buffer A&amp;#10;    A -&amp;gt;&amp;gt; B: WPEBuffer A&amp;#10;    deactivate A&amp;#10;    activate B&amp;#10;    B -&amp;gt;&amp;gt; B: Draw frame 1 from buffer A&amp;#10;    B -&amp;gt;&amp;gt; A: wpe_view_buffer_rendered(A)&amp;#10;    deactivate B&amp;#10;    activate A&amp;#10;    A -&amp;gt;&amp;gt; A: Render frame 2 in buffer B&amp;#10;    activate B&amp;#10;    B -&amp;gt;&amp;gt; B: Repaint buffer A&amp;#10;    deactivate B&amp;#10;    A -&amp;gt;&amp;gt; B: WPEBuffer B&amp;#10;    deactivate A&amp;#10;    activate B&amp;#10;    B -&amp;gt;&amp;gt; A: wpe_view_buffer_released(A)&amp;#10;    B -&amp;gt;&amp;gt; B: Draw frame 2 from buffer B&amp;#10;    B -&amp;gt;&amp;gt; A: wpe_view_buffer_rendered(B)&amp;#10;    deactivate B&amp;#10;    activate A&amp;#10;    A -&amp;gt;&amp;gt; A: Render frame 3 in buffer A&amp;#10;    A -&amp;gt;&amp;gt; B: WPEBuffer A&amp;#10;    deactivate A&amp;#10;    activate B&amp;#10;    B -&amp;gt;&amp;gt; A: wpe_view_buffer_released(B)&amp;#10;    B -&amp;gt;&amp;gt; B: Draw frame 3 from buffer A&amp;#10;    deactivate B&amp;#10;&lt;/pre&gt;
&lt;p&gt;The rendering in the current example is not optimized either because the &lt;code&gt;ThreadedCompositor&lt;/code&gt; must wait for the
complete presentation of the current frame with &lt;code&gt;glfwSwapBuffers(...)&lt;/code&gt; blocking until the drawing is finished. We can
perfectly imagine a multithreaded view where the &lt;code&gt;render_buffer(...)&lt;/code&gt; override just posts the current &lt;code&gt;WPEBuffer&lt;/code&gt; to a
separate drawing thread. This way the &lt;strong&gt;WPE WebKit&lt;/strong&gt; drawing of the next frame and the presentation of the current
frame on screen would run in parallel instead of waiting for each other.&lt;/p&gt;                </content>
		<author>
			<name>Lo&#239;c Le Page</name>
			<uri>https://blogs.igalia.com/llepage/</uri>
		</author>
	</entry>

</feed>
