1svgalib(7)                    Svgalib User Manual                   svgalib(7)
2
3
4

NAME

6       svgalib - a low level graphics library for linux
7

TABLE OF CONTENTS

9       0. Introduction
10       1. Installation
11       2. How to use svgalib
12       3. Description of svgalib functions
13       4. Overview of supported SVGA chipsets and modes
14       5. Detailed comments on certain device drivers
15       6. Goals
16       7. References (location of latest version, apps etc.)
17       8. Known bugs
18
19

0. INTRODUCTION

21       This  is  a  low  level graphics library for Linux, originally based on
22       VGAlib 1.2 by Tommy Frandsen. VGAlib supported a number of standard VGA
23       graphics  modes,  as  well  as  Tseng  ET4000 high resolution 256-color
24       modes. As of now, support for many more chipsets has  been  added.  See
25       section 4 Overview of supported SVGA chipsets and modes
26
27       It  supports  transparent  virtual  console switching, that is, you can
28       switch consoles to and from  text  and  graphics  mode  consoles  using
29       alt-[function  key].  Also,  svgalib corrects most of VGAlib's textmode
30       corruption behaviour by catching SIGSEGV,  SIGFPE,  SIGILL,  and  other
31       fatal  signals  and ensuring that a program is running in the currently
32       visible virtual console before setting a graphics mode.
33
34       Note right here that SIGUSR1 and SIGUSR2 are  used  to  manage  console
35       switching  internally  in  svgalib.   You can not use them in your pro‐
36       grams. If your program needs to use one of those signals,  svgalib  can
37       be compiled to use other signals, by editing libvga.h
38
39       This  version  includes  code to hunt for a free virtual console on its
40       own in case you are not starting the program from one (but instead over
41       a  network or modem login, from within screen(1) or an xterm(1)).  Pro‐
42       vided there is a free console, this succeeds if you are root or if  the
43       svgalib  calling  user own the current console. This is to avoid people
44       not using the console being able to fiddle with it.  On  graceful  exit
45       the  program  returns to the console from which it was started.  Other‐
46       wise it remains in text mode at the VC which svgalib allocated to allow
47       you  to  see any error messages. In any case, any I/O the svgalib makes
48       in text mode (after calling vga_init(3)) will also take place  at  this
49       new console.
50
51       Alas,  some games misuse their suid root privilege and run as full root
52       process. svgalib cannot detect this and allows Joe Blow User to open  a
53       new  VC  on  the console. If this annoys you, ROOT_VC_SHORTCUT in Make‐
54       file.cfg allows you to disable allocating a new  VC  for  root  (except
55       when he owns the current console) when you compile svgalib. This is the
56       default.
57
58       When the library is used by a program at run-time, first the chipset is
59       detected and the appropriate driver is used. This means that a graphics
60       program will work on any card that is supported by svgalib, if the mode
61       it  uses  is supported by the chipset driver for that card. The library
62       is upwardly compatible with VGAlib.
63
64       The set of drawing functions provided  by  svgalib  itself  is  limited
65       (unchanged  from  VGAlib) and unoptimized; you can however use vga_set‐
66       page(3) and vga_getgraphmem(3) (which points  to  the  64K  VGA  frame‐
67       buffer)  in a program or graphics library.  A fast external framebuffer
68       graphics library for linear and banked 1, 2, 3 and 4  bytes  per  pixel
69       modes is included (it also indirectly supports planar VGA modes). It is
70       documented in vgagl(7).
71
72       One obvious application of the library is a picture viewer. Several are
73       available,  along  with animation viewers. See the 7. References at the
74       end of this document.
75
76       I have added a simple VGA textmode font restoration  utility  (restore‐
77       font(1))  which  may help if you suffer from XFree86 textmode font cor‐
78       ruption. It can also be used to change the textmode font. It comes with
79       some other textmode utilities: restoretextmode(1) (which saves/restores
80       textmode registers), restorepalette(1), and the script textmode(1).  If
81       you  run  the  savetextmode(1)  script  to save textmode information to
82       /tmp, you'll be able to restore textmode  by  running  the  textmode(1)
83       script.
84
85

1. INSTALLATION

87       Installation  is  easy in general but there are many options and things
88       you should keep in mind. This document however assumes that svgalib  is
89       already installed.
90
91       If  you need information on installation see 0-INSTALL which comes with
92       the svgalib distribution.
93
94       However, even after installation of the library you might need to  con‐
95       figure svgalib using the file /etc/vga/libvga.config.  Checkout section
96       4 Overview of supported SVGA chipsets and  modes  and  libvga.config(5)
97       for information.
98
99

2. HOW TO USE SVGALIB

