blob: c3724b371296b7c9583987099e95e0c55f87f2ec [file] [log] [blame]
Brian Paul4a54ace2004-05-20 22:27:59 +00001<html>
Brian Paul56e9efa2003-09-03 23:04:02 +00002
3<TITLE>Mesa fbdev/DRI Environment</TITLE>
4
Brian Paul36da0452005-01-20 03:55:10 +00005<link rel="stylesheet" type="text/css" href="mesa.css"></head>
6
7<BODY>
Brian Paul56e9efa2003-09-03 23:04:02 +00008
9<center><H1>Mesa fbdev/DRI Drivers</H1></center>
10
11
12<H1>1. Introduction</H1>
13
14<p>
Briane75fbd32007-05-04 18:26:41 -060015The fbdev/DRI environment supports hardware-accelerated 3D rendering without
16the X window system. This is typically used for embedded applications.
Brian Paul56e9efa2003-09-03 23:04:02 +000017</p>
18
19<p>
Briane75fbd32007-05-04 18:26:41 -060020Contributors to this project include Jon Smirl, Keith Whitwell and Dave Airlie.
Brian Paul56e9efa2003-09-03 23:04:02 +000021</p>
22
23<p>
Briane75fbd32007-05-04 18:26:41 -060024Applications in the fbdev/DRI environment use
25the <a href="MiniGXL.html"> MiniGLX</a> interface to choose pixel
26formats, create rendering contexts, etc. It's a subset of the GLX and
27Xlib interfaces allowing some degree of application portability between
28the X and X-less environments.
Brian Paul56e9efa2003-09-03 23:04:02 +000029</p>
30
Brianf2d9a072007-09-27 10:35:37 -060031<p>
32Some of the files needed for building this configuration are not included
33in the normal Mesa releases so you'll need to get the latest sources
34sources from the <a href="repository.html">git repository</a>.
35</p>
36
Brian27028fc2007-11-27 10:31:05 -070037<p>
38This fbdev/DRI environment isn't well supported.
39Code and documentation updates/patches are welcomed.
40</p>
41
Brian Paul56e9efa2003-09-03 23:04:02 +000042
43<h1>2. Compilation</h1>
44
45<p>
Briane75fbd32007-05-04 18:26:41 -060046You'll need the DRM and pciaccess libraries. Check with:
Brian Paul4a54ace2004-05-20 22:27:59 +000047</p>
48<pre>
Briane75fbd32007-05-04 18:26:41 -060049 pkg-config --modversion libdrm
50 pkg-config --modversion pciaccess
Brian Paul4a54ace2004-05-20 22:27:59 +000051</pre>
52
53<p>
Brian62ef0012007-05-09 08:17:57 -060054You can get them from the git repository with:
55</p>
56<pre>
57 git clone git://anongit.freedesktop.org/git/mesa/drm
58 git clone git://anongit.freedesktop.org/git/xorg/lib/libpciaccess
59</pre>
60
61<p>
62See the README files in those projects for build/install instructions.
63</p>
64
65
66<p>
Briane75fbd32007-05-04 18:26:41 -060067You'll need fbdev header files. Check with:
Brian Paul4a54ace2004-05-20 22:27:59 +000068</p>
69<pre>
Briane75fbd32007-05-04 18:26:41 -060070 ls -l /usr/include/linux/fb.h
Brian Paul4a54ace2004-05-20 22:27:59 +000071</pre>
72
73<p>
Brian27028fc2007-11-27 10:31:05 -070074You'll need to get Mesa from git (see above).
Briane75fbd32007-05-04 18:26:41 -060075Compile Mesa with the 'linux-solo' configuration:
Brian Paul56e9efa2003-09-03 23:04:02 +000076</p>
77<pre>
Brian Paul56e9efa2003-09-03 23:04:02 +000078 make linux-solo
79</pre>
80
81<p>
Briane75fbd32007-05-04 18:26:41 -060082When complete you should have the following:
Brian Paulf4b909b2004-04-18 20:17:14 +000083</p>
Brian Paul56e9efa2003-09-03 23:04:02 +000084<ul>
Briane75fbd32007-05-04 18:26:41 -060085<li>lib/libGL.so - the GL library which applications link with
86<li>lib/*_dri_so - DRI drivers
87<li>lib/miniglx.conf - sample MiniGLX config file
88<li>progs/miniglx/* - several MiniGLX sample programs
Brian Paul56e9efa2003-09-03 23:04:02 +000089</ul>
90
91
Briane75fbd32007-05-04 18:26:41 -060092
Brian Paul56e9efa2003-09-03 23:04:02 +000093<h1>3. Using fbdev/DRI</h1>
94
95<p>
Briane75fbd32007-05-04 18:26:41 -060096If an X server currently running, exit/stop it so you're working from
97the console.
Brian Paul56e9efa2003-09-03 23:04:02 +000098</p>
99
100
Brian Paul4a54ace2004-05-20 22:27:59 +0000101<h2>3.1 Load Kernel Modules</h2>
Brian Paul56e9efa2003-09-03 23:04:02 +0000102
103<p>
Brian Paul4a54ace2004-05-20 22:27:59 +0000104You'll need to load the kernel modules specific to your graphics hardware.
105Typically, this consists of the agpgart module, an fbdev driver module
Briane75fbd32007-05-04 18:26:41 -0600106and the DRM kernel module.
107</p>
108<p>
109As root, the kernel modules can be loaded as follows:
Brian Paul56e9efa2003-09-03 23:04:02 +0000110</p>
111
Briane75fbd32007-05-04 18:26:41 -0600112<p>
113If you have Intel i915/i945 hardware:
114</p>
115<pre>
116 modprobe agpgart # the AGP GART module
117 modprobe intelfb # the Intel fbdev driver
118 modprobe i915 # the i915/945 DRI kernel module
119</pre>
Brian Paul56e9efa2003-09-03 23:04:02 +0000120
121<p>
Briane75fbd32007-05-04 18:26:41 -0600122If you have ATI Radeon/R200 hardware:
Brian Paul56e9efa2003-09-03 23:04:02 +0000123</p>
124<pre>
125 modprobe agpgart # the AGP GART module
126 modprobe radeonfb # the Radeon fbdev driver
127 modprobe radeon # the Radeon DRI kernel module
128</pre>
129
130<p>
Briane75fbd32007-05-04 18:26:41 -0600131If you have ATI Rage 128 hardware:
Brian Paul56e9efa2003-09-03 23:04:02 +0000132</p>
133<pre>
134 modprobe agpgart # the AGP GART module
135 modprobe aty128fb # the Rage 128 fbdev driver
136 modprobe r128 # the Rage 128 DRI kernel module
137</pre>
138
139<p>
Briane75fbd32007-05-04 18:26:41 -0600140If you have Matrox G200/G400 hardware:
Brian Paul56e9efa2003-09-03 23:04:02 +0000141</p>
142<pre>
143 modprobe agpgart # the AGP GART module
144 modprobe mgafb # the Matrox fbdev driver
145 modprobe mga # the Matrox DRI kernel module
146</pre>
147
148<p>
Briane75fbd32007-05-04 18:26:41 -0600149To verify that the agpgart, fbdev and drm modules are loaded:
Brian Paul56e9efa2003-09-03 23:04:02 +0000150</p>
151<pre>
Briane75fbd32007-05-04 18:26:41 -0600152 ls -l /dev/agpgart /dev/fb* /dev/dri
Brian Paul56e9efa2003-09-03 23:04:02 +0000153</pre>
Briane75fbd32007-05-04 18:26:41 -0600154<p>
155Alternately, use lsmod to inspect the currently installed modules.
156If you have problems, look at the output of dmesg.
157</p>
Brian Paul70dacab2004-02-13 18:29:42 +0000158
Brian Paul56e9efa2003-09-03 23:04:02 +0000159
160<h2>3.2 Configuration File</h2>
161
162<p>
Briane75fbd32007-05-04 18:26:41 -0600163Copy the sample miniglx.conf to /etc/miniglx.conf and review/edit its contents.
164Alternately, the MINIGLX_CONF environment variable can be used to
165indicate the location of miniglx.conf
Brian Paul56e9efa2003-09-03 23:04:02 +0000166</p>
167
Briane75fbd32007-05-04 18:26:41 -0600168To determine the pciBusID value, run lspci and examine the output.
169For example:
Brian Paul56e9efa2003-09-03 23:04:02 +0000170</p>
Briane75fbd32007-05-04 18:26:41 -0600171<pre>
172 /sbin/lspci:
173 00:02.0 VGA compatible controller: Intel Corporation 82915G/GV/910GL Express Chipset Family Graphics Controller (rev 04)
174</pre>
175<p>
17600:02.0 indicates that pciBusID should be PCI:0:2:0
177</p>
178
179
Brian Paul56e9efa2003-09-03 23:04:02 +0000180
181
182<h2>3.3 Running fbdev/DRI Programs</h2>
183
184<p>
185Make sure your LD_LIBRARY_PATH environment variable is set to the
Briane75fbd32007-05-04 18:26:41 -0600186location of the libGL.so library. You may need to append other paths
187to LD_LIBRARY_PATH if libpciaccess.so is in a non-standard location,
188for example.
Brian Paul56e9efa2003-09-03 23:04:02 +0000189</p>
190
191<p>
Brian Paulf4b909b2004-04-18 20:17:14 +0000192Change to the <code>Mesa/progs/miniglx/</code> directory and
Brian Paul56e9efa2003-09-03 23:04:02 +0000193start the sample_server program in the background:
194</p>
195<pre>
Brian62ef0012007-05-09 08:17:57 -0600196 ./sample_server &amp;
Brian Paul56e9efa2003-09-03 23:04:02 +0000197</pre>
198
199<p>
200Then try running the <code>miniglxtest</code> program:
201</p>
202<pre>
203 ./miniglxtest
204</pre>
205<p>
206You should see a rotating quadrilateral which changes color as it rotates.
207It will exit automatically after a bit.
208</p>
209
210<p>
211If you run other tests in the miniglx/ directory, you may want to run
212them from a remote shell so that you can stop them with ctrl-C.
213</p>
214
215
216
217<h1>4.0 Troubleshooting</h1>
218
Briane75fbd32007-05-04 18:26:41 -0600219<ol>
220<li>
Brian Paul56e9efa2003-09-03 23:04:02 +0000221If you try to run miniglxtest and get the following:
Briane75fbd32007-05-04 18:26:41 -0600222<br>
Brian Paul56e9efa2003-09-03 23:04:02 +0000223<pre>
224 [miniglx] failed to probe chipset
225 connect: Connection refused
226 server connection lost
227</pre>
Brian Paul56e9efa2003-09-03 23:04:02 +0000228It means that the sample_server process is not running.
Briane75fbd32007-05-04 18:26:41 -0600229<br>
230<br>
231</li>
Brian91948f92007-05-04 18:32:02 -0600232</ol>
Brian Paul56e9efa2003-09-03 23:04:02 +0000233
234
235<h1>5.0 Programming Information</h1>
236
237<p>
Brian Paul56e9efa2003-09-03 23:04:02 +0000238OpenGL/Mesa is interfaced to fbdev via the <a href="MiniGLX.html">MiniGLX</a>
239interface.
240MiniGLX is a subset of Xlib and GLX API functions which provides just
241enough functionality to setup OpenGL rendering and respond to simple
242input events.
243</p>
244
245<p>
246Since MiniGLX is a subset of the usual Xlib and GLX APIs, programs written
247to the MiniGLX API can also be run on full Xlib/GLX implementations.
248This allows some degree of flexibility for software development and testing.
249</p>
250
Brian Paule0823482003-09-03 23:10:31 +0000251<p>
252However, the MiniGLX API is not binary-compatible with full Xlib/GLX.
253Some of the structures are different and some macros/functions work
254differently.
255See the <code>GL/miniglx.h</code> header file for details.
256</p>
Brian Paul56e9efa2003-09-03 23:04:02 +0000257
258
259</body>
260</html>