Repository navigation
display(macOS): pace the VM display with CAMetalDisplayLink - #7983
Open
dragoshont wants to merge 1 commit into
Open
dragoshont wants to merge 1 commit into
dragoshont wants to merge 1 commit into
Conversation
Closed
On a MacBook Pro with an external 60 Hz main display, a VM window on the built-in 120 Hz ProMotion panel never showed more than 60 frames per second. MTKView's own timer stayed at 60 callbacks per second there even with preferredFramesPerSecond = 120. A CAMetalDisplayLink on the same layer runs at the rate it requests, and its frames reach the screen at 120 Hz. On macOS 14 and later, drive the renderer from a CAMetalDisplayLink and hand it the drawable from each update. The rate follows the screen the window is on, and an FPS limit changed in Settings now applies the next time the VM starts, not only when its window is created. Earlier macOS versions keep the view's own timer. Assisted-by: GitHub Copilot:claude-opus-5.5
dragoshont
force-pushed
the
display/metal-display-link
branch
from
October 18, 2026 10:00
dde2e47 to
47b96f7
Compare
dragoshont
marked this pull request as ready for review
October 18, 2026 13:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On my MacBook Pro with an external 60 Hz main display, a VM window on the built-in 120 Hz ProMotion panel never shows more than 60 fps.
The display is drawn from MTKView's own timer, and on that panel the timer stayed at 60 callbacks per second even with
preferredFramesPerSecond = 120(confirmed in lldb). ACAMetalDisplayLinkon the same layer runs at the rate it requests, and its frames reach the screen at 120 Hz. I haven't tried a ProMotion Mac without an external display.On macOS 14+ this drives the renderer from a
CAMetalDisplayLink.VMMetalViewhands the renderer the drawable from each update, soCSMetalRendererdoesn't change. Behaviour:Related: #7820. With #7982 the guest itself can also run at 120 Hz.
Testing: macOS 27.0.1, MacBook Pro M5 Max. Debug builds with and without this change, and a disposable Alpine VM whose console scrolls constantly. With the VM window on the 120 Hz panel, I counted distinct frames per second with ScreenCaptureKit and checked them against the Metal HUD:
Also with this PR:
Windows 11 Pro ARM64 (build 26300, viogpu3d, D3DMetal), window on the 120 Hz panel and the guest at 120 Hz through #7982. A D3D11 test presenting ~560 fps in the guest:
The Mac was busy with another app using 3+ cores during the Windows run, so those numbers are noisy. The point is that the window gets past 60.
Not tested yet: macOS 12/13, secondary displays.
An AI agent ran these tests on my Mac.
I have read the AI contribution guidelines and have followed them to the best of my ability.