[PATCH] [RFC] dix: don't use CopyWindow in driver level interface.
Michel Dänzer
michel at daenzer.net
Thu Mar 31 02:29:24 PDT 2011
On Don, 2011-03-31 at 15:21 +1000, Dave Airlie wrote:
>
> b) should the hook take Pixmap or Drawable, it probably at least
> needs an assert if it takes drawable and gets passed a window.
>
> c) is PixmapCopyRegion a good enough name?
FWIW, if the name contains Pixmap, it should probably take that. :)
> diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
> index bd533c4..5358acb 100644
> --- a/exa/exa_unaccel.c
> +++ b/exa/exa_unaccel.c
> @@ -162,6 +162,46 @@ ExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
> EXA_POST_FALLBACK_GC(pGC);
> }
>
> +void
> +ExaCheckPixmapCopyRegion(PixmapPtr pPix, RegionPtr prgnDst,
> + int dx, int dy)
> +{
> + ScreenPtr pScreen = pPix->drawable.pScreen;
> + ExaScreenPriv(pScreen);
> + int xoff, yoff;
> + RegionRec reg;
> + DrawablePtr pDrawable = &pPix->drawable;
> +
> + EXA_FALLBACK(("from %p\n", pPix, exaDrawableLocation(pDrawable)));
> +
> + exaGetDrawableDeltas(pDrawable, pPix, &xoff, &yoff);
> +
> + if (pExaScr->prepare_access_reg) {
> + RegionNull(®);
> + RegionCopy(®, prgnDst);
> + RegionTranslate(®, xoff + dx, yoff + dy);
> + pExaScr->prepare_access_reg(pPix, EXA_PREPARE_SRC, ®);
> + RegionUninit(®);
> + } else
> + exaPrepareAccess(pDrawable, EXA_PREPARE_SRC);
> +
> + if (pExaScr->prepare_access_reg) {
> + RegionNull(®);
> + RegionCopy(®, prgnDst);
> + RegionTranslate(®, xoff, yoff);
> + pExaScr->prepare_access_reg(pPix, EXA_PREPARE_SRC, ®);
> + RegionUninit(®);
> + } else
> + exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
EXA_PREPARE_SRC/DEST mismatch in the second block, but it's superfluous
anyway:
> @@ -369,33 +409,6 @@ ExaCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
> }
>
> void
> -ExaCheckCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
> -{
> - DrawablePtr pDrawable = &pWin->drawable;
> - ScreenPtr pScreen = pDrawable->pScreen;
> - EXA_PRE_FALLBACK(pScreen);
> - EXA_FALLBACK(("from %p\n", pWin));
> -
> - /* Only need the source bits, the destination region will be overwritten */
Looks like you missed this comment. :)
[...]
> diff --git a/mi/miwindow.c b/mi/miwindow.c
> index dc5d21a..c74357d 100644
> --- a/mi/miwindow.c
> +++ b/mi/miwindow.c
> @@ -822,3 +822,32 @@ miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth)
> miSegregateChildren(pChild, pReg, depth);
> }
> }
> +
> +void
> +miCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
> +{
> + /* get the pixmaps */
> + ScreenPtr pScreen = pWin->drawable.pScreen;
> + PixmapPtr pPixmap = pScreen->GetWindowPixmap(pWin);
> + RegionRec rgnDst;
> + int xoff = 0, yoff = 0;
> + int dx, dy;
> +
> +
> + dx = ptOldOrg.x - pWin->drawable.x;
> + dy = ptOldOrg.y - pWin->drawable.y;
> + RegionTranslate(prgnSrc, -dx, -dy);
> + RegionNull(&rgnDst);
> + RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
> +#ifdef COMPOSITE
> + if (pPixmap->screen_x || pPixmap->screen_y) {
> + xoff = -pPixmap->screen_x;
> + yoff = -pPixmap->screen_y;
> + }
> +#endif
> + RegionTranslate(&rgnDst, xoff, yoff);
Could only call RegionTranslate in the if block above, and move the
x/yoff locals there as well (or eliminate them altogether).
--
Earthling Michel Dänzer | http://www.vmware.com
Libre software enthusiast | Debian, X and DRI developer
More information about the xorg-devel
mailing list