blob: 294ddb1e057b70d8582fc4c24f47a1886a6a69c5 [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
Brian Paul56e9efa2003-09-03 23:04:02 +000031
32<h1>2. Compilation</h1>
33
34<p>
Briane75fbd32007-05-04 18:26:41 -060035You'll need the DRM and pciaccess libraries. Check with:
Brian Paul4a54ace2004-05-20 22:27:59 +000036</p>
37<pre>
Briane75fbd32007-05-04 18:26:41 -060038 pkg-config --modversion libdrm
39 pkg-config --modversion pciaccess
Brian Paul4a54ace2004-05-20 22:27:59 +000040</pre>
41
42<p>
Briane75fbd32007-05-04 18:26:41 -060043You'll need fbdev header files. Check with:
Brian Paul4a54ace2004-05-20 22:27:59 +000044</p>
45<pre>
Briane75fbd32007-05-04 18:26:41 -060046 ls -l /usr/include/linux/fb.h
Brian Paul4a54ace2004-05-20 22:27:59 +000047</pre>
48
49<p>
Briane75fbd32007-05-04 18:26:41 -060050Compile Mesa with the 'linux-solo' configuration:
Brian Paul56e9efa2003-09-03 23:04:02 +000051</p>
52<pre>
Brian Paul56e9efa2003-09-03 23:04:02 +000053 make linux-solo
54</pre>
55
56<p>
Briane75fbd32007-05-04 18:26:41 -060057When complete you should have the following:
Brian Paulf4b909b2004-04-18 20:17:14 +000058</p>
Brian Paul56e9efa2003-09-03 23:04:02 +000059<ul>
Briane75fbd32007-05-04 18:26:41 -060060<li>lib/libGL.so - the GL library which applications link with
61<li>lib/*_dri_so - DRI drivers
62<li>lib/miniglx.conf - sample MiniGLX config file
63<li>progs/miniglx/* - several MiniGLX sample programs
Brian Paul56e9efa2003-09-03 23:04:02 +000064</ul>
65
66
Briane75fbd32007-05-04 18:26:41 -060067
Brian Paul56e9efa2003-09-03 23:04:02 +000068<h1>3. Using fbdev/DRI</h1>
69
70<p>
Briane75fbd32007-05-04 18:26:41 -060071If an X server currently running, exit/stop it so you're working from
72the console.
Brian Paul56e9efa2003-09-03 23:04:02 +000073</p>
74
75
Brian Paul4a54ace2004-05-20 22:27:59 +000076<h2>3.1 Load Kernel Modules</h2>
Brian Paul56e9efa2003-09-03 23:04:02 +000077
78<p>
Brian Paul4a54ace2004-05-20 22:27:59 +000079You'll need to load the kernel modules specific to your graphics hardware.
80Typically, this consists of the agpgart module, an fbdev driver module
Briane75fbd32007-05-04 18:26:41 -060081and the DRM kernel module.
82</p>
83<p>
84As root, the kernel modules can be loaded as follows:
Brian Paul56e9efa2003-09-03 23:04:02 +000085</p>
86
Briane75fbd32007-05-04 18:26:41 -060087<p>
88If you have Intel i915/i945 hardware:
89</p>
90<pre>
91 modprobe agpgart # the AGP GART module
92 modprobe intelfb # the Intel fbdev driver
93 modprobe i915 # the i915/945 DRI kernel module
94</pre>
Brian Paul56e9efa2003-09-03 23:04:02 +000095
96<p>
Briane75fbd32007-05-04 18:26:41 -060097If you have ATI Radeon/R200 hardware:
Brian Paul56e9efa2003-09-03 23:04:02 +000098</p>
99<pre>
100 modprobe agpgart # the AGP GART module
101 modprobe radeonfb # the Radeon fbdev driver
102 modprobe radeon # the Radeon DRI kernel module
103</pre>
104
105<p>
Briane75fbd32007-05-04 18:26:41 -0600106If you have ATI Rage 128 hardware:
Brian Paul56e9efa2003-09-03 23:04:02 +0000107</p>
108<pre>
109 modprobe agpgart # the AGP GART module
110 modprobe aty128fb # the Rage 128 fbdev driver
111 modprobe r128 # the Rage 128 DRI kernel module
112</pre>
113
114<p>
Briane75fbd32007-05-04 18:26:41 -0600115If you have Matrox G200/G400 hardware:
Brian Paul56e9efa2003-09-03 23:04:02 +0000116</p>
117<pre>
118 modprobe agpgart # the AGP GART module
119 modprobe mgafb # the Matrox fbdev driver
120 modprobe mga # the Matrox DRI kernel module
121</pre>
122
123<p>
Briane75fbd32007-05-04 18:26:41 -0600124To verify that the agpgart, fbdev and drm modules are loaded:
Brian Paul56e9efa2003-09-03 23:04:02 +0000125</p>
126<pre>
Briane75fbd32007-05-04 18:26:41 -0600127 ls -l /dev/agpgart /dev/fb* /dev/dri
Brian Paul56e9efa2003-09-03 23:04:02 +0000128</pre>
Briane75fbd32007-05-04 18:26:41 -0600129<p>
130Alternately, use lsmod to inspect the currently installed modules.
131If you have problems, look at the output of dmesg.
132</p>
Brian Paul70dacab2004-02-13 18:29:42 +0000133
Brian Paul56e9efa2003-09-03 23:04:02 +0000134
135<h2>3.2 Configuration File</h2>
136
137<p>
Briane75fbd32007-05-04 18:26:41 -0600138Copy the sample miniglx.conf to /etc/miniglx.conf and review/edit its contents.
139Alternately, the MINIGLX_CONF environment variable can be used to
140indicate the location of miniglx.conf
Brian Paul56e9efa2003-09-03 23:04:02 +0000141</p>
142
Briane75fbd32007-05-04 18:26:41 -0600143To determine the pciBusID value, run lspci and examine the output.
144For example:
Brian Paul56e9efa2003-09-03 23:04:02 +0000145</p>
Briane75fbd32007-05-04 18:26:41 -0600146<pre>
147 /sbin/lspci:
148 00:02.0 VGA compatible controller: Intel Corporation 82915G/GV/910GL Express Chipset Family Graphics Controller (rev 04)
149</pre>
150<p>
15100:02.0 indicates that pciBusID should be PCI:0:2:0
152</p>
153
154
Brian Paul56e9efa2003-09-03 23:04:02 +0000155
156
157<h2>3.3 Running fbdev/DRI Programs</h2>
158
159<p>
160Make sure your LD_LIBRARY_PATH environment variable is set to the
Briane75fbd32007-05-04 18:26:41 -0600161location of the libGL.so library. You may need to append other paths
162to LD_LIBRARY_PATH if libpciaccess.so is in a non-standard location,
163for example.
Brian Paul56e9efa2003-09-03 23:04:02 +0000164</p>
165
166<p>
Brian Paulf4b909b2004-04-18 20:17:14 +0000167Change to the <code>Mesa/progs/miniglx/</code> directory and
Brian Paul56e9efa2003-09-03 23:04:02 +0000168start the sample_server program in the background:
169</p>
170<pre>
171 ./sample_server &
172</pre>
173
174<p>
175Then try running the <code>miniglxtest</code> program:
176</p>
177<pre>
178 ./miniglxtest
179</pre>
180<p>
181You should see a rotating quadrilateral which changes color as it rotates.
182It will exit automatically after a bit.
183</p>
184
185<p>
186If you run other tests in the miniglx/ directory, you may want to run
187them from a remote shell so that you can stop them with ctrl-C.
188</p>
189
190
191
192<h1>4.0 Troubleshooting</h1>
193
Briane75fbd32007-05-04 18:26:41 -0600194<ol>
195<li>
Brian Paul56e9efa2003-09-03 23:04:02 +0000196If you try to run miniglxtest and get the following:
Briane75fbd32007-05-04 18:26:41 -0600197<br>
Brian Paul56e9efa2003-09-03 23:04:02 +0000198<pre>
199 [miniglx] failed to probe chipset
200 connect: Connection refused
201 server connection lost
202</pre>
Brian Paul56e9efa2003-09-03 23:04:02 +0000203It means that the sample_server process is not running.
Briane75fbd32007-05-04 18:26:41 -0600204<br>
205<br>
206</li>
Brian91948f92007-05-04 18:32:02 -0600207</ol>
Brian Paul56e9efa2003-09-03 23:04:02 +0000208
209
210<h1>5.0 Programming Information</h1>
211
212<p>
Brian Paul56e9efa2003-09-03 23:04:02 +0000213OpenGL/Mesa is interfaced to fbdev via the <a href="MiniGLX.html">MiniGLX</a>
214interface.
215MiniGLX is a subset of Xlib and GLX API functions which provides just
216enough functionality to setup OpenGL rendering and respond to simple
217input events.
218</p>
219
220<p>
221Since MiniGLX is a subset of the usual Xlib and GLX APIs, programs written
222to the MiniGLX API can also be run on full Xlib/GLX implementations.
223This allows some degree of flexibility for software development and testing.
224</p>
225
Brian Paule0823482003-09-03 23:10:31 +0000226<p>
227However, the MiniGLX API is not binary-compatible with full Xlib/GLX.
228Some of the structures are different and some macros/functions work
229differently.
230See the <code>GL/miniglx.h</code> header file for details.
231</p>
Brian Paul56e9efa2003-09-03 23:04:02 +0000232
233
234</body>
235</html>