Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Dma_Buf_User_Guide

Terrence Xu edited this page Jan 10, 2019 · 4 revisions

Contents

1 Introduction

Since there is no display support in GVT-g, users have to use remote protocol to show guest desktop with installing a remote server in guest image, which is inconvenient.

A new feature called “Local display” has been supported in GVT-g (KVMGT only) by introducing “dma-buf”, a generic kernel level frame work to share buffers.

With this new feature, users can show the guest desktop using various method, such as spice and gtk.

2 Build environment

Build the "local display" environment including below steps:

a. Prepare for build

Install the needed libraries for local display, as below:

apt-get install libepoxy-dev libdrm-dev libgbm-dev spice-client-gtk libegl1-mesa-dev libgtk2.0-dev libgtk-3-dev

b. Build Kernel for KVMGT

The "dma-buf" related patches have been checked in Intel "gvt-linux" kernel at "gvt-stable-4.14", "gvt-stable-4.17" and "gvt-staging" branches, the build kernel step follow https://github.com/intel/gvt-linux/wiki/GVTg_Setup_Guide#32-build-kernel.

c. Build Qemu

The "dma-buf" enabling patches have been checked in Intel "igvtg-qemu" Qemu branches (you also can download the latest qemu from qemu.git), the build kernel step follow https://github.com/intel/gvt-linux/wiki/GVTg_Setup_Guide#331-build-qemu-for-kvmgt.

3 Usage

We have four recommend methods to connect VM with local display, "spicy", "gtk", "vnc" and "libvirt".

a. SPICY

"SPICY" is the spice client test application.

The usage is to add the display option "-display egl-headless -spice disable-ticketing,port=" and add "display=on,x-igd-opregion=on" into vgpu option ("-device vfio-pci,sysfsdev=xxx,..") into create VM command, the example of create VM script as below:

   /usr/bin/qemu-system-x86_64 \
    -m 2048 -smp 2 -M pc \
    -name local-display-vm \
    -hda /home/img/ubuntu-1.qcow2 \
    -bios /usr/bin/bios.bin -enable-kvm \
    -net nic,macaddr=52:54:00:10:00:1A -net tap,script=/etc/qemu-ifup \
    -vga none \
    -display egl-headless -spice disable-ticketing,port=5910 \
    -k en-us \
    -machine kernel_irqchip=on \
    -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 \
    -cpu host -usb -usbdevice tablet \
    -device vfio-pci,sysfsdev=/sys/bus/pci/devices/0000:00:02.0/59c57b6c-13ee-4055-846e-e4d3dc55d389,display=on,x-igd-opregion=on

Then you can connect VM by below command ("5910" is the port number you used for create VM):

spicy -h localhost -p 5910

And the VM desktop will be showed in spicy windows.

b. GTK

"GTK" is a build-in UI in Qemu for VM display.

The usage is to add the display option "-display gtk,gl=on" and add "display=on,x-igd-opregion=on" into vgpu option ("-device vfio-pci,sysfsdev=xxx,..") into create VM command, the example of create VM script as below:

   /usr/bin/qemu-system-x86_64 \
    -m 2048 -smp 2 -M pc \
    -name local-display-vm \
    -hda /home/img/ubuntu-1.qcow2 \
    -bios /usr/bin/bios.bin -enable-kvm \
    -net nic,macaddr=52:54:00:10:00:1A -net tap,script=/etc/qemu-ifup \
    -vga none \
    -display gtk,gl=on \
    -k en-us \
    -machine kernel_irqchip=on \
    -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 \
    -cpu host -usb -usbdevice tablet \
    -device vfio-pci,sysfsdev=/sys/bus/pci/devices/0000:00:02.0/59c57b6c-13ee-4055-846e-e4d3dc55d389,display=on,x-igd-opregion=on

Then the VM desktop will be showed in Qemu windows directly.

c. VNC

"VNC" is a 3rd party remote access software.

The usage is to add the display option "-display egl-headless vnc :" and add "display=on,x-igd-opregion=on" into vgpu option vgpu option ("-device vfio-pci,sysfsdev=xxx,..") into create VM command, the example of create VM script as below:

   /usr/bin/qemu-system-x86_64 \
   -m 2048 -smp 2 -M pc \
   -name local-display-vm \
   -hda /home/img/linux.qcow2 \
   -bios /usr/bin/bios.bin -enable-kvm \
   -net nic,macaddr=52:54:00:10:00:1A -net tap,script=/etc/qemu-ifup \
   -vga none \
   -display egl-headless \
   -vnc :1 \
   -k en-us \
   -machine kernel_irqchip=on \
   -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 \
   -cpu host -usb -usbdevice tablet \
   -device vfio-pci,sysfsdev=/sys/bus/pci/devices/0000:00:02.0/59c57b6c-13ee-4055-846e-e4d3dc55d389,display=on,x-igd-opregion=on

Then you can connect VM by below command ("1" is the port number you used for create VM):

vncviewer :1

And the VM desktop will be showed in VNC windows.

d. Libvirt

Libvirt is the "hypervisor management API and tool" maintained by Red Hat.

We can add the spicy related, the example of create VM script as below:

   
     1
     3323ea3e-782f-41bb-a7b8-3538d76fc73a
     1953125
     1953125
     2
     
       hvm
       
     
     
       
     
     
     destroy
     restart
     destroy

     
       /usr/bin/qemu-system-x86_64
       
         
         
         
       

       
       
         

Then the VM desktop can be showed in “virt-manager“ application directly, or you can use "spicy" to show VM desktop.

Clone this wiki locally