101       For  basic  svgalib  usage  (no  mouse,  no  raw keyboard) add #include
102       <vga.h> at the beginning your program.  Use vga_init(3) as  your  first
103       svgalib call. This will give up root privileges right after initializa‐
104       tion, making setuid-root binaries relatively safe.
105
106       The function  vga_getdefaultmode(3)  checks  the  environment  variable
107       SVGALIB_DEFAULT_MODE  for a default mode, and returns the corresponding
108       mode number. The environment string can either be a mode  number  or  a
109       mode  name as in (G640x480x2, G640x480x16, G640x480x256 , G640x480x32K,
110       G640x480x64K, G640x480x16M).  As an example, to set the default  graph‐
111       ics mode to 640x480, 256 colors, use:
112
113       export SVGALIB_DEFAULT_MODE=G640x480x256
114
115       on  the bash(1) command line. If a program needs just a linear VGA/SVGA
116       resolution (as required by vgagl(7)), only modes where bytesperpixel in
117       the vga_modeinfo structure returned by vga_getmodeinfo(3) is greater or
118       equal to 1 should be accepted (this is 0 for tweaked  planar  256-color
119       VGA modes).
120
121       Use  vga_setmode(graphicsmode)  to  set  a  graphics mode. Use vga_set‐
122       mode(TEXT) to restore textmode before program exit.
123
124       Programs that use svgalib must #include<vga.h>; if they  also  use  the
125       external  graphics  library  vgagl(7), you must also #include<vgagl.h>.
126       Linking must be done with -lvga (and -lvgagl before -lvga, if  vgagl(7)
127       is  used).  You  can  save  binary space by removing the unused chipset
128       drivers in Makefile.cfg if you only use specific chipsets. However this
129       reduces  the  flexibility  of svgalib and has a significant effect only
130       when you use the static libraries. You should  better  use  the  shared
131       libraries and these will load only the really used parts anyway.
132
133       Functions  in  the  vgagl(7)  library  have the prefix gl_.  Please see
134       vgagl(7) for details.
135
136       There are demos with sources available which will also help to get  you
137       started,  in  recomended  order  of  interest:  vgatest(6), keytest(6),
138       mousetest(6),  eventtest(6),  forktest(6),  bg_test(6),  scrolltest(6),
139       speedtest(6),  fun(6),  spin(6),  testlinear(6), lineart(6), testgl(6),
140       accel(6), testaccel(6), plane(6), and wrapdemo(6).
141
142       Debugging your programs will turn out to be rather  difficult,  because
143       the svgalib application can not restore textmode when it returns to the
144       debugger.
145
146       Happy are the users with a serial terminal, X-station, or  another  way
147       to log into the machine from network. These can use
148
149       textmode </dev/ttyN
150
151       on the console where the program runs and continue.
152
153       However,  the  vga_flip(3) function allows you to switch to textmode by
154       entering a call to it blindly into  your  debugger  when  your  program
155       stops  in  graphics  mode.   vga_flip(3) is not very robust though. You
156       shall not call it when svgalib is not yet initialized or in textmode.
157
158       Before continuing your program, you must then call vga_flip(3) again to
159       return  to  graphics  mode.  If  the  program  will not make any screen
160       accesses or svgalib calls before it returns to the  debugger,  you  can
161       omit that, of course.
162
163       This  will  only  work if your program and the debugger run in the same
164       virtual linux console.
165
166

3. DESCRIPTION OF SVGALIB FUNCTIONS

