fix(host): surface Vulkan probe failures in setup and doctor
This commit is contained in:
1 parent
e6c8388c37
commit
e62742f65d
13 files changed
+66
-27
No files matched your search
@@ -203,7 +203,7 @@ const RuntimeStep: React.FC<StepProps> = ({ locale, tr, state, runtimeTask, onCh
|
||||
const whpxOK = host.whpx === 'ready'
|
||||
const gpu = host.recommended_gpu ?? (host.gpus ?? []).find((g) => g.kind !== 'virtual')
|
||||
const gpuHint = gpuCompatHint(locale, gpu)
|
||||
const gpuOK = !!gpu && gpu.compat !== 'warn' && gpu.compat !== 'unsupported'
|
||||
const gpuOK = !host.vulkan_probe_error && !!gpu && gpu.compat !== 'warn' && gpu.compat !== 'unsupported'
|
||||
const recMem = recommendedMemoryGB(host)
|
||||
return (
|
||||
<>
|
||||
@@ -236,7 +236,10 @@ const RuntimeStep: React.FC<StepProps> = ({ locale, tr, state, runtimeTask, onCh
|
||||
<div className="row">
|
||||
<div className="row-main">
|
||||
<div className="row-title">{tr('setupGPU')}</div>
|
||||
<div className="row-sub">{gpu ? shortGPUName(gpu.name) : tr('setupNoGPU')}</div>
|
||||
{gpu && <div className="row-sub">{shortGPUName(gpu.name)}</div>}
|
||||
{host.vulkan_probe_error ? (
|
||||
<div className="row-sub warn-text">{tr('vulkanProbeFailed', { detail: host.vulkan_probe_error })}</div>
|
||||
) : !gpu && <div className="row-sub">{tr('setupNoGPU')}</div>}
|
||||
{gpuHint && <div className="row-sub warn-text">{gpuHint}</div>}
|
||||
</div>
|
||||
<div className="row-right">
|
||||
|
||||
@@ -79,6 +79,7 @@ export const wizardZh: Record<string, string> = {
|
||||
"summarySource": "来源",
|
||||
"validationChecking": "正在检查…",
|
||||
"validationPassed": "可以创建",
|
||||
"vulkanProbeFailed": "Vulkan 探测失败({detail})。请运行 vulkaninfo --summary 检查驱动。",
|
||||
"wizChooseFile": "选择…",
|
||||
"wizNoFile": "还没有选择文件",
|
||||
"wizOptions": "选项",
|
||||
@@ -166,6 +167,7 @@ export const wizardEn: Record<string, string> = {
|
||||
"summarySource": "Source",
|
||||
"validationChecking": "Checking…",
|
||||
"validationPassed": "Ready to create",
|
||||
"vulkanProbeFailed": "Vulkan probe failed ({detail}). Run vulkaninfo --summary to check the driver.",
|
||||
"wizChooseFile": "Choose…",
|
||||
"wizNoFile": "No file chosen",
|
||||
"wizOptions": "Options",
|
||||
|
||||
@@ -890,6 +890,7 @@ export type I18nKey =
|
||||
| "viewLogs"
|
||||
| "vmDir"
|
||||
| "vmName"
|
||||
| "vulkanProbeFailed"
|
||||
| "welcomeCheckHost"
|
||||
| "welcomeSub"
|
||||
| "welcomeTitle"
|
||||
|
||||
@@ -762,6 +762,7 @@ export namespace host {
|
||||
whpx_caps: WHPXCapabilities;
|
||||
needs_cold_reboot_workaround: boolean;
|
||||
gpus: GPUInfo[];
|
||||
vulkan_probe_error?: string;
|
||||
recommended_gpu?: GPUInfo;
|
||||
displays?: DisplayInfo[];
|
||||
primary_display?: DisplayInfo;
|
||||
@@ -807,6 +808,7 @@ export namespace host {
|
||||
this.whpx_caps = this.convertValues(source["whpx_caps"], WHPXCapabilities);
|
||||
this.needs_cold_reboot_workaround = source["needs_cold_reboot_workaround"];
|
||||
this.gpus = this.convertValues(source["gpus"], GPUInfo);
|
||||
this.vulkan_probe_error = source["vulkan_probe_error"];
|
||||
this.recommended_gpu = this.convertValues(source["recommended_gpu"], GPUInfo);
|
||||
this.displays = this.convertValues(source["displays"], DisplayInfo);
|
||||
this.primary_display = this.convertValues(source["primary_display"], DisplayInfo);
|
||||
|
||||
+5
-2
@@ -194,9 +194,12 @@ func cmdDoctor(cfg *config.Config, loc i18n.Locale, args []string) error {
|
||||
}
|
||||
fmt.Printf("%-36s: %s\n", i18n.T(loc, "doctor.whpx"), i18n.T(loc, whpxKey))
|
||||
|
||||
if len(rep.GPUs) == 0 {
|
||||
if rep.VulkanProbeError != "" {
|
||||
fmt.Printf("%-36s: %s\n", i18n.T(loc, "doctor.gpu"), i18n.M(loc, "doctor.gpu.probe_failed", i18n.Vars{"detail": rep.VulkanProbeError}))
|
||||
}
|
||||
if len(rep.GPUs) == 0 && rep.VulkanProbeError == "" {
|
||||
fmt.Printf("%-36s: %s\n", i18n.T(loc, "doctor.gpu"), i18n.T(loc, "doctor.gpu.none"))
|
||||
} else {
|
||||
} else if len(rep.GPUs) > 0 {
|
||||
fmt.Printf("%s:\n", i18n.T(loc, "doctor.gpu"))
|
||||
for _, g := range rep.GPUs {
|
||||
tags := []string{}
|
||||
|
||||
@@ -91,6 +91,7 @@ type Report struct {
|
||||
WHPXCaps WHPXCapabilities `json:"whpx_caps"`
|
||||
NeedsColdRebootWorkaround bool `json:"needs_cold_reboot_workaround"`
|
||||
GPUs []GPUInfo `json:"gpus"`
|
||||
VulkanProbeError string `json:"vulkan_probe_error,omitempty"`
|
||||
RecommendedGPU *GPUInfo `json:"recommended_gpu,omitempty"`
|
||||
Displays []DisplayInfo `json:"displays,omitempty"`
|
||||
PrimaryDisplay *DisplayInfo `json:"primary_display,omitempty"`
|
||||
|
||||
@@ -64,11 +64,12 @@ type memoryStatusEx struct {
|
||||
}
|
||||
|
||||
type staticHostSnapshot struct {
|
||||
needsColdReboot bool
|
||||
gpus []GPUInfo
|
||||
recGPU *GPUInfo
|
||||
topo hybridTopology
|
||||
topoOK bool
|
||||
needsColdReboot bool
|
||||
gpus []GPUInfo
|
||||
vulkanProbeError string
|
||||
recGPU *GPUInfo
|
||||
topo hybridTopology
|
||||
topoOK bool
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -82,7 +83,7 @@ var (
|
||||
|
||||
func getStaticHostSnapshot() staticHostSnapshot {
|
||||
staticHostOnce.Do(func() {
|
||||
gpus := probeVulkanGPUs()
|
||||
gpus, err := probeVulkanGPUs()
|
||||
topo, ok := probeHybridTopology()
|
||||
staticHostData = staticHostSnapshot{
|
||||
needsColdReboot: probeNeedsColdRebootWorkaround(),
|
||||
@@ -91,6 +92,9 @@ func getStaticHostSnapshot() staticHostSnapshot {
|
||||
topo: topo,
|
||||
topoOK: ok,
|
||||
}
|
||||
if err != nil {
|
||||
staticHostData.vulkanProbeError = err.Error()
|
||||
}
|
||||
})
|
||||
return staticHostData
|
||||
}
|
||||
@@ -122,6 +126,7 @@ func Inspect(dataRoot string) Report {
|
||||
WHPX: probeWHPX(),
|
||||
NeedsColdRebootWorkaround: st.needsColdReboot,
|
||||
GPUs: gpusCopy,
|
||||
VulkanProbeError: st.vulkanProbeError,
|
||||
RecommendedGPU: recGPUCopy,
|
||||
}
|
||||
if rep.WHPX == WHPXReady {
|
||||
@@ -545,10 +550,11 @@ func isUSBBusVolume(vol string) bool {
|
||||
|
||||
// ProbeVulkanGPUs returns the current Vulkan adapters without using Inspect's cache.
|
||||
func ProbeVulkanGPUs() []GPUInfo {
|
||||
return probeVulkanGPUs()
|
||||
gpus, _ := probeVulkanGPUs()
|
||||
return gpus
|
||||
}
|
||||
|
||||
func probeVulkanGPUs() []GPUInfo {
|
||||
func probeVulkanGPUs() ([]GPUInfo, error) {
|
||||
const baseKey = `SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}`
|
||||
var regGPUs []GPUInfo
|
||||
for i := 0; i < 32; i++ {
|
||||
@@ -578,8 +584,8 @@ func probeVulkanGPUs() []GPUInfo {
|
||||
DriverVersion: drvVer,
|
||||
})
|
||||
}
|
||||
vkProbes := probeVulkanDevices()
|
||||
return MergeRegistryAndVulkanGPUs(regGPUs, vkProbes)
|
||||
vkProbes, err := probeVulkanDevices()
|
||||
return MergeRegistryAndVulkanGPUs(regGPUs, vkProbes), err
|
||||
}
|
||||
|
||||
func regReadString(root uintptr, subKey, valueName string) (string, bool) {
|
||||
|
||||
@@ -5,6 +5,7 @@ package host
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
@@ -50,21 +51,21 @@ type vkExtensionProperties struct {
|
||||
|
||||
// probeVulkanDevices loads vulkan-1.dll and enumerates all visible Vulkan
|
||||
// physical devices along with their API version, PCI IDs, device type, and
|
||||
// advertised device extensions. Returns nil cleanly if the Vulkan loader is
|
||||
// absent or refuses instance creation.
|
||||
func probeVulkanDevices() []VulkanDeviceProbe {
|
||||
// advertised device extensions. An empty list with no error means enumeration succeeded.
|
||||
func probeVulkanDevices() ([]VulkanDeviceProbe, error) {
|
||||
dll := syscall.NewLazyDLL("vulkan-1.dll")
|
||||
if err := dll.Load(); err != nil {
|
||||
return nil
|
||||
return nil, err
|
||||
}
|
||||
pCreateInst := dll.NewProc("vkCreateInstance")
|
||||
pDestroyInst := dll.NewProc("vkDestroyInstance")
|
||||
pEnumPhys := dll.NewProc("vkEnumeratePhysicalDevices")
|
||||
pGetProps := dll.NewProc("vkGetPhysicalDeviceProperties")
|
||||
pEnumExts := dll.NewProc("vkEnumerateDeviceExtensionProperties")
|
||||
if pCreateInst.Find() != nil || pDestroyInst.Find() != nil ||
|
||||
pEnumPhys.Find() != nil || pGetProps.Find() != nil || pEnumExts.Find() != nil {
|
||||
return nil
|
||||
for _, proc := range []*syscall.LazyProc{pCreateInst, pDestroyInst, pEnumPhys, pGetProps, pEnumExts} {
|
||||
if err := proc.Find(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
appName := append([]byte("reims-go"), 0)
|
||||
@@ -92,15 +93,21 @@ func probeVulkanDevices() []VulkanDeviceProbe {
|
||||
uintptr(unsafe.Pointer(&instance)),
|
||||
)
|
||||
}
|
||||
if int32(res) != vkSuccess || instance == 0 {
|
||||
return nil
|
||||
if int32(res) != vkSuccess {
|
||||
return nil, vulkanResultError("vkCreateInstance", int32(res))
|
||||
}
|
||||
if instance == 0 {
|
||||
return nil, fmt.Errorf("vkCreateInstance: VK_NULL_HANDLE")
|
||||
}
|
||||
defer pDestroyInst.Call(instance, 0)
|
||||
|
||||
var count uint32
|
||||
res, _, _ = pEnumPhys.Call(instance, uintptr(unsafe.Pointer(&count)), 0)
|
||||
if (int32(res) != vkSuccess && int32(res) != vkIncomplete) || count == 0 {
|
||||
return nil
|
||||
if int32(res) != vkSuccess && int32(res) != vkIncomplete {
|
||||
return nil, vulkanResultError("vkEnumeratePhysicalDevices", int32(res))
|
||||
}
|
||||
if count == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
if count > 32 {
|
||||
count = 32
|
||||
@@ -112,7 +119,7 @@ func probeVulkanDevices() []VulkanDeviceProbe {
|
||||
uintptr(unsafe.Pointer(&devices[0])),
|
||||
)
|
||||
if int32(res) != vkSuccess && int32(res) != vkIncomplete {
|
||||
return nil
|
||||
return nil, vulkanResultError("vkEnumeratePhysicalDevices", int32(res))
|
||||
}
|
||||
|
||||
out := make([]VulkanDeviceProbe, 0, count)
|
||||
@@ -136,7 +143,14 @@ func probeVulkanDevices() []VulkanDeviceProbe {
|
||||
}
|
||||
out = append(out, probe)
|
||||
}
|
||||
return out
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func vulkanResultError(call string, result int32) error {
|
||||
if result == vkErrorIncompatibleDriver {
|
||||
return fmt.Errorf("%s: VK_ERROR_INCOMPATIBLE_DRIVER (%d)", call, result)
|
||||
}
|
||||
return fmt.Errorf("%s: VkResult %d", call, result)
|
||||
}
|
||||
|
||||
func probeVulkanDeviceExtensions(pEnumExts *syscall.LazyProc, pd uintptr) map[string]bool {
|
||||
|
||||
@@ -90,6 +90,7 @@ var catalog = map[Locale]map[string]string{
|
||||
"doctor.gpu.err.vulkan_cpu": "软件渲染 Vulkan 实现不满足 vGPU 硬件加速要求,请改用 VMware SVGA",
|
||||
"doctor.gpu.err.vulkan_too_old": "Vulkan 版本 {ver} 低于 1.3 最低要求,请更新显卡驱动或改用 VMware SVGA",
|
||||
"doctor.gpu.none": "未检测到已注册的 Vulkan ICD 显卡驱动",
|
||||
"doctor.gpu.probe_failed": "Vulkan 探测失败({detail})。请运行 vulkaninfo --summary 检查驱动。",
|
||||
"doctor.gpu.recommended": "推荐",
|
||||
"doctor.gpu.warn.amd_legacy": "AMD Vega/Polaris 在 Windows 闭源驱动下存在上游已知黑屏/设备丢失问题({ref}),建议使用其他独显或在虚拟机设置改用 VMware SVGA",
|
||||
"doctor.gpu.warn.amd_rdna2": "该 AMD 显卡在 Windows 下存在上游已知设备丢失风险({ref}),若黑屏/卡死请升级驱动或临时改用 VMware SVGA",
|
||||
@@ -624,6 +625,7 @@ var catalog = map[Locale]map[string]string{
|
||||
"doctor.gpu.err.vulkan_cpu": "Software Vulkan implementation does not meet the vGPU floor; use VMware SVGA instead",
|
||||
"doctor.gpu.err.vulkan_too_old": "Vulkan {ver} is below the required 1.3 floor; update your GPU driver or use VMware SVGA",
|
||||
"doctor.gpu.none": "No registered Vulkan ICD driver found",
|
||||
"doctor.gpu.probe_failed": "Vulkan probe failed ({detail}). Run vulkaninfo --summary to check the driver.",
|
||||
"doctor.gpu.recommended": "Recommended",
|
||||
"doctor.gpu.warn.amd_legacy": "AMD Vega/Polaris on Windows hits known upstream black-screen/device-loss issues ({ref}); prefer another discrete GPU or switch the VM to VMware SVGA",
|
||||
"doctor.gpu.warn.amd_rdna2": "This AMD GPU hits known Windows device-loss issues upstream ({ref}); update drivers or switch temporarily to VMware SVGA if it freezes",
|
||||
@@ -1099,6 +1101,7 @@ var paramOrder = map[string][]string{
|
||||
"doctor.ecores.detail": {"count", "cpus"},
|
||||
"doctor.gpu.err.missing_ext": {"ext"},
|
||||
"doctor.gpu.err.vulkan_too_old": {"ver"},
|
||||
"doctor.gpu.probe_failed": {"detail"},
|
||||
"doctor.gpu.warn.amd_legacy": {"ref"},
|
||||
"doctor.gpu.warn.amd_rdna2": {"ref"},
|
||||
"doctor.pcores.detail": {"count", "mask", "cpus"},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"doctor.gpu.probe_failed": "Vulkan probe failed ({detail}). Run vulkaninfo --summary to check the driver.",
|
||||
"doctor.title": "Reims-Go Host Environment Check",
|
||||
"doctor.os": "Operating System",
|
||||
"doctor.cpu": "CPU & Core Topology",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"vulkanProbeFailed": "Vulkan probe failed ({detail}). Run vulkaninfo --summary to check the driver.",
|
||||
"setupTitle": "Choose a data folder",
|
||||
"setupDesc": "VMs, installers and runtimes all live here",
|
||||
"setupOther": "Other location…",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"doctor.gpu.probe_failed": "Vulkan 探测失败({detail})。请运行 vulkaninfo --summary 检查驱动。",
|
||||
"doctor.title": "Reims-Go 宿主机环境体检",
|
||||
"doctor.os": "操作系统",
|
||||
"doctor.cpu": "处理器与核心拓扑",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"vulkanProbeFailed": "Vulkan 探测失败({detail})。请运行 vulkaninfo --summary 检查驱动。",
|
||||
"setupTitle": "选择数据目录",
|
||||
"setupDesc": "虚拟机、安装包和运行时都放在这里",
|
||||
"setupOther": "其他位置…",
|
||||
|
||||
Reference in new issue
Block a user