REF:
http://los-vmm.sc.intel.com/wiki/How-to-setup-kvmgt
http://xenvgt.sh.intel.com/image/bdw-h/
Host display backgroud
$ grep i915.enable_vgtbuffer=1 /boot/grub/grub.cfg
linux /boot/vmlinuz-4.3.0-rc6-vgt+ root=UUID=d686a051-44ac-4e28-ba33-c715d9944852 ro intel_iommu=igfx_off i915.hvm_boot_foreground=0 i915.enable_vgtbuffer=1
$ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-4.3.0-rc6-vgt+ root=UUID=d686a051-44ac-4e28-ba33-c715d9944852 ro intel_iommu=igfx_off i915.hvm_boot_foreground=0 i915.enable_vgtbuffer=1
# echo 0 > /sys/kernel/vgt/control/foreground_vm
The main qemu code:
qemu-igvtg/hw/display/vgt_vga.c
kernal code:
drivers/gpu/drm/i915/i915_gem_vgtbuffer.c
qemu can use flink or dambuffer to get framebuffer.
some related tools
$ glxinfo
$ echo $DISPLAY
:0
$ glxinfo
name of display: :0
libGL error: pci id for fd 4: 8086:1926, driver (null)
i965_dri.so does not support the 0x1926 PCI ID.
$ apt-get install glmark2
$ glmark2
$ cat /etc/X11/xinit/xserverrc
#!/bin/sh
exec /usr/bin/X "$@"
After an upgrade to 12.04, I had the same issue. This time, the culprit is the lightdm that the system uses. The file that needs to be updated is /etc/lightdm/lightdm.conf
and the required addition is a xserver-allow-tcp=true
in the [SeatDefaults]
section.
$ cat /etc/lightdm/lightdm.conf
[Seat:*]
autologin-guest=false
autologin-user=ubuntu
autologin-user-timeout=0
autologin-session=lightdm-autologin
xserver-allow-tcp=true
xserver-command=X -listen tcp
重新启动lightdm或者重启机器
重启后,需要执行以下命令:
$ xhost +
将这个代码加入到sshd机器的~/.bashrc
TTY=`tty`
TTY=${TTY#/dev/}
echo "current tty is: $TTY"
REMOTE=`who |grep "$TTY "`
REMOTE=${REMOTE##*\(}
REMOTE=${REMOTE%)}
echo "The login user is from: $REMOTE"
echo "The org DISPLAY=$DISPLAY"
if [[ "${DISPLAY%:*}" == "localhost" ]]; then
echo "Guess you are using X11-forwarding, do not change DISPLAY."
elif [ -n "${REMOTE%:0}" ] && [ -z "${DISPLAY%:*}" ]; then
echo "reset DISPLAY=$REMOTE:0.0"
echo "if you are use mobaxterm, you may need to set:"
echo "$ export DISPLAY=$REMOTE:n.0"
echo "if you are using X11-forwarding, please run:"
echo "$ export DISPLAY=localhost:10.0"
export DISPLAY=$REMOTE:0.0
fi
查看GPU的资源使用率。
$ sudo ipython -c '
res = [0] * 6
with open("/sys/kernel/vgt/control/available_resource") as f:
res = map(lambda x: int(x, base=0), f.readline().split(","))
print dict(
zip(["total_low_mem", "available_low_mem", "total_high_mem",
"available_high_mem", "total_fence", "available_fence"], res))
'