168       Each function has it's own section 3 manual page. For a list  of  vgagl
169       functions see vgagl(7).
170
171   Initialization
172       vga_init(3)
173              - initialize svgalib library.
174       vga_disabledriverreport(3)
175              - makes svgalib not emit any startup messages.
176       vga_claimvideomemory(3)
177              - declare the amount of video memory used.
178       vga_safety_fork(3)
179              - start a parallel process to restore the console at a crash.
180       vga_setchipset(3)
181              - force chipset.
182       vga_setchipsetandfeatures(3)
183              - force chipset and optional parameters.
184
185   Inquire hardware configuration
186       vga_getmousetype(3)
187              - returns the mouse type configured.
188       vga_getcurrentchipset(3)
189              - returns the current SVGA chipset.
190       vga_getmonitortype(3)
191              - returns the monitor type configured.
192
193   Setting video modes
194       vga_setmode(3)
195              - sets a video mode.
196       vga_setdisplaystart(3)
197              - set the display start address.
198       vga_setlogicalwidth(3)
199              - set the logical scanline width.
200       vga_setlinearaddressing(3)
201              - switch to linear addressing mode.
202       vga_setmodeX(3)
203              - try to set Mode X-like memory organization .
204       vga_ext_set(3)
205              - set and query several extended features.
206       vga_screenoff(3), vga_screenon(3)
207              - turn generation of the video signal on or off.
208
209   Get video mode information
210       vga_getxdim(3), vga_getydim(3), vga_getcolors(3)
211              - return the current screen resolution.
212       vga_white(3)
213              - return the color white in the current screen resolution.
214       vga_getcurrentmode(3)
215              - returns the current video mode.
216       vga_hasmode(3)
217              - returns if a video mode is supported.
218       vga_getmodeinfo(3)
219              - returns pointer to mode information structure for a mode.
220       vga_getdefaultmode(3)
221              - returns the default graphics mode number.
222       vga_lastmodenumber(3)
223              - returns the last video mode number.
224       vga_getmodename(3)
225              - return a name for the given video mode.
226       vga_getmodenumber(3)
227              - return a number for the given video mode.
228
229   Drawing primitives
230       vga_clear(3)
231              - clear the screen.
232       vga_setcolor(3)
233              - set the current color.
234       vga_setrgbcolor(3)
235              - set the current color.
236       vga_setegacolor(3)
237              - set the current color.
238       vga_drawpixel(3)
239              - draw a pixel on the screen.
240       vga_drawscanline(3)
241              - draw a horizontal line of pixels.
242       vga_drawscansegment(3)
243              - draw a horizontal line of pixels.
244       vga_drawline(3)
245              - draw a line on the screen.
246       vga_getpixel(3)
247              - get a pixels value from the screen.
248       vga_getscansegment(3)
249              - get a list of consecutive pixel values.
250       vga_waitretrace(3)
251              - wait for vertical retrace.
252
253   Basic (non raw) keyboard I/O
254       vga_getch(3)
255              - wait for a key.
256       vga_getkey(3)
257              - read a character from the keyboard without waiting.
258       vga_waitevent(3)
259              - wait for various I/O events.
260
261   Direct VGA memory access
262       vga_setpage(3)
263              - set the 64K SVGA page number.
264       vga_setreadpage(3)
265              - set the 64K SVGA page number.
266       vga_setwritepage(3)
267              - set the 64K SVGA page number.
268       vga_getgraphmem(3)
269              - returns the address of the VGA memory.
270       vga_copytoplanar256(3)
271              - copy linear pixmap into Mode X video memory.
272       vga_copytoplanar16(3)
273              - copy linear pixmap into VGA 16 color mode video memory.
274       vga_copytoplane(3)
275              -  copy  linear pixmap to some planes of VGA 16 color mode video
276              memory.
277
278   Manage color lookup tables
279       vga_setpalette(3)
280              - set a color in the color lookup table.
281       vga_getpalette(3)
282              - get a color in the color lookup table.
283       vga_setpalvec(3)
284              - sets colors in the color lookup table.
285       vga_getpalvec(3)
286              - gets colors from the color lookup table.
287
288   Mouse handling
289       vga_setmousesupport(3)
290              - enable mouse support.
291       mouse_init(3), mouse_init_return_fd(3)
292              - specifically initialize a mouse.
293       mouse_close(3)
294              - explicitly close a mouse.
295       mouse_update(3)
296              - updates the mouse state.
297       mouse_waitforupdate(3)
298              - wait for an mouse update.
299       mouse_setscale(3)
300              - sets a mouse scale factor.
301       mouse_setwrap(3)
302              - set what happens at the mouse boundaries.
303       mouse_setxrange(3), mouse_setyrange(3)
304              - define the boundaries for the mouse cursor.
305       mouse_getx(3), mouse_gety(3), mouse_getbutton(3)
306              - query the mouse state.
307       mouse_setposition(3)
308              - set the current mouse position.
309       mouse_getposition_6d(3), mouse_setposition_6d(3), mouse_setrange_6d(3)
310              - provide an interface to 3d mice.
311       mouse_seteventhandler(3), mouse_setdefaulteventhandler(3)
312              - set a mouse event handler.
313
314   Raw keyboard handling
315       keyboard_init(3), keyboard_init_return_fd(3)
316              - initialize the keyboard to raw mode.
317       keyboard_close(3)
318              - return the keyboard to normal operation from raw mode.
319       keyboard_update(3), keyboard_waitforupdate(3)
320              - process raw keyboard events.
321       keyboard_translatekeys(3)
322              - modify scancode mappings in raw keyboard mode.
323       keyboard_keypressed(3)
324              - check if a key is pressed when in raw keyboard mode.
325       keyboard_getstate(3)
326              - get a pointer to a buffer holding the state of all keys in raw
327              keyboard mode.
328       keyboard_clearstate(3)
329              - reset the state of all keys when in raw keyboard mode.
330       keyboard_seteventhandler(3), keyboard_setdefaulteventhandler(3)
331              - define an event handler for keyboard events in raw mode.
332
333   Joystick handling
334       joystick_init(3)
335              - initialize and calibrate joysticks.
336       joystick_close(3)
337              - close a joystick device.
338       joystick_update(3)
339              - query and process joystick state changes.
340       joystick_sethandler(3), joystick_setdefaulthandler(3)
341              - define own joystick even handler.
342       joystick_getnumaxes(3), joystick_getnumbuttons(3)
343              - query the capabilities of a joystick.
344       joystick_getaxis(3), joystick_getbutton(3)
345              - query the state of a joystick.
346       joystick_button1|2|3|4(3),  joystick_getb1|2|3|4(3), joystick_x|y|z(3),
347       joystick_getx|y|z(3)
348              - convenience macros to query the joystick position.
349
350   Accelerator interface (new style)
351       vga_accel(3)
352              - calls the graphics accelerator.
353
354   Accelerator interface (old style)
355       vga_bitblt(3)
356              - copy pixmap on screen using an accelerator.
357       vga_fillblt(3)
358              - fill rectangular area in video memory with a single color.
359       vga_hlinelistblt(3)
360              - draw horizontal scan lines.
361       vga_imageblt(3)
362              - copy a rectangular pixmap from system memory to video memory.
363       vga_blitwait(3)
364              - wait for any accelerator operation to finish.
365
366   Controlling VC switches
367       vga_lockvc(3)
368              - disables virtual console switching for safety.
369       vga_unlockvc(3)
370              - re-enables virtual console switching.
371       vga_oktowrite(3)
372              - indicates whether the program has direct access to the SVGA.
373       vga_runinbackground(3)
374              - enable running of the program while there is no VGA access.
375       vga_runinbackground_version(3)
376              - returns the version of the current background support.
377
378   Debugging aids
379       vga_dumpregs(3)
380              - dump the contents of the SVGA registers.
381       vga_gettextfont(3), vga_puttextfont(3)
382              - get/set the font used in text mode.
383       vga_gettextmoderegs(3), vga_settextmoderegs(3)
384              - get/set the vga state used in text mode.
385       vga_flip(3)
386              - toggle between text and graphics mode.
387       vga_setflipchar(3)
388              - set the character causing a vga_flip().
389

