Only two modes don't match their expected line length. One looks like a bug (it has a virtual line length of 1280 for a screen of 1600 bytes) and one looks like an optimization (2048 vs 1920). Change the mode line lengths to exactly match the expected line lengths so that the VBE code is correct.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- vgasrc/clext.c | 41 +++++++---------------------------------- vgasrc/vbe.c | 2 +- 2 files changed, 8 insertions(+), 35 deletions(-)
diff --git a/vgasrc/clext.c b/vgasrc/clext.c index 1736843..835d809 100644 --- a/vgasrc/clext.c +++ b/vgasrc/clext.c @@ -73,8 +73,8 @@ static u16 ccrtc_640x480x24[] VAR16 = { 0x2c11, 0x5f00,0x4f01,0x4f02,0x8003,0x5204,0x1e05,0x0b06,0x3e07, 0x4009,0x000c,0x000d, - 0xea10,0xdf12,0x0013,0x4014,0xdf15,0x0b16,0xc317,0xff18, - 0x001a,0x321b,0x001d, + 0xea10,0xdf12,0xf013,0x4014,0xdf15,0x0b16,0xc317,0xff18, + 0x001a,0x221b,0x001d, 0xffff }; /* 800x600x8 */ @@ -209,7 +209,7 @@ static u16 cseq_1600x1200x8[] VAR16 = { static u16 ccrtc_1600x1200x8[] VAR16 = { 0x2911,0xc300,0x9f01,0x9f02,0x8603,0x8304,0x9405,0x2406,0xf707, 0x6009,0x000c,0x000d, - 0x0310,0xff12,0xa013,0x4014,0xff15,0x2416,0xc317,0xff18, + 0x0310,0xff12,0xc813,0x4014,0xff15,0x2416,0xc317,0xff18, 0x001a,0x221b,0x001d, 0xffff }; @@ -583,13 +583,14 @@ cirrus_get_bpp_bytes(void) static void cirrus_set_line_offset(u16 new_line_offset) { + new_line_offset /= 8; u16 crtc_addr = stdvga_get_crtc(); outb(0x13, crtc_addr); - outb(new_line_offset / 8, crtc_addr + 1); + outb(new_line_offset, crtc_addr + 1);
outb(0x1b, crtc_addr); u8 v = inb(crtc_addr + 1); - outb((((new_line_offset / 8) & 0x100) >> 4) | (v & 0xef), crtc_addr + 1); + outb(((new_line_offset & 0x100) >> 4) | (v & 0xef), crtc_addr + 1); }
static u16 @@ -601,35 +602,7 @@ cirrus_get_line_offset(void) outb(0x1b, crtc_addr); u8 reg1b = inb(crtc_addr + 1);
- return (((reg1b << 4) & 0x100) + reg13) * 8; -} - -u16 -cirrus_get_line_offset_entry(struct cirrus_mode_s *table_g) -{ - u16 *crtc = GET_GLOBAL(table_g->crtc); - - u16 *c = crtc; - u16 reg13; - for (;;) { - reg13 = GET_GLOBAL(*c); - if ((reg13 & 0xff) == 0x13) - break; - c++; - } - reg13 >>= 8; - - c = crtc; - u16 reg1b; - for (;;) { - reg1b = GET_GLOBAL(*c); - if ((reg1b & 0xff) == 0x1b) - break; - c++; - } - reg1b >>= 8; - - return (((reg1b << 4) & 0x100) + reg13) * 8; + return (((reg1b & 0x10) << 4) + reg13) * 8; }
static void diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c index ee80e97..14efece 100644 --- a/vgasrc/vbe.c +++ b/vgasrc/vbe.c @@ -106,7 +106,7 @@ vbe_104f01(struct bregs *regs) SET_FARVAR(seg, info->win_func_ptr.segoff, 0x0); int width = GET_GLOBAL(vmode_g->width); int height = GET_GLOBAL(vmode_g->height); - int linesize = width * DIV_ROUND_UP(depth, 8); // XXX - not always true + int linesize = width * DIV_ROUND_UP(depth, 8); SET_FARVAR(seg, info->bytes_per_scanline, linesize); SET_FARVAR(seg, info->xres, width); SET_FARVAR(seg, info->yres, height);