blob: c7f59bb0c2f59da2755a1d20709f3e554fa78d6d [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>
Brian62ef0012007-05-09 08:17:57 -060043You can get them from the git repository with:
44</p>
45<pre>
46 git clone git://anongit.freedesktop.org/git/mesa/drm
47 git clone git://anongit.freedesktop.org/git/xorg/lib/libpciaccess
48</pre>
49
50<p>
51See the README files in those projects for build/install instructions.
52</p>
53
54
55<p>
Briane75fbd32007-05-04 18:26:41 -060056You'll need fbdev header files. Check with:
Brian Paul4a54ace2004-05-20 22:27:59 +000057</p>
58<pre>
Briane75fbd32007-05-04 18:26:41 -060059 ls -l /usr/include/linux/fb.h
Brian Paul4a54ace2004-05-20 22:27:59 +000060</pre>
61
62<p>
Briane75fbd32007-05-04 18:26:41 -060063Compile Mesa with the 'linux-solo' configuration:
Brian Paul56e9efa2003-09-03 23:04:02 +000064</p>
65<pre>
Brian Paul56e9efa2003-09-03 23:04:02 +000066 make linux-solo
67</pre>
68
69<p>
Briane75fbd32007-05-04 18:26:41 -060070When complete you should have the following:
Brian Paulf4b909b2004-04-18 20:17:14 +000071</p>
Brian Paul56e9efa2003-09-03 23:04:02 +000072<ul>
Briane75fbd32007-05-04 18:26:41 -060073<li>lib/libGL.so - the GL library which applications link with
74<li>lib/*_dri_so - DRI drivers
75<li>lib/miniglx.conf - sample MiniGLX config file
76<li>progs/miniglx/* - several MiniGLX sample programs
Brian Paul56e9efa2003-09-03 23:04:02 +000077</ul>
78
79
Briane75fbd32007-05-04 18:26:41 -060080
Brian Paul56e9efa2003-09-03 23:04:02 +000081<h1>3. Using fbdev/DRI</h1>
82
83<p>
Briane75fbd32007-05-04 18:26:41 -060084If an X server currently running, exit/stop it so you're working from
85the console.
Brian Paul56e9efa2003-09-03 23:04:02 +000086</p>
87
88
Brian Paul4a54ace2004-05-20 22:27:59 +000089<h2>3.1 Load Kernel Modules</h2>
Brian Paul56e9efa2003-09-03 23:04:02 +000090
91<p>
Brian Paul4a54ace2004-05-20 22:27:59 +000092You'll need to load the kernel modules specific to your graphics hardware.
93Typically, this consists of the agpgart module, an fbdev driver module
Briane75fbd32007-05-04 18:26:41 -060094and the DRM kernel module.
95</p>
96<p>
97As root, the kernel modules can be loaded as follows:
Brian Paul56e9efa2003-09-03 23:04:02 +000098</p>
99
Briane75fbd32007-05-04 18:26:41 -0600100<p>
101If you have Intel i915/i945 hardware:
102</p>
103<pre>
104 modprobe agpgart # the AGP GART module
105 modprobe intelfb # the Intel fbdev driver
106 modprobe i915 # the i915/945 DRI kernel module
107</pre>
Brian Paul56e9efa2003-09-03 23:04:02 +0000108
109<p>
Briane75fbd32007-05-04 18:26:41 -0600110If you have ATI Radeon/R200 hardware:
Brian Paul56e9efa2003-09-03 23:04:02 +0000111</p>
112<pre>
113 modprobe agpgart # the AGP GART module
114 modprobe radeonfb # the Radeon fbdev driver
115 modprobe radeon # the Radeon DRI kernel module
116</pre>
117
118<p>
Briane75fbd32007-05-04 18:26:41 -0600119If you have ATI Rage 128 hardware:
Brian Paul56e9efa2003-09-03 23:04:02 +0000120</p>
121<pre>
122 modprobe agpgart # the AGP GART module
123 modprobe aty128fb # the Rage 128 fbdev driver
124 modprobe r128 # the Rage 128 DRI kernel module
125</pre>
126
127<p>
Briane75fbd32007-05-04 18:26:41 -0600128If you have Matrox G200/G400 hardware:
Brian Paul56e9efa2003-09-03 23:04:02 +0000129</p>
130<pre>
131 modprobe agpgart # the AGP GART module
132 modprobe mgafb # the Matrox fbdev driver
133 modprobe mga # the Matrox DRI kernel module
134</pre>
135
136<p>
Briane75fbd32007-05-04 18:26:41 -0600137To verify that the agpgart, fbdev and drm modules are loaded:
Brian Paul56e9efa2003-09-03 23:04:02 +0000138</p>
139<pre>
Briane75fbd32007-05-04 18:26:41 -0600140 ls -l /dev/agpgart /dev/fb* /dev/dri
Brian Paul56e9efa2003-09-03 23:04:02 +0000141</pre>
Briane75fbd32007-05-04 18:26:41 -0600142<p>
143Alternately, use lsmod to inspect the currently installed modules.
144If you have problems, look at the output of dmesg.
145</p>
Brian Paul70dacab2004-02-13 18:29:42 +0000146
Brian Paul56e9efa2003-09-03 23:04:02 +0000147
148<h2>3.2 Configuration File</h2>
149
150<p>
Briane75fbd32007-05-04 18:26:41 -0600151Copy the sample miniglx.conf to /etc/miniglx.conf and review/edit its contents.
152Alternately, the MINIGLX_CONF environment variable can be used to
153indicate the location of miniglx.conf
Brian Paul56e9efa2003-09-03 23:04:02 +0000154</p>
155
Briane75fbd32007-05-04 18:26:41 -0600156To determine the pciBusID value, run lspci and examine the output.
157For example:
Brian Paul56e9efa2003-09-03 23:04:02 +0000158</p>
Briane75fbd32007-05-04 18:26:41 -0600159<pre>
160 /sbin/lspci:
161 00:02.0 VGA compatible controller: Intel Corporation 82915G/GV/910GL Express Chipset Family Graphics Controller (rev 04)
162</pre>
163<p>
16400:02.0 indicates that pciBusID should be PCI:0:2:0
165</p>
166
167
Brian Paul56e9efa2003-09-03 23:04:02 +0000168
169
170<h2>3.3 Running fbdev/DRI Programs</h2>
171
172<p>
173Make sure your LD_LIBRARY_PATH environment variable is set to the
Briane75fbd32007-05-04 18:26:41 -0600174location of the libGL.so library. You may need to append other paths
175to LD_LIBRARY_PATH if libpciaccess.so is in a non-standard location,
176for example.
Brian Paul56e9efa2003-09-03 23:04:02 +0000177</p>
178
179<p>
Brian Paulf4b909b2004-04-18 20:17:14 +0000180Change to the <code>Mesa/progs/miniglx/</code> directory and
Brian Paul56e9efa2003-09-03 23:04:02 +0000181start the sample_server program in the background:
182</p>
183<pre>
Brian62ef0012007-05-09 08:17:57 -0600184 ./sample_server &amp;
Brian Paul56e9efa2003-09-03 23:04:02 +0000185</pre>
186
187<p>
188Then try running the <code>miniglxtest</code> program:
189</p>
190<pre>
191 ./miniglxtest
192</pre>
193<p>
194You should see a rotating quadrilateral which changes color as it rotates.
195It will exit automatically after a bit.
196</p>
197
198<p>
199If you run other tests in the miniglx/ directory, you may want to run
200them from a remote shell so that you can stop them with ctrl-C.
201</p>
202
203
204
205<h1>4.0 Troubleshooting</h1>
206
Briane75fbd32007-05-04 18:26:41 -0600207<ol>
208<li>
Brian Paul56e9efa2003-09-03 23:04:02 +0000209If you try to run miniglxtest and get the following:
Briane75fbd32007-05-04 18:26:41 -0600210<br>
Brian Paul56e9efa2003-09-03 23:04:02 +0000211<pre>
212 [miniglx] failed to probe chipset
213 connect: Connection refused
214 server connection lost
215</pre>
Brian Paul56e9efa2003-09-03 23:04:02 +0000216It means that the sample_server process is not running.
Briane75fbd32007-05-04 18:26:41 -0600217<br>
218<br>
219</li>
Brian91948f92007-05-04 18:32:02 -0600220</ol>
Brian Paul56e9efa2003-09-03 23:04:02 +0000221
222
223<h1>5.0 Programming Information</h1>
224
225<p>
Brian Paul56e9efa2003-09-03 23:04:02 +0000226OpenGL/Mesa is interfaced to fbdev via the <a href="MiniGLX.html">MiniGLX</a>
227interface.
228MiniGLX is a subset of Xlib and GLX API functions which provides just
229enough functionality to setup OpenGL rendering and respond to simple
230input events.
231</p>
232
233<p>
234Since MiniGLX is a subset of the usual Xlib and GLX APIs, programs written
235to the MiniGLX API can also be run on full Xlib/GLX implementations.
236This allows some degree of flexibility for software development and testing.
237</p>
238
Brian Paule0823482003-09-03 23:10:31 +0000239<p>
240However, the MiniGLX API is not binary-compatible with full Xlib/GLX.
241Some of the structures are different and some macros/functions work
242differently.
243See the <code>GL/miniglx.h</code> header file for details.
244</p>
Brian Paul56e9efa2003-09-03 23:04:02 +0000245
246
247</body>
248</html>