4. OVERVIEW OF SUPPORTED SVGA CHIPSETS AND MODES

391   VGA and compatibles
392       320x200x256, and the series of 16-color  and  non-standard  planar  256
393       color modes supported by VGAlib, as well as 720x348x2.
394
395
396   ALI2301
397       Supports 640x480x256, 800x600x256, 1024x768x256 SVGA modes
398
399
400   AT3D (AT25)
401       Also  known  as Promotion at25. Popular as the 2D part of a voodoo rush
402       card. As of this writing there are  a  few  known  problems  with  this
403       driver. Read below.
404
405
406   ARK Logic ARK1000PV/2000PV
407       Full  support,  limited RAMDAC support. Only ARK1000PV tested. Supports
408       Clocks and Ramdac lines in config file.
409
410
411   ATI SVGA (VGA Wonder and friends)
412       This is no real driver. I do not support any  new  modes.   However  it
413       saves  additional card setup and thus allows use of the plain VGA modes
414       even when you are using non standard text  modes.  It  is  possible  to
415       enforce use of this driver even on ATI Mach32 but not very useful.
416
417
418   ATI Mach32
419       The  driver  by  Michael Weller supports all ATI BIOS-defined modes and
420       more... It hits the best out of your card.  Some  modes  may  not  have
421       nice  default timings but it uses the ATI's EEPROM for custom config or
422       allows to specify modes in libvga.config(5).  Some problems  may  occur
423       with  quite some third party cards (usually on board) Mach32 based con‐
424       trollers as they do not completely conform to the Mach32  data  sheets.
425       Check out svgalib.mach32(7) (and libvga.config(5)).
426
427
428   ATI Mach64 (rage)
429       A driver for ATi Mach64 based cards with internal DAC.
430
431
432   Chips  and  Technologies  chipsets  65525,  65535, 65546, 65548, 65550, and
433       65554 (usually in laptops).
434       This server was written using the SVGALIB patch from Sergio and  Angelo
435       Masci as a starting point. This version of the code resembled the XFree
436       server code that was used up to XFree 3.1.2. As such it  was  incapable
437       of  programming  the  clocks,  using linear addressing, Hi-Color, True-
438       Color modes or the hardware acceleration. All of  these  features  have
439       since  been  added  to  the code.  The 64200 and 64300 chips are unsup‐
440       ported, however these chips are very similar to the 6554x  chips  which
441       are supported.
442
443
444   Cirrus Logic GD542x/3x
445       All  the  modes, including 256 color, 32K/64K color, 16M color (3 bytes
446       per pixel) and 32-bit pixel 16M color modes (5434). Some  bitblt  func‐
447       tions are supported.  The driver doesn't work with mode dumps, but uses
448       a SVGA abstraction with mode timings like the X drivers.
449
450
451   Genoa(?) GVGA6400 cards.
452       Supported.
453
454
455   Hercules Stingray 64/Video
456       Is supported as an ARK2000PV
457
458
459   NV3 driver for the Riva128.
460       This driver was written by Matan Ziv-Av and is derived from the XFree86
461       driver by David J. Mckay. It lacks 24bit modes (can the card do them at
462       all?), acceleration support and pageflipping in threeDKit is broken.
463
464
465   Oak Technologies OTI-037/67/77/87
466       Driver by Christopher Wiles; includes 32K color modes for OTI-087.
467
468
469   S3
470       The driver is not complete, but should work on a number  of  cards/RAM‐
471       DACs, and 640x480x256 should work on most card. The best support is for
472       a 801/805 with AT&T20C490-compatible RAMDAC, and S3-864  +  SDAC.   All
473       256/32K/64K/16M  works  for  them  (within the bounds of video memory &
474       ramdac restrictions).
475
476       The supported cards include S3 Virge and S3 Trio64 cards.
477
478       None of the acceleration function is supported yet.
479
480       The chip level code should work with the 964/868/968, but  most  likely
481       the card they come on would use an unsupported ramdac/clock chip.  Sup‐
482       port for these chips is slowly being added.
483
484       Clocks and Ramdac lines in libvga.config(5) supported.
485
486       The maximum pixel clock (in MHz) of the ramdac can be set using a  Dac‐
487       speed  line  in the config file. A reasonable default is assumed if the
488       Dacspeed line is omitted.  Clocks should be the  same  as  in  XFree86.
489       Supported  ramdac  IDs:  Sierra32K,  SC15025,  SDAC, GenDAC, ATT20C490,
490       ATT20C498, IBMRGB52x.
491
492       Example:
493       Clocks 25.175 28.3 40 70 50 75 36 44.9 0 118 77 31.5 110 65 72 93.5
494       Ramdac att20c490
495       DacSpeed 85
496
497       Also supported, at least in combination with the SC15025/26A ramdac, is
498       the  ICD 2061A clock chip.  Since it cannot be autodetected you need to
499       define it in the config file using a Clockchip line. As there is no way
500       to  read  the  current settings out of the 2061, you have the option to
501       specify the frequency used when switching back to text mode  as  second
502       argument in the Clockchip line.
503
504       This  is  especially  required if your text mode is an 132 column mode,
505       since these modes use a clock from the  clock  chip,  while  80  column
506       modes use a fixed clock of 25 MHz.  The text mode frequency defaults to
507       40 MHz, if omitted.
508
509       Example:
510       ClockChip icd2061a 40.0
511
512
513   Trident TVGA 8900C/9000 (and possibly also 8800CS/8900A/B)  and  also  TVGA
514       9440
515       Derived  from  tvgalib  by  Toomas  Losin.  TVGA  9440  support  by ARK
516       <ark@lhq.com, root@ark.dyn.ml.or>.
517
518       Supports 640x480x256, 800x600x256, 1024x768x256  (interlaced  and  non-
519       interlaced)  Might  be useful to add 16-color modes (for those equipped
520       with a 512K TVGA9000) for the 8900 and 9000 cards.
521
522       320x200x{32K, 64K, 16M}, 640x480x{256, 32K,  64K,  16M},  800x600x{256,
523       32K,  64K,  16M}, 1024x768x{16, 256}, 800x600x{16, 256, 32K, 64K} modes
524       are supported for the TVGA 9440.
525
526       Autodetection can be forced with a:
527
528              chipset TVGA memory flags
529
530       line in the config file.
531
532       memory is the amount of VGA memory in KB, flags is  composed  of  three
533       bits:
534
535              bit2 = false, bit1 = false
536                     force 8900.
537
538              bit2 = false, bit1 = true
539                     force 9440.
540
541              bit2 = true, bit1 = false
542                     force 9680.
543
544              bit0 = true
545                     force noninterlaced.
546
547              bit0 = false
548                     force  interlaced  which  only  matters on 8900's with at
549                     least 1M since there is no 512K interlaced  mode  on  the
550                     8900 or any of the other cards.
551
552
553   Tseng ET4000/ET4000W32(i/p)
554       Derived  from  VGAlib;  not  the same register values.  ET4000 register
555       values are not compatible; see svgalib.et4000(7).
556
557       Make sure the colors are right in hicolor  mode;  the  vgatest  program
558       should draw the same color bars for 256 and hicolor modes (the DAC type
559       is defined at compilation  in  et4000.regs  or  the  dynamic  registers
560       file).   ET4000/W32  based cards usually have an AT&T or Sierra 15025/6
561       DAC. With recent W32p based cards, you might have some  luck  with  the
562       AT&T  DAC  type.   If the high resolution modes don't work, you can try
563       dumping the registers in DOS using the program in the et4000/ directory
564       and putting them in a file (/etc/vga/libvga.et4000 is parsed at runtime
565       if  DYNAMIC  is  defined  in  Makefile.cfg  at  compilation  (this   is
566       default)).
567
568       Supported    modes    are   640x480x256,   800x600x256,   1024x768x256,
569       640x480x32K, 800x600x32K, 640x480x16M, etc.
570
571       Reports of ET4000/W32i/p functionality are welcome.
572
573       There may be a problem with the way the hicolor DAC  register  is  han‐
574       dled;  dumped  registers  may  use  one of two timing methods, with the
575       value written to the register for a particular DAC for a  hicolor  mode
576       (in  vgahico.c)  being  correct for just one of the these methods. As a
577       consequence some dumped resolutions may work while others don't.
578
579
580   Tseng ET6000
581       Most modes of which the card is capable are supported.  The 8 15 16  24
582       and 32 bit modes are supported.
583
584       The  ET6000 has a built in DAC and there is no problem coming from that
585       area. The ET6000 is capable  of  acceleration,  but  this  as  well  as
586       sprites are not yet implemented in the driver.
587
588       The  driver now uses modelines in libvga.config for user defined modes.
589       It is sometimes useful to add a modeline for a  resolution  which  does
590       not display well.  For example, the G400x600 is too far to the right of
591       the screen using standard modes.  This is  corrected  by  including  in
592       libvga.config the line
593
594       Modeline "400x600@72"  25.000 400  440  488  520   600  639  644  666
595
596       More examples are given below.
597
598       This driver was provided by Don Secrest.
599
600
601   VESA
602       Please  read  README.vesa  and  README.lrmi  in doc subdirectory of the
603       standard distribution.
604
605       Go figure! I turned off autodetection in the release, as a broken  bios
606       will  be  called  too, maybe crashing the machine. Enforce VESA mode by
607       putting a chipset VESA in the end of your libvga.config(5).
608
609       Note that it will leave protected mode and call the cards bios  opening
610       the door to many hazards.
611
612

