Re: [gtk-list] Re: Gdk, X11, and backing store



On Wed, 11 Nov 1998, Jeff Garzik wrote:

> Dov Grobgeld wrote:
> > 
> > I have a question concerned with the lack of backing store in Gdk. I'm
> > not a big expert on X, but one of the things that I have picked up is
> > that if when you create a window do:
> > 
> >     unsigned long valuemask;
> >     XSetWindowAttributes attributes;
> > 
> >     :
> >     valuemask = CWBackingStore;
> >     attributes.backing_store = WhenMapped;
> >     :
> > 
> >     win = XCreateWindow(... , valuemask, &attributes);
> >     XMapWindow(dpy, win);
> > 
> > you no longer get any exposure events for the window, but the X server
> > is taking care of the exposure events on its own by using backing_store.
> > 
> > For some reason not totally clear to me, it is much faster to use
> > backing store than to do the exposure handling yourself by drawing in
> > a pixmap and just copying it when you get the exposure event. I
> > suspect that the X-server is using video-memory than is not visible on
> > the screen, whereas such memory is not available for a user process,
> > but I might be wrong.
> 
> I believe that the X server uses server-side resources for the backing
> store, as you suspect.  If you want to do your own backing store-type
> functionality, use XImage*() calls.  An XImage is a server-side
> resource, whereas (IIRC) a pixmap is a client-side resource.

Actually it's the other way around. An XImage is a client-side resource.
Everytime you want to draw an XImage to a Drawable you have to copy that
image to the server. Shared memory XImages means that the server and
client share the piece of memory that make up the image and that means
that the server can copy the image from that memory location straight to
the video memory. It is therefore much faster than an ordinary XImage
where you have to transfer the whole image over the network.

A pixmap is a server-side resource and thus drawing a pixmap in a drawable
is much faster than drawing an image. A pixmap is also less flexible
in that you cannot modify individual pixels. 

Backing store is used by the server to eliminate the need of expose
events. The server simply stores the piece of the window that is covered
by something and redraws it when that part becomes visible again. Thus
using backing store uses more server side resources. Backing store is
intended for use with windows with short life expectancy such as menues.
If you use backing store for every window you will spend a lot of server
resources and that is not nice to other applications.



I hope I got everything right. It's been a long time since I read the Xlib
programming manual.

-----------------------------------------------------------------------
Per Lewau (perle@lysator.liu.se) Student of Computer Science at
				 Linköping University, 
				 Sweden. 
"Why waste time learning, when ignorance is instantaneous?"
						- Hobbes



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