47

The original DOOM and its derivatives (DOOM II, Heretic, Hexen) were early 90s 3D games released at a time when DOS PCs usually had ISA bus Super VGA graphics cards. In the following few years, PCs would be upgraded to PCI bus graphics cards. The difference was stark, with PCI bus running at 33 MHz and 32-bits wide.

But DOOM engine games not only run fine on newer PCI graphics cards, but seem to benefit from the added performance. Anecdotally, DOOM on a Pentium PCI machine is faster than on an 80486DX with ISA graphics by a margin that suggest to me it isn't just a result of the marginally faster CPU. So, I am speculating that the PCI bus graphics card is also leveraged somehow.

How does DOOM (specifically) use this newer bus and graphics card than what it was written for to get added performance?

2
  • 4
    Assuming you by "DOS" mean "MS-DOS", Doom certainly isn't a "DOS" game. It will only run on an IBM compatible machine with VGA compatible graphics. It only uses MS-DOS as a glorified boot loader and will not run on any other MS-DOS based machines like the NEC PC9801 series.
    – idrougge
    Commented May 6, 2021 at 16:16
  • Many later graphically intensive DOS games worked by writing directly to video memory from the CPU. The faster that completed the faster they could render. This is opposed to home computer and console graphics which were often done through features of the card and would mostly behave the same as the chip where the used feature originated.
    – davolfman
    Commented Aug 6 at 0:05

4 Answers 4

80

DOOM itself doesn’t do anything special to benefit from PCI graphics cards. It runs faster with PCI graphics cards (and VLB, AGP, and PCI Express cards) than with ISA graphics cards because the supporting bus is faster, so reads from and writes to video memory take less time.

PCI goes to great lengths to preserve backwards compatibility with ISA-based VGA, providing support for “VGA compatible” adapters so that they can appear in memory at the same locations and use the same I/O ports as ISA VGA cards. So accesses to the VGA registers and to the VGA buffer (at 0xA0000) go directly to the main PCI VGA compatible adapter in the system, with no change required in the operating system or programs running on it. (This is the reason why there’s a specific “VGA compatible controller” device type in PCI. Such shenanigans are impossible for other device types in PCI, which is why PCI sound cards have so much trouble providing compatibility with programs written for ISA sound cards.)

A faster bus and/or faster video memory immediately leads to higher performance in video-intensive programs because software doesn’t need to be careful about how it accesses video memory (except on CGA, and on all platforms with vertical blank synchronisation if it cares about tearing). So REP MOVSW or REP MOVSD with no waiting in software, once the program decides to write a frame, is perfectly fine, and will go faster and faster as the underlying hardware improves. On platforms where this can’t work in hardware (e.g. on an 8088 with a VGA card), the hardware takes care of specifics — for example on an 8088 the bus unit will split up 16-bit accesses.

Your question is specific to DOOM but other DOS games are in a similar situation. Later games tended to rely on VBE (often using UniVBE) to access video modes beyond those provided by VGA, but they mostly didn’t use anything beyond video-mode setup and framebuffer configuration (see also Were any DOS games (or software) known to use VBE/AF?), so improved video speed came mostly from bus speed increases, faster video memory, and speed increases in the cards themselves (which was already a factor in the ISA era, compare most Trident cards to Tseng cards for example).

For an excellent explanation of the intricacies of VGA programming and its memory layout, see Fabien Sanglard’s Game Engine Black Book series. The DOOM update loop is shown on page 185 of the DOOM book; it doesn’t use any assembly language (unlike the renderer, see pp. 290 and following), but it does have one perhaps surprising feature given the 32-bit nature of the code: VGA updates are done 16 bits at a time. Section 2.3 of the same book, pp. 59 and following, describes some of the improvements to VGA adapters around the time DOOM was released, in particular the switch to the VESA Local Bus on 486s. The benchmark table on page 287 shows the importance of the bus.

