Skip to content

Commit

Permalink
qemu: Enable hardware acceleration on Windows
Browse files Browse the repository at this point in the history
And document the default "tcg" fallback accel
  • Loading branch information
afbjorklund committed Aug 18, 2024
1 parent af5e8a8 commit 10d3aa3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/drivers/qemu/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,17 +545,19 @@ func (d *Driver) Start() error {
}

func hardwareAcceleration() string {
if detect.IsAmd64M1Emulation() {
return "tcg"
}
if runtime.GOOS == "darwin" {
if !detect.IsAmd64M1Emulation() && runtime.GOOS == "darwin" {
// On macOS, enable the Hypervisor framework accelerator.
return "hvf"
}
if _, err := os.Stat("/dev/kvm"); err == nil && runtime.GOOS == "linux" {
// On Linux, enable the Kernel Virtual Machine accelerator.
return "kvm"
}
if runtime.GOOS == "windows" {
// On Windows, enable the Windows Hypervisor Platform accelerator.
return "whpx"
}
// Use the default, "tcg" (in software, not hardware accelerated)
return ""
}

Expand Down

0 comments on commit 10d3aa3

Please sign in to comment.