Path: utzoo!utgpu!watserv1!watmath!att!att!bu.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!turnkey!orchard.la.locus.com!prodnet.la.locus.com!jta From: jta@locus.com (JT Anderson) Newsgroups: comp.windows.ms.programmer Subject: Re: Why are 256-color drivers slower than 16-color drivers? Message-ID: <19011@oolong.la.locus.com> Date: 1 Nov 90 01:44:35 GMT References: <590@nih-csl.nih.gov> Organization: Locus Computing Corp, Los Angeles Lines: 42 In article <590@nih-csl.nih.gov> bert@helix.nih.gov (Bert Tyler) writes: > > > ... Windows 256-color drivers are slower than 16-color drivers ... > >I've seen this stated authoritatively enough, and often enough, from >people who's messages consistently show that they know what they are >talking about, that I believe it to be true. Certainly, with my PS/2 and >its vanilla VGA adapter, I'm never gonna see the difference myself . > >On the other hand, my experience with writing the video drivers for >Fractint-for-DOS would have indicated just the opposite. Reading/writing >a pixel to a 256-color screen involves a simple MOV (preceded on occasion >by a bank-switch, but only on occasion), and updating a line segment involves >a single REP MOVSB (two, if you have to switch banks somewhere in the middle). >The same functions on a 16-color EGA/VGA driver take enough INs and OUTs >to fill a Russian novel. In FFD, the initial Mandelbrot image takes >significantly *less* time in 640x480x256 mode than in 640x480x16 mode >just because of this. > >So, why is this situation reversed in the Windows environment? Something >to do with Windows (as opposed to video driver) overhead? Sixteen color VGA, and to a somewhat lesser extent EGA, graphics modes provide at least two hardware assists that are lost in the 256 color modes. First, when scrolling data vertically, each byte you move can move all four bitplanes for 8 pixels worth of data. In 256 color modes, each byte you move is only 1 pixel. A significant difference. This advantage applies to any screen to screen bitblt where source and destination have the same byte alignment. Second, writing text is essentially a processes of blitting from a single bit per pixel source to a multi-bit per pixel destination. VGA write mode 3 provides a tremendious assist in this operation for 16 color modes. If only the foreground pixels of the text are being written, this can be very fast. If both foreground and background are being written, it is probably still significantly faster than the work needed to expand the bit per pixel source to a byte per pixel destination. If someone would make a VGA like card with an 8 plane 256 color mode, it would probably be nearly as fast for the most common operations as the four plane (16 color) modes.