Files
reactos/drivers/base
Dmitry Borisov 5d5a280f2a [BOOTVID:VGA] Reduce the number of VGA graphics controller state transitions (#9026)
Add a variable to remember what the current VGA graphics controller state
is, in order to avoid many unnecessary I/O port accesses, which are slow.

There are two main paths that trigger it:

1. Calling PrepareForSetPixel() for each character in a string:
- VidDisplayString > DisplayCharacter > PrepareForSetPixel
- VidDisplayStringXY > DisplayCharacter > PrepareForSetPixel

2. Calling PrepareForSetPixel() for each row in a RLE run:
- RleBitBlt > PrepareForSetPixel
- RleBitBlt > VidSolidColorFill > PrepareForSetPixel

See below for the patch results (measured in number of ReadWriteMode() calls):

BEFORE:
LiveCD graphics mode:  1702
LiveCD debug:          1515
LiveCD debug (screen): 16046
BSoD screen drawing:   867

AFTER:
LiveCD graphics mode:  3
LiveCD debug:          95
LiveCD debug (screen): 570
BSoD screen drawing:   36

----

Timing measurements (by hbelusca):

BEFORE:
- DisplayBootBitmap(Gfx): 415.3ms
- DisplayBootBitmap(SOS): 311.5ms
- KiDisplayBlueScreen:    655.4ms

AFTER:
- DisplayBootBitmap(Gfx): 390.7ms (-5.9%)
- DisplayBootBitmap(SOS): 307.7ms (-1.2%)
- KiDisplayBlueScreen:    651.0ms (-0.7%)
2026-11-03 00:15:19 +01:00
..
…
…