EFI GOP lying about screen resolution?
Posted: Wed Mar 06, 2024 3:40 pm
Hello,
I came across strange issue when trying to print text on one of my laptops.
Everything started when I started testing my code on bare metal, and one machine behaved different than others. Instead of text, it showed some trash on the screen.
I started investigating this and after a while I realized that the problem is not connected with my putchar() implementation, but with framebuffer itself.
I have not noticed anything earlier, as all I tested on bare metal was to clear screen (or draw full screen filled rectangle), what worked fine. But when I modified my clearscreen function to draw clear just the 1/4 of the screen it also produced some artifacts.
I use GOP and GOP reports that current mode is 1024x768x32. So I use below code to draw a horizontal line at the top of the screen:
and it is drawn too long (fills whole line 0 and a bit more than half of line 1). I tried to use hardcoded value (1024) instead of FrameBufferData.Width, but this gives exact result.
When I wanted to draw a rectangle (0,0, 1024/2, 768/2), what on qemu and other hardware looked fine, with below code:
this one affected laptop gave me the following result:
What is strange, when I try to fill full screen, it works properly. But that's the only thing that works here...
This is what GOP protocol reports about video mode:
Finally, I tried running Limine 7.0.5. and the result is very similar:
Anyone came across similar issue?
Is it possible to get FB working properly on this hardware or should I consider this as a firmware bug and don't bother about it any longer?
I came across strange issue when trying to print text on one of my laptops.
Everything started when I started testing my code on bare metal, and one machine behaved different than others. Instead of text, it showed some trash on the screen.
I started investigating this and after a while I realized that the problem is not connected with my putchar() implementation, but with framebuffer itself.
I have not noticed anything earlier, as all I tested on bare metal was to clear screen (or draw full screen filled rectangle), what worked fine. But when I modified my clearscreen function to draw clear just the 1/4 of the screen it also produced some artifacts.
I use GOP and GOP reports that current mode is 1024x768x32. So I use below code to draw a horizontal line at the top of the screen:
Code: Select all
for(PositionX = 0; PositionX < FrameBufferData.Width; PositionX++)
FrameBufferData.Address[PositionX] = 0xFFFFFF;
When I wanted to draw a rectangle (0,0, 1024/2, 768/2), what on qemu and other hardware looked fine, with below code:
Code: Select all
for(PositionX = 0; PositionX < HlpFrameBufferData.Width / 2; PositionX++)
{
for(PositionY = 0; PositionY < HlpFrameBufferData.Height / 2; PositionY++)
{
FrameBufferIndex = PositionY * HlpFrameBufferData.Width + PositionX;
HlpFrameBufferData.Address[FrameBufferIndex] = 0x00000077;
}
}
What is strange, when I try to fill full screen, it works properly. But that's the only thing that works here...
This is what GOP protocol reports about video mode:
Finally, I tried running Limine 7.0.5. and the result is very similar:
Anyone came across similar issue?
Is it possible to get FB working properly on this hardware or should I consider this as a firmware bug and don't bother about it any longer?