17ec681f3SmrgVMware SVGA3D 27ec681f3Smrg============= 37ec681f3Smrg 47ec681f3SmrgThis page describes how to build, install and use the 57ec681f3Smrg`VMware <https://www.vmware.com/>`__ guest GL driver (aka the SVGA or 67ec681f3SmrgSVGA3D driver) for Linux using the latest source code. This driver gives 77ec681f3Smrga Linux virtual machine access to the host's GPU for 87ec681f3Smrghardware-accelerated 3D. VMware Workstation running on Linux or Windows 97ec681f3Smrgand VMware Fusion running on MacOS are all supported. 107ec681f3Smrg 117ec681f3SmrgWith the August 2015 Workstation 12 / Fusion 8 releases, OpenGL 3.3 is 127ec681f3Smrgsupported in the guest. This requires: 137ec681f3Smrg 147ec681f3Smrg- The VM is configured for virtual hardware version 12. 157ec681f3Smrg- The host OS, GPU and graphics driver supports DX11 (Windows) or 167ec681f3Smrg OpenGL 4.0 (Linux, Mac) 177ec681f3Smrg- On Linux, the vmwgfx kernel module must be version 2.9.0 or later. 187ec681f3Smrg- A recent version of Mesa with the updated svga Gallium driver. 197ec681f3Smrg 207ec681f3SmrgOtherwise, OpenGL 2.1 is supported. 217ec681f3Smrg 227ec681f3SmrgWith the Fall 2018 Workstation 15 / Fusion 11 releases, additional 237ec681f3Smrgfeatures are supported in the driver: 247ec681f3Smrg 257ec681f3Smrg- Multisample antialiasing (2x, 4x) 267ec681f3Smrg- GL_ARB/AMD_draw_buffers_blend 277ec681f3Smrg- GL_ARB_sample_shading 287ec681f3Smrg- GL_ARB_texture_cube_map_array 297ec681f3Smrg- GL_ARB_texture_gather 307ec681f3Smrg- GL_ARB_texture_query_lod 317ec681f3Smrg- GL_EXT/OES_draw_buffers_indexed 327ec681f3Smrg 337ec681f3SmrgThis requires version 2.15.0 or later of the vmwgfx kernel module and 347ec681f3Smrgthe VM must be configured for hardware version 16 or later. 357ec681f3Smrg 367ec681f3SmrgOpenGL 3.3 support can be disabled by setting the environment variable 377ec681f3SmrgSVGA_VGPU10=0. You will then have OpenGL 2.1 support. This may be useful 387ec681f3Smrgto work around application bugs (such as incorrect use of the OpenGL 3.x 397ec681f3Smrgcore profile). 407ec681f3Smrg 417ec681f3SmrgMost modern Linux distros include the SVGA3D driver so end users 427ec681f3Smrgshouldn't be concerned with this information. But if your distro lacks 437ec681f3Smrgthe driver or you want to update to the latest code these instructions 447ec681f3Smrgexplain what to do. 457ec681f3Smrg 467ec681f3SmrgFor more information about the X components see these wiki pages at 477ec681f3Smrgx.org: 487ec681f3Smrg 497ec681f3Smrg- `Driver Overview <https://wiki.x.org/wiki/vmware>`__ 507ec681f3Smrg- `xf86-video-vmware 517ec681f3Smrg Details <https://wiki.x.org/wiki/vmware/vmware3D>`__ 527ec681f3Smrg 537ec681f3SmrgComponents 547ec681f3Smrg---------- 557ec681f3Smrg 567ec681f3SmrgThe components involved in this include: 577ec681f3Smrg 587ec681f3Smrg- Linux kernel module: vmwgfx 597ec681f3Smrg- X server 2D driver: xf86-video-vmware 607ec681f3Smrg- User-space libdrm library 617ec681f3Smrg- Mesa/Gallium OpenGL driver: "svga" 627ec681f3Smrg 637ec681f3SmrgAll of these components reside in the guest Linux virtual machine. On 647ec681f3Smrgthe host, all you're doing is running VMware 657ec681f3Smrg`Workstation <https://www.vmware.com/products/workstation/>`__ or 667ec681f3Smrg`Fusion <https://www.vmware.com/products/fusion/>`__. 677ec681f3Smrg 687ec681f3SmrgPrerequisites 697ec681f3Smrg------------- 707ec681f3Smrg 717ec681f3Smrg- Kernel version at least 2.6.25 727ec681f3Smrg- Xserver version at least 1.7 737ec681f3Smrg- Ubuntu: For Ubuntu you need to install a number of build 747ec681f3Smrg dependencies. 757ec681f3Smrg 767ec681f3Smrg :: 777ec681f3Smrg 787ec681f3Smrg sudo apt-get install git-core 797ec681f3Smrg sudo apt-get install ninja-build meson libpthread-stubs0-dev 807ec681f3Smrg sudo apt-get install xserver-xorg-dev x11proto-xinerama-dev libx11-xcb-dev 817ec681f3Smrg sudo apt-get install libxcb-glx0-dev libxrender-dev 827ec681f3Smrg sudo apt-get build-dep libgl1-mesa-dri libxcb-glx0-dev 837ec681f3Smrg 847ec681f3Smrg 857ec681f3Smrg- Fedora: For Fedora you also need to install a number of build 867ec681f3Smrg dependencies. 877ec681f3Smrg 887ec681f3Smrg :: 897ec681f3Smrg 907ec681f3Smrg sudo yum install mesa-libGL-devel xorg-x11-server-devel xorg-x11-util-macros 917ec681f3Smrg sudo yum install libXrender-devel.i686 927ec681f3Smrg sudo yum install ninja-build meson gcc expat-devel kernel-devel git-core 937ec681f3Smrg sudo yum install makedepend flex bison 947ec681f3Smrg 957ec681f3Smrg 967ec681f3SmrgDepending on your Linux distro, other packages may be needed. Meson 977ec681f3Smrgshould tell you what's missing. 987ec681f3Smrg 997ec681f3SmrgGetting the Latest Source Code 1007ec681f3Smrg------------------------------ 1017ec681f3Smrg 1027ec681f3SmrgBegin by saving your current directory location: 1037ec681f3Smrg 1047ec681f3Smrg:: 1057ec681f3Smrg 1067ec681f3Smrg export TOP=$PWD 1077ec681f3Smrg 1087ec681f3Smrg 1097ec681f3Smrg- Mesa/Gallium main branch. This code is used to build libGL, and the 1107ec681f3Smrg direct rendering svga driver for libGL, vmwgfx_dri.so, and the X 1117ec681f3Smrg acceleration library libxatracker.so.x.x.x. 1127ec681f3Smrg 1137ec681f3Smrg :: 1147ec681f3Smrg 1157ec681f3Smrg git clone https://gitlab.freedesktop.org/mesa/mesa.git 1167ec681f3Smrg 1177ec681f3Smrg 1187ec681f3Smrg- VMware Linux guest kernel module. Note that this repo contains the 1197ec681f3Smrg complete DRM and TTM code. The vmware-specific driver is really only 1207ec681f3Smrg the files prefixed with vmwgfx. 1217ec681f3Smrg 1227ec681f3Smrg :: 1237ec681f3Smrg 1247ec681f3Smrg git clone git://anongit.freedesktop.org/git/mesa/vmwgfx 1257ec681f3Smrg 1267ec681f3Smrg 1277ec681f3Smrg- libdrm, a user-space library that interfaces with DRM. Most distros 1287ec681f3Smrg ship with this but it's safest to install a newer version. To get the 1297ec681f3Smrg latest code from Git: 1307ec681f3Smrg 1317ec681f3Smrg :: 1327ec681f3Smrg 1337ec681f3Smrg git clone https://gitlab.freedesktop.org/mesa/drm.git 1347ec681f3Smrg 1357ec681f3Smrg 1367ec681f3Smrg- xf86-video-vmware. The chainloading driver, vmware_drv.so, the legacy 1377ec681f3Smrg driver vmwlegacy_drv.so, and the vmwgfx driver vmwgfx_drv.so. 1387ec681f3Smrg 1397ec681f3Smrg :: 1407ec681f3Smrg 1417ec681f3Smrg git clone git://anongit.freedesktop.org/git/xorg/driver/xf86-video-vmware 1427ec681f3Smrg 1437ec681f3Smrg 1447ec681f3SmrgBuilding the Code 1457ec681f3Smrg----------------- 1467ec681f3Smrg 1477ec681f3Smrg- Determine where the GL-related libraries reside on your system and 1487ec681f3Smrg set the LIBDIR environment variable accordingly. 1497ec681f3Smrg 1507ec681f3Smrg For 32-bit Ubuntu systems: 1517ec681f3Smrg 1527ec681f3Smrg :: 1537ec681f3Smrg 1547ec681f3Smrg export LIBDIR=/usr/lib/i386-linux-gnu 1557ec681f3Smrg 1567ec681f3Smrg For 64-bit Ubuntu systems: 1577ec681f3Smrg 1587ec681f3Smrg :: 1597ec681f3Smrg 1607ec681f3Smrg export LIBDIR=/usr/lib/x86_64-linux-gnu 1617ec681f3Smrg 1627ec681f3Smrg For 32-bit Fedora systems: 1637ec681f3Smrg 1647ec681f3Smrg :: 1657ec681f3Smrg 1667ec681f3Smrg export LIBDIR=/usr/lib 1677ec681f3Smrg 1687ec681f3Smrg For 64-bit Fedora systems: 1697ec681f3Smrg 1707ec681f3Smrg :: 1717ec681f3Smrg 1727ec681f3Smrg export LIBDIR=/usr/lib64 1737ec681f3Smrg 1747ec681f3Smrg- Build libdrm: 1757ec681f3Smrg 1767ec681f3Smrg :: 1777ec681f3Smrg 1787ec681f3Smrg cd $TOP/drm 1797ec681f3Smrg meson builddir --prefix=/usr --libdir=${LIBDIR} 1807ec681f3Smrg ninja -C builddir 1817ec681f3Smrg sudo ninja -C builddir install 1827ec681f3Smrg 1837ec681f3Smrg 1847ec681f3Smrg- Build Mesa and the vmwgfx_dri.so driver, the vmwgfx_drv.so xorg 1857ec681f3Smrg driver, the X acceleration library libxatracker. The vmwgfx_dri.so is 1867ec681f3Smrg used by the OpenGL libraries during direct rendering, and by the Xorg 1877ec681f3Smrg server during accelerated indirect GL rendering. The libxatracker 1887ec681f3Smrg library is used exclusively by the X server to do render, copy and 1897ec681f3Smrg video acceleration: 1907ec681f3Smrg 1917ec681f3Smrg The following configure options doesn't build the EGL system. 1927ec681f3Smrg 1937ec681f3Smrg :: 1947ec681f3Smrg 1957ec681f3Smrg cd $TOP/mesa 1967ec681f3Smrg meson builddir --prefix=/usr --libdir=${LIBDIR} -Dgallium-drivers=svga -Ddri-drivers=swrast -Dgallium-xa=true -Ddri3=false 1977ec681f3Smrg ninja -C builddir 1987ec681f3Smrg sudo ninja -C builddir install 1997ec681f3Smrg 2007ec681f3Smrg 2017ec681f3Smrg Note that you may have to install other packages that Mesa depends 2027ec681f3Smrg upon if they're not installed in your system. You should be told 2037ec681f3Smrg what's missing. 2047ec681f3Smrg 2057ec681f3Smrg- xf86-video-vmware: Now, once libxatracker is installed, we proceed 2067ec681f3Smrg with building and replacing the current Xorg driver. First check if 2077ec681f3Smrg your system is 32- or 64-bit. 2087ec681f3Smrg 2097ec681f3Smrg :: 2107ec681f3Smrg 2117ec681f3Smrg cd $TOP/xf86-video-vmware 2127ec681f3Smrg ./autogen.sh --prefix=/usr --libdir=${LIBDIR} 2137ec681f3Smrg make 2147ec681f3Smrg sudo make install 2157ec681f3Smrg 2167ec681f3Smrg 2177ec681f3Smrg- vmwgfx kernel module. First make sure that any old version of this 2187ec681f3Smrg kernel module is removed from the system by issuing 2197ec681f3Smrg 2207ec681f3Smrg :: 2217ec681f3Smrg 2227ec681f3Smrg sudo rm /lib/modules/`uname -r`/kernel/drivers/gpu/drm/vmwgfx.ko* 2237ec681f3Smrg 2247ec681f3Smrg Build and install: 2257ec681f3Smrg 2267ec681f3Smrg :: 2277ec681f3Smrg 2287ec681f3Smrg cd $TOP/vmwgfx 2297ec681f3Smrg make 2307ec681f3Smrg sudo make install 2317ec681f3Smrg sudo depmod -a 2327ec681f3Smrg 2337ec681f3Smrg If you're using a Ubuntu OS: 2347ec681f3Smrg 2357ec681f3Smrg :: 2367ec681f3Smrg 2377ec681f3Smrg sudo update-initramfs -u 2387ec681f3Smrg 2397ec681f3Smrg If you're using a Fedora OS: 2407ec681f3Smrg 2417ec681f3Smrg :: 2427ec681f3Smrg 2437ec681f3Smrg sudo dracut --force 2447ec681f3Smrg 2457ec681f3Smrg Add 'vmwgfx' to the /etc/modules file: 2467ec681f3Smrg 2477ec681f3Smrg :: 2487ec681f3Smrg 2497ec681f3Smrg echo vmwgfx | sudo tee -a /etc/modules 2507ec681f3Smrg 2517ec681f3Smrg .. note:: 2527ec681f3Smrg 2537ec681f3Smrg some distros put DRM kernel drivers in different directories. 2547ec681f3Smrg For example, sometimes vmwgfx.ko might be found in 2557ec681f3Smrg ``/lib/modules/{version}/extra/vmwgfx.ko`` or in 2567ec681f3Smrg ``/lib/modules/{version}/kernel/drivers/gpu/drm/vmwgfx/vmwgfx.ko``. 2577ec681f3Smrg 2587ec681f3Smrg After installing vmwgfx.ko you might want to run the following 2597ec681f3Smrg command to check that the new kernel module is in the expected place: 2607ec681f3Smrg 2617ec681f3Smrg :: 2627ec681f3Smrg 2637ec681f3Smrg find /lib/modules -name vmwgfx.ko -exec ls -l '{}' \; 2647ec681f3Smrg 2657ec681f3Smrg If you see the kernel module listed in more than one place, you may 2667ec681f3Smrg need to move things around. 2677ec681f3Smrg 2687ec681f3Smrg Finally, if you update your kernel you'll probably have to rebuild 2697ec681f3Smrg and reinstall the vmwgfx.ko module again. 2707ec681f3Smrg 2717ec681f3SmrgNow try to load the kernel module by issuing 2727ec681f3Smrg 2737ec681f3Smrg:: 2747ec681f3Smrg 2757ec681f3Smrg sudo modprobe vmwgfx 2767ec681f3Smrg 2777ec681f3SmrgThen type 2787ec681f3Smrg 2797ec681f3Smrg:: 2807ec681f3Smrg 2817ec681f3Smrg dmesg 2827ec681f3Smrg 2837ec681f3Smrgto watch the debug output. It should contain a number of lines prefixed 2847ec681f3Smrgwith "[vmwgfx]". 2857ec681f3Smrg 2867ec681f3SmrgThen restart the Xserver (or reboot). The lines starting with 2877ec681f3Smrg"vmwlegacy" or "VMWARE" in the file /var/log/Xorg.0.log should now have 2887ec681f3Smrgbeen replaced with lines starting with "vmwgfx", indicating that the new 2897ec681f3SmrgXorg driver is in use. 2907ec681f3Smrg 2917ec681f3SmrgRunning OpenGL Programs 2927ec681f3Smrg----------------------- 2937ec681f3Smrg 2947ec681f3SmrgIn a shell, run 'glxinfo' and look for the following to verify that the 2957ec681f3Smrgdriver is working: 2967ec681f3Smrg 2977ec681f3Smrg:: 2987ec681f3Smrg 2997ec681f3Smrg OpenGL vendor string: VMware, Inc. 3007ec681f3Smrg OpenGL renderer string: Gallium 0.4 on SVGA3D; build: RELEASE; 3017ec681f3Smrg OpenGL version string: 2.1 Mesa 8.0 3027ec681f3Smrg 3037ec681f3SmrgIf you don't see this, try setting this environment variable: 3047ec681f3Smrg 3057ec681f3Smrg:: 3067ec681f3Smrg 3077ec681f3Smrg export LIBGL_DEBUG=verbose 3087ec681f3Smrg 3097ec681f3Smrgthen rerun glxinfo and examine the output for error messages. 3107ec681f3Smrg 3117ec681f3SmrgIf OpenGL 3.3 is not working (you only get OpenGL 2.1): 3127ec681f3Smrg 3137ec681f3Smrg- Make sure the VM uses hardware version 12. 3147ec681f3Smrg- Make sure the vmwgfx kernel module is version 2.9.0 or later. 3157ec681f3Smrg- Check the vmware.log file for errors. 3167ec681f3Smrg- Run 'dmesg \| grep vmwgfx' and look for "DX: yes". 317