9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] Double buffering graphics
@ 2002-05-30 19:40 andrey mirtchovski
  0 siblings, 0 replies; 8+ messages in thread
From: andrey mirtchovski @ 2002-05-30 19:40 UTC (permalink / raw)
  To: 9fans


> Any pointers on how I can implement
> double buffering graphics in  Plan9 ?

if you want an example of double buffered graphics in p9 you can look
at the XaoS source (http://www.acl.lanl.gov/plan9/xaos the relevant
file is in ./src/ui/ui-drv/plan9/).

it uses a single Image and two pixel arrays.  it works on the current
array and when it's ready executes a loadimage() and a draw()

pretty similar to Russ' solution



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [9fans] Double buffering graphics
  2002-06-05  7:51 andrey mirtchovski
@ 2002-06-10 10:02 ` Douglas A. Gwyn
  0 siblings, 0 replies; 8+ messages in thread
From: Douglas A. Gwyn @ 2002-06-10 10:02 UTC (permalink / raw)
  To: 9fans

> > Be sure to switch during the vertical retrace interval,
> > to avoid yucky visual artifacts.
andrey mirtchovski wrote:
> who should take care of that?  the drawing library (i.e.  draw()), the
> software or the driver?

If you're really fortunate, the graphics hardware was designed to
help in this frame synchronization.  Just how you do it depends on
the graphics subsystem (software and hardware) architecture and
capabilities.  As to who "should" take care of it, it "should" be
whoever is in the best position to detect the VRI onset, perhaps
an interrupt handler (which would simply switch buffer pointers).


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [9fans] Double buffering graphics
  2002-05-30 19:48 rsc
@ 2002-06-05  9:55 ` Douglas A. Gwyn
  0 siblings, 0 replies; 8+ messages in thread
From: Douglas A. Gwyn @ 2002-06-05  9:55 UTC (permalink / raw)
  To: 9fans

rsc@plan9.bell-labs.com wrote:
> One cheap way to do double buffering
> is to just allocate two images and then
> draw them onto the screen alternating
> between them.

Be sure to switch during the vertical retrace interval,
to avoid yucky visual artifacts.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [9fans] Double buffering graphics
@ 2002-06-05  7:51 andrey mirtchovski
  2002-06-10 10:02 ` Douglas A. Gwyn
  0 siblings, 1 reply; 8+ messages in thread
From: andrey mirtchovski @ 2002-06-05  7:51 UTC (permalink / raw)
  To: 9fans


> Be sure to switch during the vertical retrace interval,
> to avoid yucky visual artifacts.

who should take care of that?  the drawing library (i.e.  draw()), the
software or the driver?



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [9fans] Double buffering graphics
@ 2002-05-30 20:10 rog
  0 siblings, 0 replies; 8+ messages in thread
From: rog @ 2002-05-30 20:10 UTC (permalink / raw)
  To: 9fans

> Writes from normal memory to video memory
> are very fast.  The reverse operation is very slow
> (I've seen faster 5400rpm disks).

is it this that causes the big slowdown when
part of a window is off screen?



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [9fans] Double buffering graphics
@ 2002-05-30 20:10 rsc
  0 siblings, 0 replies; 8+ messages in thread
From: rsc @ 2002-05-30 20:10 UTC (permalink / raw)
  To: 9fans

yes.  then every operation is implemented by
copying the visible part of the window to the
main memory copy, performing the operation
there, and copying the visible part back.

russ




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [9fans] Double buffering graphics
@ 2002-05-30 19:48 rsc
  2002-06-05  9:55 ` Douglas A. Gwyn
  0 siblings, 1 reply; 8+ messages in thread
From: rsc @ 2002-05-30 19:48 UTC (permalink / raw)
  To: 9fans

That depends on exactly what you are trying to
accomplish.

If you want double buffering in the video
memory itself, that will take some work
(like a video memory allocator).

One cheap way to do double buffering
is to just allocate two images and then
draw them onto the screen alternating
between them.

If all you want is for the user not to see
intermediate images, you could just allocate
one image, work there, and draw it to the screen
whenever it is presentable.

Writes from normal memory to video memory
are very fast.  The reverse operation is very slow
(I've seen faster 5400rpm disks).

Russ



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [9fans] Double buffering graphics
@ 2002-05-30 19:43 Elizabeth Strumph
  0 siblings, 0 replies; 8+ messages in thread
From: Elizabeth Strumph @ 2002-05-30 19:43 UTC (permalink / raw)
  To: 9fans

Hallo,

Any pointers on how I can implement
double buffering graphics in  Plan9 ?

Thanks much
--Elizabeth

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-06-10 10:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-30 19:40 [9fans] Double buffering graphics andrey mirtchovski
2002-05-30 19:43 Elizabeth Strumph
2002-05-30 19:48 rsc
2002-06-05  9:55 ` Douglas A. Gwyn
2002-05-30 20:10 rsc
2002-05-30 20:10 rog
2002-06-05  7:51 andrey mirtchovski
2002-06-10 10:02 ` Douglas A. Gwyn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).