]> xenbits.xensource.com Git - people/andrewcoop/seabios.git/commitdiff
SeaVGABIOS/vbe: Query driver for scanline pitch v2
authorPatrick Rudolph <siro@das-labor.org>
Mon, 29 May 2017 17:25:12 +0000 (19:25 +0200)
committerKevin O'Connor <kevin@koconnor.net>
Mon, 12 Jun 2017 19:17:09 +0000 (15:17 -0400)
Query the driver for the real scanline pitch in bytes.

As cbvga doesn't change the pitch on mode change, always
return the same pitch, that might exceed width times Bytes-per-pixel.

Report the default stdvga pitch for all other drivers.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
vgasrc/cbvga.c
vgasrc/stdvga.c
vgasrc/vbe.c
vgasrc/vgahw.h
vgasrc/vgautil.h

index 39ffdbb26796f604126173c9182309e74d7e31f5..417ade3af90df0c5d13f478cc48d02ea71c11f03 100644 (file)
@@ -115,6 +115,13 @@ cbvga_set_mode(struct vgamode_s *vmode_g, int flags)
     return 0;
 }
 
+int
+cbvga_get_linesize(struct vgamode_s *vmode_g)
+{
+    /* Can't change mode, always report active pitch. */
+    return GET_GLOBAL(CBlinelength);
+}
+
 #define CB_TAG_FRAMEBUFFER      0x0012
 struct cb_framebuffer {
     u32 tag;
index 886deca0f315f1ad1d47bab2cb2b46d08b8f19cd..0e24297e4d8b5e64f1f4be450fc456f66e650720 100644 (file)
@@ -321,6 +321,11 @@ stdvga_set_dacformat(struct vgamode_s *vmode_g, int val)
     return -1;
 }
 
+int
+stdvga_get_linesize(struct vgamode_s *vmode_g)
+{
+    return DIV_ROUND_UP(vmode_g->width * vga_bpp(vmode_g), 8);
+}
 
 /****************************************************************
  * Save/Restore state
index facad1982b9b56a1b58987887b68f6963bd13cdb..724c1bad6d7a8f612e05c198223fb418c194837c 100644 (file)
@@ -107,7 +107,7 @@ vbe_104f01(struct bregs *regs)
     // Basic information about mode.
     int width = GET_GLOBAL(vmode_g->width);
     int height = GET_GLOBAL(vmode_g->height);
-    int linesize = DIV_ROUND_UP(width * vga_bpp(vmode_g), 8);
+    int linesize = vgahw_get_linesize(vmode_g);
     SET_FARVAR(seg, info->bytes_per_scanline, linesize);
     SET_FARVAR(seg, info->xres, width);
     SET_FARVAR(seg, info->yres, height);
index dab2b4dd37e4604f6e5c7b2f7860b45bd03d6591..2a85eba8d7a8d1c065adad91c8f8dca166740cf9 100644 (file)
@@ -139,4 +139,10 @@ static inline int vgahw_save_restore(int cmd, u16 seg, void *data) {
     return stdvga_save_restore(cmd, seg, data);
 }
 
+static inline int vgahw_get_linesize(struct vgamode_s *vmode_g) {
+    if (CONFIG_VGA_COREBOOT)
+        return cbvga_get_linesize(vmode_g);
+    return stdvga_get_linesize(vmode_g);
+}
+
 #endif // vgahw.h
index 08c4e8dca0794196e249e300581a221a0f8152a5..fae5fbaeefb91c90e1963d2ba17b6b0c769ce486 100644 (file)
@@ -17,6 +17,7 @@ int cbvga_get_dacformat(struct vgamode_s *vmode_g);
 int cbvga_set_dacformat(struct vgamode_s *vmode_g, int val);
 int cbvga_save_restore(int cmd, u16 seg, void *data);
 int cbvga_set_mode(struct vgamode_s *vmode_g, int flags);
+int cbvga_get_linesize(struct vgamode_s *vmode_g);
 int cbvga_setup(void);
 
 // clext.c
@@ -63,6 +64,7 @@ void stdvga_list_modes(u16 seg, u16 *dest, u16 *last);
 void stdvga_build_video_param(void);
 void stdvga_override_crtc(int mode, u8 *crtc);
 int stdvga_set_mode(struct vgamode_s *vmode_g, int flags);
+int stdvga_get_linesize(struct vgamode_s *vmode_g);
 void stdvga_set_packed_palette(void);
 
 // swcursor.c