dmxpict.c File Reference
#include "dmx.h"
#include "dmxsync.h"
#include "dmxpict.h"
#include "dmxwindow.h"
#include "dmxpixmap.h"
#include "fb.h"
#include "pixmapstr.h"
#include "dixstruct.h"
#include <X11/extensions/render.h>
#include <X11/extensions/renderproto.h>
#include <X11/extensions/Xfixes.h>
#include "picture.h"
#include "picturestr.h"
#include "mipict.h"
#include "fbpict.h"

Functions

static int dmxProcRenderCreateGlyphSet (ClientPtr client)
static int dmxProcRenderFreeGlyphSet (ClientPtr client)
static int dmxProcRenderAddGlyphs (ClientPtr client)
static int dmxProcRenderFreeGlyphs (ClientPtr client)
static int dmxProcRenderCompositeGlyphs (ClientPtr client)
static int dmxProcRenderSetPictureTransform (ClientPtr client)
static int dmxProcRenderSetPictureFilter (ClientPtr client)
static int dmxGlyphErrorHandler (Display *dpy, XErrorEvent *ev)
void dmxInitRender (void)
void dmxResetRender (void)
Bool dmxPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
static XRenderPictFormat * dmxFindFormat (DMXScreenInfo *dmxScreen, PictFormatPtr pFmt)
Bool dmxBEFreeGlyphSet (ScreenPtr pScreen, GlyphSetPtr glyphSet)
int dmxBECreateGlyphSet (int idx, GlyphSetPtr glyphSet)
static Picture dmxDoCreatePicture (PicturePtr pPicture)
void dmxCreatePictureList (WindowPtr pWindow)
int dmxBECreatePicture (PicturePtr pPicture)
int dmxCreatePicture (PicturePtr pPicture)
Bool dmxBEFreePicture (PicturePtr pPicture)
Bool dmxDestroyPictureList (WindowPtr pWindow)
void dmxDestroyPicture (PicturePtr pPicture)
int dmxChangePictureClip (PicturePtr pPicture, int clipType, pointer value, int n)
void dmxDestroyPictureClip (PicturePtr pPicture)
void dmxChangePicture (PicturePtr pPicture, Mask mask)
void dmxValidatePicture (PicturePtr pPicture, Mask mask)
void dmxComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
void dmxGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists, GlyphPtr *glyphs)
void dmxCompositeRects (CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, xRectangle *rects)
Bool dmxInitIndexed (ScreenPtr pScreen, PictFormatPtr pFormat)
void dmxCloseIndexed (ScreenPtr pScreen, PictFormatPtr pFormat)
void dmxUpdateIndexed (ScreenPtr pScreen, PictFormatPtr pFormat, int ndef, xColorItem *pdef)
void dmxTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps)
void dmxTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntri, xTriangle *tris)
void dmxTriStrip (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points)
void dmxTriFan (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points)

Variables

int RenderErrBase
int(* ProcRenderVector [RenderNumberRequests])(ClientPtr)
static int(* dmxSaveRenderVector [RenderNumberRequests])(ClientPtr)
static int dmxGlyphLastError

Detailed Description

Provide support for the RENDER extension (version 0.8).


Function Documentation

int dmxBECreateGlyphSet ( int  idx,
GlyphSetPtr  glyphSet 
)
int dmxBECreatePicture ( PicturePtr  pPicture)

Create pPicture on the backend.

References DMX_GET_PICT_PRIV, dmxDoCreatePicture(), dmxValidatePicture(), and _dmxPictPriv::pict.

Referenced by dmxBERestoreRenderPict().

Bool dmxBEFreeGlyphSet ( ScreenPtr  pScreen,
GlyphSetPtr  glyphSet 
)
Bool dmxBEFreePicture ( PicturePtr  pPicture)
void dmxChangePicture ( PicturePtr  pPicture,
Mask  mask 
)

Change the attributes of the pictures. If the picture has not yet been created due to lazy window creation, save the mask so that it can be used to appropriately initialize the picture's attributes when it is created later.

References DMX_GET_PICT_PRIV, DMX_UNWRAP, DMX_WRAP, dmxChangePicture(), dmxScreens, and _dmxPictPriv::savedMask.

Referenced by dmxChangePicture(), and dmxPictureInit().

int dmxChangePictureClip ( PicturePtr  pPicture,
int  clipType,
pointer  value,
int  n 
)
void dmxCloseIndexed ( ScreenPtr  pScreen,
PictFormatPtr  pFormat 
)

