Page 1 of 1

[SOLVED] VESA doesnt work with QEMU on Windows 11

Posted: Wed Jul 03, 2024 10:29 am
by Xenon
Hello everyone,

I am currently working on a very simple kernel.

However, I got some issues when it comes to VESA graphics on my Windows 11 machine.
Specifically, I switch to 24bpp VESA mode, but I can only use the red and green channel, the blue channel just displays black. Also, when i set red and green bits, it display the color as white...

I tried running it on another PC (old PC, cant use it for development), where it runs just fine. (blue colors working etc)

If you wanna try it yourself, heres the git repo: https://github.com/user23078509817/kernel

I am currently using Windows 11 with an Nvidia RTX 3050, and QEMU 9.0.1 in WSL. (also tried running QEMU directly on Windows, also didnt work).

Does anyone know what could possibly be the issue?

thanks in advance!

EDIT:

I solved it. I think I am completely dumb...

For the past few years I always had the windows night mode toggled on.

tried it without, it worked.

...

Re: VESA doesnt work with QEMU on Windows 11

Posted: Wed Jul 03, 2024 9:35 pm
by Octocontrabass
Assuming your framebuffer is 24bpp, this calculation is wrong. Is this the function you're using when you see the wrong colors?

This probably isn't an issue in QEMU, but this mode might not be 24bpp everywhere. VBE 3 doesn't have fixed mode numbers, so you need to check the ModeInfoBlock for each available mode to find the one you want.

Re: VESA doesnt work with QEMU on Windows 11

Posted: Thu Jul 04, 2024 8:27 am
by Xenon
I tried outputting the vesa and videoinfo blocks using my printf. (screenshot)

It actually outputs 24bpp, 1 byte per channel plus the correct color location and bytesperline but the colors still dont show correctly.

I also updated the code you mentioned to include a * 3

Any ideas?