<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:base="https://crmurillo.github.io/" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    
    <title>Cristina Murillo · Blog</title>
    <link>https://crmurillo.github.io/</link>
    <atom:link href="https://crmurillo.github.io/feed.xml" rel="self" type="application/rss+xml" />
    <description>Notes on the work I do.</description>
    <language>en</language>
    <item>
      <title>How I got started with Vulkan CTS</title>
      <link>https://crmurillo.github.io/blog/how-i-got-started-with-vulkan-cts/</link><description>&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&#39;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&#39;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×2 tiles

         Tile 0            Tile 1
         0     1     2     3     4     5            ← superblock column index
         ↓                 ↓
   0  →  ┌─────┬─────┬─────╥─────┬─────┬─────┐
         │ SB  │ SB  │ SB  ║ SB  │ SB  │ SB  │
  16     ├─────┼─────┼─────╫─────┼─────┼─────┤      SB = superblock (64×64 pixels)
         │ SB  │ SB  │ SB  ║ SB  │ SB  │ SB  │
  32  →  ╞═════╪═════╪═════╬═════╪═════╪═════╡      ═ ║  tile boundary
         │ SB  │ SB  │ SB  ║ SB  │ SB  │ SB  │      ─ │  superblock boundary
  48     ├─────┼─────┼─────╫─────┼─────┼─────┤
         │ SB  │ SB  │ SB  ║ SB  │ SB  │ SB  │
  64     └─────┴─────┴─────╨─────┴─────┴─────┘
   ↑     0     16    32    48    64    80    96     ← 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 × 16 MI = 48
  MiRowStarts[0] = 0 SB × 16 MI = 0

  1 SB = 64 pixels = 64 ÷ 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&#39;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&#39;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&#39;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&#39;t check anything. For this reason, it&#39;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&#39;t match.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It&#39;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 × 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&#39;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&#39;s fine. A &lt;code&gt;QualityWarning&lt;/code&gt; is also an accepted result. It doesn&#39;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;
</description><pubDate>Thu, 22 Oct 2026 00:00:00 +0000</pubDate>
      <dc:creator>Cristina Murillo</dc:creator>
      <guid>https://crmurillo.github.io/blog/how-i-got-started-with-vulkan-cts/</guid>
    </item>
  </channel>
</rss>