ca66596b83ac4fd80dc3b2015882979ece5cfcea
6
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
1acac3d31d |
🐛 The device advertised 120 Hz and delivered VBL at 125
`crates/reims-vgpu` display VBL limiter (`runtime/drain/mod.rs`, `model/regs.rs`, `observe/sink.rs`, `lib.rs`) plus an instrument caveat in `scripts/browser-probe/gpu-probe.html`. Affects every pathway; measured on x86 macOS / Linux Vulkan. Two constants reach the guest by two routes: `DISPLAY_REFRESH_HZ = 120` goes into the mode timing table it reads, and the VBL limiter paces the interrupt it is actually woken by. The limiter was a hardcoded `DISPLAY_VBL_MIN_INTERVAL_MS = 8`, which is 125 Hz. The guest paces to the interrupt, not the table, so it latched 125 — a driven Safari measured its own frame rate at exactly 125 Hz while our timing table claimed 120. Two comments in the same file disagreed about which was intended, one calling 8 ms "approximately 120 Hz" and the other "a healthy 125 Hz". 120 Hz is 8333 us and is **not expressible on an integer-millisecond grid**, so the units were part of the defect rather than incidental to it: an 8 ms period also carries +/-12.5% quantisation by construction. The limiter now works in microseconds via a new `observe::elapsed_us()` on the same process-monotonic clock, and `DISPLAY_VBL_MIN_INTERVAL_US` is **derived** from `DISPLAY_REFRESH_HZ` rather than restated, so the two cannot drift apart again. `t=` stamps stay in milliseconds so line-class censuses keep working. Live verification, boot before and after: `display_vbl` read `window_hz=125.0 grid_hz=125.0` and now reads `window_hz=120.0 grid_hz=120.0` against 8192 delivered VBLs. Tests: one added, 1212 -> 1213 passing, 0 failed (vulkan arm, `--test-threads=1`). It asserts the *identity* — delivered cadence equals advertised refresh — rather than either value, so it stays true if the advertised rate changes and cannot itself go stale; a second assertion pins that a whole-millisecond interval could not express the answer. Mutation verified: restoring the 8 ms grid fails it with "advertising 120 Hz but delivering 125.0 Hz (interval 8000 us)". Clippy clean with `-D warnings` on the vulkan arm; `cargo check --target aarch64-apple-darwin --features backend-metal` unchanged at 19 warnings, 0 errors. Also documents a limit of our own probe that this exposed: browsers clamp `performance.now()` (Safari to ~1 ms), so a true 8.333 ms interval arrives as 8/8/9 and the median-derived `refresh_hz` reports 125 for a display genuinely at 120. The probe cannot tell those two apart and now says so; the host-side `display_vbl` census is the instrument for that question. Not verified: **no performance claim.** Guest-side long-frame counts across runs were 15/24/28/8/10/42 with fps 118-119 and one run at 59.5, so run-to-run variance dominates any effect this could have and the post-change run's higher count is not evidence either way. The basis for this change is contract consistency — advertise what we deliver — not measured frame pacing. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
5ff185d67b |
✨ A probe that makes ANGLE name its own Metal refusal
`scripts/browser-probe/guest_angle_metal.py` (measurement only). With `--use-angle=metal`, Chrome's GPU process died reporting only "Initialization of all (1) EGL display types failed" — Chrome counting failures, not ANGLE explaining one. On the OpenGL backend ANGLE's diagnostics reach the Chrome log through `angle_platform_impl`; on the Metal backend nothing is printed at all, because the failure happens before that channel carries anything. The single line that would name the cause is the one Chrome never gets, which is why this was previously recorded as an unexplained dead end. This drives Chrome's own `libEGL.dylib` directly with an `EGL_KHR_debug` callback installed, asks for a Metal display, and initializes the OpenGL backend afterwards as a control — if Metal fails and OpenGL succeeds in the same process, the failure belongs to the Metal path and not to the harness. Measured in the live guest: metal : eglGetPlatformDisplayEXT -> EGL_NO_DISPLAY, eglGetError EGL_SUCCESS opengl: eglInitialize OK, EGL 1.5, ANGLE 2.1.28226 EGL_NO_DISPLAY together with EGL_SUCCESS is the finding. ANGLE is not failing to create the display; it is declining to offer one, from a capability check that runs before creation. That relocates the question from "why does Metal device creation fail" — it does not fail, the device resolves — to "which capability does this guest's Metal device not have". Two notes for whoever runs this next. The probe loads CoreGraphics before any Metal call, because a bare ctypes process otherwise latches a nil system-default device and would manufacture the failure it is diagnosing. And `eglDebugMessageControlKHR` takes `EGLAttrib*` (`intptr_t`, 64-bit) while `eglGetPlatformDisplayEXT` takes the EXT spelling `EGLint*` (32-bit); passing one width for both walks ANGLE off the end of the array and segfaults the process, which reads as "the Metal backend crashed" rather than "the probe passed the wrong type". Both cost a debugging cycle here and are commented at their sites. Verification: run against the live x86 guest (macOS 13.7.8, `reims-vgpu-pci`), output above. The OpenGL control arm is what rules out the harness. Not verified: which capability ANGLE is testing. That is a property of ANGLE, not of this device, and is being read out of the ANGLE binary separately. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
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> |
||
|
|
6ae2502d7a |
✨ A mean frame rate cannot see the hitch it is asked about
`scripts/browser-probe/` (measurement only; no device or backend behavior changes). The frame-pacing arm of `gpu-probe.html` reported a mean fps and a single worst-frame figure. Neither can answer the question the probe exists for. "120 fps, perfectly even" and "120 fps with occasional stalls" produce the same mean, and one 40 ms stall and forty of them produce the same worst frame. The one measured number carried forward from this rig — Safari at 119.4 fps, worst frame 13 ms — is consistent with both a healthy display and a stuttering one, so it could not settle anything. The loop now keeps every frame delta and summarises the distribution: median/p95/p99, a long-frame count and percentage, dropped refreshes, the worst consecutive run of long frames, and a histogram bucketed in refresh intervals. The run of long frames is reported separately from their count because only a run is visible as a jerk; ten scattered drops and one ten-frame freeze are the same number and not the same defect. Two choices worth stating. The refresh interval is the *median* observed delta, not a hardcoded 1/120: this guest display has run at 60 and at 120, and a fixed budget misreports every frame on the other one. The median rather than the mean because it is the estimator a burst of long frames cannot drag with it. A frame counts as long past 1.5 intervals, the midpoint between one interval and two, which is where a delta stops being jitter around the budget and becomes a skipped vblank. The statistics moved into a DOM-free `summarizeDeltas` so they can be tested. `PROBE_SECONDS` widens the window through `web-gpu-probe.sh` (the settle wait scales with it, or a slow browser is read before it posts and scored silent); 5 s establishes a mean but can miss a stall that happens twice a minute. Tests: `node scripts/browser-probe/pacing-stats-test.mjs` — 20 checks, all passing. It slices the functions out of the page rather than restating them, so it exercises shipped code and not a copy that can drift. Mutation-verified by replacing the median with a hardcoded 120 Hz budget: 5 checks fail, and a healthy 60 Hz stream is then scored as dropping all 300 frames, which is the specific lie the median exists to prevent. Not verified: no live guest run yet — this commit changes the instrument, not the thing measured. Requires `node` for the test only; the probe page itself runs in the guest browser as before. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
1e1875e643 |
✨ Probes that measure Metal, CGL and WebGL from inside the guest
Follow-on to the CDP client. Three questions kept coming back unanswerable from the host side, so each now has a probe that asks the guest directly. `guest_gl_renderers.py` enumerates CGL renderers. On this guest the answer is one renderer, the Apple Software Renderer, `accelerated=0` — which is the whole explanation for every OpenGL-based browser reporting software rendering at once. Note the constants: `kCGLRP*` are small integers, and the first version of this file used the `kCGLPFA*` values in the 1600s by mistake, which makes `CGLDescribeRenderer` fail every query and reads as a dead GPU rather than a dead probe. `guest_metal_caps.py` reports the Metal device. It drives `objc_msgSend` through ctypes with explicit per-call argtypes — derived argtypes cannot express an out-parameter, since `ctypes.byref` yields a CArgObject with no `from_param`. `gpu-probe.html` + `probe_server.py` + `web-gpu-probe.sh` ask each browser whether WebGL/WebGPU came up and how many frames it sustained. The page posts its own result back to the server that served it: Safari has no debugging protocol, and AppleScript into Safari or Finder times out on this guest waiting for an automation-consent click that an unattended run cannot give. Serving over http rather than file:// is required for that POST to be same-origin. Measured with these, x86/Vulkan, macOS 13.7.8, one boot: Safari 16.6 WebGL1+2 "Apple GPU", hardware, 119.4 fps, worst frame 13 ms Chrome 151 WebGL1+2 unavailable, WebGPU no adapter, 134.6 fps rAF only Firefox 153 WebGL1+2 unavailable, no navigator.gpu, 122.5 fps rAF only So Metal works and the fault is not general. Chrome's GPU process exits during init with "Initialization of all (1) EGL display types failed", including when ANGLE is forced to Metal from a GUI-session launch with the blocklist ignored. The device is fully usable — it compiles MSL and creates a command queue — but `MTLCreateSystemDefaultDevice()` returns nil while `MTLCopyAllDevices()` returns it, and ANGLE-Metal asks for the system default. Tooling only; no crate code touched. |
||
|
|
1fd9e88383 |
✨ A browser probe that can read the browser's own GPU verdict
The browser-facing goals (Chrome/Firefox GPU acceleration, WebGL, WebGPU, in-page frame rate) are scored on facts only the browser can report, and nothing in the tree could ask it. A host-window screenshot cannot say why `chrome://gpu` disabled a feature, and `chrome://gpu` renders its report inside a shadow root, so even a screenshot of it is not text. `scripts/browser-probe/cdp.py` speaks the Chrome DevTools Protocol over a hand-rolled RFC 6455 client. Neither the Linux host nor the macOS guest has `websockets` or `websocket-client`, and installing one into the guest would change the snapshot under measurement, so the ~80 lines of client framing are written out directly. Chrome exposes CDP natively and Firefox 129+ exposes it behind `remote.active-protocols=2`, so one client covers both. `chrome_gpu_report.py` prints the Graphics Feature Status, driver identity and Problems Detected blocks as plain lines. It is a file rather than a heredoc piped through ssh because the shadow-DOM walk needs `\n` inside a JS string literal and a double-quoted ssh command eats one level of backslash, which fails as a syntax error pointing at an unrelated line. `chrome-gpu-status.sh` gives every run a fresh `--user-data-dir`. Chrome latches "GPU access is disabled due to frequent crashes" into the profile, so a reused profile reports some earlier boot's verdict rather than the build under test — that is not a hypothetical, it is what the first reading here did. Tooling only; no crate code touched, so no test or clippy arm is affected. |