Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fbdev-dri.html 9.1KB

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