faq.html revision 1.1.1.2 1 1.1 mrg <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 1.1 mrg <html lang="en">
3 1.1 mrg <head>
4 1.1 mrg <meta http-equiv="content-type" content="text/html; charset=utf-8">
5 1.1 mrg <title>Mesa FAQ</title>
6 1.1 mrg <link rel="stylesheet" type="text/css" href="mesa.css">
7 1.1 mrg </head>
8 1.1 mrg <body>
9 1.1 mrg
10 1.1 mrg <div class="header">
11 1.1 mrg <h1>The Mesa 3D Graphics Library</h1>
12 1.1 mrg </div>
13 1.1 mrg
14 1.1 mrg <iframe src="contents.html"></iframe>
15 1.1 mrg <div class="content">
16 1.1 mrg
17 1.1 mrg <h1>Mesa Frequently Asked Questions</h1>
18 1.1.1.2 mrg Last updated: 19 September 2018
19 1.1 mrg
20 1.1 mrg <br>
21 1.1 mrg <br>
22 1.1 mrg <h2>Index</h2>
23 1.1.1.2 mrg <ol>
24 1.1.1.2 mrg <li><a href="#part1">High-level Questions and Answers</a></li>
25 1.1.1.2 mrg <li><a href="#part2">Compilation and Installation Problems</a></li>
26 1.1.1.2 mrg <li><a href="#part3">Runtime / Rendering Problems</a></li>
27 1.1.1.2 mrg <li><a href="#part4">Developer Questions</a></li>
28 1.1.1.2 mrg </ol>
29 1.1 mrg <br>
30 1.1 mrg <br>
31 1.1 mrg
32 1.1 mrg
33 1.1 mrg
34 1.1 mrg <h1 id="part1">1. High-level Questions and Answers</h1>
35 1.1 mrg
36 1.1 mrg <h2>1.1 What is Mesa?</h2>
37 1.1 mrg <p>
38 1.1 mrg Mesa is an open-source implementation of the OpenGL specification.
39 1.1 mrg OpenGL is a programming library for writing interactive 3D applications.
40 1.1.1.2 mrg See the <a href="https://www.opengl.org/">OpenGL website</a> for more
41 1.1 mrg information.
42 1.1 mrg </p>
43 1.1 mrg <p>
44 1.1 mrg Mesa 9.x supports the OpenGL 3.1 specification.
45 1.1 mrg </p>
46 1.1 mrg
47 1.1 mrg
48 1.1 mrg <h2>1.2 Does Mesa support/use graphics hardware?</h2>
49 1.1 mrg <p>
50 1.1 mrg Yes. Specifically, Mesa serves as the OpenGL core for the open-source DRI
51 1.1 mrg drivers for X.org.
52 1.1 mrg </p>
53 1.1 mrg <ul>
54 1.1.1.2 mrg <li>See the <a href="https://dri.freedesktop.org/">DRI website</a>
55 1.1 mrg for more information.</li>
56 1.1.1.2 mrg <li>See <a href="https://01.org/linuxgraphics">01.org</a>
57 1.1 mrg for more information about Intel drivers.</li>
58 1.1.1.2 mrg <li>See <a href="https://nouveau.freedesktop.org">nouveau.freedesktop.org</a>
59 1.1 mrg for more information about Nouveau drivers.</li>
60 1.1.1.2 mrg <li>See <a href="https://www.x.org/wiki/RadeonFeature">www.x.org/wiki/RadeonFeature</a>
61 1.1 mrg for more information about Radeon drivers.</li>
62 1.1 mrg </ul>
63 1.1 mrg
64 1.1 mrg <h2>1.3 What purpose does Mesa serve today?</h2>
65 1.1 mrg <p>
66 1.1 mrg Hardware-accelerated OpenGL implementations are available for most popular
67 1.1 mrg operating systems today.
68 1.1 mrg Still, Mesa serves at least these purposes:
69 1.1 mrg </p>
70 1.1 mrg <ul>
71 1.1 mrg <li>Mesa is used as the core of the open-source X.org DRI
72 1.1 mrg hardware drivers.
73 1.1 mrg </li>
74 1.1 mrg <li>Mesa is quite portable and allows OpenGL to be used on systems
75 1.1 mrg that have no other OpenGL solution.
76 1.1 mrg </li>
77 1.1 mrg <li>Software rendering with Mesa serves as a reference for validating the
78 1.1 mrg hardware drivers.
79 1.1 mrg </li>
80 1.1 mrg <li>A software implementation of OpenGL is useful for experimentation,
81 1.1 mrg such as testing new rendering techniques.
82 1.1 mrg </li>
83 1.1 mrg <li>Mesa can render images with deep color channels: 16-bit integer
84 1.1 mrg and 32-bit floating point color channels are supported.
85 1.1 mrg This capability is only now appearing in hardware.
86 1.1 mrg </li>
87 1.1 mrg <li>Mesa's internal limits (max lights, clip planes, texture size, etc) can be
88 1.1 mrg changed for special needs (hardware limits are hard to overcome).
89 1.1 mrg </li>
90 1.1 mrg </ul>
91 1.1 mrg
92 1.1 mrg
93 1.1 mrg <h2>1.4 What's the difference between "Stand-Alone" Mesa and the DRI drivers?</h2>
94 1.1 mrg <p>
95 1.1 mrg <em>Stand-alone Mesa</em> is the original incarnation of Mesa.
96 1.1 mrg On systems running the X Window System it does all its rendering through
97 1.1 mrg the Xlib API:
98 1.1 mrg </p>
99 1.1 mrg <ul>
100 1.1 mrg <li>The GLX API is supported, but it's really just an emulation of the
101 1.1 mrg real thing.
102 1.1 mrg <li>The GLX wire protocol is not supported and there's no OpenGL extension
103 1.1 mrg loaded by the X server.
104 1.1 mrg <li>There is no hardware acceleration.
105 1.1 mrg <li>The OpenGL library, libGL.so, contains everything (the programming API,
106 1.1 mrg the GLX functions and all the rendering code).
107 1.1 mrg </ul>
108 1.1 mrg <p>
109 1.1 mrg Alternately, Mesa acts as the core for a number of OpenGL hardware drivers
110 1.1 mrg within the DRI (Direct Rendering Infrastructure):
111 1.1 mrg <ul>
112 1.1 mrg <li>The libGL.so library provides the GL and GLX API functions, a GLX
113 1.1 mrg protocol encoder, and a device driver loader.
114 1.1 mrg <li>The device driver modules (such as r200_dri.so) contain a built-in
115 1.1 mrg copy of the core Mesa code.
116 1.1 mrg <li>The X server loads the GLX module.
117 1.1 mrg The GLX module decodes incoming GLX protocol and dispatches the commands
118 1.1 mrg to a rendering module.
119 1.1 mrg For the DRI, this module is basically a software Mesa renderer.
120 1.1 mrg </ul>
121 1.1 mrg
122 1.1 mrg
123 1.1 mrg
124 1.1 mrg <h2>1.5 How do I upgrade my DRI installation to use a new Mesa release?</h2>
125 1.1 mrg <p>
126 1.1 mrg This wasn't easy in the past.
127 1.1 mrg Now, the DRI drivers are included in the Mesa tree and can be compiled
128 1.1 mrg separately from the X server.
129 1.1 mrg Just follow the Mesa <a href="install.html">compilation instructions</a>.
130 1.1 mrg </p>
131 1.1 mrg
132 1.1 mrg
133 1.1 mrg <h2>1.6 Are there other open-source implementations of OpenGL?</h2>
134 1.1 mrg <p>
135 1.1 mrg Yes, SGI's <a href="http://oss.sgi.com/projects/ogl-sample/index.html">
136 1.1 mrg OpenGL Sample Implementation (SI)</a> is available.
137 1.1 mrg The SI was written during the time that OpenGL was originally designed.
138 1.1 mrg Unfortunately, development of the SI has stagnated.
139 1.1 mrg Mesa is much more up to date with modern features and extensions.
140 1.1 mrg </p>
141 1.1 mrg
142 1.1 mrg <p>
143 1.1.1.2 mrg <a href="https://sourceforge.net/projects/ogl-es/">Vincent</a> is
144 1.1 mrg an open-source implementation of OpenGL ES for mobile devices.
145 1.1 mrg
146 1.1 mrg <p>
147 1.1 mrg <a href="http://www.dsbox.com/minigl.html">miniGL</a>
148 1.1 mrg is a subset of OpenGL for PalmOS devices.
149 1.1 mrg
150 1.1 mrg <p>
151 1.1 mrg <a href="http://bellard.org/TinyGL/">TinyGL</a>
152 1.1 mrg is a subset of OpenGL.
153 1.1 mrg </p>
154 1.1 mrg
155 1.1 mrg <p>
156 1.1.1.2 mrg <a href="https://sourceforge.net/projects/softgl/">SoftGL</a>
157 1.1 mrg is an OpenGL subset for mobile devices.
158 1.1 mrg </p>
159 1.1 mrg
160 1.1 mrg <p>
161 1.1 mrg <a href="http://chromium.sourceforge.net/">Chromium</a>
162 1.1 mrg isn't a conventional OpenGL implementation (it's layered upon OpenGL),
163 1.1 mrg but it does export the OpenGL API. It allows tiled rendering, sort-last
164 1.1 mrg rendering, etc.
165 1.1 mrg </p>
166 1.1 mrg
167 1.1 mrg <p>
168 1.1 mrg <a href="http://www.ticalc.org/archives/files/fileinfo/361/36173.html">ClosedGL</a>
169 1.1 mrg is an OpenGL subset library for TI graphing calculators.
170 1.1 mrg </p>
171 1.1 mrg
172 1.1 mrg <p>
173 1.1 mrg There may be other open OpenGL implementations, but Mesa is the most
174 1.1 mrg popular and feature-complete.
175 1.1 mrg </p>
176 1.1 mrg
177 1.1 mrg
178 1.1 mrg
179 1.1 mrg <br>
180 1.1 mrg <br>
181 1.1 mrg
182 1.1 mrg
183 1.1 mrg <h1 id="part2">2. Compilation and Installation Problems</h1>
184 1.1 mrg
185 1.1 mrg
186 1.1 mrg <h2>2.1 What's the easiest way to install Mesa?</h2>
187 1.1 mrg <p>
188 1.1 mrg If you're using a Linux-based system, your distro CD most likely already
189 1.1 mrg has Mesa packages (like RPM or DEB) which you can easily install.
190 1.1 mrg </p>
191 1.1 mrg
192 1.1 mrg
193 1.1 mrg <h2>2.2 I get undefined symbols such as bgnpolygon, v3f, etc...</h2>
194 1.1 mrg <p>
195 1.1 mrg You're application is written in IRIS GL, not OpenGL.
196 1.1 mrg IRIS GL was the predecessor to OpenGL and is a different thing (almost)
197 1.1 mrg entirely.
198 1.1 mrg Mesa's not the solution.
199 1.1 mrg </p>
200 1.1 mrg
201 1.1 mrg
202 1.1 mrg <h2>2.3 Where is the GLUT library?</h2>
203 1.1 mrg <p>
204 1.1 mrg GLUT (OpenGL Utility Toolkit) is no longer in the separate MesaGLUT-x.y.z.tar.gz file.
205 1.1 mrg If you don't already have GLUT installed, you should grab
206 1.1 mrg <a href="http://freeglut.sourceforge.net/">freeglut</a>.
207 1.1 mrg </p>
208 1.1 mrg
209 1.1 mrg
210 1.1 mrg <h2>2.4 Where is the GLw library?</h2>
211 1.1 mrg <p>
212 1.1.1.2 mrg GLw (OpenGL widget library) is now available from a separate <a href="https://cgit.freedesktop.org/mesa/glw/">git repository</a>. Unless you're using very old Xt/Motif applications with OpenGL, you shouldn't need it.
213 1.1 mrg </p>
214 1.1 mrg
215 1.1 mrg
216 1.1 mrg <h2>2.5 What's the proper place for the libraries and headers?</h2>
217 1.1 mrg <p>
218 1.1 mrg On Linux-based systems you'll want to follow the
219 1.1 mrg <a href="http://oss.sgi.com/projects/ogl-sample/ABI/index.html">Linux ABI</a> standard.
220 1.1 mrg Basically you'll want the following:
221 1.1 mrg </p>
222 1.1 mrg <ul>
223 1.1 mrg <li>/usr/include/GL/gl.h - the main OpenGL header
224 1.1 mrg </li><li>/usr/include/GL/glu.h - the OpenGL GLU (utility) header
225 1.1 mrg </li><li>/usr/include/GL/glx.h - the OpenGL GLX header
226 1.1 mrg </li><li>/usr/include/GL/glext.h - the OpenGL extensions header
227 1.1 mrg </li><li>/usr/include/GL/glxext.h - the OpenGL GLX extensions header
228 1.1 mrg </li><li>/usr/include/GL/osmesa.h - the Mesa off-screen rendering header
229 1.1 mrg </li><li>/usr/lib/libGL.so - a symlink to libGL.so.1
230 1.1 mrg </li><li>/usr/lib/libGL.so.1 - a symlink to libGL.so.1.xyz
231 1.1 mrg </li><li>/usr/lib/libGL.so.xyz - the actual OpenGL/Mesa library. xyz denotes the
232 1.1 mrg Mesa version number.
233 1.1 mrg </li></ul>
234 1.1 mrg <p>
235 1.1.1.2 mrg When configuring Mesa, there are three meson options that affect the install
236 1.1 mrg location that you should take care with: <code>--prefix</code>,
237 1.1.1.2 mrg <code>--libdir</code>, and <code>-D dri-drivers-path</code>. To install Mesa
238 1.1 mrg into the system location where it will be available for all programs to use, set
239 1.1 mrg <code>--prefix=/usr</code>. Set <code>--libdir</code> to where your Linux
240 1.1 mrg distribution installs system libraries, usually either <code>/usr/lib</code> or
241 1.1.1.2 mrg <code>/usr/lib64</code>. Set <code>-D dri-drivers-path</code> to the directory
242 1.1 mrg where your Linux distribution installs DRI drivers. To find your system's DRI
243 1.1 mrg driver directory, try executing <code>find /usr -type d -name dri</code>. For
244 1.1 mrg example, if the <code>find</code> command listed <code>/usr/lib64/dri</code>,
245 1.1.1.2 mrg then set <code>-D dri-drivers-path=/usr/lib64/dri</code>.
246 1.1 mrg </p>
247 1.1 mrg <p>
248 1.1 mrg After determining the correct values for the install location, configure Mesa
249 1.1.1.2 mrg with <code>meson configure --prefix=/usr --libdir=xxx -D dri-drivers-path=xxx</code>
250 1.1.1.2 mrg and then install with <code>sudo ninja install</code>.
251 1.1 mrg </p>
252 1.1 mrg <br>
253 1.1 mrg <br>
254 1.1 mrg
255 1.1 mrg
256 1.1 mrg <h1 id="part3">3. Runtime / Rendering Problems</h1>
257 1.1 mrg
258 1.1 mrg <h2>3.1 Rendering is slow / why isn't my graphics hardware being used?</h2>
259 1.1 mrg <p>
260 1.1 mrg If Mesa can't use its hardware accelerated drivers it falls back on one of its software renderers.
261 1.1 mrg (eg. classic swrast, softpipe or llvmpipe)
262 1.1 mrg </p>
263 1.1 mrg <p>
264 1.1 mrg You can run the <code>glxinfo</code> program to learn about your OpenGL
265 1.1 mrg library.
266 1.1 mrg Look for the <code>OpenGL vendor</code> and <code>OpenGL renderer</code> values.
267 1.1 mrg That will identify who's OpenGL library with which driver you're using and what sort of
268 1.1 mrg hardware it has detected.
269 1.1 mrg </p>
270 1.1 mrg <p>
271 1.1 mrg If you're using a hardware accelerated driver you want <code>direct rendering: Yes</code>.
272 1.1 mrg </p>
273 1.1 mrg <p>
274 1.1 mrg If your DRI-based driver isn't working, go to the
275 1.1.1.2 mrg <a href="https://dri.freedesktop.org/">DRI website</a> for trouble-shooting information.
276 1.1 mrg </p>
277 1.1 mrg
278 1.1 mrg
279 1.1 mrg <h2>3.2 I'm seeing errors in depth (Z) buffering. Why?</h2>
280 1.1 mrg <p>
281 1.1 mrg Make sure the ratio of the far to near clipping planes isn't too great.
282 1.1 mrg Look
283 1.1.1.2 mrg <a href="https://www.opengl.org/resources/faq/technical/depthbuffer.htm#0040">here</a>
284 1.1 mrg for details.
285 1.1 mrg </p>
286 1.1 mrg <p>
287 1.1 mrg Mesa uses a 16-bit depth buffer by default which is smaller and faster
288 1.1 mrg to clear than a 32-bit buffer but not as accurate.
289 1.1 mrg If you need a deeper you can modify the parameters to
290 1.1 mrg <code> glXChooseVisual</code> in your code.
291 1.1 mrg </p>
292 1.1 mrg
293 1.1 mrg
294 1.1 mrg <h2>3.3 Why Isn't depth buffering working at all?</h2>
295 1.1 mrg <p>
296 1.1 mrg Be sure you're requesting a depth buffered-visual. If you set the MESA_DEBUG
297 1.1 mrg environment variable it will warn you about trying to enable depth testing
298 1.1 mrg when you don't have a depth buffer.
299 1.1 mrg </p>
300 1.1 mrg <p>Specifically, make sure <code>glutInitDisplayMode</code> is being called
301 1.1 mrg with <code>GLUT_DEPTH</code> or <code>glXChooseVisual</code> is being
302 1.1 mrg called with a non-zero value for GLX_DEPTH_SIZE.
303 1.1 mrg </p>
304 1.1 mrg <p>This discussion applies to stencil buffers, accumulation buffers and
305 1.1 mrg alpha channels too.
306 1.1 mrg </p>
307 1.1 mrg
308 1.1 mrg
309 1.1 mrg <h2>3.4 Why does glGetString() always return NULL?</h2>
310 1.1 mrg <p>
311 1.1 mrg Be sure you have an active/current OpenGL rendering context before
312 1.1 mrg calling glGetString.
313 1.1 mrg </p>
314 1.1 mrg
315 1.1 mrg
316 1.1 mrg <h2>3.5 GL_POINTS and GL_LINES don't touch the right pixels</h2>
317 1.1 mrg <p>
318 1.1 mrg If you're trying to draw a filled region by using GL_POINTS or GL_LINES
319 1.1 mrg and seeing holes or gaps it's because of a float-to-int rounding problem.
320 1.1 mrg But this is not a bug.
321 1.1 mrg See Appendix H of the OpenGL Programming Guide - "OpenGL Correctness Tips".
322 1.1 mrg Basically, applying a translation of (0.375, 0.375, 0.0) to your coordinates
323 1.1 mrg will fix the problem.
324 1.1 mrg </p>
325 1.1 mrg
326 1.1 mrg <br>
327 1.1 mrg <br>
328 1.1 mrg
329 1.1 mrg
330 1.1 mrg <h1 id="part4">4. Developer Questions</h1>
331 1.1 mrg
332 1.1 mrg <h2>4.1 How can I contribute?</h2>
333 1.1 mrg <p>
334 1.1 mrg First, join the <a href="lists.html">mesa-dev mailing list</a>.
335 1.1 mrg That's where Mesa development is discussed.
336 1.1 mrg </p>
337 1.1 mrg <p>
338 1.1.1.2 mrg The <a href="https://www.opengl.org/documentation">
339 1.1 mrg OpenGL Specification</a> is the bible for OpenGL implementation work.
340 1.1 mrg You should read it.
341 1.1 mrg </p>
342 1.1 mrg <p>Most of the Mesa development work involves implementing new OpenGL
343 1.1 mrg extensions, writing hardware drivers (for the DRI), and code optimization.
344 1.1 mrg </p>
345 1.1 mrg
346 1.1 mrg <h2>4.2 How do I write a new device driver?</h2>
347 1.1 mrg <p>
348 1.1 mrg Unfortunately, writing a device driver isn't easy.
349 1.1 mrg It requires detailed understanding of OpenGL, the Mesa code, and your
350 1.1 mrg target hardware/operating system.
351 1.1 mrg 3D graphics are not simple.
352 1.1 mrg </p>
353 1.1 mrg <p>
354 1.1 mrg The best way to get started is to use an existing driver as your starting
355 1.1 mrg point.
356 1.1 mrg For a classic hardware driver, the i965 driver is a good example.
357 1.1 mrg For a Gallium3D hardware driver, the r300g, r600g and the i915g are good examples.
358 1.1 mrg </p>
359 1.1 mrg <p>The DRI website has more information about writing hardware drivers.
360 1.1 mrg The process isn't well document because the Mesa driver interface changes
361 1.1 mrg over time, and we seldom have spare time for writing documentation.
362 1.1 mrg That being said, many people have managed to figure out the process.
363 1.1 mrg </p>
364 1.1 mrg <p>
365 1.1 mrg Joining the appropriate mailing lists and asking questions (and searching
366 1.1 mrg the archives) is a good way to get information.
367 1.1 mrg </p>
368 1.1 mrg
369 1.1 mrg
370 1.1 mrg <h2>4.3 Why isn't GL_EXT_texture_compression_s3tc implemented in Mesa?</h2>
371 1.1 mrg <p>
372 1.1.1.2 mrg Oh but it is! Prior to 2nd October 2017, the Mesa project did not include s3tc
373 1.1.1.2 mrg support due to intellectual property (IP) and/or patent issues around the s3tc
374 1.1.1.2 mrg algorithm.
375 1.1.1.2 mrg </p>
376 1.1.1.2 mrg <p>
377 1.1.1.2 mrg As of Mesa 17.3.0, Mesa now officially supports s3tc, as the patent has expired.
378 1.1 mrg </p>
379 1.1 mrg <p>
380 1.1.1.2 mrg In versions prior to this, a 3rd party <a href="https://dri.freedesktop.org/wiki/S3TC">
381 1.1.1.2 mrg plug-in library</a> was required.
382 1.1 mrg </p>
383 1.1 mrg
384 1.1 mrg </div>
385 1.1 mrg </body>
386 1.1 mrg </html>
387