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.
This commit is contained in:
Ray Chason
2020-01-25 13:49:26 -05:00
committed by Pasi Kallinen
parent c0d1c4efb7
commit ab6424b31c

View File

@@ -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, &regs);
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(&regs);
} else {
(void) __dpmi_int(VIDEO_BIOS, &regs);
}
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(&regs, 0, sizeof(regs));
memset(&regs, 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 */