Indexed color visuals are not yet supported.

void dmxComposite ( CARD8  op,
PicturePtr  pSrc,
PicturePtr  pMask,
PicturePtr  pDst,
INT16  xSrc,
INT16  ySrc,
INT16  xMask,
INT16  yMask,
INT16  xDst,
INT16  yDst,
CARD16  width,
CARD16  height 
)

Composite a picture on the appropriate screen by combining the specified rectangle of the transformed src and mask operands with the specified rectangle of the dst using op as the compositing operator. For a complete description see the protocol document of the RENDER library.

References _DMXScreenInfo::beDisplay, DMX_GET_PICT_PRIV, DMX_UNWRAP, DMX_WRAP, dmxComposite(), dmxScreens, dmxSync(), and _dmxPictPriv::pict.

Referenced by dmxComposite(), and dmxPictureInit().

void dmxCompositeRects ( CARD8  op,
PicturePtr  pDst,
xRenderColor *  color,
int  nRect,
xRectangle *  rects 
)

Fill a rectangle on the appropriate screen by combining the color with the dest picture in the area specified by the list of rectangles. For a complete description see the protocol document of the RENDER library.

References _DMXScreenInfo::beDisplay, DMX_GET_PICT_PRIV, DMX_UNWRAP, DMX_WRAP, dmxCompositeRects(), dmxScreens, dmxSync(), and _dmxPictPriv::pict.

Referenced by dmxCompositeRects(), and dmxPictureInit().

int dmxCreatePicture ( PicturePtr  pPicture)

Create a picture. This function handles the CreatePicture unwrapping/wrapping and calls dmxDoCreatePicture to actually create the picture on the appropriate screen.

References DMX_GET_PICT_PRIV, DMX_UNWRAP, DMX_WRAP, dmxCreatePicture(), dmxDoCreatePicture(), dmxScreens, _dmxPictPriv::pict, and _dmxPictPriv::savedMask.

Referenced by dmxCreatePicture(), and dmxPictureInit().

void dmxCreatePictureList ( WindowPtr  pWindow)

Create a list of pictures. This function is called by dmxCreateAndRealizeWindow() during the lazy window creation realization process. It creates the entire list of pictures that are associated with the given window.

References DMX_GET_PICT_PRIV, dmxDoCreatePicture(), and _dmxPictPriv::pict.

Referenced by dmxCreateAndRealizeWindow().

void dmxDestroyPicture ( PicturePtr  pPicture)

Destroy a picture. This function calls the wrapped function that frees the resources in the DMX server associated with this picture.

References DMX_UNWRAP, DMX_WRAP, dmxBEFreePicture(), dmxDestroyPicture(), dmxScreens, and dmxSync().

Referenced by dmxDestroyPicture(), and dmxPictureInit().

void dmxDestroyPictureClip ( PicturePtr  pPicture)
Bool dmxDestroyPictureList ( WindowPtr  pWindow)

Destroy a list of pictures that are associated with the window that is being destroyed. This function is called by dmxDestroyWindow().

References dmxBEFreePicture().

Referenced by dmxDestroyWindow().

static Picture dmxDoCreatePicture ( PicturePtr  pPicture) [static]

Create a picture on the appropriate screen. This is the actual function that creates the picture. However, if the associated window has not yet been created due to lazy window creation, then delay the picture creation until the window is mapped.

References _DMXScreenInfo::beDisplay, DMX_GET_PIXMAP_PRIV, DMX_GET_WINDOW_PRIV, dmxFindFormat(), dmxScreens, _dmxWinPriv::hasPict, _dmxPixPriv::pixmap, and _dmxWinPriv::window.

Referenced by dmxBECreatePicture(), dmxCreatePicture(), and dmxCreatePictureList().

static XRenderPictFormat* dmxFindFormat ( DMXScreenInfo dmxScreen,
PictFormatPtr  pFmt 
) [static]

Find the appropriate format on the requested screen given the internal format requested. The list of formats is searched sequentially as the XRenderFindFormat() function does not always find the appropriate format when a specific format is requested.

References _DMXScreenInfo::beDisplay.

Referenced by dmxBECreateGlyphSet(), dmxDoCreatePicture(), dmxProcRenderCompositeGlyphs(), dmxTrapezoids(), dmxTriangles(), dmxTriFan(), and dmxTriStrip().

static int dmxGlyphErrorHandler ( Display *  dpy,
XErrorEvent *  ev 
) [static]

References dmxGlyphLastError.

