Solaris Handbook for Sun Frame Buffers

Double Buffer Support

XIL supports double buffers on hardware where double buffers are available (e.g. the Creator family). This section describes the double buffer support functions and their usage.

The functions are:

If you want to use a display image as a double-buffered display image, then instead of using xil_create_from_window, use xil_create_double_buffered_window to create the image. Trying to use xil_create_double_buffered_window on hardware that does not support double buffers returns a NULL device. The developer must catch the failure and call xil_create_from_window instead.

If the image was created with xil_create_double_buffered_window and the hardware supports double buffers, then XilBufferId makes sense and can take two values, XIL_BACK_BUFFER and XIL_FRONT_BUFFER. For such a window, one of the buffers is considered to be active at any time, and all functions writing to the image will be writing the active buffer (for example a copy to the image will copy the pixels to the active buffer of the image). On the other hand, the front buffer is the one that is visible, i.e. displayed on the screen. At creation time, the active buffer is XIL_BACK_BUFFER.

To start using the display image as a double buffered image after it has been created by xil_create_double_buffered_window, you need to take no special action since the active buffer is XIL_BACK_BUFFER. If the active buffer has been set to XIL_FRONT_BUFFER, the image will not be used as a double-buffered image (although imaging operations will not fail). To start using it again as a double-buffered image, make a call like the following:


which will cause output to go to the back buffer. Note that in this case, the content of the image will not be displayed (i.e., visible) without some action from the user. The action to take is a call like the following:


This will make the content of the image visible. When the image is not needed as a double-buffered image any longer, make a call like the following:


This ensures that the write and display buffers of the hardware are reset to their default values.

The following is a typical code segment for using double buffers:

dest =
for (i=0; i<repeat; i++) {