1<html><head><title>Mesa fbdev/DRI Environment</title> 2 3 4 5<link rel="stylesheet" type="text/css" href="mesa.css"></head> 6 7<body> 8 9<center><h1>Mesa fbdev/DRI Drivers</h1></center> 10<br> 11 12<h1><center>NOTE: this information is obsolete and will be removed at 13a future date</center></h1> 14 15<h1>1. Introduction</h1> 16 17<p> 18The fbdev/DRI environment supports hardware-accelerated 3D rendering without 19the X window system. This is typically used for embedded applications. 20</p> 21 22<p> 23Contributors to this project include Jon Smirl, Keith Whitwell and Dave Airlie. 24</p> 25 26<p> 27Applications in the fbdev/DRI environment use 28the MiniGLX interface to choose pixel 29formats, create rendering contexts, etc. It's a subset of the GLX and 30Xlib interfaces allowing some degree of application portability between 31the X and X-less environments. 32</p> 33 34<p> 35Note that this environment is not well-supported and these instructions 36may not be completely up to date. 37</p> 38<br> 39 40 41 42<h1>2. Compilation</h1> 43<p> 44 45<h2>2.1 glxproto</h2> 46 47Get <a href="http://cvsweb.xfree86.org/cvsweb/*checkout*/xc/include/GL/glxproto.h?rev=1.9">glxproto.h</a>. Copy it to the /mesa/include/GL/ directory. 48</p> 49 50<h2>2.2 libpciaccess</h2> 51<p> 52Check if you have libpciaccess installed: 53</p> 54 55<pre>pkg-config --modversion pciaccess 56</pre> 57<p> 58If not you can download the latest code from: 59</p> 60<pre> git clone git://anongit.freedesktop.org/git/xorg/lib/libpciaccess 61</pre> 62<p> 63Run autogen.sh to generate a configure file. autogen.sh uses autoconf 64utility. This utility may not be installed with your linux distro, 65check if it is available. if not you can use your package manager or 66type: 67</p> 68<pre>sudo apt-get install autoconf 69</pre> 70The next step is to install the libpciaccess library. 71<pre>make 72make install 73</pre> 74<p> Now your libpciaccess.a file is saved into /usr/local/lib 75directory. If you have a libpciaccess.a in /usr/lib you may simply copy 76and overwrite these files. Don't forget to copy libpciaccess.pc file to 77/usr/lib/pkgconfig, which is also located in /usr/local/lib/pkgconfig/. 78Or you may use the following system variables: 79</p> 80<pre>export LD_LIBRARY_PATH=/usr/local/lib 81export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 82</pre> 83 84<h2>2.3 drm</h2> 85 86<p>The next step is to compile the drm. DRM consists of two seperate parts, 87the DRM client library(lindrm.so) and kernel device module(such as 88radeon.ko). We need to make a small change in kernel device module. So 89you need to download the kernel source. You may choose the nearest 90mirror from www.kernel.org, or you are using Fedora Core 5, for 91example, you may need to install RPMs such as: 92kernel-smp-devel-2.16.15-1.2054_FC5.i686.rpm 93kernel-devel-2.6.15-1.2054_FC5.i686.rpm 94etc. You can find a detailed information <a href="http://www.howtoforge.com/kernel_compilation_fedora">here.</a> 95</p> 96 97<p>You will find drm_drv.c at /usr/src/LINUX-VERSION/drivers/char/drm/. Edit this code and comment out the following part: 98</p> 99 100<pre> 101 /* || 102 ((ioctl->flags & DRM_MASTER) && !priv->master)*/ 103</pre> 104Now you are ready to compile your kernel. If your kernel version is 105identical to the version you have compiled, you can simply over write 106your new "ko" files over older ones. If you have compiled a different 107kernel, you must configure your grub or lilo to be able to boot your 108new kernel. <p> 109You'll need fbdev header files. Check with: 110</p> 111<pre> 112 ls -l /usr/include/linux/fb. 113</pre> 114<p>This file may be missing if you have not installed linux header files. 115 116 117<h2>2.4 Mesa</h2> 118 119</p><p>Get latest development Mesa sources from git repository 120(currently 7.1-prerelease) 121</p> 122<pre> 123 git clone git://anongit.freedesktop.org/git/mesa/mesa 124</pre> 125 126<p>You will need the makedepend utility which is a part of mesa project 127to build your linux-solo. You probably wont have this utility. You can 128download its source from following git repulsitory: 129</p> 130<pre> 131 git clone git://anongit.freedesktop.org/git/xorg/util/makedepend 132</pre> 133 134<p>Get the latest stable mesa version from SourceForge (currently 7.0.3) 135<a href="http://sourceforge.net/project/showfiles.php?group_id=3">http://sourceforge.net/project/showfiles.php?group_id=3</a> 136</p> 137 138<p>Copy the miniglx folder from 7.1-prerelease to 7.0.3. 139You may also extract GLUT to 7.0.3 version at this step. 140</p> 141 142<p>Edit linux-solo.conf at /conf directory, just only compile the 143graphics driver you need, delete the unwanted drivers names from the 144list(some drivers are causing problems...) 145</p> 146<pre> 147 while(build==0) 148 { 149 make linux-solo 150 151 There will be some missing header files, copy them from 7.1-prerelease 152 } 153</pre> 154 155<p> 156When complete you should have the following: 157</p> 158<ul> 159<li>lib/libGL.so - the GL library which applications link with 160</li><li>lib/*_dri_so - DRI drivers 161</li><li>lib/miniglx.conf - sample MiniGLX config file 162</li><li>progs/miniglx/* - several MiniGLX sample programs 163</li></ul> 164 165To install these files into appropriate locations in system: 166<pre> 167 make install 168</pre> 169 170Now your openGL libraries are copied to /usr/local/lib and 171miniglx.conf is copied to /etc. You may copy them to /usr/lib and 172overwrite your old GL libraries. Or you may export following variable: 173 174<pre> 175 export LIBGL_DRIVERS_PATH=/usr/local/lib 176</pre> 177<br> 178 179 180<h1>3. Using fbdev/DRI</h1> 181 182<p> 183If an X server currently running, exit/stop it so you're working from 184the console. Following command shuts down the x window and also the multi user support. 185</p> 186<pre> 187 init 1 188</pre> 189 190<p>Also you may define the runlevel as 1 in "/etc/inittab". Your system 191will always start in single user mode and without x-window with this 192option set. 193</p><h2>3.1 Load Kernel Modules</h2> 194 195<p> 196You'll need to load the kernel modules specific to your graphics hardware. 197Typically, this consists of the agpgart module, an fbdev driver module 198and the DRM kernel module. 199</p> 200<p> 201As root, the kernel modules can be loaded as follows: 202</p> 203 204<p> 205If you have Intel i915/i945 hardware: 206</p> 207<pre> modprobe agpgart # the AGP GART module 208 modprobe intelfb # the Intel fbdev driver 209 modprobe i915 # the i915/945 DRI kernel module 210</pre> 211 212<p> 213If you have ATI Radeon/R200 hardware: 214</p> 215<pre> modprobe agpgart # the AGP GART module 216 modprobe radeonfb # the Radeon fbdev driver 217 modprobe radeon # the Radeon DRI kernel module 218</pre> 219 220<p> 221If you have ATI Rage 128 hardware: 222</p> 223<pre> modprobe agpgart # the AGP GART module 224 modprobe aty128fb # the Rage 128 fbdev driver 225 modprobe r128 # the Rage 128 DRI kernel module 226</pre> 227 228<p> 229If you have Matrox G200/G400 hardware: 230</p> 231<pre> modprobe agpgart # the AGP GART module 232 modprobe mgafb # the Matrox fbdev driver 233 modprobe mga # the Matrox DRI kernel module 234</pre> 235 236<p> 237To verify that the agpgart, fbdev and drm modules are loaded: 238</p> 239<pre> ls -l /dev/agpgart /dev/fb* /dev/dri 240</pre> 241<p> 242Alternately, use lsmod to inspect the currently installed modules. 243If you have problems, look at the output of dmesg. 244</p> 245 246 247<h2>3.2 Configuration File</h2> 248 249<p> 250review/edit /etc/miniglx.conf. 251Alternately, the MINIGLX_CONF environment variable can be used to 252indicate the location of miniglx.conf 253</p> 254 255To determine the pciBusID value, run lspci and examine the output. 256For example: 257<p></p> 258<pre> /sbin/lspci: 259 00:02.0 VGA compatible controller: Intel Corporation 82915G/GV/910GL Express Chipset Family Graphics Controller (rev 04) 260</pre> 261<p> 26200:02.0 indicates that pciBusID should be PCI:0:2:0 263</p> 264 265 266 267 268<h2>3.3 Running fbdev/DRI Programs</h2> 269 270<p> 271Make sure your LD_LIBRARY_PATH environment variable is set to the 272location of the libGL.so library. You may need to append other paths 273to LD_LIBRARY_PATH if libpciaccess.so is in a non-standard location, 274for example. 275</p> 276 277<p> 278Change to the <code>Mesa/progs/miniglx/</code> directory and 279start the sample_server program in the background: 280</p> 281<pre> ./sample_server & 282</pre> 283 284<p> 285Then try running the <code>miniglxtest</code> program: 286</p> 287<pre> ./miniglxtest 288</pre> 289<p> 290You should see a rotating quadrilateral which changes color as it rotates. 291It will exit automatically after a bit. 292</p> 293 294<p> 295If you run other tests in the miniglx/ directory, you may want to run 296them from a remote shell so that you can stop them with ctrl-C. 297</p> 298<br> 299 300 301<h1>4.0 Troubleshooting</h1> 302 303<ol> 304<li> 305If you try to run miniglxtest and get the following: 306<br> 307<pre> [miniglx] failed to probe chipset 308 connect: Connection refused 309 server connection lost 310</pre> 311It means that the sample_server process is not running. 312<br> 313<br> 314</li> 315</ol> 316 317 318<h1>5.0 Programming Information</h1> 319 320<p> 321OpenGL/Mesa is interfaced to fbdev via the MiniGLX interface. 322MiniGLX is a subset of Xlib and GLX API functions which provides just 323enough functionality to setup OpenGL rendering and respond to simple 324input events. 325</p> 326 327<p> 328Since MiniGLX is a subset of the usual Xlib and GLX APIs, programs written 329to the MiniGLX API can also be run on full Xlib/GLX implementations. 330This allows some degree of flexibility for software development and testing. 331</p> 332 333<p> 334However, the MiniGLX API is not binary-compatible with full Xlib/GLX. 335Some of the structures are different and some macros/functions work 336differently. 337See the GL/miniglx.h header file for details. 338</p> 339 340 341 342</body> 343</html> 344