Referenced by dmxBECreateGlyphSet().

void dmxGlyphs ( CARD8  op,
PicturePtr  pSrc,
PicturePtr  pDst,
PictFormatPtr  maskFormat,
INT16  xSrc,
INT16  ySrc,
int  nlists,
GlyphListPtr  lists,
GlyphPtr *  glyphs 
)

Null function to catch when/if RENDER calls lower level mi hooks. Compositing glyphs is handled by dmxProcRenderCompositeGlyphs(). This function should never be called.

Referenced by dmxPictureInit().

Bool dmxInitIndexed ( ScreenPtr  pScreen,
PictFormatPtr  pFormat 
)

Indexed color visuals are not yet supported.

void dmxInitRender ( void  )

Initialize the Proc Vector for the RENDER extension. The functions here cannot be handled by the mi layer RENDER hooks either because the required information is no longer available when it reaches the mi layer or no mi layer hooks exist. This function is called from InitOutput() since it should be initialized only once per server generation.

References dmxProcRenderAddGlyphs(), dmxProcRenderCompositeGlyphs(), dmxProcRenderCreateGlyphSet(), dmxProcRenderFreeGlyphs(), dmxProcRenderFreeGlyphSet(), dmxProcRenderSetPictureFilter(), dmxProcRenderSetPictureTransform(), dmxSaveRenderVector, and ProcRenderVector.

Referenced by InitOutput().

Bool dmxPictureInit ( ScreenPtr  pScreen,
PictFormatPtr  formats,
int  nformats 
)

Initialize the RENDER extension, allocate the picture privates and wrap mi function hooks. If the shadow frame buffer is used, then call the appropriate fb initialization function.

References DMX_WRAP, dmxChangePicture(), dmxChangePictureClip(), dmxComposite(), dmxCompositeRects(), dmxCreatePicture(), dmxDestroyPicture(), dmxDestroyPictureClip(), dmxGlyphs(), dmxPictPrivateKeyRec, dmxScreens, dmxShadowFB, dmxTrapezoids(), dmxTriangles(), dmxTriFan(), dmxTriStrip(), and dmxValidatePicture().

Referenced by dmxScreenInit().

static int dmxProcRenderAddGlyphs ( ClientPtr  client) [static]

Add glyphs to the Glyph Set on each screen.

References _DMXScreenInfo::beDisplay, DMX_GET_GLYPH_PRIV, dmxNumScreens, dmxSaveRenderVector, dmxScreens, dmxSync(), and _dmxGlyphPriv::glyphSets.

Referenced by dmxInitRender().

static int dmxProcRenderCompositeGlyphs ( ClientPtr  client) [static]

Composite glyphs on each screen into the requested picture. If either the src or dest picture has not been allocated due to lazy window creation, this request will gracefully return.

References _DMXScreenInfo::beDisplay, DMX_GET_GLYPH_PRIV, DMX_GET_PICT_PRIV, dmxFindFormat(), dmxSaveRenderVector, dmxScreens, dmxSync(), _dmxGlyphPriv::glyphSets, and _dmxPictPriv::pict.

Referenced by dmxInitRender().

static int dmxProcRenderCreateGlyphSet ( ClientPtr  client) [static]

Create a Glyph Set on each screen. Save the glyphset ID from each screen in the Glyph Set's private structure. Fail if the format requested is not available or if the Glyph Set cannot be created on the screen.

References _DMXScreenInfo::beDisplay, DMX_SET_GLYPH_PRIV, dmxBECreateGlyphSet(), dmxBEFreeGlyphSet(), dmxNumScreens, dmxSaveRenderVector, dmxScreens, and _dmxGlyphPriv::glyphSets.

Referenced by dmxInitRender().

static int dmxProcRenderFreeGlyphs ( ClientPtr  client) [static]

Free glyphs from the Glyph Set for each screen.

References _DMXScreenInfo::beDisplay, DMX_GET_GLYPH_PRIV, dmxNumScreens, dmxSaveRenderVector, dmxScreens, dmxSync(), and _dmxGlyphPriv::glyphSets.

Referenced by dmxInitRender().

static int dmxProcRenderFreeGlyphSet ( ClientPtr  client) [static]
static int dmxProcRenderSetPictureFilter ( ClientPtr  client) [static]

Set the picture filter on each screen.

References _DMXScreenInfo::beDisplay, DMX_GET_PICT_PRIV, dmxSaveRenderVector, dmxScreens, dmxSync(), and _dmxPictPriv::pict.

