[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to best get smooth scrolling in X?



On Wed, 27 Nov 2002, Mads Bondo Dydensborg wrote:

> Yes, this seems in line with most other stuff I have read. It is the same
> thing for stuff like DGA, right?
>
> DGA & SDL gives true doublebuffering, but only in fullscreen mode it
> seems. Sigh.

OpenGL hardware typically provides for two modes:

  * Full screen mode - there are literally two chunks of
    memory.  Your program writes into one chunk while
    the display reads from the other.  Hitting the
    swap-buffer call EITHER:
       a) Swaps the display and draw pointers
          immediately.
    ...OR:
       b) Waits for the next vertical retrace and
          then swaps the pointers.
    Most systems provide a shell variable that selects
    which of these two modes are used.

  * Windowed mode - there is a chunk of memory for
    each window which the application program draws
    into and one large chunk for the display to read
    from.  When *one* of the applications hits the
    swap-buffer call EITHER:
        a) The system *rapidly* (and in hardware)
           copies that window buffer into the display
           buffer at the right location.
    ...OR:
        b) It waits for the next vertical retrace and
           copies the buffer.  Since it can copy
           pixels much faster than the display can
           read them, the new image is replaced faster
           than the CRT can display it and it appears
           to swap instantaneously.
    Once again, that shell variable is gonna determine
    which you get.

What happens in windowed mode is rather inevitable because
different applications may choose to swap their buffers
at different times - and windows can overlap, be hidden or
be iconified and yet still be rendered into.

This also helps to explain why running full-screen is
typically faster than running in a window - you save the
hardware the time to copy the image.

----
Steve Baker                      (817)619-2657 (Vox/Vox-Mail)
L3Com/Link Simulation & Training (817)619-2466 (Fax)
Work: sjbaker@link.com           http://www.link.com
Home: sjbaker1@airmail.net       http://www.sjbaker.org