From 3526ffc094277e03d1a01435036bfb089806b88d Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Tue, 28 Mar 2023 08:12:38 +0900 Subject: [PATCH] [BLUE] Optimize ScrIoControl for speed (#5185) Optimize IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE and IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER for speed by using cache. CORE-18838 --- drivers/setup/blue/blue.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/setup/blue/blue.c b/drivers/setup/blue/blue.c index 81011fe10cc..06e498d8208 100644 --- a/drivers/setup/blue/blue.c +++ b/drivers/setup/blue/blue.c @@ -1073,6 +1073,8 @@ ScrIoControl( if (DeviceExtension->Enabled && DeviceExtension->VideoMemory) { + UCHAR attr = Buf->wAttribute; + vidmem = DeviceExtension->VideoMemory; offset = (Buf->dwCoord.X + Buf->dwCoord.Y * DeviceExtension->Columns) * 2 + 1; @@ -1082,7 +1084,7 @@ ScrIoControl( for (dwCount = 0; dwCount < nMaxLength; dwCount++) { - vidmem[offset + (dwCount * 2)] = (char)Buf->wAttribute; + vidmem[offset + (dwCount * 2)] = attr; } Buf->dwTransfered = dwCount; } @@ -1271,6 +1273,8 @@ ScrIoControl( if (DeviceExtension->Enabled && DeviceExtension->VideoMemory) { + UCHAR ch = Buf->cCharacter; + vidmem = DeviceExtension->VideoMemory; offset = (Buf->dwCoord.X + Buf->dwCoord.Y * DeviceExtension->Columns) * 2; @@ -1280,7 +1284,7 @@ ScrIoControl( for (dwCount = 0; dwCount < nMaxLength; dwCount++) { - vidmem[offset + (dwCount * 2)] = (char)Buf->cCharacter; + vidmem[offset + (dwCount * 2)] = ch; } Buf->dwTransfered = dwCount; }