VGA(3)                                                     VGA(3)

     NAME
          vga - VGA controller device

     SYNOPSIS
          bind #v /dev

          /dev/vgactl
          /dev/vgaiob
          /dev/vgaiow
          /dev/vgaiol

     DESCRIPTION
          The VGA device allows configuration of a graphics controller
          on a PC.  Vgactl allows control over higher-level settings
          such as display height, width, depth, controller and
          hardware-cursor type.  Vgaiob, vgaiow and vgaiol allow con-
          trol over individual 8-bit, 16-bit and 32-bit x86 I/O-ports
          respectively, such as those used to implement configuration
          and setup registers on a VGA controller card.  These func-
          tions are normally carried out by vga(8).

          Writes to vgactl are of the form `attribute value'.  Valid
          attributes are

          size value is 'XxYxZ' , where X, Y and Z are numbers that
               tell the kernel the width and height of the screen in
               pixels and the number of bits per pixel.

          type tells the kernel which type of controller is being
               used, mainly to enable the correct code for display-
               memory bank switching at resolutions greater than
               640x480x1. The names vga, clgd542x, et4000, mach32, and
               s3 are supported for value.

               Note that this list does not indicate the full set of
               VGA chips supported. For example, s3 includes the
               86C801/5, 86C928, Vision864, and Vision964.  It is the
               job of vga(8) to recognize which particular chip is
               being used and to initialize it appropriately.

          hwgc tells the kernel to use a particular type of hardware
               graphics cursor.  Bt485hwgc, et4000hwgc, s3hwgc and
               tvp3020hwgc, are currently recognized values.  A value
               of off reverts to using the software cursor.

          Reading vgactl returns the current settings, one per line.

     EXAMPLES
          The following reverts to using the software graphics cursor

     Page 1                       Plan 9            (printed 12/21/24)

     VGA(3)                                                     VGA(3)

               echo -n 'hwgc off' >/dev/vgactl

          Sample code to read an x86 8-bit I/O port

               uchar
               inportb(long port)
               {
                    uchar data;

                    if(iobfd == -1)
                         iobfd = open("#v/vgaiob", ORDWR);

                    seek(iobfd, port, 0);
                    if(read(iobfd, &data, sizeof(data)) != sizeof(data))
                         error("inportb(0x%4.4x): %r0, port);
                    return data;
               }

     SOURCE
          /sys/src/9/pc/devvga.c

     SEE ALSO
          vga(8)

     BUGS
          There should be some restriction on the range of valid
          ports.

          There should be support for the hardware graphics cursor on
          the clgd54[23]x VGA controller chips.

          The hardware graphics cursor on the et4000 does not work in
          2x8-bit mode.

     Page 2                       Plan 9            (printed 12/21/24)