Files
reims-vgpu/docs
Anees Iqbal b34e6f95ab 🐛 Destroy every host object as the app lets it go
Only textures posted OBJECT_DESTROY. Buffers, heaps, samplers, depth-stencil
states, pipelines, libraries, events, fences, shared events and queues stayed
on the host for the process's life, and the region blocks under Shared buffers,
Shared heaps, IOSurface copies and queue rings were never given back. Now that
the host refuses a BLOCK_RELEASE while an object lies in the block, a long-lived
process such as WindowServer would run the region out, and one making more than
256 queues over its life would run out of queues.

Each wrapper's dealloc now retires its destroy through RgfxRetirement, and
gives back what the object lay over only after it: the block, the no-copy
caller's pages, or the resource id. A queue ends through the kext's
QUEUE_DESTROY, its completion ring is read no more, and then its rings' blocks
and submission writer go.

Metal's lifetime rules hold as before. A command buffer keeps its queue, a
heap-placed buffer or texture keeps its heap (answered by `heap`), and a
function keeps its library, so a pipeline made from it still names a library
the host holds. A command buffer holds releases back from its making, not its
commit, since Metal keeps what it encodes alive from the encode on.

Releases also keep their order now while one thread runs those due. Before, a
release retired in that window with no ticket live ran at once, ahead of them,
and a block release could overtake the destroy of the texture over the block.

The shell tests cover each kind, the heap, library and queue lifetimes, and the
block order. Their fixtures' transport is never freed, so an object that goes
after its test posts into a live ring. `tex_probe kinds N` churns every kind
through a 1 GiB region on a guest.
2026-11-05 21:58:31 -08:00
..
2026-11-05 21:58:28 -08:00