saa/saa_render.c
static void
saa_triangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
	      PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
	      int ntri, xTriangle * tris)
{
    ScreenPtr pScreen = pDst->pDrawable->pScreen;
    PictureScreenPtr ps = GetPictureScreen(pScreen);
    BoxRec bounds;

    if (maskFormat) {
	PicturePtr pPicture;
	INT16 xDst, yDst;
	INT16 xRel, yRel;
	saa_access_t access;

	miTriangleBounds(ntri, tris, &bounds);

	if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
	    return;

	xDst = tris[0].p1.x >> 16;
	yDst = tris[0].p1.y >> 16;

	pPicture = saa_create_alpha_picture(pScreen, pDst, maskFormat,
					    bounds.x2 - bounds.x1,
					    bounds.y2 - bounds.y1);
	if (!pPicture)
	    return;

	if (saa_pad_write(pPicture->pDrawable, NULL, FALSE, &access)) {
	    (*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris);
	    saa_fad_write(pPicture->pDrawable, access);
	}

	xRel = bounds.x1 + xSrc - xDst;
	yRel = bounds.y1 + ySrc - yDst;
	CompositePicture(op, pSrc, pPicture, pDst,
			 xRel, yRel, 0, 0, bounds.x1, bounds.y1,
			 bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
	FreePicture(pPicture, 0);
    } else {
	if (pDst->polyEdge == PolyEdgeSharp)
	    maskFormat = PictureMatchFormat(pScreen, 1, PICT_a1);
	else
	    maskFormat = PictureMatchFormat(pScreen, 8, PICT_a8);

	for (; ntri; ntri--, tris++)
	    saa_triangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, tris);
    }
}
/**
 * saa_triangles is essentially a copy of miTriangles that uses
 * saa_create_alpha_picture instead of miCreateAlphaPicture.
 *
 * The problem with miCreateAlphaPicture is that it calls PolyFillRect
 * to initialize the contents after creating the pixmap, which
 * causes the pixmap to be moved in for acceleration. The subsequent
 * call to AddTriangles won't be accelerated however, which forces the pixmap
 * to be moved out again.
 */
saa_triangles is essentially a copy of miTriangles that uses
saa_create_alpha_picture instead of miCreateAlphaPicture.

The problem with miCreateAlphaPicture is that it calls PolyFillRect
to initialize the contents after creating the pixmap, which
causes the pixmap to be moved in for acceleration. The subsequent
call to AddTriangles won't be accelerated however, which forces the pixmap
to be moved out again.
saa_triangles is essentially a copy of miTriangles that uses saa_create_alpha_picture instead of miCreateAlphaPicture . The problem with miCreateAlphaPicture is that it calls PolyFillRect to initialize the contents after creating the pixmap which causes the pixmap to be moved in for acceleration . The subsequent call to AddTriangles won ' t be accelerated however which forces the pixmap to be moved out again .
static void
saa_triangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
	      PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
	      int ntri, xTriangle * tris)
{
    ScreenPtr pScreen = pDst->pDrawable->pScreen;
    PictureScreenPtr ps = GetPictureScreen(pScreen);
    BoxRec bounds;
    if (maskFormat) {
	PicturePtr pPicture;
	INT16 xDst, yDst;
	INT16 xRel, yRel;
	saa_access_t access;
	miTriangleBounds(ntri, tris, &bounds);
	if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
	    return;
	xDst = tris[0].p1.x >> 16;
	yDst = tris[0].p1.y >> 16;
	pPicture = saa_create_alpha_picture(pScreen, pDst, maskFormat,
					    bounds.x2 - bounds.x1,
					    bounds.y2 - bounds.y1);
	if (!pPicture)
	    return;
	if (saa_pad_write(pPicture->pDrawable, NULL, FALSE, &access)) {
	    (*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris);
	    saa_fad_write(pPicture->pDrawable, access);
	}
	xRel = bounds.x1 + xSrc - xDst;
	yRel = bounds.y1 + ySrc - yDst;
	CompositePicture(op, pSrc, pPicture, pDst,
			 xRel, yRel, 0, 0, bounds.x1, bounds.y1,
			 bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
	FreePicture(pPicture, 0);
    } else {
	if (pDst->polyEdge == PolyEdgeSharp)
	    maskFormat = PictureMatchFormat(pScreen, 1, PICT_a1);
	else
	    maskFormat = PictureMatchFormat(pScreen, 8, PICT_a8);
	for (; ntri; ntri--, tris++)
	    saa_triangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, tris);
    }
}
static void saa_triangles ( CARD8 op , PicturePtr pSrc , PicturePtr pDst , PictFormatPtr maskFormat , INT16 xSrc , INT16 ySrc , int ntri , xTriangle * tris ) { ScreenPtr pScreen = pDst -> pDrawable -> pScreen ; PictureScreenPtr ps = GetPictureScreen ( pScreen ) ; BoxRec bounds ; if ( maskFormat ) { PicturePtr pPicture ; INT16 xDst , yDst ; INT16 xRel , yRel ; saa_access_t access ; miTriangleBounds ( ntri , tris , & bounds ) ; if ( bounds . y1 >= bounds . y2 || bounds . x1 >= bounds . x2 ) return ; xDst = tris [ 0 ] . p1 . x >> 16 ; yDst = tris [ 0 ] . p1 . y >> 16 ; pPicture = saa_create_alpha_picture ( pScreen , pDst , maskFormat , bounds . x2 - bounds . x1 , bounds . y2 - bounds . y1 ) ; if ( ! pPicture ) return ; if ( saa_pad_write ( pPicture -> pDrawable , NULL , FALSE , & access ) ) { ( * ps -> AddTriangles ) ( pPicture , - bounds . x1 , - bounds . y1 , ntri , tris ) ; saa_fad_write ( pPicture -> pDrawable , access ) ; } xRel = bounds . x1 + xSrc - xDst ; yRel = bounds . y1 + ySrc - yDst ; CompositePicture ( op , pSrc , pPicture , pDst , xRel , yRel , 0 , 0 , bounds . x1 , bounds . y1 , bounds . x2 - bounds . x1 , bounds . y2 - bounds . y1 ) ; FreePicture ( pPicture , 0 ) ; } else { if ( pDst -> polyEdge == PolyEdgeSharp ) maskFormat = PictureMatchFormat ( pScreen , 1 , PICT_a1 ) ; else maskFormat = PictureMatchFormat ( pScreen , 8 , PICT_a8 ) ; for ( ; ntri ; ntri -- , tris ++ ) saa_triangles ( op , pSrc , pDst , maskFormat , xSrc , ySrc , 1 , tris ) ; } }
saa_triangles is essentially a copy of miTriangles that uses
 saa_create_alpha_picture instead of miCreateAlphaPicture.
saa_triangles is essentially a copy of miTriangles that uses saa_create_alpha_picture instead of miCreateAlphaPicture .