www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/25/18:16:38

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Fast block transfer VRAM to VRAM (help me)
Date: Wed, 25 Mar 1998 19:16:51 +0000
Organization: None
Message-ID: <ywzPYLAjgVG1EwIJ@talula.demon.co.uk>
References: <3 DOT 0 DOT 5 DOT 32 DOT 19980325150929 DOT 007a29c0 AT vip DOT cybercity DOT dk>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 38
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Nils Emil P. Larsen writes:
>How do I transfer a block (e.g. a screen 640x480) from one place in VRAM to
>another place in VRAM, without moving it to plain RAM first?

General advice: don't bother.

On most SVGA boards reading video memory is much, much slower than
writing it (I've seen differences of up to about 30 times slower!) so
this operation will be extremely slow. Even worse, if you are using a
banked SVGA mode there will be a big problem because you need to read
one part of vram while writing to another, and there is no way to point
the bank register at both locations simultaneously. On cards that only
have a single banked memory aperture, this copy requires either a lot of
thrashing the bank selection back and forth, or the entire image to be
copied into a temporary memory location. Neither method is fast :-)

There are two specific cases where vram->vram copies can be quite fast:

- in mode-X, if the source and dest both have the same quad alignment,
the VGA latch registers can be used. On modern hardware this still
probably isn't any faster than a mem->screen blit in a linear mode, but
it is an extremely useful trick on older hardware (386, slow 486, and
ISA bus cards).

- if you can use a hardware accelerator, blitting within the video
memory can be very fast. There isn't any good way to do this at the
moment, but I'm currently working on a VBE/AF driver for Allegro, which
will support hardware blits on any card that SciTech provide accelerated
VBE/AF drivers for (currently ATI, S3, Cirrus, Tseng, and some others).

If neither of those cases applies to your program, don't even think
about blitting within the video memory. Using memory sources will be
many times faster.


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"Pigs use it for a tambourine" - Frank Zappa

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019