new vbe sortof works
[retroray] / src / dos / vidsys.h
1 #ifndef VIDSYS_VIDEO_H_
2 #define VIDSYS_VIDEO_H_
3
4 #include <stdlib.h>
5 #include "sizeint.h"
6
7 struct vid_drvops;
8
9 struct vid_color {
10         int r, g, b;
11 };
12
13 struct vid_gfxops {
14         void (*pack)(uint32_t *pix, int r, int g, int b);
15         void (*unpack)(uint32_t pix, int *r, int *g, int *b);
16         void (*setpal)(int idx, int count, const struct vid_color *col);
17         void (*getpal)(int idx, int count, struct vid_color *col);
18         void (*vsync)(void);
19
20         void (*clear)(uint32_t color);
21         void (*blitfb)(void *fb, int pitch);
22         void (*flip)(int vsync);
23
24         void (*fill)(int x, int y, int w, int h, uint32_t color);
25         void (*blit)(int x, int y, int w, int h, void *img, int pitch);
26         void (*line)(int x0, int y0, int x1, int y1, uint32_t color);
27         void (*hline)(int x, int y, int len, uint32_t color);
28         void (*vline)(int x, int y, int len, uint32_t color);
29 };
30
31 struct vid_driver {
32         const char *name;
33         int prio;
34
35         struct vid_modeinfo *modes;
36         int num_modes;
37
38         struct vid_drvops *ops;
39 };
40
41 struct vid_modeinfo {
42         int modeno;
43         int width, height, bpp, pitch;
44         int ncolors;
45         uint32_t rmask, gmask, bmask;
46         int rshift, gshift, bshift;
47         int pages;
48         int win_size, win_gran, win_step;
49         uint32_t vmem_addr;
50         size_t vmem_size;
51         int lfb;
52
53         struct vid_driver *drv;
54         struct vid_gfxops ops;
55 };
56
57 int vid_init(void);
58 void vid_cleanup(void);
59
60 int vid_curmode(void);
61 void *vid_setmode(int mode);
62 int vid_findmode(int xsz, int ysz, int bpp);
63 struct vid_modeinfo *vid_modeinfo(int mode);
64
65 void vid_vsync(void);                           /* defined in drv_vga.c */
66 int vid_setwin(int win, int pos);       /* defined in drv_vbe.c */
67
68 /* current mode functions */
69 int vid_islinear(void);
70 int vid_isbanked(void);
71
72 void vid_setpal(int idx, int count, const struct vid_color *col);
73 void vid_getpal(int idx, int count, struct vid_color *col);
74
75 void vid_blitfb(void *fb, int pitch);
76 void vid_blitfb32(uint32_t *fb, int pitch);
77
78 #endif  /* VIDSYS_VIDEO_H_ */