Files
metal2vulkan/crates
Anees Iqbal 01cf2d8553 Heap textures Metal keeps compressed over host pages take the image over the pages
On RADV, a texture placed in a no-copy heap over dma-buf pages never reached the dma-buf image
path (runtime_lane::dma_buf_imports: four tests counted (0, 0) images and fallbacks where they
expect (1, 0) or (0, 1), on the Radeon 780M, jobs 4456 runs 1 and 2). Two causes:
- heap_plan makes a texture whose optimal image does not fit Metal's answer a shadow of the
  tiles Metal lays it in uncompressed (HeapLayout::Uncompressed) where Metal keeps it losslessly
  compressed, and host_heap_plan returned that shadow at once for any Tiled route, so the image
  over the pages (a DRM_FORMAT_MOD_LINEAR image over a dma-buf of its own pages, or a linear
  image over pointer pages) was never asked. Metal's bytes of such a texture are no layout of
  its texels, so the driver's rows serve it as well as those tiles do, with no copy: now that
  image where it serves, and the uncompressed tiles in a copied heap or where none serves. A
  texture Metal tiles keeps the shadow of Metal's tiles, as before.
- dma_buf_heap_plan held the natural image's memory alignment to the heap's answer (Metal's 128
  bytes, finer than RADV's 256-byte plane rule). The image's import is its own, bound at its
  start, so no heap offset is held to it; its plane offset is the texels' offset in their first
  page, which the driver takes or refuses as the texture is made (the shadow, counted and
  announced, where it refuses), as dma_buf.rs documents. NaturalLayout's unread alignment goes.

Both routes announce heap-texture-lossless-layout per texture, as before. The tests that failed
are the four dma_buf_imports heap texture tests; the evidence is their run on RADV after this.

(cherry picked from commit 28555cdec39555657339d74bef72298b9d84e2ca)
2026-11-07 11:49:38 -08:00
..