adventure 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. From The Be Newsletter
  2. Volume 3, Issue 8 -- February 24, 1999
  3. --------------------------------------------------------------------------------
  4. BE ENGINEERING INSIGHTS: Adventures in Graphics Drivers
  5. By Leo Schwab -- <ewhac@be.com>
  6. --------------------------------------------------------------------------------
  7. This adventure is more true than I might otherwise be
  8. willing to admit. All persons and events depicted are
  9. entirely fictitious, except where they aren't. Unflattering
  10. characterizations of certain organizations are entirely
  11. deliberate and intentional.
  12. You are in a cube. In front of you is a 16"
  13. (visible) Sony monitor. In front of that is a
  14. Mitsumi keyboard and an unbranded mouse. Just to
  15. the right is a 266 MHz PC clone. The system is
  16. running a development version of BeOS R4.
  17. There is a graphics card here.
  18. There is a floppy disk here.
  19. There is a note from your boss here.
  20. There is a Hoberman sphere here.
  21. > INVENTORY
  22. You have a well-used satchel. Inside it are
  23. A set of screwdrivers
  24. A small telescope
  25. A 16M laptop RAM module
  26. A book on decorative knots
  27. A PCMCIA Ethernet card
  28. Last year's tax return
  29. A 166 MHz Pentium laptop computer
  30. A bottle of echinacea capsules
  31. Hair sticks
  32. Your wallet contains $3200.
  33. > REPLACE KEYBOARD
  34. You put aside the amazingly cruddy Mitsumi keyboard
  35. and substitute your favorite AT&T keyboard.
  36. > PUT LAPTOP ON DESK
  37. The laptop is now on the desk.
  38. > READ NOTE
  39. "Write a driver for this card. We'd like it in time
  40. for R4 release."
  41. > EXAMINE GRAPHICS CARD
  42. You are evidently the proud owner of a Yoyodyne
  43. Monstra VelocElite-LX 128-3D-AGP graphics card.
  44. > INSERT CARD IN MACHINE
  45. The machine emits a curious and worrying noise.
  46. > TURN OFF MACHINE AND INSERT CARD
  47. The graphics card is now installed in the machine.
  48. > TURN ON MACHINE
  49. BeOS R4(devel) boots. You are looking at a
  50. gray scale desktop.
  51. > EXAMINE FLOPPY DISK
  52. The handwritten label reads, "Programming docs."
  53. > INSERT DISK AND PRINT DOCS
  54. Nothing happens.
  55. > INSERT DISK, MOUNT DISK, AND PRINT DOCS
  56. The drive spins for a moment, and the command prompt
  57. returns.
  58. > READ DOCS
  59. I see no docs here.
  60. > GO TO PRINTER AND GET DOCS
  61. The printer is out of paper.
  62. > PUT PAPER IN PRINTER
  63. There is no paper here.
  64. > STEAL PAPER FROM COPIER UPSTAIRS
  65. After installing the liberated paper in the printer,
  66. you print your docs.
  67. > EXAMINE DOCS
  68. The cover page reads, "Yoyodyne Monstra
  69. VelocElite-LX 128-3D Programmer's Reference. Alpha
  70. Revision 05-31-98. Confidential and Proprietary.
  71. Restricted Secret; Level Violet. Do not expose in
  72. public. This document must be kept secured when not
  73. in use. Disclosure of this document to third
  74. parties is punishable by death."
  75. > READ DOCS
  76. After several hours, you finish reading the docs.
  77. The VelocElite-LX is a depressingly predictable
  78. variation on the VGA register set. There are some
  79. registers that have unhelpfully terse descriptions.
  80. The card also has the ability to execute rendering
  81. command lists out of RAM.
  82. You now know enough to write a rough driver for the
  83. card.
  84. > WRITE ROUGH DRIVER
  85. After several days, you have driver ready to test.
  86. > INSTALL DRIVER AND TEST
  87. You reboot the machine. The screen is blank.
  88. > RUN 'minicom' ON LAPTOP
  89. The 'minicom' terminal emulator is now running in an
  90. XTerm on the laptop.
  91. > PRESS ALT-SYSRQ ON MACHINE
  92. Nothing happens.
  93. > PLUG SERIAL CABLE INTO LAPTOP
  94. The "kdebug>" prompt from the kernel debugger
  95. appears on the XTerm.
  96. > EXAMINE REGISTERS
  97. After thirty minutes, you determine that two of the
  98. sync registers are set incorrectly.
  99. > FIX BUGS IN DRIVER AND TEST
  100. You can't see anything.
  101. > REBOOT IN SAFE MODE AND FIX BUGS
  102. A new version of the driver is ready to test.
  103. > TEST
  104. You reboot the machine. You see a color BeOS
  105. desktop.
  106. > TEST MODES
  107. You switch to 800*600. It looks fine.
  108. You switch to 1024*768. It looks fine.
  109. You switch to 1152*864. There are pixel sparkles on
  110. the screen.
  111. > PRESS ALT-SYSRQ ON MACHINE
  112. Nothing happens.
  113. > YES, IT DOES!
  114. Oh, sorry, I forgot. You get a "kdebug>" prompt.
  115. > EXAMINE SYNC REGISTERS
  116. After forty minutes, you find nothing wrong with the
  117. registers.
  118. > EXAMINE REGISTER 0x6000
  119. Register 0x6000 (FIFO watermarks) contains 0x0201
  120. (powerup default).
  121. > WRITE 0x0200 TO REGISTER 0x6000
  122. This is one of the poorly documented registers. Are
  123. you sure you want to do this?
  124. > YES
  125. The screen goes blank.
  126. > WRITE 0x0201 TO REGISTER 0x6000
  127. You see a color BeOS desktop.
  128. > WRITE 0x0202 TO REGISTER 0x6000
  129. The screen goes blank.
  130. [ ...Many more iterations deleted... ]
  131. > WRITE 0x1810 TO REGISTER 0x6000
  132. The pixel sparkles cease.
  133. > MODIFY DRIVER TO WRITE 0x1810 to 0x6000 AND TEST
  134. You reboot the machine. You see a color BeOS
  135. desktop, sans pixel sparkles.
  136. > ADD HARDWARE BLITTER SUPPORT TO DRIVER AND TEST
  137. You reboot the machine. You see a perfectly stable
  138. display of utter garbage with icons and text on top
  139. of it.
  140. > FIX RECTANGLE CODE AND TEST
  141. You reboot the machine. You see a color BeOS desktop.
  142. > DRAG WINDOW
  143. The screen turns blank.
  144. > FIX BLITTING CODE AND TEST
  145. You can't see anything. If you proceed, you will
  146. likely be eaten by a Grue.
  147. > REBOOT IN SAFE MODE, FIX BLITTING CODE, AND TEST
  148. You reboot the machine. A color BeOS desktop greets
  149. you.
  150. > DRAG WINDOW
  151. The window moves, but leaves "dirt" behind it.
  152. > READ DOCS ON BLITTER
  153. "The blit width register is set to the number of
  154. bytes copied per row." Your code reflects this
  155. statement.
  156. > ADD FENCEPOST TO BLIT WIDTH AND TEST
  157. You reboot the machine. Windows now drag normally,
  158. except for some weirdness at the left edge of the
  159. screen.
  160. > EXAMINE WEIRDNESS
  161. It looks as if the left four columns of pixels are
  162. being blitted 64 pixels too high.
  163. > READ DOCS ON BLITTER
  164. There is nothing in the docs to explain this behavior.
  165. > GO www.yoyodyne.com
  166. You are in a Web site.
  167. There are many links here.
  168. > GO DEVELOPER SUPPORT
  169. There is no developer support here.
  170. > READ DOCS ON SUPPORT
  171. There is nothing in the docs on how to get support.
  172. > TALK TO BOSS
  173. Your boss gives you the e-mail address of the contact
  174. person at Yoyodyne.
  175. > SEND MAIL DESCRIBING PROBLEM
  176. The e-mail disappears down the Ethernet port, on its
  177. way to yoyodyne.com.
  178. > WAIT
  179. Time passes.
  180. You have new mail.
  181. > READ MAIL
  182. You have 1 new message(s):
  183. From: john.smallberries@yoyodyne.com
  184. "Oh, yeah. That's a known bug. The official
  185. workaround is to copy those four pixel columns in
  186. software."
  187. > WRITE SPECIAL CASE FOR BLITTING CODE AND TEST
  188. You reboot the machine. Windows now glide across
  189. the display like silk.
  190. > TEST 15 BIT MODES
  191. All 15 bit modes work perfectly.
  192. > TEST 16 BIT MODES
  193. All 16 bit modes work perfectly.
  194. > TEST 32 BIT MODES
  195. The screen turns blank, then returns to the previous
  196. mode.
  197. > READ DOCS ON DISPLAY DEPTHS
  198. "The following display depths are supported:
  199. 0x00: 4 bits
  200. 0x02: 8 bits
  201. 0x04: 16 bits (RGB 555)
  202. 0x05: 16 bits (RGB 565)
  203. 0x06: 24 bits (RGB 888)
  204. 0x08: 32 bits (xRGB 8888)"
  205. > PRESS ALT-SYSRQ AND EXAMINE REGISTER
  206. The display depth register is set to 0x05.
  207. > WRITE 0x08 TO REGISTER
  208. The display turns blank.
  209. > WRITE 0x06 TO REGISTER
  210. You see a color BeOS desktop.
  211. > WRITE MAIL DESCRIBING PROBLEM
  212. Nothing happens.
  213. > ENTER 'c' AT DEBUGGER PROMPT AND WRITE MAIL
  214. The e-mail disappears down the Ethernet port, on its
  215. way to yoyodyne.com.
  216. > WAIT
  217. Time passes.
  218. You have new mail.
  219. > READ MAIL
  220. You have 1 new message(s):
  221. From: john.smallberries@yoyodyne.com
  222. "I just spoke to our hardware engineer, and he says
  223. that 32-bit modes don't really work all that well,
  224. and they should be avoided. 24-bit works fine,
  225. however."
  226. > REMOVE 32 BIT SUPPORT FROM DRIVER AND TEST
  227. You reboot the machine. You have now have a
  228. functional accelerated BeOS desktop.
  229. > CHECK DRIVER INTO SOURCE TREE
  230. You check in your new source files into the master
  231. source tree.
  232. You have broken the build.
  233. A dunce cap has appeared in your cube.
  234. > FIX DEPENDENCY FILE AND CHECK IN
  235. The build is restored to its former glory.
  236. The dunce cap has vanished.
  237. You have new mail.
  238. > READ MAIL
  239. You have 1 new message(s):
  240. From: baron@be.com
  241. "We're having trouble with the Yoyodyne driver in
  242. the QA lab. Can you look at it?"
  243. > GO QA LAB
  244. You are in the QA Lab. Many machines on many
  245. shelves are here, running test programs. The Baron
  246. directs you to the misbehaving machine. Its screen
  247. is blank.
  248. > TELNET INTO MACHINE
  249. A 'bash' shell prompt greets you.
  250. > REMOVE FILE '/boot/home/config/settings/app_server_settings'
  251. AND REBOOT
  252. You reboot the machine. You see a perfectly
  253. functional 640*480 display.
  254. The Baron looks like he has something to say.
  255. > TALK TO BARON
  256. He directs you to another machine. The monitor
  257. looks as if it can't quite sync to the card's
  258. signal.
  259. > TELNET INTO MACHINE
  260. A 'bash' shell prompt greets you.
  261. > REMOVE FILE '/boot/home/config/settings/app_server_settings'
  262. AND REBOOT
  263. Ha ha! That doesn't work this time! A sense of
  264. crushing defeat envelops you.
  265. > DON'T EDITORIALIZE
  266. Sorry.
  267. > EXAMINE MONITOR
  268. You are looking at a Flabloden 15ZF monitor.
  269. > READ MONITOR DOCS
  270. "Congratulations on your purchase of a Flabloden
  271. 15ZF monitor. Our products are fully compliant with
  272. VESA standards, including the VESA signalling and
  273. GTF specifications, assuring your monitor will work
  274. with whatever the hell graphics card you have
  275. installed..."
  276. > GO www.vesa.org
  277. You are at the Video Electronics Standards
  278. Association's Web site.
  279. There are many links here.
  280. A Reporter from CNN visiting Jean-Louis wanders by.
  281. He glances in your cube.
  282. > HIDE YOYODYNE DOCS!
  283. It is too late. The Reporter has seen the docs on
  284. your desk. A lightning bolt stabs out of the sky
  285. and through the ceiling, striking the Reporter,
  286. leaving only a smoking pile of ash.
  287. > CLEAN UP ASH
  288. You dutifully clean up the Reporter's remains.
  289. > SEARCH FOR GTF DOCS
  290. You find a link here named "VESA General Timing
  291. Formula."
  292. > GO VESA GENERAL TIMING FORMULA
  293. A Troll bars your way. He is demanding tribute.
  294. > EXAMINE TROLL
  295. He is big, strong, mean, ugly, pitiless, and
  296. unusually well dressed.
  297. > EVADE TROLL
  298. Despite your best efforts, the Troll thwarts your
  299. attempts to evade him.
  300. > TALK TO TROLL
  301. "THOU CANST NOT PASS LEST THOU PAYEST UNTO ME MY
  302. RIGHTFUL TRIBUTE!" thunders the Troll.
  303. > EXPLAIN SITUATION TO TROLL
  304. The Troll ignores you.
  305. > KILL TROLL
  306. You can't do that.
  307. > DAMMIT!
  308. Now who's editorializing?
  309. > PAY TRIBUTE
  310. Reluctantly, you hand over the required tribute.
  311. The Troll gives you a token so that you may pass
  312. this way again.
  313. Your wallet now contains $2500.
  314. > GO VESA GENERAL TIMING FORMULA
  315. There is a file here. The description says it
  316. contains the algorithm for calculating sync timings
  317. for any display mode.
  318. > DOWNLOAD FILE
  319. A copy of the file is now on your machine.
  320. > READ FILE
  321. There is no PDF reader here.
  322. > TRANSFER FILE TO LAPTOP AND READ
  323. After picking through some opaque language, you now
  324. understand the VESA GTF.
  325. > ADD VESA GTF CODE TO DRIVER AND TEST
  326. You reboot the machine. The Flabloden 15ZF monitor
  327. now works perfectly.
  328. You have new mail.
  329. > READ MAIL
  330. You have 2 new message(s):
  331. From: xf541ceuc8@aol.com
  332. "MAKE.MONEY.FAST! Hi, my name is Dave Rhodes..."
  333. > DELETE MESSAGE, NEXT MESSAGE
  334. From: rjs@be.com
  335. "We're going to need AGP support on the Yoyodyne
  336. card so we can start on OpenGL acceleration. Can
  337. you help with that?"
  338. > READ DOCS ON AGP
  339. Except for a few PCI configuration registers, there
  340. is no mention of AGP in the docs.
  341. > GO developer.intel.com
  342. You are at Intel's developers' Web site.
  343. There are many links here.
  344. > FIND AGP DOCS
  345. You find a single file named, "Accelerated Graphics
  346. Port Interface Specification (v2.0)".
  347. > DOWNLOAD FILE TO LAPTOP AND READ
  348. AGP is an extension to PCI. Like a modern CPU's
  349. MMU, AGP uses a translation table (called a GART) to
  350. make disjoint blocks of system memory appear
  351. contiguous. Both the graphics card and the
  352. motherboard controller must be properly configured
  353. for AGP to work. The layout and function of the PCI
  354. AGP configuration registers are described only in
  355. general terms. Most of the rest of the document
  356. describes hardware implementation and signalling
  357. details.
  358. > EXAMINE MOTHERBOARD IN MACHINE
  359. Your machine uses an Intel 440LX motherboard
  360. controller.
  361. > GO developer.intel.com
  362. You are at Intel's developers' Web site.
  363. There are many links here.
  364. > FIND 440LX DOCS
  365. You find a file named, "Intel 440LX AGPset: 82443LX
  366. PCI AGP Controller (PAC) Datasheet"
  367. > DOWNLOAD FILE TO LAPTOP AND READ
  368. You now understand how to program the host's and
  369. graphics card's AGP control registers.
  370. > ADD CODE ENABLING AGP 1X MODE TO DRIVER AND TEST
  371. You reboot the machine. Everything still works.
  372. > ADD CODE ENABLING SIDEBAND ADDRESSING TO DRIVER AND TEST
  373. You reboot the machine. Everything still works.
  374. > ADD CODE ENABLING GART TO DRIVER AND TEST
  375. You do not know how to create a GART.
  376. > READ AGP DOCS ON GART
  377. "The specific layout of the GART is
  378. chipset-specific, and not documented here. GART
  379. manipulation is done via a miniport driver or HAL
  380. supplied with the chipset BIOS reference
  381. implementation."
  382. > READ 440LX DOCS ON GART
  383. There is no description of the GART here.
  384. > GO developer.intel.com
  385. You are at Intel's developers' Web site.
  386. There are many links here.
  387. > FIND GART DOCS
  388. There are no GART docs here.
  389. > SEARCH FOR OTHER AGP RESOURCES
  390. There is a link to the AGP Implementor's Forum, at
  391. www.agpforum.org.
  392. > GO www.agpforum.org
  393. You are at the AGP Implementor's Forum Web site.
  394. There are many links here.
  395. > FIND GART DOCS
  396. A Troll bars your way. He is demanding tribute.
  397. > EVADE TROLL
  398. Despite your best efforts, the Troll thwarts your
  399. attempts to evade him.
  400. > PAY TRIBUTE
  401. Reluctantly, you hand over the required tribute.
  402. The Troll gives you a token so that you may pass
  403. this way again.
  404. Your wallet is now empty.
  405. > FIND GART DOCS
  406. There are no GART docs here. The Troll laughs
  407. uproariously.
  408. > FIND ALL PROGRAMMING DOCS
  409. You find a file named, "System Software."
  410. > DOWNLOAD FILE TO LAPTOP AND READ
  411. 'ghostscript' reports: "This PDF file is encrypted
  412. and cannot be processed."
  413. > CRASH LAPTOP BACK TO WINDOWS
  414. You close your XTerms, reboot the laptop, and in
  415. mere minutes, Windows is ready.
  416. > OPEN "SYSTEM SOFTWARE" DOCS
  417. The PDF reader opens. This looks suspiciously like a
  418. Powerpoint slide.
  419. > SEARCH DOCS FOR "GART"
  420. "GART manipulation is performed through the miniport
  421. driver and DirectX 5 extensions..."
  422. > CURSE
  423. You heartily curse in a manner that comes only with
  424. long practice. Co-workers pop up from their cubes
  425. like prairie dogs.
  426. > SCORE
  427. Out of a possible 127 points, you have a total score
  428. of 83 (65%).
  429. > SAVE
  430. Your adventure has been saved...