[SOLVED] VESA doesnt work with QEMU on Windows 11

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Xenon
Posts: 2
Joined: Wed Jul 03, 2024 10:22 am
Libera.chat IRC: xenon

[SOLVED] VESA doesnt work with QEMU on Windows 11

Post 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.

...
Last edited by Xenon on Thu Jul 04, 2024 10:21 am, edited 1 time in total.
Octocontrabass
Member
Member
Posts: 5560
Joined: Mon Mar 25, 2013 7:01 pm

Re: VESA doesnt work with QEMU on Windows 11

Post 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.
Xenon
Posts: 2
Joined: Wed Jul 03, 2024 10:22 am
Libera.chat IRC: xenon

Re: VESA doesnt work with QEMU on Windows 11

Post 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?
Attachments
screen.png
Post Reply