aboutsummaryrefslogtreecommitdiff
path: root/docs/fbdev-dri.html
blob: 18b0ca815e7eb3a8e090bc564234eb172aaa6f71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<html>

<TITLE>Mesa fbdev/DRI Environment</TITLE>

<link rel="stylesheet" type="text/css" href="mesa.css"></head>

<BODY>

<center><H1>Mesa fbdev/DRI Drivers</H1></center>


<H1>1. Introduction</H1>

<p>
The fbdev/DRI sub-project within Mesa brings hardware accelerated OpenGL
rendering to the Linux fbdev environment.
The X Window System / XFree86 is not needed.
</p>

<p>
Basically, the <a href="http://dri.sf.net/">DRI</a> drivers for hardware
accelerated OpenGL for XFree86 have been ported to fbdev so that X is
not needed.
This means fbdev/DRI works in full-screen mode only.
</p>

<p>
DRI driver writers may find this simplified environment easier to work in,
compared to the full XFree86/DRI environment.
</p>

<p>
Much of the work for this project has been done by Jon Smirl and
Keith Whitwell.
</p>

<p>
To use fbdev/DRI, you'll need a Linux 2.4 or 2.6 kernel.
</p>

<h3>Background Info</h3>

<p>
The Mesa-based DRI drivers used to be hosted in the DRI tree (which is
basically a copy of the XFree86 tree).
Since the Mesa-based DRI drivers are moreso "Mesa drivers" than "XFree86
drivers" and the fact that with some work, the drivers could be used
without X, the driver code was moved into the Mesa tree.
</p>

<p>
So now the DRI drivers can be compiled for two different environments:
fbdev and XFree86.
To build the drivers for XFree86, one has to download/build the DRI
source tree.
Eventually, we'd like to be able to build the drivers for XFree86 outside
of the XFree86/DRI trees.
</p>




<h1>2. Compilation</h1>

<h2>2.1 Compiling the DRM modules</h2>

<p>
First, you'll need the DRM (Direct Rendering Manager) kernel module sources.
They're found in a module of the DRI CVS tree.
To obtain the code do the following:
</p>
<pre>
   cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/dri login
</pre>
<p>
Press Enter/Return when prompted for a password.  Then,
</p>
<pre>
   cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/dri co drm
</pre>

<p>
Compile the DRM kernel modules:
</p>
<pre>
  cd drm/linux
  make
</pre>

<p>
Note: you may need to be root in order to make a few symlinks.
</p>
<p>
When compilation is done, you should have at least the following
kernel modules:
</p>
<pre>
  gamma.o
  i810.o
  i830.o
  mach64.o
  mga.o
  r128.o
  radeon.o
  savage.o
  sis.o
  tdfx.o
  via.o
</pre>
<p>
You'll probably want to copy/move them into your kernel module directory
(for example: <code>/lib/modules/2.4.18-14/kernel/drivers/char/drm/</code>).
</p>



<h2>2.2 Compiling the Mesa drivers</h2>

<p>
Begin by editing the <code>Mesa/configs/default</code> file to set
the <code>DRM_SOURCE_PATH</code> variable.
Set it to the location where the DRM module sources are located.
For example, if your current directory in step 2.1 was <code>/home/fred/</code>
set DRM_SOURCE_PATH to <code>/home/fred/drm</code>
</p>

<p>
Next, assuming you're starting with a fresh Mesa CVS checkout,
do the following:
</p>
<pre>
   make linux-solo
</pre>

<p>
If you previously built the source tree, run <code>make realclean</code>
first to remove the old object files.
</p>

<p>
When this is finished, check the <code>Mesa/lib/</code> directory
to verify that the following files were made:
</p>

<ul>
<li><code>libGL.so.1.2</code> - the client-side OpenGL library
    (and a few symlinks to it).
