Question about probing VGA space

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
devsau
Member
Member
Posts: 35
Joined: Thu Jun 13, 2013 12:07 pm

Question about probing VGA space

Post by devsau »

So after parsing acpi boot arch and verifying VGA space, (this is on a real board btw) So there exists onboard video (with a vga adapter) then a pci device (ive determined via class code to be VGA compatible) which is my actual video card.

so question is, wouldnt the traditional VGA space at A0000 belong to the onboard adapter? or would the bios see that another adapter is connected and somehow remap this? :?
Casm
Member
Member
Posts: 221
Joined: Sun Oct 17, 2010 2:21 pm
Location: United Kingdom

Re: Question about probing VGA space

Post by Casm »

Perhaps they are both recipients of writes to their respective video buffers (mapped at 0xA0000), but your monitor is only connected to one of them.
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: Question about probing VGA space

Post by Gigasoft »

Most BIOSes disable the onboard VGA controller if a PCI VGA card is found. Other BIOSes require a manual setting.
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: Question about probing VGA space

Post by Nessphoro »

Gigasoft wrote:Most BIOSes disable the onboard VGA controller if a PCI VGA card is found. Other BIOSes require a manual setting.
Eh, my bios supports onboard + external GPU to run at the same time.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Question about probing VGA space

Post by Brendan »

Hi,
Nessphoro wrote:
Gigasoft wrote:Most BIOSes disable the onboard VGA controller if a PCI VGA card is found. Other BIOSes require a manual setting.
Eh, my bios supports onboard + external GPU to run at the same time.
PCI devices have "BARs" (Base Address Registers) that tell them where their registers and memory mapped IO areas are in the physical address space. Each PCI device has it's "BARs" set differently, so that there's no conflicts and everything works. This means that you can have 10 different video cards using 10 different physical addresses and (for sane/modern software) everything will work fine. This is nice and clean and solves all the problems.

Sadly, ancient software from last century is too crappy to handle this. For the purpose of backward compatibility; all the hardware involved gets bloated up with hacks. This includes video cards that have "VGA emulation" to make ancient crappy software happy (where the video card tries to emulate accesses to VGA IO ports and the VGA area from 0x000A0000 to 0x000BFFFF); but also includes special hacks in things like the PCI host controller and PCI to PCI bridges to forward accesses to the obsolete VGA stuff to the video card's "VGA emulation" hack-fest.

Of course only one video card can be in "VGA emulation hack-fest mode" at a time; because 2 pieces of hardware can't both respond to the ancient/obsolete VGA IO ports and the VGA area from 0x000A0000 to 0x000BFFFF at the same time.

This means that the BIOS sets up PCI device's BARs; then (for backward compatibility, for ancient/crappy software) selects one video card to setup in "VGA emulation hack-fest mode"; and configures that video card, PCI host controller, PCI to PCI bridges, etc to make ancient/crappy software happy. Old crappy software will continue to be crappy (e.g. will work for "VGA" because of all the hacks in hardware; but will not support any extra video cards); and good/modern software will ignore all the obsolete crud (e.g. device drivers that treat PCI devices as PCI devices, where there's no resource conflicts and 10 different video cards can all work at the same time).


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Question about probing VGA space

Post by Combuster »

so question is, wouldnt the traditional VGA space at A0000 belong to the onboard adapter? or would the bios see that another adapter is connected and somehow remap this?
If you want to know what's listening on VGA accesses, the OS itself will have serious trouble to know for sure where it ends up.

For the closest thing to an answer, you require a driver for the video card that owns the VGA range at that moment. Many video cards of the day have a bit hidden in a register that enables VGA decoding or not, and you can check that to see if it's been initialized to listen to VGA addresses.
This of course doesn't solve the issue of a lack of routing of hardware transactions to the video card of choice.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply