Engineering

3D acceleration for Windows VMs on Apple Silicon: what it speeds up and what it doesn't

MacVisor's next update adds experimental 3D acceleration, which draws a Windows 11 VM's Direct3D 11 with the Mac's GPU. We measured one VM with it on and off: WebGL, video, browsing, documents and line-of-business apps.

· 14 min read

A Windows 11 VM with 3D acceleration on and off: scrolling from 20.4 to 60 frames a second, WebGL to the display's limit, 4K video at about half the CPU, and typing about a frame slower.

A Windows 11 VM in MacVisor draws everything with the Mac's CPU: the desktop, every app, every frame of video. MacVisor's next update, 27.2.2, adds an option that moves much of that to the Mac's GPU: 3D Acceleration (Experimental). It isn't in the current release, 27.2.1. When the update is out, the option is off by default, and available for every MacVisor 27 license.

This post explains why Windows draws in software on Apple's Virtualization framework, how the experimental path works, and what we measured with it on and off. The short version: browsers, WebGL and video gain a lot, some apps gain nothing, typing gets about a frame slower, and you give up Suspend.

Why Windows draws in software

MacVisor runs every VM on Apple's Virtualization framework. The framework has two graphics devices. Its virtio GPU is a 2D device: a guest gets a framebuffer and nothing that draws for it. Its accelerated GPU has guest drivers for macOS only.

So a Windows guest has a screen and no GPU. Direct3D still works, because Windows falls back to its own software renderer, which Edge reports as Microsoft Basic Render Driver. Windows' compositor, the browser's pages and every WebGL canvas are then drawn by the VM's vCPUs. That is fine for many apps. It gets expensive when a lot of pixels change at once: scrolling, video, animation, a large Retina window.

How the experimental path works

Four parts carry a Direct3D call from a Windows program to the Mac's GPU.

1. A display driver in Windows. With 3D on, Windows uses a virtio-gpu display driver for Windows (viogpu3d) in place of the standard display-only driver. It is a kernel driver derived from the virtio-win project's display driver, with user-mode Direct3D drivers built from Mesa. They turn a program's Direct3D calls into a stream of commands. This is setup by a VM's MacVisor Agent, which adds it to Windows' driver store.

2. virtio-gpu across the VM boundary. A Windows VM's display in MacVisor is Virtio-MVZ, MacVisor's own virtio-gpu device, built on the framework's custom-device API. With 3D on, the device also offers virtio-gpu's 3D half: rendering contexts, shared memory for commands and data, and fences that tell the guest when work is done. One detail matters on Apple Silicon. Apple's framework maps shared memory into a guest in 16 KiB units, and the driver places its buffers in 4 KiB units. MacVisor's device keeps the whole shared-memory window as one block of the Mac's memory and gives the renderer a pointer into it, so the driver's buffers aren't copied and the driver runs unmodified.

3. A render server on the Mac. The commands go to a build of virglrenderer, with a few changes of ours. It runs as a render server beside the VM's own process, with one worker process for each Windows program that uses Direct3D, so a program that misbehaves loses its own worker and nothing else. The server and its workers run in a sandbox: they can use the GPU, their own files and the VM's shader cache, and have no network and none of your files.

4. Direct3D on Metal. Each worker loads DXMT, an implementation of Direct3D 11 on Metal, built natively for macOS with some changes. DXMT translates the calls and the shaders, and Metal draws them on the Mac's GPU. The finished frame comes back through shared memory, and for most programs MacVisor copies it once into the VM window's surface.

The Windows driver and the renderer's Direct3D support are based on third party components. MacVisor's part is the device, the sandbox, and getting the driver in and out of Windows safely. Windows never swaps a display driver while it runs, so turning 3D on takes one restart of Windows, and turning it off takes the restart you're asked for and one more that Windows makes by itself.

The test, and its limits

