Skip to content

Commit f0fc24f

Browse files
committed
Use SSE also in VBE video output
1 parent 1cacd76 commit f0fc24f

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

applications/windowserver/src/video/vbe_video_output.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "vbe_video_output.hpp"
2222
#include <libvbedriver/vbedriver.hpp>
2323
#include <stdio.h>
24+
#include <immintrin.h>
2425

2526
bool g_vbe_video_output::initializeWithSettings(uint32_t width, uint32_t height, uint32_t bits)
2627
{
@@ -37,17 +38,25 @@ void g_vbe_video_output::blit(g_rectangle invalid, g_rectangle sourceSize, g_col
3738
uint16_t bpp = videoModeInformation.bpp;
3839
uint8_t* position = ((uint8_t*) videoModeInformation.lfb) + (invalid.y * videoModeInformation.bpsl);
3940

40-
uint32_t right = invalid.x + invalid.width;
41-
uint32_t bottom = invalid.y + invalid.height;
41+
int right = invalid.x + invalid.width;
42+
int bottom = invalid.y + invalid.height;
4243

4344
if(bpp == 32)
4445
{
4546
for(int y = invalid.y; y < bottom; y++)
4647
{
48+
auto sourceRow = &source[y * sourceSize.width];
49+
4750
auto position4 = (uint32_t*) position;
48-
for(int x = invalid.x; x < right; x++)
51+
int x = invalid.x;
52+
for(; x < right - 4; x += 4)
53+
{
54+
__m128i data = _mm_loadu_si128((__m128i*) &sourceRow[x]);
55+
_mm_storeu_si128((__m128i*) &position4[x], data);
56+
}
57+
for(; x < right; x++)
4958
{
50-
position4[x] = source[y * sourceSize.width + x];
59+
position4[x] = sourceRow[x];
5160
}
5261
position += videoModeInformation.bpsl;
5362
}

0 commit comments

Comments
 (0)