From ab6424b31c23dafc98aa7031b76446ad1f25fbb7 Mon Sep 17 00:00:00 2001 From: Ray Chason Date: Sat, 25 Jan 2020 13:49:26 -0500 Subject: [PATCH] Call the window function directly if supported Some BIOSes allow calling the window function directly, bypassing the logic that distinguishes this call from other BIOS calls. Should be faster on some systems. --- sys/msdos/vidvesa.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/msdos/vidvesa.c b/sys/msdos/vidvesa.c index f1e1848ef..07a76219e 100644 --- a/sys/msdos/vidvesa.c +++ b/sys/msdos/vidvesa.c @@ -120,6 +120,7 @@ static unsigned short vesa_y_center; /* Y centering offset */ static unsigned short vesa_scan_line; /* Bytes per scan line */ static int vesa_read_win; /* Select the read window */ static int vesa_write_win; /* Select the write window */ +static unsigned long vesa_win_func; static unsigned long vesa_win_pos[2]; /* Window position */ static unsigned long vesa_win_addr[2]; /* Window physical address */ static unsigned long vesa_win_size; /* Window size */ @@ -245,7 +246,14 @@ unsigned long offset; regs.h.bl = window; regs.x.dx = offset / vesa_win_gran; pos = regs.x.dx * vesa_win_gran; - (void) __dpmi_int(VIDEO_BIOS, ®s); + + if (vesa_win_func != 0) { + regs.x.cs = vesa_win_func >> 16; + regs.x.ip = vesa_win_func & 0xFFFF; + (void) __dpmi_simulate_real_mode_procedure_retf(®s); + } else { + (void) __dpmi_int(VIDEO_BIOS, ®s); + } vesa_win_pos[window] = pos; } @@ -921,7 +929,7 @@ vesa_detect() dosmemput(&vbe_info, sizeof(vbe_info), vbe_info_seg * 16L); /* Request VESA BIOS information */ - memset(®s, 0, sizeof(regs)); + memset(®s, 0, sizeof(regs)); regs.x.ax = 0x4F00; regs.x.di = 0; regs.x.es = vbe_info_seg; @@ -1004,6 +1012,7 @@ vesa_detect() break; } } + vesa_win_func = mode_info.WinFuncPtr; vesa_win_addr[0] = mode_info.WinASegment * 16L; vesa_win_addr[1] = mode_info.WinBSegment * 16L; vesa_win_pos[0] = 0xFFFFFFFF; /* position unknown */ -- 2.50.0