small DOS vga improvement

Andreas Mohr andi at
Fri Jan 17 18:08:21 CST 2003

Hi all,

inline small frequently used functions to use less CPU cycles :-)

This patch resulted from an investigation on why Turbo Pascal was slow like
Note that the reason that TP6 is so slow is that it seems to be polling
the VGA I/O sync bit for every character printed, resulting in a drawing
speed of approximately 0.5 lines/second...
In other words: we should try to find a way to increase the frequency
of the VGA sync refresh bit updates...

Or maybe instead of automatically updating the refresh bits, what about
updating them on I/O access only ?
(i.e. calculate it from the last time they have been accessed and deduce the
current status that the bits are supposed to be in currently at the
given current time ?)
After all every I/O access *is* being trapped, so we should make use of
that and not opt for the stupid way of unconditionally periodically
updating the bits...

I mean: somehow NT-based systems need to achieve the very same thing,
and I guess they're doing it the "proper" way, whatever that may be...

Index: dlls/winedos/vga.c
RCS file: /home/wine/wine/dlls/winedos/vga.c,v
retrieving revision 1.27
diff -u -r1.27 vga.c
--- dlls/winedos/vga.c	7 Jan 2003 20:36:23 -0000	1.27
+++ dlls/winedos/vga.c	18 Jan 2003 00:15:57 -0000
@@ -278,29 +278,29 @@
-static void VGA_InstallTimer(unsigned Rate)
+static void VGA_InstallTimer(unsigned rate)
     if (!VGA_timer_thread)
         VGA_timer = CreateWaitableTimerA( NULL, FALSE, NULL );
         VGA_timer_thread = CreateThread( NULL, 0, VGA_TimerThread, NULL, 0, NULL );
-    QueueUserAPC( set_timer_rate, VGA_timer_thread, (ULONG_PTR)Rate );
+    QueueUserAPC( set_timer_rate, VGA_timer_thread, (ULONG_PTR)rate );
-static BOOL VGA_IsTimerRunning(void)
+static inline BOOL VGA_IsTimerRunning(void)
     return VGA_timer_thread ? TRUE : FALSE;
-HANDLE VGA_AlphaConsole(void)
+static inline HANDLE VGA_AlphaConsole(void)
     /* this assumes that no Win32 redirection has taken place, but then again,
      * only 16-bit apps are likely to use this part of Wine... */
     return GetStdHandle(STD_OUTPUT_HANDLE);
+static inline char *VGA_AlphaBuffer(void)
     return (char *)0xb8000;
@@ -470,7 +470,7 @@
 /* Get a single [char wide] color in 16 color mode. */
-char VGA_GetColor16(int reg)
+inline char VGA_GetColor16(int reg)
     if (!lpddraw) return 0;
@@ -532,7 +532,7 @@
     return sdesc.lpSurface;
-void VGA_Unlock(void)
+inline void VGA_Unlock(void)
@@ -564,7 +564,7 @@
  * Get start of 64k window at 0xa0000 in bytes.
  * Value is -1 in color plane modes.
-int VGA_GetWindowStart()
+inline int VGA_GetWindowStart()
     return vga_fb_window;

Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany

More information about the wine-patches mailing list