mirror of
https://github.com/lemonade-sdk/mac_linuxgpu.git
synced 2026-11-23 17:59:26 -10:00
dext_dma_import() takes a memory descriptor a client passed (a display agent's IOSurface pages, as a structure-input descriptor), retains it and prepares it for DMA with an IODMACommand on the bound device, limited to the device's DMA width. Every segment must be whole 16 KiB pages below that width and together exactly the requested length; otherwise the mapping is completed again and refused. The mapping is recorded in the same table as the coherent mappings, under an import id, so the existing rules hold for it: dext_dma_release_import() completes it, or under the shutdown hold only retires it until the endpoint reset; a quarantine retains it; fini refuses while it lives; the shutdown hold counts its bytes. Coherent-allocation lookups (descriptor copies, range descriptors, frees by CPU address) never match an import. Table entries now hold an IOMemoryDescriptor, the type IODMACommand prepares. The DriverKit mocks prepare several segments when asked, and test-iokit-dma's "import" scenario covers the lifetime, release under the shutdown hold, refusals (partial pages, no room, PrepareForDMA failure, a misaligned run, an IOVA beyond the DMA width) and quarantine retention.