5
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Chenmunka
    Commented May 6, 2021 at 8:20
  • 1
    I had an EISA VGA system and it was a little disappointing that Doom only had 16-bit accesses as it wasted half the capacity and effectively ran at the same speed as with quality ISA VGA. Still though, it was plenty fast... Commented May 9, 2021 at 14:01
  • As far as I remember, the amount of ISA compatibility PCI could offer was highly dependent on whether the hardware in question customarily used ISA DMA - so sound cards and floppy disk controllers were big trouble (and led to the introduction of the more ISA compatible LPC bus for on-board hardware), VGA, serial ports, and AT bus hard disks were fine.
    – TeaRex
    Commented Aug 6 at 7:42
  • @TeaRex ISA DMA support is the main blocker for sound cards and FDCs, yes; but there’s more to it than that for VGA — PCI support for “VGA compatible” cards includes fixed-address buffers (for the framebuffer at A0000h), fixed-address I/O ports (for the VGA ports), palette snooping, and possibly even fixed-address option ROM (I’m not sure about the latter but I don’t have my PCI book handy; there’s at least a requirement to make the option ROM available in the first mebibyte in some way or other). Commented Aug 6 at 9:39
  • @TeaRex the main difference is that the PCI committee planned for VGA support, so PCI includes all the extras required for that; but they didn’t plan for ISA DMA support... Commented Aug 6 at 9:43
35

(When selecting an answer, use Stephen's - I just put this here because it is too much text for a comment)

Most Important: It's a Game of Raw Numbers.

We can ignore more complicated stuff and simply go for bandwidth:

  • ISA had at the time a bandwidth around 16 MiB/s (*2)

  • VLB (*1) and PCI offered up to 133 MiB/s bandwidth.

  • A 320 x 200 screen needs 64 kB (lets say 64 KiB) (*3)

  • With 30 fps, which can be considered good (*4), that adds up to ~2 MiB/s

  • 2 MiB/s is 17% of the raw ISA bandwidth

  • but it's only 2 % of VLB and PCI's bandwidth

That is worlds for a game like DOOM, that did in the days shined due its many ways to make 3D run on barely able hardware. Often forgotten today, Doom not only reduced detail, but as well screen size. It offered 9 sizes, from 320x200 down to 96x48 (*5), and having a letterbox around the action was common, not the exception.

Performance One Can Feel

Gaining 14% additional CPU time to operate is nothing for an application, but huge on a resource strapped game. It's the difference of running DOOM in at least one screen mode up.

And between an ISA system capable to use 320x200 and the same CPU setup with PCI of at least doubling the frame rate - that's from barely playable to lightning fast.

Either effect is quite visible. All without changing anything within the game.

Downward Compatibility is the Name of the Game

PCI (and VLB) were made to have (existing) I/O hardware appear to the system like before. VLB a bit more than PCI, as PCI. In either case VGA memory and control was mapped at the same addresses than on ISA. A worthwhile effort as all software would benefit right away without any modification. It would need no knowledge about the changed bus system - the same way a 8086 software does not need to know if it's running on a Pentium.

So it was downward compatibility of the new bus systems - made by its developers to be able to sell PCI systems. After all, who would buy an incompatible PC, one were the Flight Simulator doesn't work like on an 8088?


From Comments:

But how is this managed "automagically". How is this forward/upward compatibility implemented?

There is nothing magic. The VGA memory was with PCI available at the same real address as with ISA before: A0000h. No change in the (visible) HSI (*6), so no need to change the software.

Your [@StephenKitt's] improved answer implies to me that original VGA was designed with upward compatibility to a 32-bit system bus.

No, if at all, the other way around. The newer busses were the same, except faster and wider. And both changes are invisible to software. From a software PoV there is no difference on how fast a CPU runs and/or if an access is done in bytes or words. That's all covered by the CPU hardware. The only measurable difference is speed. Something software will only 'feel' in performance (which is what your question is about), but not in operation.

Also that faster busses are transparent because slower busses just introduce wait-states.

No, there is no relation between software and bus (or CPU) speed. That is, no other than over all performance. Software does not need to be rewritten for different clocked CPU's, bus width or speeds. It will just show in what it can crank thru in course of time. In case of your PCI/ISA question, DOOM is simply able to transfer a frame in less time, thus either producing more frames in a given time (aka fps), or frames with a higher resolution (selected in the option screen). Either way: Better Gaming.


Lesser but Related: Pentium and VLB Sucked.

I do not remember the full parts, but AFAIR Pentium chipsets and the VLB protocol did not go well with each other resulting in a meagre performance, making a Pentium-VLB slower than a 486-VLB, while Pentium-PCI did work well. This not only made VLB obsolete soon, but also added a lot of less than favourable DOOM results.

Carmack and Romero, the DOOM guys, did BTW think that VLB was the way of the future to go and PCI just a strange side development by Intel, as one of them stated at the time.


*1 - Never forget VLB, it was the go to for gamer at the time)

*2 - Well, ISA had no fixed defined bandwith, as it always depended on the system. Early PC managed 2 MiB/s, while original AT did 6 MiB, later AT 8 MiB. Bus clock was ties to CPU clock, so faster AT clones could apply 10..12 MHz, neting up to 12 MiB/s. Many I/O cards would comply. With later 386 passing 16 MHz CPU clock, Chipsets started to handle I/O clock as a integer, non binary fraction of CPU clock. Like 33 MHz Systems offering 6.66 MHz, 8.33, 11 or 16MHz. Again later almost arbitrary dividers were offered.

At the time of DOOM, most ISA cards worked fine at 12 MHz or above. This already brought a huge speed advantage and higher frame rates, all without VLB/PCI.

For the above calculation I use 16 MiB/s as it represents what a good ISA card could deliver when plugged into a state of the art 386/486 system. After all, while using 8 MiB/s might show an even higher speed up, I do not believe it be fair to compare the new PCI bus system with anything else than the top end of its predecessor.

*3 - 320x200 is full screen and was almost never played. Highest regular mode was 320x168 with the well known status bar at the bottom of the screen.Saving these 32 lines brought already a noticeable difference in frame rate, even on high end systems.

*4 - Looking back shows how much pampered we're today. Playing Doom at 20-30 fps was great.

*5 - Yes, way less than a Game Boy - not sure if anyone ever successfully played in that mode.

*6 - Hardware Software Interface - a fancy name for addresses by software and their semantics.

11
  • 3
    Doom at 20-30 FPS is still great - on a DOS PC. It helps that there's so little latency between input and output, and that the FPS is stable - almost all of the time is spent waiting for the writes to VGA memory to go through, which doesn't change much from frame to frame, due to generally low overdraw. Duke 3D is even better, and could support very high resolutions too (though obviously on far better hardware). But hey, I originally played Crysis at 15 FPS (dropping to 5 in the "frozen" part :D); the human brain is very able to adapt to low but predictable framerates.
    – Luaan
    Commented May 5, 2021 at 5:02
  • Pentium had a 64 bit memory bus, VLB being based on 486 bus had only a 32 bit memory interface. This was the main difficulty to get both to work together. Commented May 5, 2021 at 7:39
  • 1
    "not sure if anyone ever successfully played in that mode" - OK, it was on Quake, but I played that with about that size on a 68040 with AGA. :) Commented May 5, 2021 at 19:45
  • 1
    ISA bandwidth numbers are a bit arbitrary, because there was never really a formal spec that nailed down the clock speed like with PCI. Historically it ranged from 4 MHz to 16+ MHz. Some cards just didn't work right on machines with a fast ISA bus, so more reliable early 90's ISA slots were often much slower than many 80's ISA slots. 8 MHz / 16 bit would be "theoretically" 16 MB/sec. (But good luck actually measuring exactly that on any given machine.)
    – wrosecrans
    Commented May 7, 2021 at 18:53
  • 3
    I don't see anyone actually mentioning the real reason VLB failed. It wasn't "it's 32-bit". It's that it was DIRECTLY TIED to the 486 pins. There was no almost "bus" or buffer between the card and the CPU. It was directly attached! Have a videocard with any problems even a electrical blip? Crashes the CPU directly. And how do you make a new CPU socket if VLB expects the 486 socket? You don't. Unless you get a VLB-to-PCI bus chip. At which point why not just use PCI? I directly experienced how "finicky" CPU and VLB cards were with various combos failing. Far worse than even Voodoo 2 cards. Commented Nov 3, 2022 at 22:47
