Previous Next Table of Contents

2. PTC's ways of accessing the screen in X11

PTC at the moment implements three different ways of accessing the screen which are totally transparent to you, the programmer (i.e. you don't have to care which one is selected when you write your code). Before I explain what they mean, here is the order in which they are tried at runtime, the ones which are tried first are given priority because they are faster.

The different modes will be tried in the following order:

There are several reasons why DGA and MIT Shm can fail to initialise properly, and these will be presented in the respective sections. Again, the policy is to try the faster access modes first.

2.1 Direct Graphics Access (DGA)

DGA is an extension to the X protocol found, amongst others, in XFree86 servers. It allows direct writes to the frame buffer and thus it is quite fast. It is also the only way to get fullscreen access in X apart from stretching, which we really don't want ;)

For these reasons, PTC will try to open a DGA mode first. Due to the nature of DGA there are however quite a few restrictions:

All of these restrictions are due to the nature of the DGA extension, not to the way PTC is implemented. If you can't meet one of them, PTC will automatically fall back to the next lower level, which is MITShm.

2.2 MIT Shared Memory extension (MIT-Shm)

This X server extension, present in most X servers (tested on SGI, Linux) on systems with shared memory capabilities allows PTC to store its images in a shared memory segment and to skip the Xlib ipc channel.

This is not much slower than DGA, maybe a tiny bit because the surface you use has to be copied twice (once to the image, then to the window), but of course it is not fullscreen. Then again, your application does not have to run with root permissions.

The only restriction of SHM is that it will not run over a network. For remote display, only the next method is applicable.

2.3 XImage

The last option in the chain. This is certainly much slower than the ones mentioned above. A normal XImage is created as an offscreen surface to draw into and is put into the window when update is called.

The already mentioned advantages: No access right restrictions and it runs over a network (which is quite slow for realtime graphics, but this is about the concept :). Don't worry, though, this mode won't be entered on too many occasions at today's standard of X servers.


Previous Next Table of Contents