Referenced by dmxInitRender().

static int dmxProcRenderSetPictureTransform ( ClientPtr  client) [static]

Set the picture transform on each screen.

References _DMXScreenInfo::beDisplay, DMX_GET_PICT_PRIV, dmxSaveRenderVector, dmxScreens, dmxSync(), and _dmxPictPriv::pict.

Referenced by dmxInitRender().

void dmxResetRender ( void  )

Reset the Proc Vector for the RENDER extension back to the original functions. This function is called from dmxCloseScreen() during the server reset (only for screen #0).

References dmxSaveRenderVector, and ProcRenderVector.

Referenced by dmxCloseScreen().

void dmxTrapezoids ( CARD8  op,
PicturePtr  pSrc,
PicturePtr  pDst,
PictFormatPtr  maskFormat,
INT16  xSrc,
INT16  ySrc,
int  ntrap,
xTrapezoid *  traps 
)

Composite a list of trapezoids on the appropriate screen. For a complete description see the protocol document of the RENDER library.

References _DMXScreenInfo::beDisplay, DMX_GET_PICT_PRIV, DMX_UNWRAP, DMX_WRAP, dmxFindFormat(), dmxScreens, dmxSync(), dmxTrapezoids(), and _dmxPictPriv::pict.

Referenced by dmxPictureInit(), and dmxTrapezoids().

void dmxTriangles ( CARD8  op,
PicturePtr  pSrc,
PicturePtr  pDst,
PictFormatPtr  maskFormat,
INT16  xSrc,
INT16  ySrc,
int  ntri,
xTriangle *  tris 
)

Composite a list of triangles on the appropriate screen. For a complete description see the protocol document of the RENDER library.

References _DMXScreenInfo::beDisplay, DMX_GET_PICT_PRIV, DMX_UNWRAP, DMX_WRAP, dmxFindFormat(), dmxScreens, dmxSync(), dmxTriangles(), and _dmxPictPriv::pict.

Referenced by dmxPictureInit(), and dmxTriangles().

void dmxTriFan ( CARD8  op,
PicturePtr  pSrc,
PicturePtr  pDst,
PictFormatPtr  maskFormat,
INT16  xSrc,
INT16  ySrc,
int  npoint,
xPointFixed *  points 
)

Composite a triangle fan on the appropriate screen. For a complete description see the protocol document of the RENDER library.

References _DMXScreenInfo::beDisplay, DMX_GET_PICT_PRIV, DMX_UNWRAP, DMX_WRAP, dmxFindFormat(), dmxScreens, dmxSync(), dmxTriFan(), and _dmxPictPriv::pict.

Referenced by dmxPictureInit(), and dmxTriFan().

void dmxTriStrip ( CARD8  op,
PicturePtr  pSrc,
PicturePtr  pDst,
PictFormatPtr  maskFormat,
INT16  xSrc,
INT16  ySrc,
int  npoint,
xPointFixed *  points 
)

Composite a triangle strip on the appropriate screen. For a complete description see the protocol document of the RENDER library.

References _DMXScreenInfo::beDisplay, DMX_GET_PICT_PRIV, DMX_UNWRAP, DMX_WRAP, dmxFindFormat(), dmxScreens, dmxSync(), dmxTriStrip(), and _dmxPictPriv::pict.

Referenced by dmxPictureInit(), and dmxTriStrip().

void dmxUpdateIndexed ( ScreenPtr  pScreen,
PictFormatPtr  pFormat,
int  ndef,
xColorItem *  pdef 
)

Indexed color visuals are not yet supported.

void dmxValidatePicture ( PicturePtr  pPicture,
Mask  mask 
)

Validate the picture's attributes before rendering to it. Update any picture attributes that have been changed by one of the higher layers.

References _DMXScreenInfo::beDisplay, DMX_GET_PICT_PRIV, DMX_UNWRAP, DMX_WRAP, dmxScreens, dmxSync(), dmxValidatePicture(), _dmxPictPriv::pict, and _dmxPictPriv::savedMask.

Referenced by dmxBECreatePicture(), dmxPictureInit(), and dmxValidatePicture().


Variable Documentation

int dmxGlyphLastError [static]

Catch errors that might occur when allocating Glyph Sets. Errors are saved in dmxGlyphLastError for later handling.

Referenced by dmxBECreateGlyphSet(), and dmxGlyphErrorHandler().

int(* ProcRenderVector[RenderNumberRequests])(ClientPtr)

Referenced by dmxInitRender(), and dmxResetRender().