rayzor
view src/vbe.h @ 11:fe94d9e986ae
optimized 16bpp swap_buffers
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 10 Apr 2014 08:42:33 +0300 |
parents | |
children |
line source
1 #ifndef VBE_H_
2 #define VBE_H_
4 #include "inttypes.h"
6 #define VBE_ATTR_LFB (1 << 7)
7 #define VBE_MODE_LFB (1 << 14)
9 #pragma pack (push, 0)
10 struct vbe_info {
11 uint8_t sig[4];
12 uint16_t version;
13 uint32_t oem_str_ptr;
14 uint8_t caps[4]; /* capabilities */
15 uint32_t vid_mode_ptr; /* vbefarptr to video mode list */
16 uint16_t total_mem; /* num of 64k mem blocks */
17 uint16_t oem_sw_rev; /* VBE implementation software revision */
18 uint32_t oem_vendor_name_ptr;
19 uint32_t oem_product_name_ptr;
20 uint32_t oem_product_rev_ptr;
21 uint8_t reserved[222];
22 uint8_t oem_data[256];
23 };
25 struct vbe_mode_info {
26 uint16_t mode_attr;
27 uint8_t wina_attr, winb_attr;
28 uint16_t win_gran, win_size;
29 uint16_t wina_seg, winb_seg;
30 uint32_t win_func;
31 uint16_t scanline_bytes;
33 /* VBE 1.2 and above */
34 uint16_t xres, yres;
35 uint8_t xcharsz, ycharsz;
36 uint8_t num_planes;
37 uint8_t bpp;
38 uint8_t num_banks;
39 uint8_t mem_model;
40 uint8_t bank_size; /* bank size in KB */
41 uint8_t num_img_pages;
42 uint8_t reserved1;
44 /* direct color fields */
45 uint8_t rmask_size, rpos;
46 uint8_t gmask_size, gpos;
47 uint8_t bmask_size, bpos;
48 uint8_t xmask_size, xpos;
49 uint8_t cmode_info; /* direct color mode attributes */
51 /* VBE 2.0 and above */
52 uint32_t fb_addr; /* physical address of the linear framebuffer */
53 uint32_t reserved2;
54 uint16_t reserved3;
56 uint8_t reserved4[206];
57 };
58 #pragma pack (pop)
60 struct vbe_info *vbe_get_info(void);
61 struct vbe_mode_info *vbe_get_mode_info(unsigned int mode);
63 int vbe_set_mode(unsigned int mode);
65 int vbe_set_palette_bits(int bits);
66 void vbe_set_palette(int idx, int *col, int count, int bits);
68 void print_mode_info(FILE *fp, struct vbe_mode_info *modei);
70 #endif /* VBE_H_ */