3

I can't recall the technical specifics after all this time, but I do remember that my ISA SVGA card (Trident 8900-based) would default to 8-bit bus traffic and 8-bit video-BIOS access. Getting both to 16-bit took quite some BIOS, TSR, and boot-time utility twiddling.

Games were noticeably faster in fully 16-bit mode!

So I doubt many ISA cards were actually running at their full ISA capability, which would exaggerate the perceived performance boost seen with PCI/VL-bus cards.

(N.B. I intended this as a comment, but the site upgraded it to an answer whilst I was signing in!)

Edit: ... and of course then there was the separate palaver of trying to get the video ROM shadowed by the system RAM. Basically, there was a lot of tweaking by the user needed, which in turn made it near-impossible for the coders to know precisely what to expect.

The temptation is to assume people would use the extra bandwidth to push more pixels around, i.e. to move from MCGA to a "hi-res" SVGA (640x480x256) mode; but remember that there was no standard API for that until VBE took off - see the linked question - and by that time 3-d accelerators were on the horizon.

So for the OP's question: DOOM (on MS-DOS) wouldn't behave differently depending on the data bus; it would assume an IBM VGA card. Meanwhile, ISA cards were partly nobbled by backwards-compatibility issues: my old card was expected to be fully-functional even in an XT, whereas a PCI card knows it's in a 486 or better.