<li><code>libGLU.so.1.1</code> - the GLU library (and a few symlinks to it).
<li><code>libglut.so.3.7</code> - the GLUT library (and a few symlinks to it).
<li><code>mga_dri.so</code> - DRI driver for Matrox G200/G400 cards.
<li><code>r128_dri.so</code> - DRI driver for ATI Rage 128 cards.
<li><code>r200_dri.so</code> - DRI driver for ATI R200 Radeon cards.
<li><code>radeon_dri.so</code> - DRI driver for original ATI Radeon cards.
<li><code>i810_dri.so</code> - DRI driver for Intel i810/i815 chips.
<li><code>i830_dri.so</code> - DRI driver for Intel i830/i845 chips.
<li><code>mga_dri.so</code> - DRI driver for Matrox G200/G400 cards.
<li><code>sis_dri.so</code> - DRI driver for SIS cards.
<li><code>tdfx_dri.so</code> - DRI driver for 3dfx Voodoo 3/4/5 cards.
<li><code>gamma_dri.so</code> - DRI driver for 3Dlabs gamma cards.
<li><code>fb_dri.so</code> - software-only fbdev driver.
<li><code>miniglx.conf</code> - configuration file for the MiniGLX interface
</ul>


<h1>3. Using fbdev/DRI</h1>

<p>
If XFree86 is currently running, exit/stop the X server so you're
working from the console.
</p>


<h2>3.1 Load Kernel Modules</h2>

<p>
You'll need to load the kernel modules specific to your graphics hardware.
Typically, this consists of the agpgart module, an fbdev driver module
and the DRM kernel module (from step 2.1).
</p>


<p>
If you have ATI Radeon/R200 hardware, run as root:
</p>
<pre>
   modprobe agpgart            # the AGP GART module
   modprobe radeonfb           # the Radeon fbdev driver
   modprobe radeon             # the Radeon DRI kernel module
</pre>

<p>
If you have ATI Rage 128 hardware, run as root:
</p>
<pre>
   modprobe agpgart            # the AGP GART module
   modprobe aty128fb           # the Rage 128 fbdev driver
   modprobe r128               # the Rage 128 DRI kernel module
</pre>

<p>
If you have Matrox G200/G400 hardware, run as root:
</p>
<pre>
   modprobe agpgart            # the AGP GART module
   modprobe mgafb              # the Matrox fbdev driver
   modprobe mga                # the Matrox DRI kernel module
</pre>

<p>
Then run <code>lsmod</code> to be sure the modules are loaded.
For a Radeon card, you should see something like this:
</p>
<pre>
Module                  Size  Used by    Not tainted
radeon                110308   0  (unused)
radeonfb               21900   0  (unused)
agpgart                43072   1 
</pre>



<h2>3.2 Configuration File</h2>

<p>
The <code>Mesa/lib/miniglx.conf</code> file should be installed
in <code>/etc/</code>.
</p>

<p>
Edit <code>/etc/miniglx.conf</code> to be sure it's set up correctly
for your hardware.
Comments in the file explain the options.
</p>


<h2>3.3 Running fbdev/DRI Programs</h2>

<p>
Make sure your LD_LIBRARY_PATH environment variable is set to the
<code>Mesa/lib/</code> directory.
</p>

<p>
Change to the <code>Mesa/progs/miniglx/</code> directory and
start the sample_server program in the background:
</p>
<pre>
   ./sample_server &
</pre>

<p>
Then try running the <code>miniglxtest</code> program:
</p>
<pre>
   ./miniglxtest
</pre>
<p>
You should see a rotating quadrilateral which changes color as it rotates.
It will exit automatically after a bit.
</p>

<p>
If you run other tests in the miniglx/ directory, you may want to run
them from a remote shell so that you can stop them with ctrl-C.
</p>



<h1>4.0 Troubleshooting</h1>

<p>
If you try to run miniglxtest and get the following:
</p>
<pre>
   [miniglx] failed to probe chipset
   connect: Connection refused
   server connection lost
</pre>
<p>
It means that the sample_server process is not running.
</p>




<h1>5.0 Programming Information</h1>

<p>
The full OpenGL API is available with fbdev/DRI.
</p>

<p>
OpenGL/Mesa is interfaced to fbdev via the <a href="MiniGLX.html">MiniGLX</a>
interface.
MiniGLX is a subset of Xlib and GLX API functions which provides just
enough functionality to setup OpenGL rendering and respond to simple
input events.
</p>

<p>
Since MiniGLX is a subset of the usual Xlib and GLX APIs, programs written
to the MiniGLX API can also be run on full Xlib/GLX implementations.
This allows some degree of flexibility for software development and testing.
</p>

<p>
However, the MiniGLX API is not binary-compatible with full Xlib/GLX.
Some of the structures are different and some macros/functions work
differently.
See the <code>GL/miniglx.h</code> header file for details.
</p>


</body>
</html>