Files
reims-vgpu/scripts/browser-probe
Anees IqbalandClaude a26f96bb11 🐛 The nil default Metal device was the probe's, not the guest's
`scripts/browser-probe/` (measurement only). Refutes a recorded root cause.

`guest_metal_caps.py` reported `MTLCreateSystemDefaultDevice(): nil` against a
guest whose `MTLCopyAllDevices()` returned one working device. That reading was
carried forward as the root cause of Chrome and Firefox having no GPU here:
ANGLE-Metal asks for the system default at display init, so a nil default
device explained "Initialization of all (1) EGL display types failed", and it
was recorded as a settled dead end not worth retrying.

It is a defect in the probe. Metal resolves the system default through
`CGSCreateDefaultMetalDevice`, which it reaches by `dlopen`ing CoreGraphics and
`dlsym`ing that symbol, and it returns nil with **no fallback** when the lookup
fails. The work sits behind a `dispatch_once`, so the result is latched for the
life of the process. A bare `ctypes` process has no CoreGraphics loaded; a
normal application links it and never sees this.

Measured in the running guest, one process each:

  bare                       -> nil, and still nil after a later dlopen
  dlopen(CoreGraphics) first -> Apple Paravirtual device
  MTLCopyAllDevices first    -> nil

The "still nil after a later dlopen" arm is what identifies the `dispatch_once`
latch rather than a transient. With CoreGraphics loaded before the first Metal
call, the same guest, in the same boot, answers `Apple Paravirtual device`.

So the system default device resolves, and whatever stops Chrome reaching the
GPU is still unknown. Adds `guest_default_device.py`, which walks Metal's four
nil-producing exits in one process and prints each input before the answer, so
a future nil names its own cause instead of needing a second run: it reports
the device array, the `deviceNameMatch` preference, the CoreGraphics dlopen and
dlsym, the direct `CGSCreateDefaultMetalDevice` result, and only then the
question itself. Live output ends `VERDICT: the system default device resolves.
Any browser that reports no GPU is failing for some other reason.`

Verification: both probes run against the live x86 guest (macOS 13.7.8,
`reims-vgpu-pci`); `guest_metal_caps.py` now reads `ok` where it read `nil`
minutes earlier in the same boot, which is the before/after for this change.

Not verified: why Chrome's GPU process actually fails. This commit removes a
wrong answer, it does not supply the right one, and the flag combinations
previously abandoned on the strength of that wrong answer are now untested
rather than known-bad.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-01 23:36:50 +03:00
..