VGA(4)                    OpenBSD Programmer's Manual                   VGA(4)

NAME
     vga - VGA graphics driver for wscons

SYNOPSIS
     vga0 at isa?
     vga* at pci?
     wsdisplay* at vga?
     option PCIAGP

DESCRIPTION
     This driver handles VGA graphics hardware within the wscons(4) console
     framework.  It doesn't provide direct device driver entry points but
     makes its functions available via the internal wsdisplay(4) interface.

     The vga driver supports multiple virtual screens on one physical display.
     The screens allocated on one display can be of different ``types'', where
     a type refers to various display properties.  The type is determined at
     the time the virtual screen is created and can't be changed later.
     Screens are either created at kernel startup (then the default type is
     used) or later with help of the wsconscfg(8) utility.

     Currently, the following screen types are supported:

     80x25   This is the standard VGA text mode with 80 columns and 25 rows.
             16 different colors can be displayed at the same time.  Charac-
             ters are 8 x 16 pixels large, and a font consists of 256 charac-
             ters.  A built-in font of this size is always present on a VGA
             card.  It's also possible to use a downloaded font instead.

     80x25bf A modified version of the previous.  It only allows 8 colors to
             be displayed.  In exchange, it can access two fonts at the same
             time, so that 512 different characters can be displayed.

     80x40   A text mode with 80 columns and 40 rows.  Similar to the standard
             mode, 16 colors and 256 characters are available.  Characters are
             8 x 10 pixels large.  For this mode to be useful, a font of that
             character size must be downloaded.

     80x40bf A modified version of the previous.  It only allows 8 colors to
             be displayed.  In exchange, it can access two fonts at the same
             time, so that 512 different characters can be displayed.

     80x50   A text mode with 80 columns and 50 rows.  Similar to the standard
             mode, 16 colors and 256 characters are available.  Characters are
             8 x 8 pixels large.  For this mode to be useful, a font of that
             character size must be downloaded.

     80x50bf A modified version of the previous.  It only allows 8 colors to
             be displayed.  In exchange, it can access two fonts at the same
             time, so that 512 different characters can be displayed.

     80x24   A variant of the ``80x25'' screen type which displays 24 lines
             only.  It uses the standard 8x16 VGA font.  This mode might be
             useful for applications which depend on closer DEC VT100 compati-
             bility.

     80x24bf A modified version of the previous.  It only allows 8 colors to
             be displayed.  In exchange, it can access two fonts at the same
             time, so that 512 different characters can be displayed.

     The vga driver can display fonts of the original IBM type and ISO-8859-1
     encoded fonts.  As an experimental feature, the ``higher half'' fonts of
     the former OpenBSD/i386 pcvt driver distribution can be used too if
     option WSCONS_SUPPORT_PCVTFONTS was set at kernel compile time.  This is
     only useful with the ``*bf'' screen types; a font containing the ASCII
     range of characters must be available too on this screen.

AGP SUPPORT
     option PCIAGP enables support for programming the AGP GART through
     ioctl(2), which is used by the X server on some architectures.

     The following ioctl(2) operations can be performed on /dev/ttyC0, and are
     defined in <sys/agpio.h>:

     AGPIOC_INFO
             Returns information about the AGP subsystem.  The result is a
             pointer to the following structure:

             typedef struct _agp_info {
                     agp_version version;  /* version of driver (unused)   */
                     u_int32_t bridge_id;  /* bridge vendor/device         */
                     u_int32_t agp_mode;   /* mode info of bridge          */
                     off_t aper_base;      /* base of aperture             */
                     size_t aper_size;     /* size of aperture             */
                     size_t pg_total;      /* max pages (swap + system)    */
                     size_t pg_system;     /* max pages (system)           */
                     size_t pg_used;       /* current pages used           */
             } agp_info;

     AGPIOC_ACQUIRE
             Acquire control of the AGP chipset for use by this client.  Re-
             turns EBUSY if the AGP chipset is already acquired by another
             client.

     AGPIOC_RELEASE
             Release control of the AGP chipset.  This does not unbind or free
             any allocated memory, which is the responsibility of the client
             to handle if necessary.

     AGPIOC_SETUP
             Enable the AGP hardware with the relevant mode.  This ioctl(2)
             takes the following structure:

             typedef struct _agp_setup {
                     u_int32_t agp_mode;   /* mode info of bridge */
             } agp_setup;

             The mode bits are defined in <sys/agpio.h>.

     AGPIOC_ALLOCATE
             Allocate physical memory suitable for mapping into the AGP aper-
             ture.  This ioctl(2) takes the following structure:

             typedef struct _agp_allocate {
                     int key;              /* tag of allocation            */
                     size_t pg_count;      /* number of pages              */
                     u_int32_t type;       /* 0 == normal, other devspec   */
                     u_int32_t physical;   /* device specific (some devices
                                            * need a phys address of the
                                            * actual page behind the gatt
                                            * table)                       */
             } agp_allocate;

             It returns a handle to the allocated memory.

     AGPIOC_DEALLOCATE
             Free the previously allocated memory associated with the handle
             passed.

     AGPIOC_BIND
             Bind the allocated memory at given offset with the AGP aperture.
             Returns EINVAL if the memory is already bound or the offset is
             not at AGP page boundary.  This ioctl(2) takes the following
             structure:

             typedef struct _agp_bind {
                     int key;         /* tag of allocation            */
                     off_t pg_start;  /* starting page to populate    */
             } agp_bind;

             The tag of allocation is the handle returned by AGPIOC_ALLOCATE.

     AGPIOC_UNBIND
             Unbind memory from the AGP aperture.  Returns EINVAL if the memo-
             ry is not bound.  This ioctl(2) takes the following structure:

             typedef struct _agp_unbind {
                     int key;                /* tag of allocation         */
                     u_int32_t priority;     /* priority for paging out   */
             } agp_unbind;

SEE ALSO
     ioctl(2), intro(4), isa(4), pcdisplay(4), pci(4), wscons(4),
     wsdisplay(4), wsconscfg(8), wsfontload(8)

BUGS
     Only a subset of the possible text modes is supported.

     VGA cards are supposed to emulate an MDA if a monochrome display is con-
     nected.  In this case, the device will naturally not support colors at
     all, but offer the capability to display underlined characters instead.
     The ``80x25bf'', ``80x40bf'', ``80x50bf'', and ``80x24bf'' screen types
     will not be available.  This mode of operation is not tested.

OpenBSD 4.0                     March 20, 1999                               3
