A small tutorial in AGP speed setup
A small tutorial in AGP speed setup
I'm not sure where I should be putting this so I apologise in advance for mis-posting. This forum deals with a lot of 'low-level' hardware topics so I hope it will be of some value to anyone who wishes to use it. If you can provide more information on AGP programming than I've got here please add it.
Unfortunately there's not a lot of info on AGP programming. OSRC used to have links but they've gone and even 'googling' brings up nothing. The Linux Code is as mysterious as ever and I can't find any low level DirectDraw (hardware) programming Docs.
My interest stems not from the fact that I want to do 3D graphics etc, I just figure "If I've got a 4X AGP card, why is the bus running in PCI mode?"
All AGP cards run at 33Mhz if they're not set up properly. And when your trying to extend the 'prettyness' of your OS speed to screen is everything.
Anyway, I was trawling through a rather large book called "PCI System Architecture" from Addison Wesley and in the section entitled "Configuration Registers" they provide an example
of how to control a PCI card using what is termed a 'capabilities list'.
Guess what the example is that they used? --- AGP!
No information of the 3D acceleration bit but all the information on how to turn up the speed of the AGP slot.
After testing, there was a substantial increase in the amount of data I could shove accross the connection. (Depending on your system, there may be a larger or smaller increase).
Unfortunately there's not a lot of info on AGP programming. OSRC used to have links but they've gone and even 'googling' brings up nothing. The Linux Code is as mysterious as ever and I can't find any low level DirectDraw (hardware) programming Docs.
My interest stems not from the fact that I want to do 3D graphics etc, I just figure "If I've got a 4X AGP card, why is the bus running in PCI mode?"
All AGP cards run at 33Mhz if they're not set up properly. And when your trying to extend the 'prettyness' of your OS speed to screen is everything.
Anyway, I was trawling through a rather large book called "PCI System Architecture" from Addison Wesley and in the section entitled "Configuration Registers" they provide an example
of how to control a PCI card using what is termed a 'capabilities list'.
Guess what the example is that they used? --- AGP!
No information of the 3D acceleration bit but all the information on how to turn up the speed of the AGP slot.
After testing, there was a substantial increase in the amount of data I could shove accross the connection. (Depending on your system, there may be a larger or smaller increase).
Re:A small tutorial in AGP speed setup
So here it is - a small tutorial in AGP speed setup.
I assume that you have access to the PCI specs and can read/write PCI configuration registers. If you don't, what follows isn't going to be much use. I'm assuming PCI Spec 2.2 or higher. Have no idea if these work on the PCI Ex cards coming onto the market, somehow I doubt it.
Firstly, detect the AGP card using standard PCI interrogation.
The device ID should be 03h with a subclass code of 02h indicating: display controller - 3D controller.
Next from dword 0dh you will find the capabilities pointer. This points to a linked list of 'capabilities' a device may have.
At the Dword pointed by the pointer you'll find another Dword with the following format
0-7 Capability ID
8-15 Pointer to next capability (points directly to the next capability in the list)
16 - 31 Feature Specific
So what you do is follow the yellow brick list until you come to an entry with the capability ID of 02h or "AGP".
By the way, power management (01h), slot id (04h), message signaled interrupts (05h), compactpci (06h) - no information provided.
Once you have the appropriate capability, you can now check which AGP version you have.
In the same DWord holding the Capability ID - the following bits have the following meaning:
Bits 16 - 19 Minor revision
Bits 20 - 23 Major revision
Now that you're satisfied that you've got an AGP of the appropriate revision in custody, the next DWORD holds the AGP status register(read only unimplemented bits are 0's):
Bits 0-2 AGP SPEED
This indicates the data transfer rates supported by the AGP card. All data rates supported are
indicated by set bits.
Bit Transfer rate
0 1X
1 2X
2 4X
I assume that you have access to the PCI specs and can read/write PCI configuration registers. If you don't, what follows isn't going to be much use. I'm assuming PCI Spec 2.2 or higher. Have no idea if these work on the PCI Ex cards coming onto the market, somehow I doubt it.
Firstly, detect the AGP card using standard PCI interrogation.
The device ID should be 03h with a subclass code of 02h indicating: display controller - 3D controller.
Next from dword 0dh you will find the capabilities pointer. This points to a linked list of 'capabilities' a device may have.
At the Dword pointed by the pointer you'll find another Dword with the following format
0-7 Capability ID
8-15 Pointer to next capability (points directly to the next capability in the list)
16 - 31 Feature Specific
So what you do is follow the yellow brick list until you come to an entry with the capability ID of 02h or "AGP".
By the way, power management (01h), slot id (04h), message signaled interrupts (05h), compactpci (06h) - no information provided.
Once you have the appropriate capability, you can now check which AGP version you have.
In the same DWord holding the Capability ID - the following bits have the following meaning:
Bits 16 - 19 Minor revision
Bits 20 - 23 Major revision
Now that you're satisfied that you've got an AGP of the appropriate revision in custody, the next DWORD holds the AGP status register(read only unimplemented bits are 0's):
Bits 0-2 AGP SPEED
This indicates the data transfer rates supported by the AGP card. All data rates supported are
indicated by set bits.
Bit Transfer rate
0 1X
1 2X
2 4X
Re:A small tutorial in AGP speed setup
Bit 3 Reserved
I don't have an 8X AGP card, but it wouldn't be too much to assume that this is now the 8X rate
indicator bit, particularly since 16X cards will never exist due to PCI Ex. On the other hand flipping both 2X and 4X should equal 8X so.......
Bit 4 Fast Writes supported. (1 - Yes)
Bit 5 Addresses > 4Gbytes. (1 - Yes)
This one's for 64 bit systems Mips, Sparc, PowerPC etc.
Bits 8 - 6 Reserved
Bit 9 Side Band Addressing supported. (1 - Yes)
If supported (and activated) increases the speed of AGP accesses.
Bits 10 - 23 Reserved
Bits 24 - 31 Maximum depth of the AGP request queue supported. Unless you're into the 3D stuff - this is useless.
OK, now we know the rates supported and the AGP's capabilities, time to speed things up.
The next DWORD is the AGP Command Register where all the good stuff resides and it's format is exactly the same as the status register except for one bit - the activate AGP bit (bit .
To increase speed, flip one (and only one) bit in the data rate section.
For example to enable 4x AGP, set bit 2 of the configuration register then turn on bit 8 and
- ZIPPPP, ZAPPPP, KAPOWWWW ***** 4X the data rate *****
Set the Fast-write and side-band addressing bits (if applicable) to get a little bit more speed.
Be warned, some cards do not like these enabled when installed on particular chipsets (some VIA boards I believe).
So there, a quick and easy way to boost video speed.
Many thanks to Tom Shanley, Don Anderson and Addison Wesley for providing the information.
"PCI SYSTEM ARCHITECTURE, Fourth Edition, ISBN 0-201-30974-2"
I also noticed there's an "AGP ARCHITECTURE, ISBN 0-201-37964-3", *currently unavailable (like all the other AGP programming info)* - Is this some sort of conspiracy? Is there a secret government agency determined to suppress all AGP information?
It's not like the PCI hardware specs or anything to do with actual AGP hardware implemenatation.
All I want to do is know how to program the blasted thing!
P.S. If you use the above for GUI/graphics/whatever development, I'd really be interested in the results obtained.
Not necessarily a detailed analysis, just a - "Everything speeded up - happy".
I don't have an 8X AGP card, but it wouldn't be too much to assume that this is now the 8X rate
indicator bit, particularly since 16X cards will never exist due to PCI Ex. On the other hand flipping both 2X and 4X should equal 8X so.......
Bit 4 Fast Writes supported. (1 - Yes)
Bit 5 Addresses > 4Gbytes. (1 - Yes)
This one's for 64 bit systems Mips, Sparc, PowerPC etc.
Bits 8 - 6 Reserved
Bit 9 Side Band Addressing supported. (1 - Yes)
If supported (and activated) increases the speed of AGP accesses.
Bits 10 - 23 Reserved
Bits 24 - 31 Maximum depth of the AGP request queue supported. Unless you're into the 3D stuff - this is useless.
OK, now we know the rates supported and the AGP's capabilities, time to speed things up.
The next DWORD is the AGP Command Register where all the good stuff resides and it's format is exactly the same as the status register except for one bit - the activate AGP bit (bit .
To increase speed, flip one (and only one) bit in the data rate section.
For example to enable 4x AGP, set bit 2 of the configuration register then turn on bit 8 and
- ZIPPPP, ZAPPPP, KAPOWWWW ***** 4X the data rate *****
Set the Fast-write and side-band addressing bits (if applicable) to get a little bit more speed.
Be warned, some cards do not like these enabled when installed on particular chipsets (some VIA boards I believe).
So there, a quick and easy way to boost video speed.
Many thanks to Tom Shanley, Don Anderson and Addison Wesley for providing the information.
"PCI SYSTEM ARCHITECTURE, Fourth Edition, ISBN 0-201-30974-2"
I also noticed there's an "AGP ARCHITECTURE, ISBN 0-201-37964-3", *currently unavailable (like all the other AGP programming info)* - Is this some sort of conspiracy? Is there a secret government agency determined to suppress all AGP information?
It's not like the PCI hardware specs or anything to do with actual AGP hardware implemenatation.
All I want to do is know how to program the blasted thing!
P.S. If you use the above for GUI/graphics/whatever development, I'd really be interested in the results obtained.
Not necessarily a detailed analysis, just a - "Everything speeded up - happy".
Re:A small tutorial in AGP speed setup
I might be able to give you some stuff on my radeon 9200SE, which afaik is 8x. Do you have some sample binary image or your own OS maybe?
PS: You have an accidental smiley in your code. You can change it to 8 ) to avoid it.
The book he refers to is http://www.amazon.com/exec/obidos/tg/de ... ce&s=books by the way, and it's available for 5 more people from this place. Good luck
PS: You have an accidental smiley in your code. You can change it to 8 ) to avoid it.
The book he refers to is http://www.amazon.com/exec/obidos/tg/de ... ce&s=books by the way, and it's available for 5 more people from this place. Good luck
Re:A small tutorial in AGP speed setup
I saved the info to the FAQ...
Re:A small tutorial in AGP speed setup
something is wrong here, i have AGP 3.0 spec as pdf ( i can send it to you by email if you give me your email address ) and it says the following... ( interestingly it doesn't even talk about apg2x and earlier [in command register] )Bits 0-2 AGP SPEED
This indicates the data transfer rates supported by the AGP card. All data rates supported are
indicated by set bits.
Bit Transfer rate
0 1X
1 2X
2 4X
PS: i don't have AGP 2.0 spec... only 3.0 pdf
COMMAND REGISTER
Data Rate Enable (DRATE) - The setting of these bits
determines the data transfer rate. One (and only one) bit
in this field must be set to indicate the desired data
transfer rate. The same bit must be set on both master
and target. The encoding assumes AGP3.0_Mode is set
in AGPSTAT.
Encoding Meaning
001 4X Data Transfer Mode
010 8X Data Transfer Mode
100 Reserved
STATUS REGISTER
Data Rate Support (RATE) -
AGPSTAT[3] Code Speed Supported
0 xxx See AGP2.0 Specs
1 001 4x
1 010 8x
1 011 4, and 8x
1 All other codes Reserved
AGP 3.0 spec page 49
Re:A small tutorial in AGP speed setup
i send the spec to [email protected], i hope it is correct
Re:A small tutorial in AGP speed setup
Thanks for the AGP specs Cemre - I think the book I've got quotes from AGP Spec 2. It looks as if with Spec 3 *'THEY'* began using mutiple definitions for AGP speeds and possibly altered the register layout for more features etc... What I posted stated 'one bit per speed supported'. This obviously is no longer the case.
Candy - I'm using an 'altered' verion of Chis Gieses PCI - detection utility, PCI-32
Chris Giese <[email protected]>, http://www.execpc.com/~geezer
It's a DOS program that simply walks the PCI chain and reports the device and vendor numbers.
Well, it does a lot more now. It produces badly formatted lists (function over form) of installed hardware capabilities information which includes AGP 2.0 and some info on PCI
power management. I'll update the code with the info Cemre sent and post it here *hopefully* by the weekend (dependant on workload and small children). My 1 year old niece is aborable and I get to give her back at the end of the day!
I've also had a chance to have a 'poke' at some of my college computers and found that some video cards don't stick to the PCI 'classing' rules as they should. Some of them used a
subclass code of 80h which stands for 'other display controllers'. So when you're doing a PCI search for a video card check for subcodes 02h and 80h.
I must also make mention that the 'PCI features list' that makes the AGP features accessible only exists with PCI spec 2.2+ so older computers may not be able to identify AGP cards so easily. Anything after 1998 should support the features lists. My 1998 Pentium II supports it via an ATI Rage II card. Hardware programming through non-standard interfaces is obviously still going to be a sticking point with older computers.
I've altered the info in the FAQ slightly witht tha above info and I'll add the AGP 3.0 info when I wrap my head around the changes.
Keep safe.
Candy - I'm using an 'altered' verion of Chis Gieses PCI - detection utility, PCI-32
Chris Giese <[email protected]>, http://www.execpc.com/~geezer
It's a DOS program that simply walks the PCI chain and reports the device and vendor numbers.
Well, it does a lot more now. It produces badly formatted lists (function over form) of installed hardware capabilities information which includes AGP 2.0 and some info on PCI
power management. I'll update the code with the info Cemre sent and post it here *hopefully* by the weekend (dependant on workload and small children). My 1 year old niece is aborable and I get to give her back at the end of the day!
I've also had a chance to have a 'poke' at some of my college computers and found that some video cards don't stick to the PCI 'classing' rules as they should. Some of them used a
subclass code of 80h which stands for 'other display controllers'. So when you're doing a PCI search for a video card check for subcodes 02h and 80h.
I must also make mention that the 'PCI features list' that makes the AGP features accessible only exists with PCI spec 2.2+ so older computers may not be able to identify AGP cards so easily. Anything after 1998 should support the features lists. My 1998 Pentium II supports it via an ATI Rage II card. Hardware programming through non-standard interfaces is obviously still going to be a sticking point with older computers.
I've altered the info in the FAQ slightly witht tha above info and I'll add the AGP 3.0 info when I wrap my head around the changes.
Keep safe.
Re:A small tutorial in AGP speed setup
Ok, I've had a read (understanding to come soon) of the AGP 3 specs that Cemre sent me (thankyou once again).
Page 48 provides details of the APG status register. One of the previously undefined bits (Bit 3) now selects either AGP 2 (unset) or AGP 3. When the bit is unset the register interface must follow AGP 2 conventions in which the info I posted earlier works (and accounts for the discrepancy).
In AGP 3 mode, AGP 1X and 2X have been dropped and 8X has been added.
I've updated the FAQ with this info.
Code still to come - I can't get to the 'real' computer yet to get at my files. I'm thinking of renaming my OS to *Indigestion*, things just keep coming up...................
Page 48 provides details of the APG status register. One of the previously undefined bits (Bit 3) now selects either AGP 2 (unset) or AGP 3. When the bit is unset the register interface must follow AGP 2 conventions in which the info I posted earlier works (and accounts for the discrepancy).
In AGP 3 mode, AGP 1X and 2X have been dropped and 8X has been added.
I've updated the FAQ with this info.
Code still to come - I can't get to the 'real' computer yet to get at my files. I'm thinking of renaming my OS to *Indigestion*, things just keep coming up...................
Re:A small tutorial in AGP speed setup
OK, code as promised. What I tend to do when trying to understand something (such as AGP) and wanting to test the info, I write a small utility (or in this case modify an existing one) to read the information and return it. Info about the utility is in the top of the detectpci.c file
The main function is pci_scan_vendor whose' definition looks disgusting, but you should be able to follow the code.
The principle behind the function served as the basis of my OS's device detector, but there's still a lot of reliance on 'hardwired' drivers.
The source is attached and I've had to zip it because it's bigger than 30k uncompiled and the compiled is 70k. I use DJGPP.
Unzip then compile:-
GCC detectpci.c -odetectpci.exe
This is a DOS Executable (Windows hates it with a vengeace).
To use: detectpci > results.txt. You can then browse results.txt for the information. No, there's no file handling functions to save the info. Function over form. There's better things to do than spend weeks writing a detection utility.
The AGP 3 spec indicates that multiple AGP buses can be supported within a system. So what I'm thinking is : if you change the speed of one, change them all just to be on the safe side. Adding recommendation to the FAQ.
The main function is pci_scan_vendor whose' definition looks disgusting, but you should be able to follow the code.
The principle behind the function served as the basis of my OS's device detector, but there's still a lot of reliance on 'hardwired' drivers.
The source is attached and I've had to zip it because it's bigger than 30k uncompiled and the compiled is 70k. I use DJGPP.
Unzip then compile:-
GCC detectpci.c -odetectpci.exe
This is a DOS Executable (Windows hates it with a vengeace).
To use: detectpci > results.txt. You can then browse results.txt for the information. No, there's no file handling functions to save the info. Function over form. There's better things to do than spend weeks writing a detection utility.
The AGP 3 spec indicates that multiple AGP buses can be supported within a system. So what I'm thinking is : if you change the speed of one, change them all just to be on the safe side. Adding recommendation to the FAQ.