NAME
vga_getmodeinfo - returns pointer to mode information structure for a
mode
SYNOPSIS
#include <vga.h>
vga_modeinfo *vga_getmodeinfo(int mode );
DESCRIPTION
The function returns a pointer to a statical allocated mode information
structure which is filled out with details for a video mode mode.
#include <vga.h> defines vga_modeinfo as
typedef struct {
int width;
int height;
int bytesperpixel;
int colors;
int linewidth;
int maxlogicalwidth;
int startaddressrange;
int maxpixels;
int haveblit;
int flags;
/* Extended fields, not always available: */
int chiptype;
int memory;
int linewidth_unit;
char *linear_aperture;
int aperture_size;
void (*set_aperture_page) (int page);
void *extensions;
} vga_modeinfo;
If the given mode is out of range, NULL is returned. Beware, even when
vga_getmodeinfo() returns details about a certain mode, you must check
if it is currently available (may depend on memory size and other
details) with vga_hasmode (3).
The fields meaning in detail:
Basic mode details
width Width of mode in pixels.
height Height of mode in pixel lines.
bytesperpixel
Bytes per pixel. This is 1, 2, 3, or 4 (for 256, 32K & 64K, 16M,
16M$ modes) and 0 for planar VGA modes.
linewidth
Logical scanline width in bytes. This is the memory offset
between two pixels above each other in two adjacent screen
lines. It is not valid to assume that linewidth == width *
bytesperpixel in general!
colors The number of colors which you can display simultaneously 2, 16,
256, 32768, 65536, or 16777216. Generally 16 and 256 mean that
a color lookup table is used. 2 means that only black/white is
used and the others use some high/true color mode.
Possible modifications of the memory layout
maxlogicalwidth
The maximum logical scanline width (in bytes) which you can set
for this mode with vga_setlogicalwidth(3) while still expecting
a perfect screen image.
startaddressrange
Mask of changeable bits of start address (in pixels). All bits
zero in startaddressrange must also be zero in a call to
vga_setdisplaystart(3) when you want to avoid noisy video
signals.
Memory size
maxpixels
Maximum number of pixels that will fit in a logical screen
(depends on video memory).
Further, advanced capabilities
haveblit
Indicates whether the following bitblit functions are available.
It is a logical or of the following predefined values (which
each have only one bit set).
HAVE_BITBLIT
has vga_bitblt(3) old style accelerator function.
HAVE_FILLBLIT
has vga_fillblt(3) old style accelerator function.
HAVE_IMAGEBLIT
has vga_imageblt(3) old style accelerator function.
HAVE_HLINELISTBLIT
has vga_hlinelistblt(3) old style accelerator function.
HAVE_BLITWAIT
has vga_blitwait(3) old style accelerator function.
flags Miscellaneous flags. It is a logical or of the following
predefined values (which each have only one bit set).
HAVE_RWPAGE
vga_setreadpage(3) and vga_setwritepage(3) are available
in this mode.
IS_INTERLACED
Mode is interlaced, which means it will tend to flicker
and the user might be happier if the application chooses
another mode.
IS_MODEX
Mode user mode X like memory layout (planar 256 colors
VGA mode). See vga_setmodeX(3) for some explanations.
IS_DYNAMICMODE
Dynamically loaded mode. This mode was defined in
/etc/vga/libvga.conf by the user. He will probably prefer
its usage. However, usually this should be of no interest
to the user.
CAPABLE_LINEAR
Mode can be set to linear addressing with
vga_setlinearaddressing(3).
IS_LINEAR
Linear addressing is already enabled for this mode.
EXT_INFO_AVAILABLE
The extended fields in this information structure are set
to sensible information. If EXT_INFO_AVAILABLE is not set
you should even not access these fields as you might have
encountered an old version of svgalib and the fields
migth actually not have been allocated at all.
RGB_MISORDERED
For 16M4 modes it means that the 4 bytes per pixel
actually mean 0BGR rather than BGR0 as per default. For
16M mode it means that the 3 bytes actually mean RGB
instead of BGR.
The first is a general limitation of Mach32, the latter
one of Mach32 with a ramdac of type 4. The vga_ drawing
functions takes this into account.
HAVE_EXT_SET
A vga_ext_set(3) is available and can be called.
Extended mode information
You must check for EXT_INFO_AVAILABLE in flags before trying to access
these values.
chiptype
the chiptype that was detected/set. This specifies a subtype of
the current vga_getchipset(3) setting whose value depends on the
chipset. It should be only used for debugging or internally.
memory memory available on the SVGA card in KB.
linewidth_unit
use only a multiple of this value for set_logicalwidth(3) or
set_displaystart(3) to ensure graceful alignment of lines onto
the vga memory in this mode and for noiseless video signals.
linear_aperture
ptr to a mmaped secondary linear framebuffer (not related to the
use of vga_setlinearaddressing(3)) (NULL if unavailable)
aperture_size
size of the secondary framebuffer in KB. 0 if unavailable.
set_aperture_page
a function taking an int as parameter to select a page in the
framebuffer addressed by read/writes to this memory arey (if
aperture_size < memory.
extensions
pointer to additional, internal, chipset specific info (contents
of the EEPROM for Mach32 driver.)
The vgatest(6) demo displays most of this info for all supported modes.
SEE ALSO
svgalib(7), vgagl(7), libvga.config(5), vgatest(6), vga_hasmode(3),
vga_init(3), vga_setmode(3), vga_getcurrentmode(3),
vga_getdefaultmode(3), vga_lastmodenumber(3), vga_getmodename(3),
vga_getmodenumber(3), vga_setlogicalwidth(3), vga_bitblt(3),
vga_fillblt(3), vga_imageblt(3), vga_hlinelistblt(3), vga_blitwait(3),
vga_setmodeX(3), vga_getchipset(3), vga_ext_set(3),
vga_setlinearaddressing(3)
AUTHOR
This manual page was edited by Michael Weller <eowmob@exp-math.uni-
essen.de>. The exact source of the referenced function as well as of
the original documentation is unknown.
It is very likely that both are at least to some extent are due to Harm
Hanemaayer <H.Hanemaayer@inter.nl.net>.
Occasionally this might be wrong. I hereby asked to be excused by the
original author and will happily accept any additions or corrections to
this first version of the svgalib manual.