saa/saa_render.c
static Bool
saa_copy_composite(CARD8 op,
		   PicturePtr pSrc,
		   PicturePtr pMask,
		   PicturePtr pDst,
		   INT16 xSrc,
		   INT16 ySrc,
		   INT16 xMask,
		   INT16 yMask,
		   INT16 xDst, INT16 yDst, CARD16 width, CARD16 height,
		   RegionPtr dst_region)
{
    if (!pSrc->pDrawable || pSrc->transform ||
	pSrc->repeat || xSrc < 0 || ySrc < 0 ||
	xSrc + width > pSrc->pDrawable->width ||
	ySrc + height > pSrc->pDrawable->height)
	return FALSE;

    if (op == PictOpSrc ||
	(op == PictOpOver && PICT_FORMAT_A(pSrc->format) == 0 &&
	 pMask == NULL)) {

	int xoff, yoff;
	PixmapPtr dst_pix = saa_get_pixmap(pDst->pDrawable, &xoff, &yoff);
	struct saa_pixmap *dst_spix = saa_pixmap(dst_pix);
	struct saa_pixmap *src_spix =
	    saa_pixmap(saa_get_drawable_pixmap(pSrc->pDrawable));
	int ret;

	if (src_spix->auth_loc != saa_loc_driver ||
	    dst_spix->auth_loc != saa_loc_driver)
	    return FALSE;

	src_spix->src_format = pSrc->format;
	dst_spix->dst_format = pDst->format;

	xDst += pDst->pDrawable->x;
	yDst += pDst->pDrawable->y;
	xSrc += pSrc->pDrawable->x;
	ySrc += pSrc->pDrawable->y;

	/*
	 * Dst region is in backing pixmap space. We need to
	 * translate it.
	 */
	REGION_TRANSLATE(pScreen, dst_region, -xoff, -yoff);
	ret = saa_hw_copy_nton(pSrc->pDrawable, pDst->pDrawable, NULL,
			       REGION_RECTS(dst_region),
			       REGION_NUM_RECTS(dst_region),
			       xSrc - xDst, ySrc - yDst, FALSE, FALSE);
	REGION_TRANSLATE(pScreen, dst_region, xoff, yoff);

	src_spix->src_format = 0;
	dst_spix->dst_format = 0;

	if (ret)
	    return TRUE;
    }
    return FALSE;
}
/*
 * Try to turn a composite operation into an accelerated copy.
 * We can do that in some special cases for PictOpSrc and PictOpOver.
 */
Try to turn a composite operation into an accelerated copy.
We can do that in some special cases for PictOpSrc and PictOpOver.
Try to turn a composite operation into an accelerated copy . We can do that in some special cases for PictOpSrc and PictOpOver .
static Bool
saa_copy_composite(CARD8 op,
		   PicturePtr pSrc,
		   PicturePtr pMask,
		   PicturePtr pDst,
		   INT16 xSrc,
		   INT16 ySrc,
		   INT16 xMask,
		   INT16 yMask,
		   INT16 xDst, INT16 yDst, CARD16 width, CARD16 height,
		   RegionPtr dst_region)
{
    if (!pSrc->pDrawable || pSrc->transform ||
	pSrc->repeat || xSrc < 0 || ySrc < 0 ||
	xSrc + width > pSrc->pDrawable->width ||
	ySrc + height > pSrc->pDrawable->height)
	return FALSE;
    if (op == PictOpSrc ||
	(op == PictOpOver && PICT_FORMAT_A(pSrc->format) == 0 &&
	 pMask == NULL)) {
	int xoff, yoff;
	PixmapPtr dst_pix = saa_get_pixmap(pDst->pDrawable, &xoff, &yoff);
	struct saa_pixmap *dst_spix = saa_pixmap(dst_pix);
	struct saa_pixmap *src_spix =
	    saa_pixmap(saa_get_drawable_pixmap(pSrc->pDrawable));
	int ret;
	if (src_spix->auth_loc != saa_loc_driver ||
	    dst_spix->auth_loc != saa_loc_driver)
	    return FALSE;
	src_spix->src_format = pSrc->format;
	dst_spix->dst_format = pDst->format;
	xDst += pDst->pDrawable->x;
	yDst += pDst->pDrawable->y;
	xSrc += pSrc->pDrawable->x;
	ySrc += pSrc->pDrawable->y;
	REGION_TRANSLATE(pScreen, dst_region, -xoff, -yoff);
	ret = saa_hw_copy_nton(pSrc->pDrawable, pDst->pDrawable, NULL,
			       REGION_RECTS(dst_region),
			       REGION_NUM_RECTS(dst_region),
			       xSrc - xDst, ySrc - yDst, FALSE, FALSE);
	REGION_TRANSLATE(pScreen, dst_region, xoff, yoff);
	src_spix->src_format = 0;
	dst_spix->dst_format = 0;
	if (ret)
	    return TRUE;
    }
    return FALSE;
}
static Bool saa_copy_composite ( CARD8 op , PicturePtr pSrc , PicturePtr pMask , PicturePtr pDst , INT16 xSrc , INT16 ySrc , INT16 xMask , INT16 yMask , INT16 xDst , INT16 yDst , CARD16 width , CARD16 height , RegionPtr dst_region ) { if ( ! pSrc -> pDrawable || pSrc -> transform || pSrc -> repeat || xSrc < 0 || ySrc < 0 || xSrc + width > pSrc -> pDrawable -> width || ySrc + height > pSrc -> pDrawable -> height ) return FALSE ; if ( op == PictOpSrc || ( op == PictOpOver && PICT_FORMAT_A ( pSrc -> format ) == 0 && pMask == NULL ) ) { int xoff , yoff ; PixmapPtr dst_pix = saa_get_pixmap ( pDst -> pDrawable , & xoff , & yoff ) ; struct saa_pixmap * dst_spix = saa_pixmap ( dst_pix ) ; struct saa_pixmap * src_spix = saa_pixmap ( saa_get_drawable_pixmap ( pSrc -> pDrawable ) ) ; int ret ; if ( src_spix -> auth_loc != saa_loc_driver || dst_spix -> auth_loc != saa_loc_driver ) return FALSE ; src_spix -> src_format = pSrc -> format ; dst_spix -> dst_format = pDst -> format ; xDst += pDst -> pDrawable -> x ; yDst += pDst -> pDrawable -> y ; xSrc += pSrc -> pDrawable -> x ; ySrc += pSrc -> pDrawable -> y ; REGION_TRANSLATE ( pScreen , dst_region , - xoff , - yoff ) ; ret = saa_hw_copy_nton ( pSrc -> pDrawable , pDst -> pDrawable , NULL , REGION_RECTS ( dst_region ) , REGION_NUM_RECTS ( dst_region ) , xSrc - xDst , ySrc - yDst , FALSE , FALSE ) ; REGION_TRANSLATE ( pScreen , dst_region , xoff , yoff ) ; src_spix -> src_format = 0 ; dst_spix -> dst_format = 0 ; if ( ret ) return TRUE ; } return FALSE ; }
Try to turn a composite operation into an accelerated copy.
Try to turn a composite operation into an accelerated copy .
/*
	 * Dst region is in backing pixmap space. We need to
	 * translate it.
	 */