summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-12-10 14:28:53 -0800
committerH. Peter Anvin <hpa@zytor.com>2007-12-10 14:28:53 -0800
commit504383a4f0194c8e26e0db66171ca702452f27be (patch)
tree11c240fe9ad2566792b75caf07cb8a9dd0b95c3d
parentebde32062eb97d6315b0a0d850b8054cf4dfdfca (diff)
downloadsyslinux-504383a4f0194c8e26e0db66171ca702452f27be.tar.gz
Fix handling of VESA modes with noncontiguous memory buffers
Handle VESA modes with noncontiguous memory buffers. In particular, this applies to Qemu/KVM in Cirrus emulation mode.
-rw-r--r--com32/lib/sys/vesa/background.c4
-rw-r--r--com32/lib/sys/vesa/drawtxt.c11
-rw-r--r--com32/lib/sys/vesa/initvesa.c4
3 files changed, 10 insertions, 9 deletions
diff --git a/com32/lib/sys/vesa/background.c b/com32/lib/sys/vesa/background.c
index cc515fb0..9f23ae28 100644
--- a/com32/lib/sys/vesa/background.c
+++ b/com32/lib/sys/vesa/background.c
@@ -57,8 +57,8 @@ static void draw_background_line(int line, int start, int npixels)
unsigned int bytes_per_pixel = __vesacon_bytes_per_pixel;
enum vesa_pixel_format pixel_format = __vesacon_pixel_format;
uint8_t *fbptr = (uint8_t *)__vesa_info.mi.lfb_ptr +
- (line*VIDEO_X_SIZE+start)*bytes_per_pixel;
-
+ line*__vesa_info.mi.logical_scan + start*bytes_per_pixel;
+
lbp = line_buf;
while (npixels--)
lbp = format_pixel(lbp, *bgptr++, pixel_format);
diff --git a/com32/lib/sys/vesa/drawtxt.c b/com32/lib/sys/vesa/drawtxt.c
index 5accd861..dde85b0b 100644
--- a/com32/lib/sys/vesa/drawtxt.c
+++ b/com32/lib/sys/vesa/drawtxt.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 2006 H. Peter Anvin - All Rights Reserved
+ * Copyright 2006-2007 H. Peter Anvin - All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -83,7 +83,7 @@ static void vesacon_update_characters(int row, int col, int nrows, int ncols)
int i, j, jx, pixrow, pixsrow;
struct vesa_char *rowptr, *rowsptr, *cptr, *csptr;
unsigned int bytes_per_pixel = __vesacon_bytes_per_pixel;
- unsigned long pixel_offset, bytes_per_row;
+ unsigned long pixel_offset;
uint8_t row_buffer[VIDEO_X_SIZE*4], *rowbufptr;
uint8_t *fbrowptr;
uint8_t sha;
@@ -108,8 +108,9 @@ static void vesacon_update_characters(int row, int col, int nrows, int ncols)
break;
}
- bytes_per_row = bytes_per_pixel*VIDEO_X_SIZE;
- fbrowptr = ((uint8_t *)__vesa_info.mi.lfb_ptr)+pixel_offset*bytes_per_pixel;
+ fbrowptr = ((uint8_t *)__vesa_info.mi.lfb_ptr) +
+ (row*height+VIDEO_BORDER) * __vesa_info.mi.logical_scan +
+ (col*width+VIDEO_BORDER) * bytes_per_pixel;
/* Note that we keep a 1-character guard area around the real text area... */
rowptr = &__vesacon_text_display[(row+1)*(TEXT_PIXEL_COLS/FONT_WIDTH+2)+(col+1)];
@@ -197,7 +198,7 @@ static void vesacon_update_characters(int row, int col, int nrows, int ncols)
copy_dword(fbrowptr, row_buffer, (rowbufptr-row_buffer) >> 2);
bgrowptr += VIDEO_X_SIZE;
- fbrowptr += bytes_per_row;
+ fbrowptr += __vesa_info.mi.logical_scan;
if (++pixrow == height) {
rowptr += TEXT_PIXEL_COLS/FONT_WIDTH+2;
diff --git a/com32/lib/sys/vesa/initvesa.c b/com32/lib/sys/vesa/initvesa.c
index c70f1cdb..c3bf175f 100644
--- a/com32/lib/sys/vesa/initvesa.c
+++ b/com32/lib/sys/vesa/initvesa.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1999-2006 H. Peter Anvin - All Rights Reserved
+ * Copyright 1999-2007 H. Peter Anvin - All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -163,7 +163,7 @@ static int vesacon_set_mode(void)
if ( (mi->mode_attr & 0x009b) != 0x009b )
continue;
- /* Must be 640x480, 32 bpp */
+ /* Must be 640x480 */
if ( mi->h_res != VIDEO_X_SIZE || mi->v_res != VIDEO_Y_SIZE )
continue;