disable vgpu on non-nixos systems
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import random
|
import random
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -24,9 +25,9 @@ def graphics_options(vm: VmConfig) -> GraphicOptions:
|
|||||||
return GraphicOptions([
|
return GraphicOptions([
|
||||||
*common,
|
*common,
|
||||||
"-nographic",
|
"-nographic",
|
||||||
"-vga", "none",
|
|
||||||
"-device", f"vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid={cid}",
|
"-device", f"vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid={cid}",
|
||||||
"-display", "egl-headless,gl=core",
|
"-vga", "none",
|
||||||
|
#"-display", "egl-headless,gl=core",
|
||||||
|
|
||||||
# this would make the gpu part of the hypervisor
|
# this would make the gpu part of the hypervisor
|
||||||
#"-device", "virtio-vga-gl,blob=true",
|
#"-device", "virtio-vga-gl,blob=true",
|
||||||
@@ -38,13 +39,24 @@ def graphics_options(vm: VmConfig) -> GraphicOptions:
|
|||||||
], cid)
|
], cid)
|
||||||
# fmt: on
|
# fmt: on
|
||||||
else:
|
else:
|
||||||
|
if not os.path.exists("/run/opengl-driver"):
|
||||||
|
display_options = [
|
||||||
|
"-vga",
|
||||||
|
"none",
|
||||||
|
"-display",
|
||||||
|
"gtk,gl=on",
|
||||||
|
"-device",
|
||||||
|
"virtio-gpu-gl",
|
||||||
|
"-display",
|
||||||
|
"spice-app,gl=on",
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
display_options = ["-display", "spice-app"]
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
return GraphicOptions([
|
return GraphicOptions([
|
||||||
*common,
|
*common,
|
||||||
"-vga", "none",
|
*display_options,
|
||||||
"-display", "gtk,gl=on",
|
|
||||||
"-device", "virtio-gpu-gl",
|
|
||||||
"-display", "spice-app,gl=on",
|
|
||||||
"-device", "virtio-serial-pci",
|
"-device", "virtio-serial-pci",
|
||||||
"-chardev", "spicevmc,id=vdagent0,name=vdagent",
|
"-chardev", "spicevmc,id=vdagent0,name=vdagent",
|
||||||
"-device", "virtserialport,chardev=vdagent0,name=com.redhat.spice.0",
|
"-device", "virtserialport,chardev=vdagent0,name=com.redhat.spice.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user