We wrote a small bench that runs inside the guest and measured the same VM twice, with 3D on and with it off.

  • The Mac: a Mac mini with an M4 Pro (Mac16,11), macOS 27.2.1.
  • MacVisor: a pre-release build of 27.2.2.
  • The VM: Windows 11 Pro on ARM, 26H2 (build 26300.9974), 4 vCPUs, 8 GB of memory, Edge 158.
  • The display: 4964 x 2756 pixels at 200% scale: a maximized window at Retina resolution on a 5K-class screen.
  • The runs: 20 seconds per test (30 for the idle desktop), one run per mode. CPU was sampled once a second in the guest and on the Mac.
  • The drivers: "Red Hat VirtIO GPU 3D controller" (100.6.101.58000) with 3D on, "Red Hat VirtIO GPU DOD controller" (100.103.104.30200) with it off.

Read the numbers with these limits in mind:

  • One Mac, one VM, one run per mode. Nothing here says how much two runs of the same mode differ. Don't read much into a difference of a few percent.
  • Frame rates stop at 60. Edge draws at the display's refresh rate at most, so a test that reads 60 with 3D on can't show how much faster the GPU could go. Those rows are marked "(cap)".
  • The display favours the GPU. About 13.7 million pixels is a lot to draw with a CPU. A smaller window should narrow the gap, and we didn't measure one.
  • Edge only, with pages we wrote, driven by script. No games, and no third-party benchmark.
  • Frames are counted in the guest, when Edge or the app produced them. Whether the Mac's screen showed each one isn't measured.
  • The Mac's GPU isn't measured. With 3D on, work moves from the VM's vCPUs to the GPU, and only the CPU side shows in the tables.
  • The video rows are less certain. During the 3D-on video test, Edge's window wasn't the front window. No frame was dropped, but a window that isn't in front can be drawn differently, so the video rows may understate or flatter 3D. That test needs another run before anyone leans on it.
  • The build is a moving artifact. As we develop this, this isn't final. We may need to update this post again upon the final release, also unverified by others. So please take this with a bag of salt.

With the standard driver Windows reports the display's refresh rate as 1 Hz, and with the 3D driver as 60 Hz. The resolution and scale were the same in both runs.

Results

Graphics

Test in Edge3D on3D offOn / off
WebGL, 400 lit cubes: frames per second60.0 (cap)12.74.71x
WebGL, 400 lit cubes: 95th percentile frame18.3 ms93.7 ms0.20x
WebGL, full-window ray-marching shader: frames per second59.4 (cap)2.325.83x
WebGL, full-window ray-marching shader: 95th percentile frame17.7 ms1,191 ms0.01x
2D canvas, 3000 sprites: frames per second42.124.71.70x
2D canvas, 3000 sprites: 95th percentile frame33.7 ms46.9 ms0.72x
4K video at 30 frames per second: frames shown per second30.030.01.00x
4K video: frames dropped0.00%0.00%
4K video: 95th percentile time between frames36.0 ms48.7 ms0.74x
4K video: frames later than 1.5 frame times09

With 3D off, WebGL still works: Edge draws it with Windows' software renderer, at 12.7 and 2.3 frames a second. With 3D on, both WebGL tests sit at the display's limit. The 2D canvas test's median frame was at 60 Hz too (17.1 ms), but 123 of its 843 frames took two refreshes or more, which is why it averages 42.1. Video played without a dropped frame either way; what changes is how evenly the frames arrive, and what they cost (below).

Browsing, documents and line-of-business apps

Test3D on3D offOn / off
Scrolling a long article: frames per second60.0 (cap)20.42.95x
Scrolling: 95th percentile frame18.8 ms62.5 ms0.30x
Scrolling: frames longer than 33.4 ms0.00%100.00%
Typing in a 200-paragraph document: keystroke to painted, median3.7 ms3.2 ms1.16x
Typing: keystroke to on screen, median29.6 ms13.1 ms2.26x
Typing: keystroke to on screen, 95th percentile37.8 ms30.2 ms1.25x
Web data grid with live charts: frames per second60.0 (cap)38.31.57x
Web data grid: sort or filter to on screen, median33.0 ms59.0 ms0.56x
WPF grid and shapes: frames per second12.55.72.20x
WPF grid and shapes: 95th percentile frame117.8 ms321.1 ms0.37x
WinForms grid and shapes: paints per second31.932.90.97x
WinForms grid and shapes: 95th percentile paint40.5 ms36.2 ms1.12x
File Explorer: open, median of 5540 ms575 ms0.94x
Notepad: open, median of 5248 ms242 ms1.03x

