OSDev.org
https://forum.osdev.org/

Bochs / VmWare VGA driver: list of available modes
https://forum.osdev.org/viewtopic.php?f=1&t=33490
Page 1 of 1

Author:  fano1 [ Thu Feb 07, 2019 3:00 am ]
Post subject:  Bochs / VmWare VGA driver: list of available modes

Hello!

As VBE has a way to get the list of the available modes that the GPU supports I expected to have the possibility to query this in the native drivers but I do not find a function to get these modes neither in Bochs "VBE" neither in VmWare documentation. I say more I've clearly the impression that I can set the virtual GPU in any mode I want (strange one as 1200x1000 to say), I tough maybe it is because they are virtual GPU so I hardcoded some modes that make sense for me...

I could query VBE at boot time (when in real mode) to read the VBEModeInfo but not all modes supported will be present (I have read here that for example 16:9 ones could be not listed!) and I've checked the Intel and AMD native drivers - really confusing documentation - and well I find nothing to get those "available modes"...

So then I've a doubt this concept makes sense or is only in my mind?

There are the monitors that have "available modes" but not GPU perhaps?

Author:  Octocontrabass [ Thu Feb 07, 2019 9:24 am ]
Post subject:  Re: Bochs / VmWare VGA driver: list of available modes

The available modes are the ones that are supported by both the display and the GPU. The display provides information (EDID, DisplayID) to tell you which modes it supports. You, the GPU driver developer, are expected to know the capabilities of the GPU.

Sometimes the display will tell you a range of timings it supports, rather than specific modes. In that case, you'll probably want to refer to standard display modes (VESA has a pretty good list) and pick the ones that fit in that range.

You may also want to allow the user to customize the mode, in case the display doesn't/can't accurately report its capabilities.

Author:  Combuster [ Thu Feb 07, 2019 10:32 am ]
Post subject:  Re: Bochs / VmWare VGA driver: list of available modes

Monitors have been over the place over the many years. Old ones only support one horizontal or vertical frequency and will literally burn out if given something else. For this reason you probably won't find any one of these anymore. CRT circuitry was later improved with frequency detection modules which would tune to a small assortment of predefined settings, leading to the prefab settings of 640x480, 800x600 and 1024x768. Some might be forgiving and try to render nearby relations, drawing part of it off the side of the electron tube, possibly with some buttons to help you put the image in place. Not all monitors supported EDID, or any of its discrete predecessors, which probably lead to conservative listings in the video BIOS. In practice, any somewhat modern CRT will just eat whatever you give it. The structure inside ultimately decides which resolutions you get "sharp" on one, but in all its a forgiving device.
Video BIOSes have gone through a similar cycle: predefined modes up to the VGA, then VESA added new mode numbers to preset resolutions, then dropped the list again later - which of course made all the BIOSes stick to the numbers anyway. You'll notice that many of them effectively ship the VESA mode list and be done with it.

The flat panels have started this cycle all over again - with some early ones again burning out on wrong signals. They have horrible aliasing issues compared to CRTs, but they usually do support resolutions other than their native ones. And they all self-identify. The BIOS-cycle has also started all over: In all cases I've been able to test so far, EFI offered very few resolutions, particularly compared to when the very same system in legacy mode provided way more opportunities. For laptops this is probably a good thing, but for desktops its straight up a step backwards.

As far as acceleration abilities are concerned, most simply support any multiple of 8, 16 or 32 in each direction. The only exception to that I've seen is the Voodoo 1, whose 3D engine only has a single bit to select either 640 or 800 horizontal. Feel free to look up its age for comparison. Resolutions are usually less tightly bound, with verticals typically having no alignment at all - this is due to the vertical synchronisation signal traditionally lasting for a period one horizontal line.

Bochs is even simpler: it typically runs as a window and as such has no size restrictions of any sort. It will thus accept any resolution provided up to a built-in memory limit. The shipped BIOS however is a different story: Bochs has emulations for different video hardware, and they are all controlled by the same BIOS blob. In addition, it tries to do whatever the average computer would do: it too will list the stock VESA modes - and it will quite happily suggest 1280x1024 on 1366x768 laptop panels. The window manager will not scale for you, and this time there's absolutely no way for you to detect this condition.

Author:  fano1 [ Thu Feb 07, 2019 11:28 am ]
Post subject:  Re: Bochs / VmWare VGA driver: list of available modes

Hmm said in this way seems there is really no a way to get this list... but Windows have it!
My PC has NVIDIA 6150 GPU which maximum resolution accepted is 1920*1080 and indeed when I've connect to HDMI 4K screen I'm limited to that maximum resolution...

Windows show me a simple combo-box with other resolutions too... until I think the legacy VGA (640x480), for all of them I can select the refresh rate (23, 24, 50, 59 and 60) information this that VESA does not does.

Really the Windows NVIDIA driver has hardcoded these mode tables based on the GPU model?

Author:  Octocontrabass [ Fri Feb 08, 2019 4:03 am ]
Post subject:  Re: Bochs / VmWare VGA driver: list of available modes

fano1 wrote:
Really the Windows NVIDIA driver has hardcoded these mode tables based on the GPU model?

Probably not.

It's true that they most likely have a hardcoded table of common modes, but it's independent of GPU model. When they decide which modes to show you, they take that big list, add any modes specified by the display, and then remove any modes that aren't supported by both the display and the GPU.

Here's a list of modes standardized by VESA. (PDF) It's pretty old, and it doesn't include modes specified by other standards, but it's a good start.

Author:  fano1 [ Fri Feb 08, 2019 6:14 am ]
Post subject:  Re: Bochs / VmWare VGA driver: list of available modes

It is correct that while these mode are "standardized" monitor and GPU manufacturer are free to ignore them, right?

I can imagine two algorithms here:

Bochs / VmWare (virtual GPU in general):

  • suppose the GPU supports all resolutions it is only a window in the end :D
  • read EDID of the monitor to get the lists of resolution the monitor support [1]
    • EDID broken / not supported: list only VESA "safe" modes
    • EDID working: add them to the list
  • The "default mode" is the monitor preferred mode or the most closer to it if not in the list. It is the mode will be automatically selected.

Real GPU:

  • read EDID of the monitor to get the lists of resolution the monitor support [1]
    • EDID broken / not supported: list only VESA "safe" modes
    • EDID working: add them to the list
  • Check each of the modes in the list to see if the GPU support it, looking at the HaikuOS source code of NVIDIA driver it seems that it is a subtractive process (there is a routine to understand if the GPU accepts a mode NOT a function to get the mode supported)
  • The "default mode" is the monitor preferred mode or the most closer to it if not in the list. It is the mode will be automatically selected.

[1] When I'm using VmWare / Bochs the EDID infos are of my real monitor or a VmWare / Bochs emulated display?

Author:  Octocontrabass [ Fri Feb 08, 2019 7:09 am ]
Post subject:  Re: Bochs / VmWare VGA driver: list of available modes

fano1 wrote:
It is correct that while these mode are "standardized" monitor and GPU manufacturer are free to ignore them, right?

Of course. GPUs are usually flexible enough to produce signals well outside any established standard, but most displays have trouble with nonstandard timings.

fano1 wrote:
When I'm using VmWare / Bochs the EDID infos are of my real monitor or a VmWare / Bochs emulated display?

If that information is available, it'll be from the emulated display.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/