diff options
-rw-r--r-- | vgasrc/cbvga.c | 7 | ||||
-rw-r--r-- | vgasrc/stdvga.c | 5 | ||||
-rw-r--r-- | vgasrc/vbe.c | 2 | ||||
-rw-r--r-- | vgasrc/vgahw.h | 6 | ||||
-rw-r--r-- | vgasrc/vgautil.h | 2 |
5 files changed, 21 insertions, 1 deletions
diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c index 39ffdbb2..417ade3a 100644 --- a/vgasrc/cbvga.c +++ b/vgasrc/cbvga.c @@ -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; diff --git a/vgasrc/stdvga.c b/vgasrc/stdvga.c index 886deca0..0e24297e 100644 --- a/vgasrc/stdvga.c +++ b/vgasrc/stdvga.c @@ -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 diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c index facad198..724c1bad 100644 --- a/vgasrc/vbe.c +++ b/vgasrc/vbe.c @@ -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); diff --git a/vgasrc/vgahw.h b/vgasrc/vgahw.h index dab2b4dd..2a85eba8 100644 --- a/vgasrc/vgahw.h +++ b/vgasrc/vgahw.h @@ -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 diff --git a/vgasrc/vgautil.h b/vgasrc/vgautil.h index 08c4e8dc..fae5fbae 100644 --- a/vgasrc/vgautil.h +++ b/vgasrc/vgautil.h @@ -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 |