aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/sys/vesa/screencpy.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-02-13 19:00:12 -0800
committerH. Peter Anvin <hpa@zytor.com>2008-02-13 19:00:12 -0800
commitbc1081b746cc3a224470567990364bf62162b405 (patch)
treec713af8aa792ab2f66a0ef88a56e08a46cde84e1 /com32/lib/sys/vesa/screencpy.c
parent2079650b3e6dbe302fe27e5256fd412894c2f4b9 (diff)
downloadsyslinux.git-bc1081b746cc3a224470567990364bf62162b405.tar.gz
syslinux.git-bc1081b746cc3a224470567990364bf62162b405.tar.xz
syslinux.git-bc1081b746cc3a224470567990364bf62162b405.zip
VESA: move pixel formatting into __vesacon_copy_to_screen()syslinux-3.62-pre5
Make pixel formatting an integral part of __vesacon_copy_to_screen(). In order to cut down on the dispatch overhead, make the formatting functions contain the pixel loop, so we only do indirect dispatch twice per pixel row - once for the formatting and once for copying to the screen.
Diffstat (limited to 'com32/lib/sys/vesa/screencpy.c')
-rw-r--r--com32/lib/sys/vesa/screencpy.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/com32/lib/sys/vesa/screencpy.c b/com32/lib/sys/vesa/screencpy.c
index a8be4306..f526de5a 100644
--- a/com32/lib/sys/vesa/screencpy.c
+++ b/com32/lib/sys/vesa/screencpy.c
@@ -42,7 +42,7 @@ static struct win_info {
} wi;
static void *
-vesacon_copy_to_paged_screen(void *dst, const void *src, size_t len);
+memcpy_to_paged_screen(void *dst, const void *src, size_t len);
static inline int __constfunc ilog2(unsigned int x)
{
@@ -50,15 +50,17 @@ static inline int __constfunc ilog2(unsigned int x)
return x;
}
+static void * (*memcpy_to_screen)(void *, const void *, size_t);
+
void __vesacon_init_copy_to_screen(void)
{
struct vesa_mode_info * const mi = &__vesa_info.mi;
int winn;
if (mi->mode_attr & 0x0080) {
- __vesacon_copy_to_screen = memcpy; /* Really easy... */
+ memcpy_to_screen = memcpy;
} else {
- __vesacon_copy_to_screen = vesacon_copy_to_paged_screen;
+ memcpy_to_screen = memcpy_to_paged_screen;
mi->lfb_ptr = 0; /* Zero-base this */
wi.win_pos = -1; /* Undefined position */
@@ -76,8 +78,17 @@ void __vesacon_init_copy_to_screen(void)
}
}
+void __vesacon_copy_to_screen(void *dst, const uint32_t *src, size_t npixels)
+{
+ size_t bytes = npixels * __vesacon_bytes_per_pixel;
+ char rowbuf[bytes+4];
+
+ __vesacon_format_pixels(rowbuf, src, npixels);
+ memcpy_to_screen(dst, rowbuf, bytes);
+}
+
static void *
-vesacon_copy_to_paged_screen(void *dst, const void *src, size_t len)
+memcpy_to_paged_screen(void *dst, const void *src, size_t len)
{
size_t win_pos, win_off;
size_t win_size = wi.win_size;
@@ -86,18 +97,16 @@ vesacon_copy_to_paged_screen(void *dst, const void *src, size_t len)
size_t l;
size_t d = (size_t)dst;
const char *s = src;
- com32sys_t ireg;
-
- memset(&ireg, 0, sizeof ireg);
- ireg.eax.w[0] = 0x4F05; /* VBE Window Control */
- /* BH = 0 -> Set memory window */
- ireg.ebx.b[0] = wi.win_num;
while (len) {
win_off = d & omask;
win_pos = d & ~omask;
if (win_pos != wi.win_pos) {
+ com32sys_t ireg;
+ memset(&ireg, 0, sizeof ireg);
+ ireg.eax.w[0] = 0x4F05;
+ ireg.ebx.b[0] = wi.win_num;
ireg.edx.w[0] = win_pos >> wi.win_gshift;
__intcall(0x10, &ireg, NULL);
wi.win_pos = win_pos;