blob: 0d9e52cee478d20b7208fb5606f48ce56b92ea7f [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
Brian Paul56e9efa2003-09-03 23:04:02 +000037
38<h1>2. Compilation</h1>
39
40<p>
Briane75fbd32007-05-04 18:26:41 -060041You'll need the DRM and pciaccess libraries. Check with:
Brian Paul4a54ace2004-05-20 22:27:59 +000042</p>
43<pre>
Briane75fbd32007-05-04 18:26:41 -060044 pkg-config --modversion libdrm
45 pkg-config --modversion pciaccess
Brian Paul4a54ace2004-05-20 22:27:59 +000046</pre>
47
48<p>
Brian62ef0012007-05-09 08:17:57 -060049You can get them from the git repository with:
50</p>
51<pre>
52 git clone git://anongit.freedesktop.org/git/mesa/drm
53 git clone git://anongit.freedesktop.org/git/xorg/lib/libpciaccess
54</pre>
55
56<p>
57See the README files in those projects for build/install instructions.
58</p>
59
60
61<p>
Briane75fbd32007-05-04 18:26:41 -060062You'll need fbdev header files. Check with:
Brian Paul4a54ace2004-05-20 22:27:59 +000063</p>
64<pre>
Briane75fbd32007-05-04 18:26:41 -060065 ls -l /usr/include/linux/fb.h
Brian Paul4a54ace2004-05-20 22:27:59 +000066</pre>
67
68<p>
Briane75fbd32007-05-04 18:26:41 -060069Compile Mesa with the 'linux-solo' configuration:
Brian Paul56e9efa2003-09-03 23:04:02 +000070</p>
71<pre>
Brian Paul56e9efa2003-09-03 23:04:02 +000072 make linux-solo
73</pre>
74
75<p>
Briane75fbd32007-05-04 18:26:41 -060076When complete you should have the following:
Brian Paulf4b909b2004-04-18 20:17:14 +000077</p>
Brian Paul56e9efa2003-09-03 23:04:02 +000078<ul>
Briane75fbd32007-05-04 18:26:41 -060079<li>lib/libGL.so - the GL library which applications link with
80<li>lib/*_dri_so - DRI drivers
81<li>lib/miniglx.conf - sample MiniGLX config file
82<li>progs/miniglx/* - several MiniGLX sample programs
Brian Paul56e9efa2003-09-03 23:04:02 +000083</ul>
84
85
Briane75fbd32007-05-04 18:26:41 -060086
Brian Paul56e9efa2003-09-03 23:04:02 +000087<h1>3. Using fbdev/DRI</h1>
88
89<p>
Briane75fbd32007-05-04 18:26:41 -060090If an X server currently running, exit/stop it so you're working from
91the console.
Brian Paul56e9efa2003-09-03 23:04:02 +000092</p>
93
94
Brian Paul4a54ace2004-05-20 22:27:59 +000095<h2>3.1 Load Kernel Modules</h2>
Brian Paul56e9efa2003-09-03 23:04:02 +000096
97<p>
Brian Paul4a54ace2004-05-20 22:27:59 +000098You'll need to load the kernel modules specific to your graphics hardware.
99Typically, this consists of the agpgart module, an fbdev driver module
Briane75fbd32007-05-04 18:26:41 -0600100and the DRM kernel module.
101</p>
102<p>
103As root, the kernel modules can be loaded as follows:
Brian Paul56e9efa2003-09-03 23:04:02 +0000104</p>
105
Briane75fbd32007-05-04 18:26:41 -0600106<p>
107If you have Intel i915/i945 hardware:
108</p>
109<pre>
110 modprobe agpgart # the AGP GART module
111 modprobe intelfb # the Intel fbdev driver
112 modprobe i915 # the i915/945 DRI kernel module
113</pre>
Brian Paul56e9efa2003-09-03 23:04:02 +0000114
115<p>
Briane75fbd32007-05-04 18:26:41 -0600116If you have ATI Radeon/R200 hardware:
Brian Paul56e9efa2003-09-03 23:04:02 +0000117</p>
118<pre>
119 modprobe agpgart # the AGP GART module
120 modprobe radeonfb # the Radeon fbdev driver
121 modprobe radeon # the Radeon DRI kernel module
122</pre>
123
124<p>
Briane75fbd32007-05-04 18:26:41 -0600125If you have ATI Rage 128 hardware:
Brian Paul56e9efa2003-09-03 23:04:02 +0000126</p>
127<pre>
128 modprobe agpgart # the AGP GART module
129 modprobe aty128fb # the Rage 128 fbdev driver
130 modprobe r128 # the Rage 128 DRI kernel module
131</pre>
132
133<p>
Briane75fbd32007-05-04 18:26:41 -0600134If you have Matrox G200/G400 hardware:
Brian Paul56e9efa2003-09-03 23:04:02 +0000135</p>
136<pre>
137 modprobe agpgart # the AGP GART module
138 modprobe mgafb # the Matrox fbdev driver
139 modprobe mga # the Matrox DRI kernel module
140</pre>
141
142<p>
Briane75fbd32007-05-04 18:26:41 -0600143To verify that the agpgart, fbdev and drm modules are loaded:
Brian Paul56e9efa2003-09-03 23:04:02 +0000144</p>
145<pre>
Briane75fbd32007-05-04 18:26:41 -0600146 ls -l /dev/agpgart /dev/fb* /dev/dri
Brian Paul56e9efa2003-09-03 23:04:02 +0000147</pre>
Briane75fbd32007-05-04 18:26:41 -0600148<p>
149Alternately, use lsmod to inspect the currently installed modules.
150If you have problems, look at the output of dmesg.
151</p>
Brian Paul70dacab2004-02-13 18:29:42 +0000152
Brian Paul56e9efa2003-09-03 23:04:02 +0000153
154<h2>3.2 Configuration File</h2>
155
156<p>
Briane75fbd32007-05-04 18:26:41 -0600157Copy the sample miniglx.conf to /etc/miniglx.conf and review/edit its contents.
158Alternately, the MINIGLX_CONF environment variable can be used to
159indicate the location of miniglx.conf
Brian Paul56e9efa2003-09-03 23:04:02 +0000160</p>
161
Briane75fbd32007-05-04 18:26:41 -0600162To determine the pciBusID value, run lspci and examine the output.
163For example:
Brian Paul56e9efa2003-09-03 23:04:02 +0000164</p>
Briane75fbd32007-05-04 18:26:41 -0600165<pre>
166 /sbin/lspci:
167 00:02.0 VGA compatible controller: Intel Corporation 82915G/GV/910GL Express Chipset Family Graphics Controller (rev 04)
168</pre>
169<p>
17000:02.0 indicates that pciBusID should be PCI:0:2:0
171</p>
172
173
Brian Paul56e9efa2003-09-03 23:04:02 +0000174
175
176<h2>3.3 Running fbdev/DRI Programs</h2>
177
178<p>
179Make sure your LD_LIBRARY_PATH environment variable is set to the
Briane75fbd32007-05-04 18:26:41 -0600180location of the libGL.so library. You may need to append other paths
181to LD_LIBRARY_PATH if libpciaccess.so is in a non-standard location,
182for example.
Brian Paul56e9efa2003-09-03 23:04:02 +0000183</p>
184
185<p>
Brian Paulf4b909b2004-04-18 20:17:14 +0000186Change to the <code>Mesa/progs/miniglx/</code> directory and
Brian Paul56e9efa2003-09-03 23:04:02 +0000187start the sample_server program in the background:
188</p>
189<pre>
Brian62ef0012007-05-09 08:17:57 -0600190 ./sample_server &amp;
Brian Paul56e9efa2003-09-03 23:04:02 +0000191</pre>
192
193<p>
194Then try running the <code>miniglxtest</code> program:
195</p>
196<pre>
197 ./miniglxtest
198</pre>
199<p>
200You should see a rotating quadrilateral which changes color as it rotates.
201It will exit automatically after a bit.
202</p>
203
204<p>
205If you run other tests in the miniglx/ directory, you may want to run
206them from a remote shell so that you can stop them with ctrl-C.
207</p>
208
209
210
211<h1>4.0 Troubleshooting</h1>
212
Briane75fbd32007-05-04 18:26:41 -0600213<ol>
214<li>
Brian Paul56e9efa2003-09-03 23:04:02 +0000215If you try to run miniglxtest and get the following:
Briane75fbd32007-05-04 18:26:41 -0600216<br>
Brian Paul56e9efa2003-09-03 23:04:02 +0000217<pre>
218 [miniglx] failed to probe chipset
219 connect: Connection refused
220 server connection lost
221</pre>
Brian Paul56e9efa2003-09-03 23:04:02 +0000222It means that the sample_server process is not running.
Briane75fbd32007-05-04 18:26:41 -0600223<br>
224<br>
225</li>
Brian91948f92007-05-04 18:32:02 -0600226</ol>
Brian Paul56e9efa2003-09-03 23:04:02 +0000227
228
229<h1>5.0 Programming Information</h1>
230
231<p>
Brian Paul56e9efa2003-09-03 23:04:02 +0000232OpenGL/Mesa is interfaced to fbdev via the <a href="MiniGLX.html">MiniGLX</a>
233interface.
234MiniGLX is a subset of Xlib and GLX API functions which provides just
235enough functionality to setup OpenGL rendering and respond to simple
236input events.
237</p>
238
239<p>
240Since MiniGLX is a subset of the usual Xlib and GLX APIs, programs written
241to the MiniGLX API can also be run on full Xlib/GLX implementations.
242This allows some degree of flexibility for software development and testing.
243</p>
244
Brian Paule0823482003-09-03 23:10:31 +0000245<p>
246However, the MiniGLX API is not binary-compatible with full Xlib/GLX.
247Some of the structures are different and some macros/functions work
248differently.
249See the <code>GL/miniglx.h</code> header file for details.
250</p>
Brian Paul56e9efa2003-09-03 23:04:02 +0000251
252
253</body>
254</html>