Index: [thread] [date] [subject] [author]
  From: Marcus Sundberg <mackan@stacken.kth.se>
  To  : ggi-develop@eskimo.com
  Date: Thu, 18 Feb 1999 22:16:49 +0000

Re: New function ggiFlushRegion()

David Joffe wrote:
> 
> On Wed, 17 Feb 1999, Marcus Sundberg wrote:
> >As the comment suggest it's exactly the same as ggiFlush() except
> >that it will only flush the specified region on targets that can
> >do this - like the X target. On other targets it is identical to
> >ggiFlush().
> 
> Is this a good idea? Thinking specifically of my game .. I could, perhaps,
> improve performance on the X target by updating only the necessary regions ...
> this would probably amount to (say) 2 or 3 ggiFlushRegion calls in a single
> frame (which may or may not improve performance, depending on the overhead.
> Right now it's just a single ggiFlush per frame.) The problem here would be
> that if the same binary was run in console mode, or on the svgalib target, the
> same code would produce 3 entire screen flushes, clearly *not* optimal, if, as
> you say, it would be identical to ggiFlush. Or am I confused?

Note that ggiFlush() does very different things on different targets.

On the X target ggiFlush() makes the X server copy the offscreen
XImage that LibGGI draws on to the screen. And if MIT-SHM is not
available the XImage data is even pushed through a socket before 
the X-server gets it. Here a few ggiFlushRegion() is clearly very
advantageos over a single ggiFlush() if you have only modified small
parts of the visual.

On the svgalib, fbdev or DGA targets on the other hand ggiFlush()
does not do anything at all, so it doesn't matter if you use
ggiFlush() or ggiFlushRegion().

In short - less than say 5 ggiFlushRegion() calls on a total area of
less than half the visual is always better than a single ggiFlush()
call. If you need more ggiFlushRegion() calls or update a larger
area every frame you should probably do some benchmarking on
different targets and test which alternative gives best performance.

//Marcus
-- 
-------------------------------+------------------------------------
        Marcus Sundberg        | http://www.stacken.kth.se/~mackan/
 Royal Institute of Technology |       Phone: +46 707 295404
       Stockholm, Sweden       |   E-Mail: mackan@stacken.kth.se

Index: [thread] [date] [subject] [author]