Three things stand out.

Scrolling is the clearest win for everyday work. With 3D off, every frame of the scroll took longer than two refreshes. With it on, none did.

Typing gets about a frame slower. "Painted" is when Edge's main thread has drawn the frame with the new character, and it is the same in both modes. "On screen" is when Edge has handed that frame to Windows, and there 3D on is 16.5 ms behind, about one frame at 60 Hz. We haven't traced where that frame goes. If typing feel is all you care about, 3D doesn't help it. The web grid goes the other way: a sort or a filter of 2000 rows, where there is far more to draw, reaches the screen sooner with 3D on.

WPF gains, WinForms doesn't. WPF draws with Direct3D 9, which the driver doesn't offer, so with 3D on WPF renders in software (it reported rendering tier 0). It still ran at about twice the frame rate, because Windows' compositor and everything around the app moved to the GPU. With 3D off WPF reported tier 2, but there Windows' software renderer stands in for the GPU, so the CPU did all of it. WinForms draws with GDI+ on the CPU in both modes, and its numbers barely move.

CPU, in the guest and on the Mac

The guest column is the whole guest as a percentage of all four vCPUs. The Mac column is the VM's processes together (its runner, the guest's vCPUs and the render server) as a percentage of one of the Mac's cores.

TestGuest, 3D onGuest, 3D offOn the Mac, 3D onOn the Mac, 3D off
Idle desktop12.5%10.8%56%43%
WebGL cubes17.0%92.0%99%373%
WebGL shader14.2%97.8%85%396%
2D canvas31.1%44.8%156%176%
4K video22.0%46.3%99%187%
Scrolling15.0%39.6%108%172%
Typing19.0%21.0%90%89%
Web data grid25.7%46.9%153%196%
WPF35.5%79.1%154%332%
WinForms36.5%39.3%175%167%
File Explorer and Notepad21%22.0%98%92%

With 3D off, the two WebGL tests use nearly all four vCPUs and still miss their frames. With 3D on, the same tests leave the guest mostly idle. During video, Windows' compositor (dwm) used 80.9% of a vCPU with 3D off and 1.7% with it on.

The render server's own share of the Mac column was between 0% and 34% of a core: 34% for the web grid, 28% for the 2D canvas, 23% for scrolling, 14% for WinForms, 12% and 9% for the two WebGL tests, and less for the rest.

An idle VM costs a little more with 3D on: 56% of a core against 43%. The bench's own script runs in the guest and samples once a second during every test, the idle one included, so read the difference between the two columns, not either as what an idle VM costs. Typing, WinForms and opening windows cost the same either way.

When to turn it on, and when to leave it off

Turn it on for:

  • Browser-heavy work. Scrolling went from 20.4 to 60 frames a second, and the VM's cost on the Mac fell from 172% of a core to 108%.
  • WebGL. Our two tests went from 12.7 and 2.3 frames a second to the display's limit.
  • Video. The same 30 frames a second, more evenly, for about half the CPU. (See the caveat about the video test above.)
  • Large or Retina windows. The more pixels, the more a CPU struggles and the less a GPU cares.
  • WPF apps, somewhat. About twice the frame rate in our test, though WPF itself still draws in software.

Expect no gain for:

  • WinForms and other GDI apps. They draw on the CPU either way.
  • Typing. A keystroke reached the screen in a median of 29.6 ms with 3D on and 13.1 ms with it off.
  • An idle VM, which costs the Mac a little more with 3D on.

