File: vga_getmodeinfo.3

package info (click to toggle)
svgalib 1%3A1.4.3-33
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 8,012 kB
  • sloc: ansic: 60,381; makefile: 1,138; asm: 630; sh: 86; perl: 54; pascal: 49
file content (281 lines) | stat: -rw-r--r-- 7,113 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
.TH vga_getmodeinfo 3 "27 July 1997" "Svgalib (>= 1.2.11)" "Svgalib User Manual"
.SH NAME
vga_getmodeinfo \- returns pointer to mode information structure for a mode
.SH SYNOPSIS

.B "#include <vga.h>"

.BI "vga_modeinfo *vga_getmodeinfo(int " mode " );

.SH DESCRIPTION
The function returns a pointer to a statical allocated mode information structure which is
filled out with details for a video mode
.IR mode .

.B "#include <vga.h>"
defines
.B vga_modeinfo
as

.B typedef struct {
.br
.B "    " int width;
.br
.B "    " int height;
.br
.B "    " int bytesperpixel;
.br
.B "    " int colors;
.br
.B "    " int linewidth;
.br
.B "    " int maxlogicalwidth;
.br
.B "    " int startaddressrange;
.br
.B "    " int maxpixels;
.br
.B "    " int haveblit;
.br
.B "    " int flags;
.br
/* Extended fields, not always available: */
.br
.B "    " int chiptype;
.br
.B "    " int memory;
.br
.B "    " int linewidth_unit;
.br
.B "    " char *linear_aperture;
.br
.B "    " int aperture_size;
.br
.B "    " void (*set_aperture_page) (int page);
.br
.B "    " void *extensions;
.br
.B } vga_modeinfo;

If the given
.I mode
is out of range,
.B NULL
is returned.
.BR Beware ,
even when
.B 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
.B vga_hasmode (3).

The fields meaning in detail:

.SS Basic mode details
.TP
.B width
Width of mode in pixels.
.TP
.B height
Height of mode in pixel lines.
.TP
.B bytesperpixel
Bytes per pixel. This is 1, 2, 3, or 4 (for 256, 32K & 64K, 16M, 16M$ modes) and 0 for planar
VGA modes.
.TP
.B linewidth
Logical scanline width in bytes. This is the memory offset between two pixels above each other
in two adjacent screen lines. It is
.B not
valid to assume that
.BR linewidth " == " width " * " bytesperpixel
in general!
.TP
.B 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.
.SS Possible modifications of the memory layout
.TP
.B maxlogicalwidth
The maximum logical scanline width (in bytes) which you can set for this mode with
.BR vga_setlogicalwidth (3)
while still expecting a perfect screen image.
.TP
.B startaddressrange
Mask of changeable bits of start address (in pixels). All bits zero in
.B startaddressrange
must also be zero in a call to
.BR vga_setdisplaystart (3)
when you want to avoid noisy video signals.
.SS Memory size
.TP
.B maxpixels
Maximum number of pixels that will fit in a logical screen (depends on video memory).
.SS Further, advanced capabilities
.TP
.B 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).
.RS
.TP
.B HAVE_BITBLIT
has
.BR vga_bitblt (3)
old style accelerator function.
.TP
.B HAVE_FILLBLIT
has
.BR vga_fillblt (3)
old style accelerator function.
.TP
.B HAVE_IMAGEBLIT
has
.BR vga_imageblt (3)
old style accelerator function.
.TP
.B HAVE_HLINELISTBLIT
has
.BR vga_hlinelistblt (3)
old style accelerator function.
.TP
.B HAVE_BLITWAIT
has
.BR vga_blitwait (3)
old style accelerator function.
.RE
.PP
.TP
.B flags
Miscellaneous flags.  It is a logical or
of the following predefined values (which each have only one bit set).
.RS
.TP
.B HAVE_RWPAGE
.BR vga_setreadpage "(3) and " vga_setwritepage (3)
are available in this mode.
.TP
.B IS_INTERLACED
Mode is interlaced, which means it will tend to flicker and the user might be happier if the
application chooses another mode.
.TP
.B IS_MODEX
Mode user mode X like memory layout (planar 256 colors VGA mode). See
.BR vga_setmodeX (3)
for some explanations.
.TP
.B IS_DYNAMICMODE
Dynamically loaded mode. This mode was defined in
.I /etc/vga/libvga.conf
by the user. He will probably prefer its usage. However, usually this should
be of no interest to the user.
.TP
.B CAPABLE_LINEAR
Mode can be set to linear addressing with
.BR vga_setlinearaddressing (3).
.TP
.B IS_LINEAR
Linear addressing is already enabled for this mode.
.TP
.B 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.
.TP
.B 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
.B vga_
drawing functions takes this into account.
.TP
.B HAVE_EXT_SET
A
.BR vga_ext_set (3)
is available and can be called.
.RE
.SS Extended mode information
You must check for
.B EXT_INFO_AVAILABLE
in
.B flags
before trying to access these values.
.TP
.B chiptype
the chiptype that was detected/set. This specifies a subtype of the current
.BR vga_getchipset (3)
setting whose value depends on the chipset. It should be only used for
debugging or internally.
.TP
.B memory
memory available on the SVGA card in KB.
.TP
.B linewidth_unit
use only a multiple of this value for
.BR 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.
.TP
.B linear_aperture
ptr to a mmaped secondary linear framebuffer (not related to the use of
.BR vga_setlinearaddressing (3))
.RB ( NULL
if unavailable)
.TP
.B aperture_size
size of the secondary framebuffer in KB. 0 if unavailable.
.TP
.B 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
.BR aperture_size " < " memory .
.TP
.B extensions
pointer to additional, internal, chipset specific info
(contents of the EEPROM for Mach32 driver.)
.PP
The
.BR vgatest (6)
demo displays most of this info for all supported modes.

.SH SEE ALSO

.BR svgalib (7),
.BR vgagl (7),
.BR libvga.config (5),
.BR vgatest (6),
.BR vga_hasmode (3),
.BR vga_init (3),
.BR vga_setmode (3),
.BR vga_getcurrentmode (3),
.BR vga_getdefaultmode (3),
.BR vga_lastmodenumber (3),
.BR vga_getmodename (3),
.BR vga_getmodenumber (3),
.BR vga_setlogicalwidth (3),
.BR vga_bitblt (3),
.BR vga_fillblt (3),
.BR vga_imageblt (3),
.BR vga_hlinelistblt (3),
.BR vga_blitwait (3),
.BR vga_setmodeX (3),
.BR vga_getchipset (3),
.BR vga_ext_set (3),
.BR vga_setlinearaddressing (3)

.SH 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.