Re: Page Flipping

Search this archive.

From: James (james@jigsawdezign.com)
Date: Sun 19 May 2002 - 14:41:49 IDT


Matan,

   Thanks for the info.... but which way around do you suggest;

vga_setdisplaystart();  // page flip
vga_waitretrace();        // only takes affect now

or,

vga_waitretrace();       // wait for the blank
vga_setdisplaystart(); // switch pages


I suppose the 2nd way is probably the best because on video cards that
switch the page immediatley it will perform the switch during the vertical
blank (as we have just waited for one to happen with vga_waitretrace). And
on cards with register double buffering, it`ll still work as they will also
perform the switch straight away, as it is currently in a vertical blank.
(or will they actually wait for vertical blank AFTER the one it is
currently in?)  This is only a minor timing issue, but I`d rather know what
is going on with my video refreshes during my games!


One other thing that bothers me.... I`m more from an Amiga background of
games programming, and on this platform you could perform smooth hardware
scrolling vertically and horizontally as the hardware allowed the
programmer to change the display start to ANY address in video RAM. So you
could do vertical scrolling by changing the start address in
increments/decrements of a lines width, AND you could scroll horizontally
by incrementing the start address by units of 1. On the PC hardware (in
640x480 256 mode) it seems that it only lets you use certain address
alignments... so although vertical scrolling does work (becuase a line
width is usually divisable by 4 or 8), but, I can only scroll horizontally
4 pixels at a time. Is there some other way of hardware scrolling
horizontally, or do I have to resort to holding a large page in system
memory and copying it to video RAM each frame? How does DirectX deal with
this, as doesn`t that allow smooth hardware scrolling?


Thanks,
James






Matan Ziv-Av wrote:

> On Sun, 19 May 2002, James wrote:
>
> > Hello all,
> >
> >  Just need to know exactly how the function vga_setdisplaystart()
> > operates. I can think of two possibilities:
> >
> > a) The page switch takes affect during the NEXT vertical blank.
> > b) The page switch happens immediatley.
>
> The functions writes the new value immediately to the necessary
> registers.
> In most (modern) video cards those registers are double bufferred, and
> the change actually takes affect only at the next vertical refresh
> period.
>
> There are three other behaviours:
> 1- change takes place immediatelly.
> 2- There is a register that decides if the change is immediate or at VR.
> 3- The standard registers are not double bufferred, but there is an
>    extra set of display start registers which are.
>
> Until now (actually, about a month ago), I ignored this issue. From now,
> I'll try to fix the drivers for card which are in case 2 or 3, to behave
> as in the double buffered case.
>
> For example: riva128 (nv3) has non double bufferred registers, but nv10
> and later are double bufferred. Not sure about nv4, nv5.
> Cirrus Logic Laguna chipset is type 3.
> Rage 128 is type 2.
>
> > If it works likecase "a" then I would do something like this:
> >
> > vga_setdisplaystart();  // page flip
> > vga_waitretrace();        // only takes affect now
> >
> >
> > however if its more like case "b" then I`d do this;
> >
> > vga_waitretrace();       // wait for the blank
> > vga_setdisplaystart(); // switch pages
>
> Just remember that vga_waitretrace() does busy waiting, rather than
> blocking.
>
> --
> Matan Ziv-Av.                         matan@svgalib.org


------------------------------------------------------------------
Unsubscribe:  To:   listbot@svgalib.org
              Body: unsubscribe linux-svgalib


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:25 IST