9 Commits
Author SHA1 Message Date
geramyloveless 4b142d018e Merge feature/radv-apple-vram (d132e25) into display-c
The DART has no fixed DMA budget (the platform's refusal is the limit,
logged), page descriptors grow with RAM, and kmemcheck is compiled only
in debug builds.

Conflicts, both sides kept: the shutdown hold still waits up to
DEXT_DMA_HOLD_DRAIN_MS for operations in flight, now without a budget
argument; test_iokit_dma keeps the in-flight hold, aperture gate and
large-mapping tests; the fence wait-any test keeps one 2 s bound.
2026-10-04 10:08:00 -07:00
geramyloveless c969e84507 dart: no fixed DMA budget; the platform's refusal is the limit, logged
The DART layer refused any mapping past a hard-coded 1.5 GiB of live
DMA bytes. Every dext page is DMA-backed, so GTT objects failed with
ENOMEM at 1439 MiB (97 MiB already mapped at start) although amdgpu
reports 64 GiB of GTT; llama.cpp's 1 GiB staging buffer and pinned host
buffers could not be allocated.

The limits that exist are the platform's: memory and wiring (the user
wire limit here is 108.8 GiB of 128 GiB, with 19.2 GiB kept for the
kernel), and the DART's IOVA window for the device, which the device
tree gives a Thunderbolt port's dart-apciec as 2047 MiB (IOVAs from
2 GiB). DriverKit enforces both: IOBufferMemoryDescriptor::Create or
PrepareForDMA fails. So:

- dart.c only accounts live-mapped bytes (used/peak); a mapping fails
  when the seam fails it. linuxu_dart_budget and rt_dart_ceiling are
  gone (rt_dart_peak reports the high-water mark).
- The seam logs each refusal with its size, the refusing call, its
  IOReturn and what is already mapped (a run of identical refusals
  logs its first and every 256th).
- The shutdown and probe holds take no ceiling. They count the bytes
  mapped at their start and those mapped during them; retired mappings
  keep their DART IOVA until the endpoint reset, so the DART refuses a
  teardown mapping that would not fit beside them. A ceiling at the
  live total would refuse every probe allocation (nothing is mapped
  when the probe hold starts).
- The dext's mapping table and dart.c's streaming slots were fixed at
  4096 entries, another wall: both grow in chunks that never move.

test_iokit_dma models the DART window and adds large mappings: a
1.5 GiB + 16 KiB mapping, a refused 512 MiB one (logged), 4500 live
mappings, and a teardown mapping refused beside retired ones under
the shutdown hold. test_session_shutdown closes a session with 6 GiB
mapped. test_dma_dart maps 3 GiB and 6000 live mappings.
2026-10-04 09:29:20 -07:00
geramyloveless 7375ebd3d2 libdrm-mlg: the primary node, KMS queries and drmMlgScanout
- The device has a primary node, /dev/dri/card0, next to the render
  node: open, stat, node types and names. Its files are never DRM master.
- xf86drmMode.h: resources, CRTCs, encoders, connectors (which never
  probe), planes, object properties, properties, blobs and IN_FORMATS
  iteration, and framebuffers (AddFB2 with modifiers, RmFB, CloseFB).
- drmMlgScanout: LX_SCANOUT for a primary-node descriptor of the
  library. drmMlgConnectorDisplay finds the macOS display that stands for
  a connector's monitor: the one with the vendor, model and serial number
  the display agent gives a virtual display for that EDID
  (drmMlgEdidIdentity computes them as the agent does).
- test-scanout: a libdrm-mlg client on the fixture's DCN 4.0.1 output
  (scanout_fixture.c): the primary node without master and the driver's
  modeset with it open, KMS queries, framebuffers of dma-buf imports, both
  layers with flip syncobjs, held desktop frames, a scaled frame, the
  mailbox under held vblanks, detach, admission, and the client's death.