5. DETAILED COMMENTS ON CERTAIN DEVICE DRIVERS

614       This  section  contains  detailed information by the authors on certain
615       chipsets.
616
617
618   AT3D (AT25)
619       Also known as Promotion at25. Popular as the 2D part of a  voodoo  rush
620       card.
621
622       I  have written a driver for this chipset, based on the XF86 driver for
623       this chipset.
624
625       The programs that work with this driver include all the programs in the
626       demos directory, zgv and dvisvga (tmview).
627
628       I believe it should be easy to make it work on AT24, AT6422.
629
630
631   ATI Mach32
632       Please see svgalib.mach32(7).
633
634
635   ATI Mach64
636       The  rage.c  driver works only on mach64 based cards with internal DAC.
637       The driver might misdetect the base frequency the card uses, so if when
638       setting  any svgalib modes the screen blanks, or complains about out of
639       bound freqencies, or the display  is  unsynced,  then  try  adding  the
640       option RageDoubleClock to the config file.
641
642
643   Chips  and  Technologies  chipsets  65525,  65535, 65546, 65548, 65550, and
644       65554 (usually in laptops).
645       Please see svgalib.chips(7).
646
647
648   Tseng ET4000/ET4000W32(i/p)
649       Please see svgalib.et4000(7).
650
651
652   Tseng ET6000
653       I have only 2 Mbytes of memory on my ET6000 card, so I am not  able  to
654       get  all  possible modes running. I haven't even tried to do all of the
655       modes which I am capable of doing, but I am confident that I can manage
656       more  modes  when  I have time. I have enough modes working to make the
657       card useful, so I felt it was worth while to add the driver to  svgalib
658       now.
659
660       Linear  graphics  is  working on this card, both with and without BACK‐
661       GROUND enabled, and vga_runinbackground works.
662
663       I decided it was best to quit working on more  modes  and  try  to  get
664       acceleration and sprites working.
665
666       My  et6000  card is on a PCI bus.  The card will run on a vesa bus, but
667       since I don't have one on my machine I couldn't develop vesa  bus  han‐
668       dling.  I quit if the bus is a vesa bus.
669
670       I  check for an et6000 card, which can be unequivocally identified. The
671       et4000 driver does not properly identify et4000 cards.  It  thinks  the
672       et6000 card is an et4000, but can only run it in vga modes.
673
674       I have found the following four modelines to be useful in libvga.config
675       or in ~/.svgalibrc for proper display of some modes.
676
677       Modeline "512x384@79" 25.175 512 560 592 640  384 428 436 494
678       Modeline "400x300@72" 25.000 400 456 472 520  300 319 332 350  DOUBLES‐
679       CAN
680       Modeline "512x480@71" 25.175 512 584 600 656  480 500 510 550
681       Modeline "400x600@72" 25.000 400 440 488 520  600 639 644 666
682
683       Don Secrest <secrest@uiuc.edu> Aug 21, 1999
684
685
686
687   Oak Technologies OTI-037/67/77/87
688       First  a  few  comments  of  me  (Michael  Weller <eowmob@exp-math.uni-
689       essen.de>):
690
691       As of this writing (1.2.8) fixes were made to the oak driver  by  Frodo
692       Looijaard  <frodol@dds.nl>  to  reenable OTI-067 support. It is unknown
693       right now if they might have broken OTI-087 support. The author of  the
694       '87  support  Christopher  Wiles  <wileyc@moscow.com> owns no longer an
695       OTI-087 card and can thus  no  longer  give  optimal  support  to  this
696       driver.  Thus  you might be better off contacting me or Frodo for ques‐
697       tions. If you are a knowledgable OTI-087 user and  experience  problems
698       you  are  welcome  to provide fixes.  No user of a OTI-087 is currently
699       known to me, so if you are able to fix problems with the driver  please
700       do so (and contact me) as noone else can.
701
702       Michael.
703
704       Now back to the original Oak information:
705
706       The original OTI driver, which supported the OTI-067/77 at 640x480x256,
707       has been augmented with the following features:
708
709
710       1)     Supported resolutions/colors have been expanded to  640x480x32K,
711              800x600x256/32K, 1024x768x256, and 1280x1024x16.
712
713       2)     The  OTI-087  (all  variants) is now supported.  Video memory is
714              correctly recognized.
715
716       The driver as it exists now is somewhat schizoid.  As the '87  incorpo‐
717       rates a completely different set of extended registers, I found it nec‐
718       essary to split its routines from the others.  Further, I did not  have
719       access  to  either  a '67 or a '77 for testing the new resolutions.  If
720       using them causes your monitor/video card to fry, your dog to bite you,
721       and so forth, I warned you.  The driver works on my '87, and that's all
722       I guarantee.  Period.
723
724       Heh.  Now, if someone wants to try them out ... let  me  know  if  they
725       work.
726
727       New from last release:
728
729       32K  modes  now  work for 640x480 and 800x600.  I found that the Sierra
730       DAC information in VGADOC3.ZIP is, well, wrong.  But, then  again,  the
731       information for the '87 was wrong also.
732
733       64K  modes  do  not  work.   I can't even get Oak's BIOS to enter those
734       modes.
735
736       I have included a 1280x1024x16 mode, but I haven't tested it.  My moni‐
737       tor can't handle that resolution.  According to the documentation, with
738       2 megs the '87 should be able to do  an  interlaced  1280x1024x256  ...
739       again,  I  couldn't get the BIOS to do the mode.  I haven't 2 megs any‐
740       way, so there it sits.
741
742       I have included routines for entering and leaving  linear  mode.   They
743       should work, but they don't.  It looks like a pointer to the frame buf‐
744       fer is not being passed to SVGALIB.  I've been fighting with  this  one
745       for  a month.  If anyone wants to play with this, let me know if it can
746       be make to work.  I've got exams that I need to pass.
747
748       Tidbit: I pulled the extended register info  out  of  the  video  BIOS.
749       When  the  information  thus  obtained  failed  to work, I procured the
750       OTI-087 data book.  It appears that Oak's video BIOS sets various modes
751       incorrectly  (e.g.  setting  8-bit color as 4, wrong dot clock frequen‐
752       cies, etc.).  Sort of makes me wonder ...
753
754       Christopher M. Wiles (a0017097@wsuaix.csc.wsu.edu)
755       12 September 1994
756
757

