vmware-guest.html revision 848b8605
1848b8605Smrg<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2848b8605Smrg<html lang="en">
3848b8605Smrg<head>
4848b8605Smrg  <meta http-equiv="content-type" content="text/html; charset=utf-8">
5848b8605Smrg  <title>VMware guest GL driver</title>
6848b8605Smrg  <link rel="stylesheet" type="text/css" href="mesa.css">
7848b8605Smrg</head>
8848b8605Smrg<body>
9848b8605Smrg
10848b8605Smrg<div class="header">
11848b8605Smrg  <h1>The Mesa 3D Graphics Library</h1>
12848b8605Smrg</div>
13848b8605Smrg
14848b8605Smrg<iframe src="contents.html"></iframe>
15848b8605Smrg<div class="content">
16848b8605Smrg
17848b8605Smrg<h1>VMware guest GL driver</h1>
18848b8605Smrg
19848b8605Smrg<p>
20848b8605SmrgThis page describes how to build, install and use the
21848b8605Smrg<a href="http://www.vmware.com/">VMware</a> guest GL driver
22848b8605Smrg(aka the SVGA or SVGA3D driver) for Linux using the latest source code.
23848b8605SmrgThis driver gives a Linux virtual machine access to the host's GPU for
24848b8605Smrghardware-accelerated 3D.
25848b8605SmrgVMware Workstation running on Linux or Windows and VMware Fusion running on
26848b8605SmrgMacOS are all supported.
27848b8605Smrg</p>
28848b8605Smrg
29848b8605Smrg<p>
30848b8605SmrgMost modern Linux distros include the SVGA3D driver so end users shouldn't
31848b8605Smrgbe concerned with this information.
32848b8605SmrgBut if your distro lacks the driver or you want to update to the latest code
33848b8605Smrgthese instructions explain what to do.
34848b8605Smrg</p>
35848b8605Smrg
36848b8605Smrg<p>
37848b8605SmrgFor more information about the X components see these wiki pages at x.org:
38848b8605Smrg</p>
39848b8605Smrg<ul>
40848b8605Smrg<li><a href="http://wiki.x.org/wiki/vmware">
41848b8605SmrgDriver Overview</a>
42848b8605Smrg<li><a href="http://wiki.x.org/wiki/vmware/vmware3D">
43848b8605Smrgxf86-video-vmware Details</a>
44848b8605Smrg</ul>
45848b8605Smrg
46848b8605Smrg
47848b8605Smrg<h2>Components</h2>
48848b8605Smrg
49848b8605SmrgThe components involved in this include:
50848b8605Smrg<ul>
51848b8605Smrg<li>Linux kernel module: vmwgfx
52848b8605Smrg<li>X server 2D driver: xf86-video-vmware
53848b8605Smrg<li>User-space libdrm library
54848b8605Smrg<li>Mesa/gallium OpenGL driver: "svga"
55848b8605Smrg</ul>
56848b8605Smrg
57848b8605Smrg<p>
58848b8605SmrgAll of these components reside in the guest Linux virtual machine.
59848b8605SmrgOn the host, all you're doing is running VMware
60848b8605Smrg<a href="http://www.vmware.com/products/workstation/">Workstation</a> or
61848b8605Smrg<a href="http://www.vmware.com/products/fusion/">Fusion</a>.
62848b8605Smrg</p>
63848b8605Smrg
64848b8605Smrg
65848b8605Smrg<h2>Prerequisites</h2>
66848b8605Smrg
67848b8605Smrg<ul>
68848b8605Smrg<li>Kernel version at least 2.6.25 
69848b8605Smrg<li>Xserver version at least 1.7 
70848b8605Smrg<li>Ubuntu: For ubuntu you need to install a number of build dependencies. 
71848b8605Smrg  <pre>
72848b8605Smrg  sudo apt-get install git-core
73848b8605Smrg  sudo apt-get install automake libtool libpthread-stubs0-dev
74848b8605Smrg  sudo apt-get install xserver-xorg-dev x11proto-xinerama-dev libx11-xcb-dev
75848b8605Smrg  sudo apt-get install libxcb-glx0-dev libxrender-dev
76848b8605Smrg  sudo apt-get build-dep libgl1-mesa-dri libxcb-glx0-dev
77848b8605Smrg  </pre>
78848b8605Smrg<li>Fedora: For Fedora you also need to install a number of build dependencies. 
79848b8605Smrg  <pre>
80848b8605Smrg  sudo yum install mesa-libGL-devel xorg-x11-server-devel xorg-x11-util-macros
81848b8605Smrg  sudo yum install libXrender-devel.i686
82848b8605Smrg  sudo yum install automake gcc libtool expat-devel kernel-devel git-core
83848b8605Smrg  sudo yum install makedepend flex bison
84848b8605Smrg  </pre>
85848b8605Smrg</ul>
86848b8605Smrg
87848b8605Smrg<p>
88848b8605SmrgDepending on your Linux distro, other packages may be needed.
89848b8605SmrgThe configure scripts should tell you what's missing.
90848b8605Smrg</p>
91848b8605Smrg
92848b8605Smrg
93848b8605Smrg
94848b8605Smrg<h2>Getting the Latest Source Code</h2>
95848b8605Smrg
96848b8605SmrgBegin by saving your current directory location:
97848b8605Smrg  <pre>
98848b8605Smrg  export TOP=$PWD
99848b8605Smrg  </pre>
100848b8605Smrg
101848b8605Smrg<ul>
102848b8605Smrg<li>Mesa/Gallium master branch. This code is used to build libGL, and the direct rendering svga driver for libGL, vmwgfx_dri.so, and the X acceleration library libxatracker.so.x.x.x. 
103848b8605Smrg  <pre>
104848b8605Smrg  git clone git://anongit.freedesktop.org/git/mesa/mesa
105848b8605Smrg  </pre>
106848b8605Smrg<li>VMware Linux guest kernel module. Note that this repo contains the complete DRM and TTM code. The vmware-specific driver is really only the files prefixed with vmwgfx. 
107848b8605Smrg  <pre>
108848b8605Smrg  git clone git://anongit.freedesktop.org/git/mesa/vmwgfx
109848b8605Smrg  </pre>
110848b8605Smrg<li>libdrm, a user-space library that interfaces with drm.
111848b8605SmrgMost distros ship with this but it's safest to install a newer version.
112848b8605SmrgTo get the latest code from git:
113848b8605Smrg  <pre>
114848b8605Smrg  git clone git://anongit.freedesktop.org/git/mesa/drm
115848b8605Smrg  </pre>
116848b8605Smrg<li>xf86-video-vmware. The chainloading driver, vmware_drv.so, the legacy driver vmwlegacy_drv.so, and the vmwgfx driver vmwgfx_drv.so. 
117848b8605Smrg  <pre>
118848b8605Smrg  git clone git://anongit.freedesktop.org/git/xorg/driver/xf86-video-vmware
119848b8605Smrg  </pre>
120848b8605Smrg</ul>
121848b8605Smrg
122848b8605Smrg
123848b8605Smrg<h2>Building the Code</h2>
124848b8605Smrg
125848b8605Smrg<ul>
126848b8605Smrg<li>Build libdrm: If you're on a 32-bit system, you should skip the --libdir configure option. Note also the comment about toolchain libdrm above. 
127848b8605Smrg  <pre>
128848b8605Smrg  cd $TOP/drm
129848b8605Smrg  ./autogen.sh --prefix=/usr --libdir=/usr/lib64
130848b8605Smrg  make
131848b8605Smrg  sudo make install
132848b8605Smrg  </pre>
133848b8605Smrg<li>Build Mesa and the vmwgfx_dri.so driver, the vmwgfx_drv.so xorg driver, the X acceleration library libxatracker.
134848b8605SmrgThe vmwgfx_dri.so is used by the OpenGL libraries during direct rendering,
135848b8605Smrgand by the Xorg server during accelerated indirect GL rendering.
136848b8605SmrgThe libxatracker library is used exclusively by the X server to do render,
137848b8605Smrgcopy and video acceleration:
138848b8605Smrg<br>
139848b8605SmrgThe following configure options doesn't build the EGL system.
140848b8605Smrg<br>
141848b8605SmrgAs before, if you're on a 32-bit system, you should skip the --libdir
142848b8605Smrgconfigure option.
143848b8605Smrg  <pre>
144848b8605Smrg  cd $TOP/mesa
145848b8605Smrg  ./autogen.sh --prefix=/usr --libdir=/usr/lib64 --with-gallium-drivers=svga --with-dri-drivers= --enable-xa --disable-dri3
146848b8605Smrg  make
147848b8605Smrg  sudo make install
148848b8605Smrg  </pre>
149848b8605Smrg
150848b8605SmrgNote that you may have to install other packages that Mesa depends upon
151848b8605Smrgif they're not installed in your system.  You should be told what's missing.
152848b8605Smrg<br>
153848b8605Smrg<br>
154848b8605Smrg
155848b8605Smrg<li>xf86-video-vmware: Now, once libxatracker is installed, we proceed with building and replacing the current Xorg driver. First check if your system is 32- or 64-bit. If you're building for a 32-bit system, you will not be needing the --libdir=/usr/lib64 option to autogen. 
156848b8605Smrg  <pre>
157848b8605Smrg  cd $TOP/xf86-video-vmware
158848b8605Smrg  ./autogen.sh --prefix=/usr --libdir=/usr/lib64
159848b8605Smrg  make
160848b8605Smrg  sudo make install
161848b8605Smrg  </pre>
162848b8605Smrg<li>vmwgfx kernel module. First make sure that any old version of this kernel module is removed from the system by issuing
163848b8605Smrg  <pre>
164848b8605Smrg  sudo rm /lib/modules/`uname -r`/kernel/drivers/gpu/drm/vmwgfx.ko*
165848b8605Smrg  </pre>
166848b8605SmrgThen 
167848b8605Smrg  <pre>
168848b8605Smrg  cd $TOP/vmwgfx
169848b8605Smrg  make
170848b8605Smrg  sudo make install
171848b8605Smrg  sudo cp 00-vmwgfx.rules /etc/udev/rules.d
172848b8605Smrg  sudo depmod -ae
173848b8605Smrg  </pre>
174848b8605Smrg
175848b8605SmrgNote: some distros put DRM kernel drivers in different directories.
176848b8605SmrgFor example, sometimes vmwgfx.ko might be found in
177848b8605Smrg<code>/lib/modules/{version}/extra/vmwgfx.ko</code> or in
178848b8605Smrg<code>/lib/modules/{version}/kernel/drivers/gpu/drm/vmwgfx/vmwgfx.ko</code>.
179848b8605Smrg<p>
180848b8605SmrgAfter installing vmwgfx.ko you might want to run the following command to
181848b8605Smrgcheck that the new kernel module is in the expected place:
182848b8605Smrg<pre>
183848b8605Smrg  find /lib/modules -name vmwgfx.ko -exec ls -l '{}' \;
184848b8605Smrg</pre>
185848b8605SmrgIf you see the kernel module listed in more than one place, you may need to
186848b8605Smrgmove things around.
187848b8605Smrg<p>
188848b8605SmrgFinally, if you update your kernel you'll probably have to rebuild and
189848b8605Smrgreinstall the vmwgfx.ko module again.
190848b8605Smrg</ul>
191848b8605Smrg
192848b8605Smrg
193848b8605SmrgNow try to load the kernel module by issuing
194848b8605Smrg  <pre>
195848b8605Smrg  sudo modprobe vmwgfx</pre>
196848b8605SmrgThen type 
197848b8605Smrg  <pre>
198848b8605Smrg  dmesg</pre>
199848b8605Smrgto watch the debug output. It should contain a number of lines prefixed with "[vmwgfx]". 
200848b8605Smrg
201848b8605Smrg<p>
202848b8605SmrgThen restart the Xserver (or reboot).
203848b8605SmrgThe lines starting with "vmwlegacy" or "VMWARE" in the file /var/log/Xorg.0.log
204848b8605Smrgshould now have been replaced with lines starting with "vmwgfx", indicating that
205848b8605Smrgthe new Xorg driver is in use. 
206848b8605Smrg</p>
207848b8605Smrg
208848b8605Smrg
209848b8605Smrg<h2>Running OpenGL Programs</h2>
210848b8605Smrg
211848b8605Smrg<p>
212848b8605SmrgIn a shell, run 'glxinfo' and look for the following to verify that the
213848b8605Smrgdriver is working:
214848b8605Smrg</p>
215848b8605Smrg
216848b8605Smrg<pre>
217848b8605SmrgOpenGL vendor string: VMware, Inc.
218848b8605SmrgOpenGL renderer string: Gallium 0.4 on SVGA3D; build: RELEASE;
219848b8605SmrgOpenGL version string: 2.1 Mesa 8.0
220848b8605Smrg</pre>
221848b8605Smrg
222848b8605Smrg<p>
223848b8605SmrgIf you don't see this, try setting this environment variable:
224848b8605Smrg  <pre>
225848b8605Smrg  export LIBGL_DEBUG=verbose</pre>
226848b8605Smrg<p>
227848b8605Smrgthen rerun glxinfo and examine the output for error messages.
228848b8605Smrg</p>
229848b8605Smrg
230848b8605Smrg</div>
231848b8605Smrg</body>
232848b8605Smrg</html>
233