vgabios: Extract out current mode finding into new function.
[seabios.git] / vgasrc / vgabios.h
index 7c5e8d352288f8bb0a8a4d670fa9dc390b1c419f..6a3a379738777a18a1e93d3c204177c1a2af19a4 100644 (file)
@@ -4,8 +4,20 @@
 #include "types.h" // u8
 #include "farptr.h" // struct segoff_s
 
-#define SCREEN_IO_START(x,y,p) (((((x)*(y)) | 0x00ff) + 1) * (p))
-#define SCREEN_MEM_START(x,y,p) SCREEN_IO_START(((x)*2),(y),(p))
+// standard BIOS Video Parameter Table
+struct VideoParam_s {
+    u8 twidth;
+    u8 theightm1;
+    u8 cheight;
+    u16 slength;
+    u8 sequ_regs[4];
+    u8 miscreg;
+    u8 crtc_regs[25];
+    u8 actl_regs[20];
+    u8 grdc_regs[9];
+} PACKED;
+
+extern struct VideoParam_s video_param_table[29];
 
 struct saveBDAstate {
     u8 video_mode;
@@ -43,12 +55,15 @@ struct saveBDAstate {
 #define MM_DIRECT          0x06
 #define MM_YUV             0x07
 
-// vgatables.c
-struct vgamode_s;
-struct vgamode_s *find_vga_entry(u8 mode);
-void build_video_param(void);
-extern struct VideoSavePointer_s video_save_pointer_table;
-extern u8 static_functionality[];
+struct vgamode_s {
+    u8 memmodel;
+    u16 width;
+    u16 height;
+    u8 depth;
+    u8 cwidth;
+    u8 cheight;
+    u16 sstart;
+};
 
 // vgafonts.c
 extern u8 vgafont8[];
@@ -58,7 +73,7 @@ extern u8 vgafont14alt[];
 extern u8 vgafont16alt[];
 
 // vgabios.c
-extern u16 VgaBDF;
+extern int VgaBDF;
 #define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val))
 struct carattr {
     u8 car, attr, use_attr;
@@ -66,6 +81,8 @@ struct carattr {
 struct cursorpos {
     u8 x, y, page;
 };
+u16 calc_page_size(u8 memmodel, u16 width, u16 height);
+struct vgamode_s *get_current_mode(void);
 void modeswitch_set_bda(int mode, int flags, struct vgamode_s *vmode_g);
 
 // vgafb.c
@@ -77,21 +94,14 @@ void vgafb_write_pixel(u8 color, u16 x, u16 y);
 u8 vgafb_read_pixel(u16 x, u16 y);
 
 // vbe.c
+u32 VBE_total_memory;
+u32 VBE_capabilities;
+u32 VBE_framebuffer;
+u16 VBE_win_granularity;
 #define VBE_OEM_STRING "SeaBIOS VBE(C) 2011"
 #define VBE_VENDOR_STRING "SeaBIOS Developers"
 #define VBE_PRODUCT_STRING "SeaBIOS VBE Adapter"
 #define VBE_REVISION_STRING "Rev. 1"
-
-struct vbe_modeinfo
-{
-    u16 width;
-    u16 height;
-    u8 depth;
-    u16 linesize;
-    u32 phys_base;
-    u32 vram_size;
-};
-
 struct bregs;
 void handle_104f(struct bregs *regs);