6. GOALS

759       I think the ability to use a VGA/SVGA graphics resolution in  one  vir‐
760       tual   console,  and  being able to switch to any other virtual console
761       and back makes a fairly useful implementation of graphics modes in  the
762       Linux console.
763
764       Programs  that use svgalib must be setuid root. I don't know how desir‐
765       able it is to have this changed; direct port access can hardly be  done
766       without.  Root  privileges  can now be given up right after initializa‐
767       tion. I noticed some unimplemented stuff in  the  kernel  header  files
768       that  may  be  useful,  although  doing all register I/O via the kernel
769       would incur a significant context-switching  overhead.  An  alternative
770       might be to have a pseudo /dev/vga device that yields the required per‐
771       missions when opened, the device being readable by  programs  in  group
772       vga.
773
774       It  is important that textmode is restored properly and reliably; it is
775       fairly reliable at the moment, but  fast  console  switching  back  and
776       forth  between  two  consoles running graphics can give problems.  Wild
777       virtual console switching also sometimes corrupts the contents  of  the
778       textmode screen buffer (not the textmode registers or font).  Also if a
779       program crashes it may write into the area  where  the  saved  textmode
780       registers  are  stored,  causing textmode not be restored correctly. It
781       would be a good idea to somehow store this information in a 'safe' area
782       (say  a  kernel buffer). Note that the vga_safety_fork(3) thing has the
783       same idea.
784
785       Currently, programs that are in graphics mode are suspended  while  not
786       in the current virtual console. Would it be a good idea to let them run
787       in the background, virtualizing framebuffer actions (this should not be
788       too  hard for linear banked SVGA modes)? It would be nice to have, say,
789       a raytracer with a real-time display run in  the  background  (although
790       just using a separate real-time viewing program is much more elegant).
791
792       Anyone wanting to rewrite it all in a cleaner way (something with load‐
793       able kernel modules  shouldn't  hurt  performance  with  linear  frame‐
794       buffer/vgagl type applications) is encouraged.
795
796       Also,  if  anyone  feels really strongly about a low-resource and true‐
797       color supporting graphical window  environment  with  cut-and-paste,  I
798       believe  it  would be surprisingly little work to come up with a simple
799       but very useful client-server system with shmem, the most useful appli‐
800       cations  being  fairly  trivial  to  write (e.g. shell window,   bitmap
801       viewer).     And many X apps would port trivially.
802
803       This is old information, please be sure to read svgalib.faq(7)  if  you
804       are interested in further goals.
805
806

