aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/sys/vesa/screencpy.c
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-11-14 19:32:23 +0000
committerMatt Fleming <matt.fleming@intel.com>2012-11-15 12:26:42 +0000
commit4b0851493dce7cb5a6ada6e525da0bda6f5048dd (patch)
treeed512ff09b7554ef73b20d3b9c1070be6fb6a45d /com32/lib/sys/vesa/screencpy.c
parentbd7ce1bbf3393be32ee63a5139fffd1aae11c7fd (diff)
downloadsyslinux-4b0851493dce7cb5a6ada6e525da0bda6f5048dd.tar.gz
syslinux-4b0851493dce7cb5a6ada6e525da0bda6f5048dd.tar.xz
syslinux-4b0851493dce7cb5a6ada6e525da0bda6f5048dd.zip
sys/vesa: Modularise common vesa code
There's lots of the vesa infrastructure that can be shared for both BIOS and EFI, so share the things that are common and split out the things that are not into firmware-specific functions and use the 'firmware' structure to access them. This commit is part of a series of changes that removes all EFI-specific code from everywhere except efi/, which means we can delete inclusion of any gnu-efi header files and remove gnu-efi paths from CFLAGS. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'com32/lib/sys/vesa/screencpy.c')
-rw-r--r--com32/lib/sys/vesa/screencpy.c46
1 files changed, 3 insertions, 43 deletions
diff --git a/com32/lib/sys/vesa/screencpy.c b/com32/lib/sys/vesa/screencpy.c
index 32dce9e6..5c6d9151 100644
--- a/com32/lib/sys/vesa/screencpy.c
+++ b/com32/lib/sys/vesa/screencpy.c
@@ -34,13 +34,8 @@
#include "vesa.h"
#include "video.h"
-static struct win_info {
- char *win_base;
- size_t win_pos;
- size_t win_size;
- int win_gshift;
- int win_num;
-} wi;
+
+static struct win_info wi;
void __vesacon_init_copy_to_screen(void)
{
@@ -71,47 +66,12 @@ void __vesacon_init_copy_to_screen(void)
}
}
-static void set_window_pos(size_t win_pos)
-{
- static com32sys_t ireg;
-
- wi.win_pos = win_pos;
-
- if (wi.win_num < 0)
- return; /* This should never happen... */
-
- 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);
-}
-
void __vesacon_copy_to_screen(size_t dst, const uint32_t * src, size_t npixels)
{
- size_t win_pos, win_off;
- size_t win_size = wi.win_size;
- size_t omask = win_size - 1;
- char *win_base = wi.win_base;
- size_t l;
size_t bytes = npixels * __vesacon_bytes_per_pixel;
char rowbuf[bytes + 4] __aligned(4);
const char *s;
s = (const char *)__vesacon_format_pixels(rowbuf, src, npixels);
-
- while (bytes) {
- win_off = dst & omask;
- win_pos = dst & ~omask;
-
- if (__unlikely(win_pos != wi.win_pos))
- set_window_pos(win_pos);
-
- l = min(bytes, win_size - win_off);
- memcpy(win_base + win_off, s, l);
-
- bytes -= l;
- s += l;
- dst += l;
- }
+ firmware->vesa->screencpy(dst, s, bytes, &wi);
}