rayzor

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