7. REFERENCES

808       The  latest  version  of  svgalib  can  be  found on sunsite.unc.edu in
809       /pub/Linux/libs/graphics or tsx-11.mit.edu  in  /pub/linux/sources/libs
810       as  svgalib-X.X.X.tar.gz.   As  of  this  writing the latest version is
811       svgalib-1.4.1.tar.gz.  There are countless mirrors of these ftp servers
812       in the world. Certainly a server close to you will carry it.
813
814       The       original       VGAlib       is       on       tsx-11.mit.edu,
815       pub/linux/sources/libs/vgalib12.tar.Z.   tvgalib-1.0.tar.Z  is  in  the
816       same directory.
817
818       SLS  has  long  been  distributing an old version of VGAlib.  Slackware
819       keeps a fairly up-to-date version of svgalib, but it may  be  installed
820       in  different directories from what svgalib likes to do by default. The
821       current svgalib install tries to remove most of this. It  also  removes
822       /usr/bin/setmclk  and  /usr/bin/convfont,  which  is a security risk if
823       setuid-root. Actually the recent makefiles try to do a really good  job
824       to cleanup the mess which some distributions make.
825
826       If  you  want  to recompile the a.out shared library, you will need the
827       DLL 'tools' package (found on tsx-11.mit.edu, GCC  dir).   To  make  it
828       work with recent ELF compiler's you actually need to hand patch it. You
829       should probably not try to compile it. Compiling  the  ELF  library  is
830       deadly simple.
831
832       And  here  is  a  list  of other references which is horribly outdated.
833       There are many more svgalib applications as  well  as  the  directories
834       might  have  changed.   However,  these will give you a start point and
835       names to hunt for on CD's or in ftp archives.
836
837
838   Viewers (in /pub/Linux/apps/graphics/viewers on sunsite.unc.edu):
839       spic   Picture viewer; JPG/PPM/GIF; truecolor; scrolling.
840       zgv    Full-featured viewer with nice file selector.
841       see-jpeg
842              Shows picture as it is being built up.
843       mpeg-linux
844              svgalib port of the Berkeley MPEG decoder (mpeg_play);  it  also
845              includes an X binary.
846       flip   FLI/FLC player (supports SVGA-resolution).
847
848   Games (in /pub/Linux/games on sunsite.unc.edu):
849       bdash  B*lderdash clone with sound.
850       sasteroids
851              Very smooth arcade asteroids game.
852       yatzy  Neat mouse controlled dice game.
853       vga_cardgames
854              Collection of graphical card games.
855       vga_gamespack
856              Connect4, othello and mines.
857       wt     Free state-of-the-art Doom-like engine.
858       Maelstrom
859              A very nice asteroids style game port from Mac.
860       Koules A game. (I've no idea what it looks like)
861
862   Docs
863       In the vga directory of the SIMTEL MSDOS collection, there is a package
864       called vgadoc3 which is a collection of VGA/SVGA register information.
865
866       The XFree86 driver sources distributed with the link-kit may  be  help‐
867       ful.
868
869
870   Miscellaneous
871       There's  an  alternative RAW-mode keyboard library by Russell Marks for
872       use with svgalib on sunsite.unc.edu.
873
874       LIBGRX, the extensive framebuffer library by  Csaba  Biegl  distributed
875       with  DJGPP,  has  been  ported  to  Linux.  Contact  Hartmut  Schirmer
876       (phc27@rz.uni-kiel.d400.de, subject prefix "HARTMUT:"). A  more  up-to-
877       date  port  by  Daniel  Jackson  (djackson@icomp.intel.com)  is on sun‐
878       site.unc.edu.
879
880       The vgalib ghostscript device driver  sources  can  be  found  on  sun‐
881       site.unc.edu,   /pub/Linux/apps/graphics.    Ghostscript  patches  from
882       Slackware: ftp.cdrom.com, /pub/linux/misc.  gnuplot patches are on sun‐
883       site.unc.edu.
884
885       Mitch  D'Souza  has  written font functions that work in 16 color modes
886       and can use VGA textmode (codepage format) fonts; these can be found in
887       his  g3fax  package  in sunsite.unc.edu.  These functions may go into a
888       later version of svgalib.
889
890

8. KNOWN BUGS

892       This section is most probably outdated, none of these problems  are  no
893       longer reported.
894
895       Using a 132 column textmode may cause graphics modes to fail. Try using
896       something like 80x28.
897
898       The console switching doesn't preserve some registers that may be  used
899       to draw in planar VGA modes.
900
901       Wild console switching can cause the text screen to be corrupted, espe‐
902       cially when switching between two graphics consoles.
903
904       On ET4000, having run XFree86 may cause high resolution modes  to  fail
905       (this is more XFree86's fault).
906
907       The  Trident  probing  routine in the XFree86 server may cause standard
908       VGA modes to fail after exiting X on a Cirrus. Try putting a  'Chipset'
909       line in your Xconfig to avoid the Trident probe, or use the link kit to
910       build a server without the Trident driver.  Saving  and  restoring  the
911       textmode  registers with savetextmode/textmode (restoretextmode) should
912       also work. [Note: svgalib now resets the particular extended  register,
913       but  only  if the Cirrus driver is used (i.e. the chipset is not forced
914       to VGA)] [This is fixed in XFree86 v2.1]
915
916       Some Paradise VGA cards may not work even in standard  VGA  modes.  Can
917       anyone confirm this?
918
919       Piping  data into a graphics program has problems. I am not sure why. A
920       pity, since zcatting a 5Mb FLC file into flip on a 4Mb machine would be
921       fun.
922
923       The  tseng3.exe  DOS program include as source in the svgalib distribu‐
924       tion doesn't recognize any modes on some  ET4000  cards.   Also  ET4000
925       cards  with  a  Acumos/Cirrus  DAC may only work correctly in 64K color
926       mode.
927
928

FILES

930       /etc/vga/libvga.config
931       /etc/vga/libvga.et4000
932
933

SEE ALSO

935       svgalib.et4000(7), svgalib.chips(7), svgalib.mach32(7), vgagl(7),  lib‐
936       vga.config(5),  3d(6), accel(6), bg_test(6), eventtest(6), forktest(6),
937       fun(6), keytest(6), lineart(5), mousetest(6), joytest(6),  mjoytest(6),
938       scrolltest(6), speedtest(6), spin(6), testaccel(6), testgl(6), testlin‐
939       ear(6), vgatest(6),  plane(6),  wrapdemo(6),  convfont(1),  dumpreg(1),
940       fix132x43(1),  restorefont(1),  restorepalette(1),  restoretextmode(1),
941       runx(1), savetextmode(1), setmclk(1), textmode(1), mach32info(1).
942
943

AUTHOR

945       There are many authors of svgalib. This  page  was  edited  by  Michael
946       Weller  <eowmob@exp-math.uni-essen.de>.  The original documentation and
947       most of svgalib was done by Harm Hanemaayer <H.Hanemaayer@inter.nl.net>
948       though.
949
950
951
952Svgalib 1.4.1                  16 December 1999                     svgalib(7)
Impressum