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 13 a future date</center></h1> 14 15 <h1>1. Introduction</h1> 16 17 <p> 18 The fbdev/DRI environment supports hardware-accelerated 3D rendering without 19 the X window system. This is typically used for embedded applications. 20 </p> 21 22 <p> 23 Contributors to this project include Jon Smirl, Keith Whitwell and Dave Airlie. 24 </p> 25 26 <p> 27 Applications in the fbdev/DRI environment use 28 the MiniGLX interface to choose pixel 29 formats, create rendering contexts, etc. It's a subset of the GLX and 30 Xlib interfaces allowing some degree of application portability between 31 the X and X-less environments. 32 </p> 33 34 <p> 35 Note that this environment is not well-supported and these instructions 36 may 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 47 Get <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> 52 Check if you have libpciaccess installed: 53 </p> 54 55 <pre>pkg-config --modversion pciaccess 56 </pre> 57 <p> 58 If 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> 63 Run autogen.sh to generate a configure file. autogen.sh uses autoconf 64 utility. This utility may not be installed with your linux distro, 65 check if it is available. if not you can use your package manager or 66 type: 67 </p> 68 <pre>sudo apt-get install autoconf 69 </pre> 70 The next step is to install the libpciaccess library. 71 <pre>make 72 make install 73 </pre> 74 <p> Now your libpciaccess.a file is saved into /usr/local/lib 75 directory. If you have a libpciaccess.a in /usr/lib you may simply copy 76 and 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/. 78 Or you may use the following system variables: 79 </p> 80 <pre>export LD_LIBRARY_PATH=/usr/local/lib 81 export 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, 87 the DRM client library(lindrm.so) and kernel device module(such as 88 radeon.ko). We need to make a small change in kernel device module. So 89 you need to download the kernel source. You may choose the nearest 90 mirror from www.kernel.org, or you are using Fedora Core 5, for 91 example, you may need to install RPMs such as: 92 kernel-smp-devel-2.16.15-1.2054_FC5.i686.rpm 93 kernel-devel-2.6.15-1.2054_FC5.i686.rpm 94 etc. 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> 104 Now you are ready to compile your kernel. If your kernel version is 105 identical to the version you have compiled, you can simply over write 106 your new "ko" files over older ones. If you have compiled a different 107 kernel, you must configure your grub or lilo to be able to boot your 108 new kernel. <p> 109 You'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 127 to build your linux-solo. You probably wont have this utility. You can 128 download 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. 139 You 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 143 graphics driver you need, delete the unwanted drivers names from the 144 list(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> 156 When 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 165 To install these files into appropriate locations in system: 166 <pre> 167 make install 168 </pre> 169 170 Now your openGL libraries are copied to /usr/local/lib and 171 miniglx.conf is copied to /etc. You may copy them to /usr/lib and 172 overwrite 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> 183 If an X server currently running, exit/stop it so you're working from 184 the 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 191 will always start in single user mode and without x-window with this 192 option set. 193 </p><h2>3.1 Load Kernel Modules</h2> 194 195 <p> 196 You'll need to load the kernel modules specific to your graphics hardware. 197 Typically, this consists of the agpgart module, an fbdev driver module 198 and the DRM kernel module. 199 </p> 200 <p> 201 As root, the kernel modules can be loaded as follows: 202 </p> 203 204 <p> 205 If 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> 213 If 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> 221 If 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> 229 If 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> 237 To 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> 242 Alternately, use lsmod to inspect the currently installed modules. 243 If you have problems, look at the output of dmesg. 244 </p> 245 246 247 <h2>3.2 Configuration File</h2> 248 249 <p> 250 review/edit /etc/miniglx.conf. 251 Alternately, the MINIGLX_CONF environment variable can be used to 252 indicate the location of miniglx.conf 253 </p> 254 255 To determine the pciBusID value, run lspci and examine the output. 256 For 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> 262 00: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> 271 Make sure your LD_LIBRARY_PATH environment variable is set to the 272 location of the libGL.so library. You may need to append other paths 273 to LD_LIBRARY_PATH if libpciaccess.so is in a non-standard location, 274 for example. 275 </p> 276 277 <p> 278 Change to the <code>Mesa/progs/miniglx/</code> directory and 279 start the sample_server program in the background: 280 </p> 281 <pre> ./sample_server & 282 </pre> 283 284 <p> 285 Then try running the <code>miniglxtest</code> program: 286 </p> 287 <pre> ./miniglxtest 288 </pre> 289 <p> 290 You should see a rotating quadrilateral which changes color as it rotates. 291 It will exit automatically after a bit. 292 </p> 293 294 <p> 295 If you run other tests in the miniglx/ directory, you may want to run 296 them 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> 305 If 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> 311 It 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> 321 OpenGL/Mesa is interfaced to fbdev via the MiniGLX interface. 322 MiniGLX is a subset of Xlib and GLX API functions which provides just 323 enough functionality to setup OpenGL rendering and respond to simple 324 input events. 325 </p> 326 327 <p> 328 Since MiniGLX is a subset of the usual Xlib and GLX APIs, programs written 329 to the MiniGLX API can also be run on full Xlib/GLX implementations. 330 This allows some degree of flexibility for software development and testing. 331 </p> 332 333 <p> 334 However, the MiniGLX API is not binary-compatible with full Xlib/GLX. 335 Some of the structures are different and some macros/functions work 336 differently. 337 See the GL/miniglx.h header file for details. 338 </p> 339 340 341 342 </body> 343 </html> 344