Getting performant VESA video output
Posted: Wed Oct 07, 2015 1:16 am
Hey 
I've implemented a windowing system that works itself quite performant and well. Still, it doesn't feel as smooth as I'd want it to, because theres a huge bottleneck: the video output.
My rather primitive approach to write the pixels to the output looks like this. It only works for LFBs and 24 or 32 bit modes. So the thing is, it works, but in VirtualBox it takes about 10ms to blit stuff. I only blit the area of the screen that is actually "dirty" (like where the mouse cursor moves or a button is clicked).
"invalid" is the rectangle to be written out, "sourceSize" is the size of the internal buffer, "source" is the internal argb buffer.
So my question is, how can you get a more performant video output? Or is that as good as it gets? VirtualBox is okay, but it just feels very slow in QEMU. Any help is greatly appreciated. 
Greets,
Max
Oh, by the way, I've updated the Ghost website, you can leave comments now: http://ghostkernel.org/
I've implemented a windowing system that works itself quite performant and well. Still, it doesn't feel as smooth as I'd want it to, because theres a huge bottleneck: the video output.
My rather primitive approach to write the pixels to the output looks like this. It only works for LFBs and 24 or 32 bit modes. So the thing is, it works, but in VirtualBox it takes about 10ms to blit stuff. I only blit the area of the screen that is actually "dirty" (like where the mouse cursor moves or a button is clicked).
"invalid" is the rectangle to be written out, "sourceSize" is the size of the internal buffer, "source" is the internal argb buffer.
Code: Select all
void vbe_video_output_t::blit(g_rectangle invalid, g_rectangle sourceSize, g_color_argb* source) {
uint16_t bpp = video_mode_information.bpp;
uint8_t* position = ((uint8_t*) video_mode_information.lfb) + (invalid.y * video_mode_information.bpsl);
uint32_t right = invalid.x + invalid.width;
uint32_t bottom = invalid.y + invalid.height;
if (bpp == 32) {
for (int y = invalid.y; y < bottom; y++) {
uint32_t* position4 = (uint32_t*) position;
for (int x = invalid.x; x < right; x++) {
position4[x] = source[y * sourceSize.width + x];
}
position += video_mode_information.bpsl;
}
} else if (bpp == 24) {
for (int y = invalid.y; y < bottom; y++) {
for (int x = invalid.x; x < right; x++) {
g_color_argb color = source[y * sourceSize.width + x];
position[x * 3] = color & 0xFF;
position[x * 3 + 1] = (color >> 8) & 0xFF;
position[x * 3 + 2] = (color >> 16) & 0xFF;
}
position += video_mode_information.bpsl;
}
}
}Greets,
Max
Oh, by the way, I've updated the Ghost website, you can leave comments now: http://ghostkernel.org/