3
  • Odd. I never had any issue with my Trident 8900 ISA cards not taking advantage of 16-bit accesses. The only card I found disappointing was one particular low end EISA card which somehow only managed to run 50% faster with 32-bit accesses than it did with 16. I didn't keep that one around long, can't even remember the model, but it may have been Trident based? Commented May 9, 2021 at 14:03
  • @BrianKnoblauch Trident made the chips, I don't know how much scope the card manufacturers had in terms of how the whole thing would behave in a particular PC.
    – Lou Knee
    Commented May 9, 2021 at 21:13
  • 1
    @BrianKnoblauch My card didn't like 16-bit data-access in the 286, but worked straightforwardly in the 486. OTOH, I still recall feeling annoyed with myself when, having had it in the same 486 for a couple of years, I then finally hit on a simplistic tweak that sped things up a lot, probably the BIOS/ROM access thing.
    – Lou Knee
    Commented May 9, 2021 at 21:20
2

The main issue here is the ISA bus is very slow.* The actual speed is about 2MB/sec for a 16-bit ISA device. I assume that is on an 8MHz ISA bus. To display 320x240x8bit graphics at 30 frames per second, 2.2MiB/sec of throughput is needed. The ISA bus can just about handle that, except that it consumes 100% of the CPU time to send the data and the CPU can't do anything else during that time. So half of the CPU time could be devoted to writing to the video buffer at 15 frames per second, and the other half to running the game.

It's like the days of Windows 2000/XP when DMA was disabled by default on parallel ports used by printers. Task Manager would would show 100% system CPU use while printing something, and it would print slowly.

If you had an ISA SCSI controller, it probably supported DMA. You could configure the DMA transfer speed to 8MB/sec or higher over 16-bit ISA if the motherboard would let it go that high.

I don't believe any ISA video cards supported DMA transfers. It would have required the CPU to write to RAM, and then the video card would copy the buffer out of RAM using DMA while the CPU was free to run the game.

PCI video cards are much faster. The bus supports bus mastering, so the CPU can read and write to PCI devices at nearly the full advertised speed of 133MB/sec. But I assume the same situation can occur again, where the CPU is slowed down by the typical transfer rate of around 110MB/sec. I wonder if any video card drivers have the CPU write to RAM and then instruct the PCI video card to DMA the buffer out of RAM, while the CPU is free to do other things?

Edit: There is a case where PCI can be slow too. Try running Windows with the generic VGA driver on a PCI video card, or the SVGA driver with XP. Scrolling and moving windows around is much slower than if the proper driver is installed. Notice that a lot of system CPU is used to do so. It's rather similar to the issues with ISA video cards.

5
  • The article you link to mentions 2MBps as a typical speed (without specifying what “typical” means); a 16-bit ISA bus supports significantly higher rates even at the “standard” 8MHz. Commented Aug 2 at 18:28
  • @Stephen Kitt, in this discussion at vogons.org/viewtopic.php?t=99874&start=20 , the user bakemono says that 3 clocks per word and 5MB/sec is the best they've seen from an ISA device. 5MB is still really slow for graphics! It's hard to find information about how fast an ISA graphics card's memory can be accessed. Commented Aug 2 at 20:38
  • 5MBps is still significantly higher than 2MBps — and yes, it is slow for graphics, but it’s fast enough for PCs back then (memory bandwidth wasn’t huge either). More importantly, it’s quite a bit more than the bandwidth required for 320×240, and more still than that required for 320×200 which is the resolution used in most games! Scroll slightly further down in the discussion on Vogons and you’ll see someone mention 6.5MBps on a Compaq 386, which is closer to the expected maximum of 8MBps (which was probably unattainable). Commented Aug 3 at 8:38
  • > It's hard to find information about how fast an ISA graphics card's memory can be accessed I think that's because it's totally card dependent: all that the CPU sees is a 64k buffer and a controller chip - it's down to the card to move things around to "clear space" for the next 64k. Giving the graphics chip direct access to system RAM (which is the opposite direction) was one of the magic powers AGP was supposed to have.
    – Lou Knee
    Commented Aug 3 at 11:33
  • If 5MBps would allow for 30 FPS on ISA, then the same CPU could do 59 FPS on PCI. The big issue is the CPU can't do anything else while writing to the video buffer. If a PCI or AGP device is just as fast as RAM, then the CPU becomes the bottle neck and having a faster bus won't make any difference beyond that point. Commented Aug 3 at 12:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .