Debian Codegraph @

docs/faq.rst

raw
1 Frequently Asked Questions
2 ==========================
3
4 Last updated: 19 September 2018
5
6 1. High-level Questions and Answers
7 -----------------------------------
8
9 1.1 What is Mesa?
10 ~~~~~~~~~~~~~~~~~
11
12 Mesa is an open-source implementation of the OpenGL specification.
13 OpenGL is a programming library for writing interactive 3D applications.
14 See the `OpenGL website <https://www.opengl.org/>`__ for more
15 information.
16
17 Mesa 9.x supports the OpenGL 3.1 specification.
18
19 1.2 Does Mesa support/use graphics hardware?
20 --------------------------------------------
21
22 Yes. Specifically, Mesa serves as the OpenGL core for the open-source
23 DRI drivers for X.org.
24
25 - See the `DRI website <https://dri.freedesktop.org/>`__ for more
26 information.
27 - See `01.org <https://www.intel.com/content/www/us/en/developer/topic-technology/open/overview.html>`__
28 for more information about Intel drivers.
29 - See `nouveau.freedesktop.org <https://nouveau.freedesktop.org>`__ for
30 more information about Nouveau drivers.
31 - See
32 `www.x.org/wiki/RadeonFeature <https://www.x.org/wiki/RadeonFeature>`__
33 for more information about Radeon drivers.
34
35 2. Compilation and Installation Problems
36 ----------------------------------------
37
38 2.1 What's the easiest way to install Mesa?
39 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40
41 If you're using a Linux-based system, your distribution
42 most likely already includes Mesa packages.
43
44 2.2 What's the proper place for the libraries and headers?
45 ----------------------------------------------------------
46
47 On Linux-based systems you'll want to follow the `Linux
48 ABI <https://registry.khronos.org/OpenGL/ABI/>`__ standard.
49 Basically you'll want the following:
50
51 ``/usr/include/GL/gl.h``
52 the main OpenGL header
53 ``/usr/include/GL/glu.h``
54 the OpenGL GLU (utility) header
55 ``/usr/include/GL/glx.h``
56 the OpenGL GLX header
57 ``/usr/include/GL/glext.h``
58 the OpenGL extensions header
59 ``/usr/include/GL/glxext.h``
60 the OpenGL GLX extensions header
61 ``/usr/lib/libGL.so``
62 a symlink to ``libGL.so.1``
63 ``/usr/lib/libGL.so.1``
64 a symlink to ``libGL.so.1.xyz``
65 ``/usr/lib/libGL.so.xyz``
66 the actual OpenGL/Mesa library. xyz denotes the Mesa version number.
67
68 When configuring Mesa, there are three meson options that affect the
69 install location that you should take care with: ``--prefix``,
70 ``--libdir``, and ``-D dri-drivers-path``. To install Mesa into the
71 system location where it will be available for all programs to use, set
72 ``--prefix=/usr``. Set ``--libdir`` to where your Linux distribution
73 installs system libraries, usually either ``/usr/lib`` or
74 ``/usr/lib64``. Set ``-D dri-drivers-path`` to the directory where your
75 Linux distribution installs DRI drivers. To find your system's DRI
76 driver directory, try executing ``find /usr -type d -name dri``. For
77 example, if the ``find`` command listed ``/usr/lib64/dri``, then set
78 ``-D dri-drivers-path=/usr/lib64/dri``.
79
80 After determining the correct values for the install location, configure
81 Mesa with
82 ``meson configure --prefix=/usr --libdir=xxx -D dri-drivers-path=xxx``
83 and then install with ``sudo meson install``.
84
85 3. Runtime / Rendering Problems
86 -------------------------------
87
88 3.1 Rendering is slow / why isn't my graphics hardware being used?
89 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
90
91 If Mesa can't use its hardware accelerated drivers it falls back on one
92 of its software renderers. (e.g. Softpipe or LLVMpipe)
93
94 You can run the ``glxinfo`` program to learn about your OpenGL library.
95 Look for the ``OpenGL vendor`` and ``OpenGL renderer`` values. That will
96 identify who's OpenGL library with which driver you're using and what
97 sort of hardware it has detected.
98
99 If you're using a hardware accelerated driver you want
100 ``direct rendering: Yes``.
101
102 If your DRI-based driver isn't working, go to the `DRI
103 website <https://dri.freedesktop.org/>`__ for trouble-shooting
104 information.
105
106 3.2 I'm seeing errors in depth (Z) buffering. Why?
107 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
108
109 Make sure the ratio of the far to near clipping planes isn't too great.
110 Look
111 `here <https://www.opengl.org/archives/resources/faq/technical/depthbuffer.htm#0040>`__
112 for details.
113
114 Mesa uses a 16-bit depth buffer by default which is smaller and faster
115 to clear than a 32-bit buffer but not as accurate. If you need a deeper
116 you can modify the parameters to ``glXChooseVisual`` in your code.
117
118 3.3 Why Isn't depth buffering working at all?
119 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
120
121 Be sure you're requesting a depth buffered-visual. If you set the
122 ``MESA_DEBUG`` environment variable it will warn you about trying to
123 enable depth testing when you don't have a depth buffer.
124
125 Specifically, make sure ``glutInitDisplayMode`` is being called with
126 ``GLUT_DEPTH`` or ``glXChooseVisual`` is being called with a non-zero
127 value for ``GLX_DEPTH_SIZE``.
128
129 This discussion applies to stencil buffers, accumulation buffers and
130 alpha channels too.
131
132 3.4 Why does ``glGetString()`` always return ``NULL``?
133 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134
135 Be sure you have an active/current OpenGL rendering context before
136 calling ``glGetString``.
137
138 3.5 ``GL_POINTS`` and ``GL_LINES`` don't touch the right pixels
139 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140
141 If you're trying to draw a filled region by using ``GL_POINTS`` or
142 ``GL_LINES`` and seeing holes or gaps it's because of a float-to-int
143 rounding problem. But this is not a bug. See Appendix H of the OpenGL
144 Programming Guide - "OpenGL Correctness Tips". Basically, applying a
145 translation of (0.375, 0.375, 0.0) to your coordinates will fix the
146 problem.
147
148 4. Developer Questions
149 ----------------------
150
151 4.1 How can I contribute?
152 ~~~~~~~~~~~~~~~~~~~~~~~~~
153
154 First, join the :doc:`mesa-dev mailing list <lists>`. That's where
155 Mesa development is discussed.
156
157 The `OpenGL Specification
158 <https://registry.khronos.org/OpenGL/index_gl.php#apispecs>`__ is the
159 bible for OpenGL implementation work. You should read it.
160
161 Most of the Mesa development work involves implementing new OpenGL
162 extensions, writing hardware drivers (for the DRI), and code
163 optimization.
164
165 4.2 How do I write a new device driver?
166 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167
168 Unfortunately, writing a device driver isn't easy. It requires detailed
169 understanding of OpenGL, the Mesa code, and your target
170 hardware/operating system. 3D graphics are not simple.
171
172 The best way to get started is to use an existing driver as your
173 starting point. For a Gallium3D hardware driver, the r300g, r600g and the i915g
174 are good examples.
175
176 The DRI website has more information about writing hardware drivers. The
177 process isn't well document because the Mesa driver interface changes
178 over time, and we seldom have spare time for writing documentation. That
179 being said, many people have managed to figure out the process.
180
181 Joining the appropriate mailing lists and asking questions (and
182 searching the archives) is a good way to get information.
183
184 4.3 Why isn't :ext:`GL_EXT_texture_compression_s3tc` implemented in Mesa?
185 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
186
187 Oh but it is! Prior to 2nd October 2017, the Mesa project did not
188 include S3TC support due to intellectual property (IP) and/or patent
189 issues around the S3TC algorithm.
190
191 As of Mesa 17.3.0, Mesa now officially supports S3TC, as the patent has
192 expired.
193
194 In versions prior to this, a 3rd party `plug-in
195 library <https://dri.freedesktop.org/wiki/S3TC>`__ was required.