OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 1:34 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: circle looks like an ellipse on real display
PostPosted: Sun Nov 13, 2022 8:12 am 
Offline
Member
Member
User avatar

Joined: Sat Oct 23, 2004 11:00 pm
Posts: 154
Hi,

I have implemented a basic linear framebuffer graphics driver with support for some basic shapes like rectangles, lines, and circles.

On QEMU emulator - where I am using 800x600x32 resolution - everything looks fine. However, when I boot my OS on a real laptop, with one of the supported resolutions like 800x600x32 or 1024x768x32, the circle looks like an ellipse - stretched horizontally. The same with lines and rectangles - they are stretched horizontally.

Does anyone know why this could be the case - I think I may be committing a known/common mistake that most newbies do while writing linear framebuffer-based graphics driver

PS: I am using grub bootloader and selecting the resolution by setting gfxmode and gfxpayload variables in grub.cfg

Thanks
Prajwal

_________________
complexity is the core of simplicity


Top
 Profile  
 
 Post subject: Re: circle looks like an ellipse on real display
PostPosted: Sun Nov 13, 2022 8:43 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
Possibly the emulator is showing 800x600 in a non-widescreen 4:3 ratio window and the real hardware is stretching 800x600 to be wide screen?

_________________
My OS is Perception.


Top
 Profile  
 
 Post subject: Re: circle looks like an ellipse on real display
PostPosted: Sun Nov 13, 2022 4:34 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
That's exactly what's happening.

You can fix it by choosing a resolution that matches the shape of the laptop's screen. If possible, choose the laptop's native resolution.


Top
 Profile  
 
 Post subject: Re: circle looks like an ellipse on real display
PostPosted: Mon Nov 14, 2022 1:51 am 
Offline
Member
Member

Joined: Wed Oct 01, 2008 1:55 pm
Posts: 3191
I think that if it is an Intel laptop, you will be out of luck. Several of those only support 4x3 resolutions both using VBE and EFI, even if you have a widescreen display. Not even the BIOS manufacturer will be able to fix this as Intel only want to support operating systems that have their own native Intel display drivers. Additionally, the 4x3 emulation they provide is horribly slow.


Top
 Profile  
 
 Post subject: Re: circle looks like an ellipse on real display
PostPosted: Mon Nov 14, 2022 3:04 am 
Offline
Member
Member

Joined: Wed Mar 30, 2011 12:31 am
Posts: 676
rdos wrote:
I think that if it is an Intel laptop, you will be out of luck. Several of those only support 4x3 resolutions both using VBE and EFI, even if you have a widescreen display. Not even the BIOS manufacturer will be able to fix this as Intel only want to support operating systems that have their own native Intel display drivers. Additionally, the 4x3 emulation they provide is horribly slow.

It's definitely a poor situation on older systems, though it's usually better on EFI - you're far more likely to get native panel resolutions out of GOP. On some BIOS systems, you could patch the VGA BIOS to replace one of the available VBE modes with the native panel resolution and timings.

Luckily, Intel GPUs aren't too hard to write barebones modesetting drivers for, especially if you just want to get one specific display working. Toaru has one just for my old ThinkPad, which has a 1440x900 panel but only offered up to 1280x800 from VBE (at least that's the right aspect ratio!)

_________________
toaruos on github | toaruos.org | gitlab | twitter | bim - a text editor


Top
 Profile  
 
 Post subject: Re: circle looks like an ellipse on real display
PostPosted: Mon Nov 14, 2022 4:37 am 
Offline
Member
Member
User avatar

Joined: Sat Oct 23, 2004 11:00 pm
Posts: 154
It is an intel laptop and uses UEFI. I am relying on grub to initialize the graphics to provide me the linear framebuffer to play with. I am basically picking a resolution that is listed as one of the supported resolutions when I run the "videoinfo" command in the grub command prompt (i.e. pressing 'c' in grub boot menu, entering grub command prompt and run "videoinfo" command to list down all supported resolutions)

Quote:
Luckily, Intel GPUs aren't too hard to write barebones modesetting drivers for, especially if you just want to get one specific display working. Toaru has one just for my old ThinkPad,

Thanks for that link - I will look into this.

Thanks
Prajwal

_________________
complexity is the core of simplicity


Top
 Profile  
 
 Post subject: Re: circle looks like an ellipse on real display
PostPosted: Mon Nov 14, 2022 6:55 am 
Offline
Member
Member

Joined: Wed Oct 01, 2008 1:55 pm
Posts: 3191
klange wrote:
rdos wrote:
I think that if it is an Intel laptop, you will be out of luck. Several of those only support 4x3 resolutions both using VBE and EFI, even if you have a widescreen display. Not even the BIOS manufacturer will be able to fix this as Intel only want to support operating systems that have their own native Intel display drivers. Additionally, the 4x3 emulation they provide is horribly slow.

It's definitely a poor situation on older systems, though it's usually better on EFI - you're far more likely to get native panel resolutions out of GOP.


It's my impression that it is worst on newer systems and works better on older. Which seems to coincidence with Linux having native video drivers, and so Intel no longer feel they need to provide the native resolution of the display through VBE or EFI. They will typically support only 640x480, 800x600 and 1024x768.

klange wrote:
On some BIOS systems, you could patch the VGA BIOS to replace one of the available VBE modes with the native panel resolution and timings.

Luckily, Intel GPUs aren't too hard to write barebones modesetting drivers for, especially if you just want to get one specific display working. Toaru has one just for my old ThinkPad, which has a 1440x900 panel but only offered up to 1280x800 from VBE (at least that's the right aspect ratio!)


That's an interesting approach. Does this only work for a very specific Intel GPU, or for a larger range of models?


Top
 Profile  
 
 Post subject: Re: circle looks like an ellipse on real display
PostPosted: Mon Nov 14, 2022 8:09 am 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
My pc with an 1920x1080 display has the same problem (Nvidia QUADRO 2000).

Everything on the screen is stretched without gpu driver (in GOP and VBE mode)


Top
 Profile  
 
 Post subject: Re: circle looks like an ellipse on real display
PostPosted: Mon Nov 14, 2022 2:42 pm 
Offline
Member
Member

Joined: Wed Oct 01, 2008 1:55 pm
Posts: 3191
I have a relatively new AMD laptop with a widescreen display, and GOP has the native resolution. I've not yet seen any AMD BIOS that doesn't support the native resolution. It seems to be an Intel problem. Additionally, AMDs displays are much faster at the same resolution when using LFB.


Top
 Profile  
 
 Post subject: Re: circle looks like an ellipse on real display
PostPosted: Mon Nov 21, 2022 3:47 pm 
Offline

Joined: Fri Nov 18, 2022 1:48 pm
Posts: 3
It is wise to not assume square pixels, and provide for a way to adjust the pixel aspect ratio.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], MichaelPetch and 58 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group