15 uint16_t vmem_blk; /* video memory size in 64k blocks */
21 uint16_t *accel_modes;
26 struct vbe_mode_info {
28 uint8_t wina_attr, winb_attr;
29 uint16_t win_gran, win_size;
30 uint16_t wina_seg, winb_seg;
32 uint16_t scanline_bytes;
34 /* VBE 1.2 and above */
36 uint8_t xcharsz, ycharsz;
41 uint8_t bank_size; /* bank size in KB */
42 uint8_t num_img_pages;
45 /* direct color fields */
50 uint8_t cmode_info; /* direct color mode attributes */
52 /* VBE 2.0 and above */
53 uint32_t fb_addr; /* physical address of the linear framebuffer */
54 uint32_t os_addr; /* phys. address of off-screen memory */
55 uint16_t os_size; /* size in KB of off-screen memory */
57 /* VBE 3.0 and above */
58 uint16_t lfb_scanline_bytes;
59 uint8_t banked_num_img_pages;
60 uint8_t lfb_num_img_pages;
61 uint8_t lfb_rsize, lfb_rpos;
62 uint8_t lfb_gsize, lfb_gpos;
63 uint8_t lfb_bsize, lfb_bpos;
64 uint8_t lfb_xsize, lfb_xpos;
65 uint32_t max_pixel_clock;
70 struct vbe_crtc_info {
71 uint16_t htotal, hsync_start, hsync_end;
72 uint16_t vtotal, vsync_start, vsync_end;
75 uint16_t rate_centihz; /* refresh rate in 1/100 hz (pck / (htotal * vtotal)) */
80 /* returned by vbe_scanline_info() */
81 struct vbe_scanline_info {
91 VBE_STEREO = 0x08, /* ? */
93 VBE_STEREO_VESA = 0x10, /* ? */
100 #define VBE_VER_MAJOR(v) (((v) >> 8) & 0xff)
101 #define VBE_VER_MINOR(v) ((v) & 0xff)
103 /* VBE mode attribute flags (vbe_mode_info.attr) */
105 VBE_ATTR_AVAIL = 0x0001,
106 VBE_ATTR_OPTINFO = 0x0002,
107 VBE_ATTR_TTY = 0x0004,
108 VBE_ATTR_COLOR = 0x0008,
109 VBE_ATTR_GFX = 0x0010,
111 VBE_ATTR_NOTVGA = 0x0020,
112 VBE_ATTR_BANKED = 0x0040,
113 VBE_ATTR_LFB = 0x0080,
114 VBE_ATTR_DBLSCAN = 0x0100,
116 VBE_ATTR_ILACE = 0x0200, /* ! */
117 VBE_ATTR_TRIPLEBUF = 0x0400,
118 VBE_ATTR_STEREO = 0x0800,
119 VBE_ATTR_STEREO_2FB = 0x1000,
121 VBE_ATTR_MUSTLOCK = 0x0200 /* ! */
124 /* VBE memory model type (vbe_mode_info.mem_model) */
136 /* VBE window attribute (vbe_mode_info.win(a|b)_attr) */
138 VBE_WIN_AVAIL = 0x01,
143 /* mode number flags */
145 VBE_MODE_RATE = 0x0800, /* VBE 3.0+ user-specified refresh rate */
146 VBE_MODE_ACCEL = 0x2000, /* VBE/AF */
147 VBE_MODE_LFB = 0x4000, /* VBE 2.0+ */
148 VBE_MODE_PRESERVE = 0x8000
151 /* standard mode numbers */
153 VBE_640X400_8BPP = 0x100,
154 VBE_640X480_8BPP = 0x101,
155 VBE_800X600_4BPP = 0x102,
156 VBE_800X600_8BPP = 0x103,
157 VBE_1024X768_4BPP = 0x104,
158 VBE_1024X768_8BPP = 0x105,
159 VBE_1280X1024_4BPP = 0x106,
160 VBE_1280X1024_8BPP = 0x107,
161 VBE_80X60_TEXT = 0x108,
162 VBE_132X25_TEXT = 0x109,
163 VBE_132X43_TEXT = 0x10a,
164 VBE_132X50_TEXT = 0x10b,
165 VBE_132X60_TEXT = 0x10c,
167 VBE_320X200_15BPP = 0x10d,
168 VBE_320X200_16BPP = 0x10e,
169 VBE_320X200_24BPP = 0x10f,
170 VBE_640X480_15BPP = 0x110,
171 VBE_640X480_16BPP = 0x111,
172 VBE_640X480_24BPP = 0x112,
173 VBE_800X600_15BPP = 0x113,
174 VBE_800X600_16BPP = 0x114,
175 VBE_800X600_24BPP = 0x115,
176 VBE_1024X768_15BPP = 0x116,
177 VBE_1024X768_16BPP = 0x117,
178 VBE_1024X768_24BPP = 0x118,
179 VBE_1280X1024_15BPP = 0x119,
180 VBE_1280X1024_16BPP = 0x11a,
181 VBE_1280X1024_24BPP = 0x11b,
183 VBE_1600X1200_8BPP = 0x120,
184 VBE_1600X1200_15BPP = 0x121,
185 VBE_1600X1200_16BPP = 0x122,
187 VBE_VMEM_MODE = 0x81ff
190 /* VBE CRTC flags (vbe_crtc_info.flags) */
192 VBE_CRTC_DBLSCAN = 0x01,
193 VBE_CRTC_ILACE = 0x02,
194 VBE_CRTC_HSYNC_NEG = 0x04,
195 VBE_CRTC_VSYNC_NEG = 0x08
199 VBE_STATE_CTRLHW = 0x01,
200 VBE_STATE_BIOS = 0x02,
201 VBE_STATE_DAC = 0x04,
202 VBE_STATE_REGS = 0x08,
204 VBE_STATE_ALL = 0xffff
210 VBE_SWAP_ASYNC /* schedule swap and return (triple-buffering) */
213 int vbe_info(struct vbe_info *info);
214 int vbe_num_modes(struct vbe_info *info);
215 int vbe_mode_info(int mode, struct vbe_mode_info *minf);
217 void vbe_print_info(FILE *fp, struct vbe_info *info);
218 void vbe_print_mode_info(FILE *fp, struct vbe_mode_info *minf);
220 int vbe_setmode(uint16_t mode);
221 int vbe_setmode_crtc(uint16_t mode, struct vbe_crtc_info *crtc);
222 int vbe_getmode(void);
224 int vbe_state_size(unsigned int flags);
225 int vbe_save(void *stbuf, int sz, unsigned int flags);
226 int vbe_restore(void *stbuf, int sz, unsigned int flags);
228 int vbe_setwin(int wid, int pos);
229 int vbe_getwin(int wid);
231 /* returns the actual length in pixels, which might not be what was requested */
232 int vbe_setscanlen(int len_pix);
233 int vbe_getscanlen(void);
234 int vbe_getpitch(void);
235 int vbe_scanline_info(struct vbe_scanline_info *sinf);
237 int vbe_setdisp(int x, int y, int when);
238 int vbe_swap(uint32_t voffs, int when);
239 int vbe_swap_pending(void); /* 0: not pending (done) or error, 1: pending swap */
240 /* TODO add stereo swap */