- docs/macos-displays.md: section 4.
2026-10-03 22:21:35 -07:00
geramyloveless 107dbd917f docs: the build 234 frame pipeline, its measurements, and zero-copy
How PRESENT queues frames for the output worker (three buffers, SDMA
bands over both rings, nonblocking flips with the copy fences as the
in-fence, a condition variable instead of polling), what the agent's
--workload runs report, why GTT scanout is not available on a dGPU
through upstream DM, and how the shared-ring alternative is to be
judged from the measured PRESENT cost.
2026-10-03 17:29:31 -07:00
geramyloveless 46ec8ad8dc docs: what System Information shows for the GPU, and why not its monitors 2026-10-03 17:12:22 -07:00
geramyloveless deb81a3455 docs: first hardware results of the macOS display path 2026-10-03 16:26:31 -07:00
geramyloveless bd63bcff87 host: display-pin-test and display-agent --create
display-pin-test [--seconds N] [--width W --height H] [--init] creates
an IOSurface, fills it with rt_surface_pattern(1), imports it once
(IMPORT: its pages as the structure input), and after the call has
returned rewrites it from the CPU every second. Each time the driver
reads it back with SDMA and through its own CPU view (VERIFY): the new
pattern must match exactly and the previous one must not. Then RELEASE,
after which the handle must be gone.

display-agent --create [--connector NAME] [--seconds N] [--init] mirrors
one connected monitor as a macOS display:
- a CGVirtualDisplay from the plan (name, IDs, size, primaries, the
  monitor's progressive modes, hiDPI 0), with the private CoreGraphics
  classes declared in CGVirtualDisplayPrivate.h;
- OUTPUT at the mode macOS picks for it;
- a ScreenCaptureKit stream of it in BGRA at that mode and refresh,
  each capture surface imported once, each frame's dirty rectangles sent
  with PRESENT;
- a mode chosen in System Settings relights the monitor at that mode;
- Ctrl-C, SIGTERM or --seconds end it: capture stopped, imports
  released, the monitor's previous configuration restored (OFF), the
  virtual display removed, and a summary of frames, average copy and
  flip times, bytes copied and the agent's CPU time.
It needs Screen Recording permission and says so when it is missing. Any
failing step ends the run with its errno; nothing else is tried.

The frame replies (verify result, present stats) and the damage
conversion live in DisplayAgent.swift, covered by test-display-agent.
2026-10-03 15:40:51 -07:00
geramyloveless f09557da66 host: display-agent --dry-run
MacLinuxGPUHost display-agent --dry-run [--once] [--interval ms] [--init]
follows the GPU's connected monitors through an observer client. It polls
the cached connector state (selector 84 STATUS) and, when the hotplug
epoch moves, probes, reads each connected monitor's mode list (MODES)
and EDID (sysfs), and prints the CGVirtualDisplay it would create, then
the add, update and remove changes against what it had. It creates no
display; without --dry-run it refuses.

The plan takes the identity and colour from the EDID: the monitor name
(else PNP ID and product), the PNP ID word as vendor, the product, the
serial (or a stable hash of the serial string), the CIE primaries and
white point. It takes the modes from the driver's list for the link:
progressive only, duplicates dropped, preferred first, and the largest
mode as max pixels. The size comes from the driver's display_info (else
the EDID's). hiDPI is 0. A monitor with no valid EDID or no progressive
mode is reported and skipped.

The model (report/modes/EDID decoding, the plan, the agent's changes)
moves to host/DisplayAgent.swift, Foundation only, which the Xcode
target now builds; test-display-agent compiles it with a test of its
own. docs/macos-displays.md records what of the frame path exists.
2026-10-03 14:51:43 -07:00
geramyloveless 6fbe50b98c docs: design for the GPU's monitors as macOS displays
Each connected monitor becomes a CGVirtualDisplay described from its
EDID and mode list. ScreenCaptureKit delivers changed frames as
IOSurfaces with dirty rects; the driver imports each surface's pages as
a GTT buffer, copies the dirty rects into a VRAM framebuffer with SDMA
and flips on vblank, with no CPU pixel copies and no fallback path.
Covers hotplug, mode changes, the remaining cost on the Mac and how to
keep it small, the increments and the open questions.
2026-10-03 14:35:21 -07:00