X Server Device Developer's Guide
검색에만이 책은
PDF로 이 문서 다운로드

MIT Shared Memory Extension

15

This chapter describes the functions that a ddx handler may call to enable full functionality of the MIT Shared Memory (MIT_SHM) extension. This extension is an MIT standard that is distributed with X11 Release 5 (X11R5).
The MIT_SHM extension is a version of the ximage interface where the actual image data is stored in a shared memory segment. This extension can yield a significant increase in performance for large images.
The following document is part of the MIT_SHM extension, and is online in the doc/hardcopy/Xext directory.
  • MIT_SHM - The MIT Shared Memory Extension, Jonathan Corbet, formatted and edited for release 5 by Keith Packard, MIT X Consortium.

MIT Shared Memory Interface

All ddx handlers may use the following functions to implement the MIT Shared Memory extension.
Table 15-1
Function NameDescription
ShmRegisterFbFuncsRegisters the cfb-compatible functions. The ddx handler must accept fake pixmaps. Fake pixmaps are pixmaps with devPrivates initialized to NULL and an internal format compatible with cfb. Note that ShmRegisterFbFuncs is called in mpgScreenInit and miScreenInit, so if your handler calls either of these functions, no other work is required.
ShmRegisterFuncsRegisters the specified shared memory function vectors. Note that to enable creation of shared memory pixmaps, you must use ShmRegisterFuncs or ShmRegisterFbFuncs.
ShmSetPixmapFormatRegisters the specified pixmap format.

ShmRegisterFbFuncs


  void ShmRegisterFbFuncs(ScreenPtr pScreen)  

PurposeThis function is provided to register the predefined shared memory functions. The predefined ShmFuncs record is registered as follows:
ShmFuncs fbFuncs={fbShmCreatePixmap, fbShmPutImage};
Called byThis function is called during device screen initialization.
ResultsThis function initializes the shmFuncs array indexed by the specified screen number with the ShmFuncs record.
ReturnsNone.

ShmRegisterFuncs


  void ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs)  

PurposeThis function is provided to register the shared memory functions. The ShmFuncsPtr has been defined as follows:
typedef struct _ShmFuncs {
Called byThis function is called during device screen initialization.
ResultsThis function initializes the shmFuncs array indexed by the specified screen number with funcs.
ReturnsShmSetPixmapFormatNone.
void ShmSetPixmapFormat(ScreenPtr pScreen, int format)
PurposeThis function is provided to register the shared memory pixmap format. The valid pixmap formats are XYPixmap, XYBitmap or ZPixmap.
Called byThis function is called during device screen initialization.
ResultsThis function initializes the shmPixFormat array indexed by the specified screen number with format.
ReturnsNone.