Leave it off when:

  • You need Suspend, or live snapshots with memory. A VM with 3D on can't be suspended, and a snapshot of it while it runs is of its disks only. What the renderer holds on the Mac's GPU can't be saved.
  • You want Windows' interface drawn the standard way, with nothing experimental between an app and the screen.

Business and CAD apps

Most business apps draw with GDI, WinForms or WPF, and the results above apply to them: little gain from 3D for GDI and WinForms, some for WPF, and Windows' compositor and anything browser-based move to the GPU. What 3D changes is the apps that wouldn't run well at all without a GPU:

  • Apps that draw with Direct3D 11 move to the GPU. Of the business apps we tried, Power BI Desktop, Teams, the new Outlook, Slack and Visual Studio Code draw on the GPU, and so do Edge and Chrome. LibreOffice, Zoom and QGIS work but draw in software either way. We haven't tried ArcGIS Pro. The Windows page lists every app we tried.
  • Apps that draw with OpenGL, Direct3D 12 or Vulkan don't gain, because the driver offers Direct3D 11 only. That rules out much of CAD, such as SolidWorks.
  • CAD vendors don't support their apps in MacVisor. For daily CAD work, Parallels Desktop, which supports DirectX 11.1 and OpenGL 4.3 (Parallels), a Windows PC or a cloud workstation with a GPU is the safer choice.

Known limits

3D acceleration is experimental, and these are its limits today:

  • Direct3D 11 only. No Direct3D 12, no Direct3D 9, no Vulkan, and no accelerated OpenGL: Windows' own OpenGL 1.1 is all there is, so apps that need newer OpenGL, such as Blender, won't start.
  • No Suspend, and disk-only live snapshots, as above. At logout with Suspend VMs chosen, such a VM is shut down instead.
  • One display per VM, and no HDR. The refresh rate is 60 Hz by default, and 30 to 120 Hz in VM Settings → Display → Refresh Rate.
  • Programs in exclusive full screen can lose their graphics at Alt+Tab, and may close: Intel (x86 and x64) programs often, ARM64 ones only late in a long Windows session. Run them in a window or in borderless full screen.
  • One worker process on the Mac for each Windows program that uses Direct3D, beside the VM's own process.
  • One copy of each frame through the CPU for most programs, from shared memory to the window's surface. Programs that present the older way, as many games do, take more.
  • An Apple Silicon Mac on macOS 27.2. So far we've run it on an M4 Pro, and not on other Apple chips or on macOS 27.0 or 27.1.
  • The driver is another project's, downloaded when a VM first needs it, and MacVisor's side of it is new. Expect rough edges.
  • Turn it off before going back to an earlier MacVisor. A version without 3D acceleration gives Windows a display its driver can't use, and Windows hangs as it starts. Turn 3D off and let the driver come out first.

Trying it when it's out

3D acceleration comes in MacVisor's next update. Once you have it:

  1. Take a snapshot of the Windows VM, or use one you can do without.
  2. Turn on 3D Acceleration (Experimental) in VM Settings → Display, or run mvz set <vm> --3d on.
  3. Start the VM from shut down. MacVisor downloads the driver and puts it into Windows, and Tasks asks for one restart of Windows.
  4. After the restart, Device Manager → Display adapters reads Red Hat VirtIO GPU 3D controller.

To go back, turn the switch off and restart Windows when Tasks asks. The window shows Windows on a basic display, or nothing, for a few seconds, Windows restarts once more by itself, and Device Manager reads Red Hat VirtIO GPU DOD controller again.

The details, the requirements and the full list of limits are in 3D acceleration (experimental). If you try it, tell us what you ran and what you saw: that is what an experimental feature is for.

The update is free for every MacVisor 27 license and the free trial. The changelog lists what else is in it.

Written By

Share this post

Founder, ScaleNinja

Lifelong builder and breaker of open-source infra platforms, now building virtualization and infrastructure software at ScaleNinja. Apache CloudStack committer, PMC member and former VP of Apache CloudStack, and member of the Apache Software Foundation and Kubernetes.