If you think that in large resolutions (1024x768 and more) screen redrawing is slow, here is the solution:
1) for vbemp.sys - http://www.geocities.com/bearwindows/vbemp.htm
Hive : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Vbemp\Device0 or HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Vgasave\Device0 in legacy mode Key : Acceleration.Level Value : (REG_DWORD) = 5
2) for vga.sys
Hive : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Vgasave\Device0 Key : Acceleration.Level Value : (REG_DWORD) = 5
Note 1: This trick works in Windows2000/XP/2003. But NOT in Windows NT 4 and others.
Note 2: For "normal accelerated drivers" like made by AMD-ATI, Intel, nVidia and others Acceleration.Level=5 key SLOWDOWNS redraw. Do not set it. In this case, optimal setting is Acceleration.Level=0 or when this key is not exist.
Acceleration.Level is a tricky key that controls how Windows changes functionality of a vendor (or Microsoft) supplied display driver.
Taken from here: http://msdn2.microsoft.com/en-us/library/ms797865.aspx and here: http://msdn2.microsoft.com/en-us/library/ms797471.aspx Windows Driver Kit: Display Devices Dynamic Change of Permitted Driver Accelerations The driver's acceleration level can be changed through the user interface by using the slider that is produced by clicking on the Display icon in Control Panel. Depending on the value set with this slider, GDI allows the following levels of driver accelerations listed in the following table. 0 All display driver accelerations are permitted. 1 DrvSetPointerShape and DrvCreateDeviceBitmap are disabled. 2 In addition to 1, more sophisticated display driver accelerations are disallowed, including DrvStretchBlt, DrvFillPath, DrvGradientFill, DrvLineTo, DrvAlphaBlend, and DrvTransparentBlt. 3 In addition to 2, all DirectDraw and Direct3D accelerations are disallowed. 4 In addition to 3, almost all display driver accelerations are disallowed, except for solid color fills, DrvCopyBits, DrvTextOut, and DrvStrokePath. DrvEscape is disabled. 5 No hardware accelerations are allowed. The driver will only be called to do bit-block transfers from a system memory surface to the screen.Pp. 5 means that driver (i.e. vbemp.sys, vga.sys, any other unaccelerated one) only do its job when transferring data from system memory to video memory is performed which is a rather FAST operation due to hardware write optimization in every modern (and not so modern) videoadapter. PCI/AGP/PCI-E (and even ISA/VLB!) videoadapters also uses CPU's speedup features of MTRR registers and USWC ( http://en.wikipedia.org/wiki/Uncacheable_Speculative_Write_Combining ) (Moving are made, for example using REPE MOVSD in 32bit color modes). But transferring data from video memory to system memory is SLOW even if you have an accelerated card and a "simple" driver. But who handles other operations when pp.5 is selected (or slider moved to "No acceleration")? Windows (i.e. win32k.sys) handles them. Using this tool ( http://www.stereopsis.com/blttest/ ). I discovered that reading from video memory to system memory is faster in pp.5 mode comparing to pp.0,1,2,3,4. Reading/Writing from system memory to video memory is performing thousand and hundreds of times when you:
P.S. In bsd/linux world (which is rather clear due to OpenSource and so on...) this feature named correctly as shadow acceleration. It minimizes reading from video memory using temporary buffer (or cache) in compter's system RAM. This buffer equals in size to video memory size of display window.
Not so long away I mention on my site regarding XP/2003's VGA driver:
Comparing to my VBEMP driver, VGA.SYS ... .... cannot switch to modes less than 640x480...
It means that even if card supports such modes (as 512x384, 320x200, 320x240, 400x300, 640x350, 640x400 and so on - in its VESA BIOS) - VGA.SYS will filter and remove them, regardless of its color resolution (8/15/16/24 or 32 bit). These modes are good for games (such as Quake1/2, HalfLife1, some others) as when VGA.SYS is used no acceleration is provided and game will work faster in low-res mode using less CPU power. Also it is good when low-res "< 640x480" modes are needed and you, for some reasons, cannot use VBEMP at all.
To resolve this problem, I make a simple patch to VGA.SYS that allows to use ANY MODE from VESA modetables which card can theoretically support (as it made in VBEMP).
1. Find this code in VGA.SYS by searching for hex string "E0 01" (480)
668178128002 cmp w,[eax],00280;X Resolution is 640 0F82F3010000 jb .000014B10;less than 640, skip it 66817814E001 cmp w,[eax],001E0;Y Resolution is 480 0F82E7010000 jb .000014B10;less than 480, skip itand change it:
668178124001 cmp w,[eax],00140;X Resolution is 320 0F82F3010000 jb .000014B10;less than 320, skip it 66817814C800 cmp w,[eax],000C8;Y Resolution is 200 0F82E7010000 jb .000014B10;less than 200, skip itI.e you must change "80 02" to "40 01" (640 to 320) and "E0 01" to "C8 00" (480 to 200). It will work as I don't know any mode that will be less than 320x200. :) Don't forget to recalculate the checksum of VGA.SYS in PE-header after all modifications or this patched VGA.SYS WILL NOT load. Windows checks every driver checksum before it can successfully load it. You can use editbin tool from Microsoft's Visual Studio or Platform SDK:
editbin /RELEASE VGA.SYS
Some years ago I found a file in %SystemRoot%\SYSTEM32\ with interesting name - MODEX.DLL.
Firstly I thought that it was for some kinda Mode X ( http://en.wikipedia.org/wiki/Mode_X ) and/or DirectX stuff. But I don't know what for exactly. Now I examine it and can tell what this mysterious dll is it for. Let's begin. Windows 2000/XP/2003 contains some internal universal kernel-mode display driver dlls. They provide support for working with different types of screen bitmap surfaces:
VGA.DLL - used for 4-bit (16 color modes) in conjunction with VGA.SYS VGA256.DLL - used for BANKED 8-bit (256 color modes) in conjunction with VGA.SYS, VBEMP.SYS (XP+) VGA64K.DLL - used for BANKED 16/24/32-bit (truecolor modes) in conjunction with VGA.SYS, VBEMP.SYS (XP+) FRAMEBUF.DLL - used for LINEAR 8/16/24/32-bit (256/truecolor modes) in conjunction with VGA.SYS (XP+), VBEMP.SYS and finally MODEX.DLL - used for BANKED ModeX 8-bit (256 color modes) WITH WIDTH OF 320 LINES in conjunction with VGA.SYS, VBEMP.SYS (planned)
The main problem that this dll is not mentioned in any documentation and even in *.inf files stored in %SystemRoot%\INF\ directory. It also disabled in registry by default. So to enable it you must insert it there manually.
In Windows XP/2003, VGA.SYS provides support for such modes, regardless of VESA BIOS support for them, which is good (some Matrox cards, for example, doesn't have 320-line modes in it's VESA BIOS):
320x200 8-bit 70 Hz 320x240 8-bit 60 Hz 320x400 8-bit 70 Hz 320x480 8-bit 60 HzThese modes are multi-plane (4 or 8 planes) so moves from/to display surface is somewhat faster than in ordinary linear modes with the same dimensions, especially when moved bitmap width is clearly divided by 8. QUAKE II has support for 320x240x8 mode. To enable MODEX.DLL use for VGA.SYS in Windows XP/2003 (Windows 2000 doesn't have a native VESA video driver so you can use VBEMP for it): For VGA.SYS: append to REG_MULTI_SZ InstalledDisplayDrivers value from
modexP.S. VBEMP.SYS support for MODEX.DLL is now done and planned to release in current month. This support covers only Windows 2000/XP/2003 version of VBEMP.