From 52b42ec9750893349540256bdabdd09a6f975a6a Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sat, 3 Jul 2021 18:52:45 +0100 Subject: [PATCH] Enabled AVX + Changed flush to flush 2 pixels per iteration. --- src/cpu.pas | 23 +++++++++++++++++++++++ src/driver/video/video.pas | 10 +++++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/cpu.pas b/src/cpu.pas index 97f427a4..cc7d6db7 100644 --- a/src/cpu.pas +++ b/src/cpu.pas @@ -291,6 +291,28 @@ begin end; end; +procedure enableAVX(); +begin + if CPUID.Capabilities1^.AVX then begin + asm + PUSH EAX + PUSH ECX + PUSH EDX + XOR ECX, ECX + db $0F + db $01 + db $D0 + OR EAX, 7 + db $0F + db $01 + db $D1 + POP EDX + POP ECX + POP EAX + end; + end; +end; + procedure init(); begin terminal.registerCommand('CPU', @Terminal_Command_CPU, 'CPU Info.'); @@ -300,6 +322,7 @@ begin getCPUCapabilities; getCPUClockSpeed; enableSSE; + enableAVX; end; end. \ No newline at end of file diff --git a/src/driver/video/video.pas b/src/driver/video/video.pas index 505aac53..c53da7f6 100644 --- a/src/driver/video/video.pas +++ b/src/driver/video/video.pas @@ -125,14 +125,14 @@ end; procedure Flush(); var x,y : uint32; - Back,Front : PuInt32; + Back,Front : PuInt64; begin if not(VESA.BackBuffer.Initialized) then exit; - Back:= PUint32(VESA.BackBuffer.Location); - Front:= PuInt32(VESA.Framebuffer.Location); - for x:=0 to VESA.Framebuffer.Width-1 do begin - for y:=0 to VESA.Framebuffer.Height-1 do begin + Back:= PUint64(VESA.BackBuffer.Location); + Front:= PuInt64(VESA.Framebuffer.Location); + for x:=0 to (VESA.Framebuffer.Width-1) div 2 do begin + for y:=0 to (VESA.Framebuffer.Height-1) div 2 do begin Front[(Y * VESA.Framebuffer.Width)+X]:= Back[(Y * VESA.Framebuffer.Width)+X]; end; end;