diff options
author | Dave Airlie <airlied@redhat.com> | 2011-06-10 14:55:30 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-06-10 14:55:30 +1000 |
commit | ff20983f5adb64665004e6aebb2930b545cec86a (patch) | |
tree | 24b3ce0a88519a3ee92d21fd2cf3d2bd995f5cdd | |
parent | 917a547511ae6d02ae36eb258b3f93e3c1fc9b41 (diff) |
drvmodel: another bunch of changes.
this is all an attempt to get EXA to behave in Xephyr.
-rw-r--r-- | dix/impedgc.c | 1 | ||||
-rw-r--r-- | dix/impedscrn.c | 4 | ||||
-rw-r--r-- | drv/drv_damage.c | 6 | ||||
-rw-r--r-- | drv/drv_gc.c | 4 | ||||
-rw-r--r-- | drv/drv_picture.c | 215 | ||||
-rw-r--r-- | drv/drvarc.c | 2 | ||||
-rw-r--r-- | exa/exa.c | 12 | ||||
-rw-r--r-- | exa/exa_accel.c | 17 | ||||
-rw-r--r-- | exa/exa_classic.c | 22 | ||||
-rw-r--r-- | exa/exa_driver.c | 4 | ||||
-rw-r--r-- | exa/exa_glyphs.c | 6 | ||||
-rw-r--r-- | exa/exa_migration_mixed.c | 4 | ||||
-rw-r--r-- | exa/exa_mixed.c | 4 | ||||
-rw-r--r-- | exa/exa_offscreen.c | 2 | ||||
-rw-r--r-- | exa/exa_priv.h | 6 | ||||
-rw-r--r-- | exa/exa_render.c | 47 | ||||
-rw-r--r-- | exa/exa_unaccel.c | 32 | ||||
-rw-r--r-- | fb/fb.h | 15 | ||||
-rw-r--r-- | fb/fb24_32.c | 6 | ||||
-rw-r--r-- | fb/fbcopy.c | 22 | ||||
-rw-r--r-- | fb/fbfill.c | 1 | ||||
-rw-r--r-- | fb/fbpixmap.c | 7 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyr_draw.c | 238 | ||||
-rw-r--r-- | include/scrnintstr.h | 3 | ||||
-rw-r--r-- | render/impedpict.c | 59 | ||||
-rw-r--r-- | render/picture.c | 1 |
26 files changed, 601 insertions, 139 deletions
diff --git a/dix/impedgc.c b/dix/impedgc.c index a2a7649cb..6baa3e7b2 100644 --- a/dix/impedgc.c +++ b/dix/impedgc.c @@ -195,6 +195,7 @@ impedPolyLines (DrawablePtr pDrawable, DrvGCPtr pDrvGC; impedGetDrawableDeltas(pDrawable, pPixmap, &x_off, &y_off); + fprintf(stderr,"poly lines %d %d\n", x_off, y_off); if (mode == CoordModePrevious) { ppt[0].x += x_off; ppt[0].y += y_off; diff --git a/dix/impedscrn.c b/dix/impedscrn.c index cfc4749d4..b5d785a68 100644 --- a/dix/impedscrn.c +++ b/dix/impedscrn.c @@ -188,7 +188,6 @@ impedCreatePixmap (ScreenPtr pScreen, int width, int height, int depth, if (!pPixmap) return NULL; - pPixmap->gpu[0] = pScreen->gpu.CreatePixmap(pScreen, width, height, depth, usage_hint); pPixmap->drawable.type = DRAWABLE_PIXMAP; pPixmap->drawable.class = 0; pPixmap->drawable.pScreen = pScreen; @@ -210,6 +209,9 @@ impedCreatePixmap (ScreenPtr pScreen, int width, int height, int depth, pPixmap->usage_hint = usage_hint; + + pPixmap->gpu[0] = pScreen->gpu.CreatePixmap(pScreen, width, height, depth, usage_hint, pPixmap); + return pPixmap; } diff --git a/drv/drv_damage.c b/drv/drv_damage.c index 5cb4d6c58..f043fe821 100644 --- a/drv/drv_damage.c +++ b/drv/drv_damage.c @@ -34,7 +34,7 @@ DrvDamageCreate (DrvDamageReportFunc damageReport, { DrvDamagePtr pDamage; - pDamage = dixAllocateObjectWithPrivates(DrvDamageRec, PRIVATE_DAMAGE); + pDamage = dixAllocateObjectWithPrivates(DrvDamageRec, PRIVATE_DRV_DAMAGE); if (!pDamage) return 0; @@ -55,6 +55,8 @@ void DrvDamageRegister (PixmapPtr pPixmap, DrvDamagePtr pDamage) { + if (!pPixmap || !pPixmap->protoPixmap) + return; DamageRegister(&(pPixmap->protoPixmap->drawable), pDamage->pParent); } @@ -81,6 +83,7 @@ DrvDamageSetReportAfterOp (DrvDamagePtr pDamage, Bool reportAfter) extern _X_EXPORT void DrvDamageRegionAppend (PixmapPtr pPixmap, RegionPtr pRegion) { + if (pPixmap->protoPixmap) return DamageRegionAppend(&(pPixmap->protoPixmap->drawable), pRegion); } @@ -99,5 +102,6 @@ DrvDamageRegion (DrvDamagePtr pDamage) void DrvDamageRegionProcessPending (PixmapPtr pPixmap) { + if (pPixmap->protoPixmap) DamageRegionProcessPending(&(pPixmap->protoPixmap->drawable)); } diff --git a/drv/drv_gc.c b/drv/drv_gc.c index f7da8b12a..45c168e62 100644 --- a/drv/drv_gc.c +++ b/drv/drv_gc.c @@ -37,7 +37,7 @@ static void DrvCheckClip(PixmapPtr pPixmap, DrvGCPtr pGC) void DrvValidateGC(PixmapPtr pPixmap, DrvGCPtr pGC) { - // (*pGC->funcs->ValidateGC) (pGC, pGC->stateChanges, pDraw); + (*pGC->ops->GPUValidateGC) (pGC, pGC->stateChanges, pPixmap); DrvCheckClip(pPixmap, pGC); pGC->stateChanges = 0; // pGC->serialNumber = pDraw->serialNumber; @@ -57,7 +57,7 @@ DrvCreateDefaultTile (DrvGCPtr pGC) (*pGC->pScreen->gpu.QueryBestSize)(TileShape, &w, &h, pGC->pScreen); pTile = (PixmapPtr) (*pGC->pScreen->gpu.CreatePixmap)(pGC->pScreen, - w, h, pGC->depth, 0); + w, h, pGC->depth, 0, NULL); pgcScratch = DrvGetScratchGC(pGC->depth, pGC->pScreen); if (!pTile || !pgcScratch) { diff --git a/drv/drv_picture.c b/drv/drv_picture.c index 0d7d271e0..71a528316 100644 --- a/drv/drv_picture.c +++ b/drv/drv_picture.c @@ -108,7 +108,7 @@ DrvChangePicture (DrvPicturePtr pPicture, if (pAlpha && pAlpha->pDrawable->type == DRAWABLE_PIXMAP) pAlpha->refcnt++; if (pPicture->alphaMap) - FreePicture ((pointer) pPicture->alphaMap, (XID) 0); + DrvFreePicture ((pointer) pPicture->alphaMap); pPicture->alphaMap = pAlpha; } } @@ -263,7 +263,7 @@ DrvFreePicture (pointer value) PictureScreenPtr ps = GetPictureScreen(pScreen); if (pPicture->alphaMap) - FreePicture ((pointer) pPicture->alphaMap, (XID) 0); + DrvFreePicture ((pointer) pPicture->alphaMap); // (*ps->gpu.DestroyPicture) (pPicture); // (*ps->DestroyPictureClip) (pPicture); @@ -312,7 +312,6 @@ DrvCreatePicture (PixmapPtr pPixmap, int *vlist) { DrvPicturePtr pPicture; - PictureScreenPtr ps = GetPictureScreen(pPixmap->pScreen); int error = Success; pPicture = dixAllocateObjectWithPrivates(DrvPictureRec, PRIVATE_DRV_PICTURE); @@ -323,9 +322,14 @@ DrvCreatePicture (PixmapPtr pPixmap, pPicture->pPixmap = pPixmap; pPicture->pFormat = pFormat; - pPicture->format = pFormat->format | (pPixmap->bitsPerPixel << 24); + if (pFormat) { + pPicture->format = pFormat->format; + if (pPixmap) + pPicture->format |= (pPixmap->bitsPerPixel << 24); + } - ++pPixmap->refcnt; + if (pPixmap) + ++pPixmap->refcnt; pPicture->pNext = 0; SetDrvPictureToDefaults (pPicture); @@ -345,6 +349,31 @@ out: return pPicture; } +void +DrvValidatePicture (DrvPicturePtr pPicture) +{ + PixmapPtr pDrawable = pPicture->pPixmap; + BoxRec pixbounds; + + if (!pDrawable) + return; + /* XXX should we translate by drawable.x/y here ? */ + /* If you want pixmaps in offscreen memory, yes */ + pixbounds.x1 = 0; + pixbounds.y1 = 0; + pixbounds.x2 = pDrawable->width; + pixbounds.y2 = pDrawable->height; + + if (pPicture->freeCompClip) + { + RegionReset(pPicture->pCompositeClip, &pixbounds); + } + else + { + pPicture->freeCompClip = TRUE; + pPicture->pCompositeClip = RegionCreate(&pixbounds, 1); + } +} void DrvCompositePicture (CARD8 op, @@ -361,7 +390,11 @@ DrvCompositePicture (CARD8 op, CARD16 height) { PictureScreenPtr ps = GetPictureScreen(pDst->pPixmap->pScreen); - + + DrvValidatePicture (pSrc); + if (pMask) + DrvValidatePicture (pMask); + DrvValidatePicture (pDst); (*ps->gpu.Composite) (op, pSrc, pMask, @@ -468,7 +501,7 @@ DrvGlyphs (CARD8 op, height = extents.y2 - extents.y1; pMaskPixmap = (*pScreen->gpu.CreatePixmap) (pScreen, width, height, maskFormat->depth, - CREATE_PIXMAP_USAGE_SCRATCH); + CREATE_PIXMAP_USAGE_SCRATCH, NULL); if (!pMaskPixmap) return; component_alpha = NeedsComponent(maskFormat->format); @@ -560,3 +593,171 @@ DrvGlyphs (CARD8 op, (*pScreen->gpu.DestroyPixmap) (pMaskPixmap); } } + +#define BOUND(v) (INT16) ((v) < MINSHORT ? MINSHORT : (v) > MAXSHORT ? MAXSHORT : (v)) + +static inline pixman_bool_t +drvClipPictureReg (pixman_region16_t * pRegion, + pixman_region16_t * pClip, + int dx, + int dy) +{ + if (pixman_region_n_rects(pRegion) == 1 && + pixman_region_n_rects(pClip) == 1) + { + pixman_box16_t * pRbox = pixman_region_rectangles(pRegion, NULL); + pixman_box16_t * pCbox = pixman_region_rectangles(pClip, NULL); + int v; + + if (pRbox->x1 < (v = pCbox->x1 + dx)) + pRbox->x1 = BOUND(v); + if (pRbox->x2 > (v = pCbox->x2 + dx)) + pRbox->x2 = BOUND(v); + if (pRbox->y1 < (v = pCbox->y1 + dy)) + pRbox->y1 = BOUND(v); + if (pRbox->y2 > (v = pCbox->y2 + dy)) + pRbox->y2 = BOUND(v); + if (pRbox->x1 >= pRbox->x2 || + pRbox->y1 >= pRbox->y2) + { + pixman_region_init (pRegion); + } + } + else if (!pixman_region_not_empty (pClip)) + return FALSE; + else + { + if (dx || dy) + pixman_region_translate (pRegion, -dx, -dy); + if (!pixman_region_intersect (pRegion, pRegion, pClip)) + return FALSE; + if (dx || dy) + pixman_region_translate(pRegion, dx, dy); + } + return pixman_region_not_empty(pRegion); +} + +static __inline Bool +drvClipPictureSrc (RegionPtr pRegion, + DrvPicturePtr pPicture, + int dx, + int dy) +{ +#if 0 + if (pPicture->clientClipType != CT_NONE) + { + Bool result; + + pixman_region_translate ( pPicture->clientClip, + pPicture->clipOrigin.x + dx, + pPicture->clipOrigin.y + dy); + + result = RegionIntersect(pRegion, pRegion, pPicture->clientClip); + + pixman_region_translate ( pPicture->clientClip, + - (pPicture->clipOrigin.x + dx), + - (pPicture->clipOrigin.y + dy)); + + if (!result) + return FALSE; + } +#endif + return TRUE; +} +/* + * returns FALSE if the final region is empty. Indistinguishable from + * an allocation failure, but rendering ignores those anyways. + */ + +Bool +drvComputeCompositeRegion (RegionPtr pRegion, + DrvPicturePtr pSrc, + DrvPicturePtr pMask, + DrvPicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + + int v; + + pRegion->extents.x1 = xDst; + v = xDst + width; + pRegion->extents.x2 = BOUND(v); + pRegion->extents.y1 = yDst; + v = yDst + height; + pRegion->extents.y2 = BOUND(v); + pRegion->data = 0; + /* Check for empty operation */ + if (pRegion->extents.x1 >= pRegion->extents.x2 || + pRegion->extents.y1 >= pRegion->extents.y2) + { + pixman_region_init (pRegion); + return FALSE; + } + + /* clip against dst */ + if (!drvClipPictureReg (pRegion, pDst->pCompositeClip, 0, 0)) + { + pixman_region_fini (pRegion); + ErrorF("failed in clip against dst\n"); + return FALSE; + } + if (pDst->alphaMap) + { + if (!drvClipPictureReg (pRegion, pDst->alphaMap->pCompositeClip, + -pDst->alphaOrigin.x, + -pDst->alphaOrigin.y)) + { + pixman_region_fini (pRegion); + ErrorF("failed in clip against alpha map\n"); + return FALSE; + } + } + /* clip against src */ + if (!drvClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc)) + { + pixman_region_fini (pRegion); + ErrorF("failed in clip against src \n"); + return FALSE; + } + if (pSrc->alphaMap) + { + if (!drvClipPictureSrc (pRegion, pSrc->alphaMap, + xDst - (xSrc - pSrc->alphaOrigin.x), + yDst - (ySrc - pSrc->alphaOrigin.y))) + { + pixman_region_fini (pRegion); + ErrorF("failed in clip against src am \n"); + return FALSE; + } + } + /* clip against mask */ + if (pMask) + { + if (!drvClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask)) + { + ErrorF("failed in clip against mask \n"); + pixman_region_fini (pRegion); + return FALSE; + } + if (pMask->alphaMap) + { + if (!drvClipPictureSrc (pRegion, pMask->alphaMap, + xDst - (xMask - pMask->alphaOrigin.x), + yDst - (yMask - pMask->alphaOrigin.y))) + { + ErrorF("failed in clip against mask am\n"); + pixman_region_fini (pRegion); + return FALSE; + } + } + } + + return TRUE; +} diff --git a/drv/drvarc.c b/drv/drvarc.c index cc4e32493..3310408d9 100644 --- a/drv/drvarc.c +++ b/drv/drvarc.c @@ -1035,7 +1035,7 @@ drvPolyArc(PixmapPtr pPixmap, DrvGCPtr pGC, int narcs, xArc *parcs) * validate it */ pPixmapTo = (PixmapPtr)(*pPixmap->pScreen->gpu.CreatePixmap) (pPixmap->pScreen, pixmapWidth, pixmapHeight, 1, - CREATE_PIXMAP_USAGE_SCRATCH); + CREATE_PIXMAP_USAGE_SCRATCH, NULL); if (!pPixmapTo) { DrvFreeScratchGC(pGCTo); @@ -135,7 +135,15 @@ exaPixmapDirty (PixmapPtr pPix, int x1, int y1, int x2, int y2) return; RegionInit(®ion, &box, 1); - //TODO DamageDamageRegion(pPix, ®ion); + + DrvDamageRegionAppend (pPix, ®ion); + + /* Go back and report this damage for DamagePtrs with reportAfter set, since + * this call isn't part of an in-progress drawing op in the call chain and + * the DDX probably just wants to know about it right away. + */ + DrvDamageRegionProcessPending (pPix); + RegionUninit(®ion); } @@ -815,7 +823,7 @@ exaDriverInit (ScreenPtr pScreen, exaDDXDriverInit(pScreen); - if (!dixRegisterPrivateKey(&exaGCPrivateKeyRec, PRIVATE_GC, sizeof(ExaGCPrivRec))) { + if (!dixRegisterPrivateKey(&exaGCPrivateKeyRec, PRIVATE_DRV_GC, sizeof(ExaGCPrivRec))) { LogMessage(X_WARNING, "EXA(%d): Failed to allocate GC private\n", pScreen->myNum); diff --git a/exa/exa_accel.c b/exa/exa_accel.c index a1029a84b..f1ccad24a 100644 --- a/exa/exa_accel.c +++ b/exa/exa_accel.c @@ -668,6 +668,7 @@ exaPolylines(PixmapPtr pPixmap, DrvGCPtr pGC, int mode, int npt, prect[i].height = y1 - y2 + 1; } + fprintf(stderr,"prect %d %dx%d %dx%d\n", i, prect[i].x, prect[i].y, prect[i].width, prect[i].height); x1 = x2; y1 = y2; } @@ -757,7 +758,7 @@ exaPolyFillRect(PixmapPtr pPix, RegionPtr pReg = RegionFromRects(nrect, prect, CT_UNSORTED); /* Compute intersection of rects and clip region */ - // RegionTranslate(pReg, pPixmap->x, pPixmap->y); + // RegionTranslate(pReg, 1, 1);//pPixmap->x, pPixmap->y); RegionIntersect(pReg, pClip, pReg); if (!RegionNumRects(pReg)) { @@ -904,15 +905,15 @@ const GCOps exaOps = { exaPolyPoint, exaPolylines, exaPolySegment, - miPolyRectangle, + drvPolyRectangle, ExaCheckPolyArc, - miFillPolygon, + drvFillPolygon, exaPolyFillRect, - miPolyFillArc, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, + drvPolyFillArc, + drvPolyText8, + drvPolyText16, + drvImageText8, + drvImageText16, ExaCheckImageGlyphBlt, ExaCheckPolyGlyphBlt, ExaCheckPushPixels, diff --git a/exa/exa_classic.c b/exa/exa_classic.c index 2624997c3..9dc00ebb3 100644 --- a/exa/exa_classic.c +++ b/exa/exa_classic.c @@ -54,7 +54,7 @@ ExaGetPixmapAddress(PixmapPtr p) */ PixmapPtr exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, - unsigned usage_hint) + unsigned usage_hint, ProtoPixmapPtr parent) { PixmapPtr pPixmap; ExaPixmapPrivPtr pExaPixmap; @@ -66,7 +66,7 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, return NullPixmap; swap(pExaScr, (&pScreen->gpu), CreatePixmap); - pPixmap = pScreen->gpu.CreatePixmap (pScreen, w, h, depth, usage_hint); + pPixmap = pScreen->gpu.CreatePixmap (pScreen, w, h, depth, usage_hint, parent); swap(pExaScr, (&pScreen->gpu), CreatePixmap); if (!pPixmap) @@ -102,9 +102,9 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, swap(pExaScr, (&pScreen->gpu), DestroyPixmap); return NULL; } -#if 0 + /* Set up damage tracking */ - pExaPixmap->pDamage = DamageCreate (NULL, NULL, + pExaPixmap->pDamage = DrvDamageCreate (NULL, NULL, DamageReportNone, TRUE, pScreen, pPixmap); @@ -115,11 +115,11 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, return NULL; } - DamageRegister (pPixmap, pExaPixmap->pDamage); + DrvDamageRegister (pPixmap, pExaPixmap->pDamage); /* This ensures that pending damage reflects the current operation. */ /* This is used by exa to optimize migration. */ - DamageSetReportAfterOp (pExaPixmap->pDamage, TRUE); -#endif + DrvDamageSetReportAfterOp (pExaPixmap->pDamage, TRUE); + pExaPixmap->area = NULL; /* We set the initial pixmap as completely valid for a simple reason. @@ -192,13 +192,11 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int dept /* Pixmaps subject to ModifyPixmapHeader will be pinned to system or * gpu memory, so there's no need to track damage. */ -#if 0 if (pExaPixmap->pDamage) { - DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage); - DamageDestroy(pExaPixmap->pDamage); + DrvDamageUnregister(pPixmap, pExaPixmap->pDamage); + DrvDamageDestroy(pExaPixmap->pDamage); pExaPixmap->pDamage = NULL; } -#endif } swap(pExaScr, (&pScreen->gpu), ModifyPixmapHeader); @@ -228,7 +226,7 @@ exaDestroyPixmap_classic (PixmapPtr pPixmap) if (pExaPixmap->area) { DBG_PIXMAP(("-- 0x%p (0x%x) (%dx%d)\n", - (void*)pPixmap->id, + 0, ExaGetPixmapPriv(pPixmap)->area->offset, pPixmap->width, pPixmap->height)); diff --git a/exa/exa_driver.c b/exa/exa_driver.c index 36ddcf6d3..430bfadd5 100644 --- a/exa/exa_driver.c +++ b/exa/exa_driver.c @@ -48,7 +48,7 @@ ExaGetPixmapAddress(PixmapPtr p) */ PixmapPtr exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth, - unsigned usage_hint) + unsigned usage_hint, ProtoPixmapPtr parent) { PixmapPtr pPixmap; ExaPixmapPrivPtr pExaPixmap; @@ -60,7 +60,7 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth, return NullPixmap; swap(pExaScr, (&pScreen->gpu), CreatePixmap); - pPixmap = pScreen->gpu.CreatePixmap(pScreen, 0, 0, depth, usage_hint); + pPixmap = pScreen->gpu.CreatePixmap(pScreen, 0, 0, depth, usage_hint, parent); swap(pExaScr, (&pScreen->gpu), CreatePixmap); if (!pPixmap) diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c index 61b46b55e..25ac8d3e3 100644 --- a/exa/exa_glyphs.c +++ b/exa/exa_glyphs.c @@ -185,7 +185,7 @@ exaRealizeGlyphCaches(ScreenPtr pScreen, /* Now allocate the pixmap and picture */ pPixmap = (*pScreen->gpu.CreatePixmap) (pScreen, CACHE_PICTURE_WIDTH, - height, depth, 0); + height, depth, 0 , NULL); if (!pPixmap) return FALSE; @@ -737,7 +737,7 @@ exaGlyphs (CARD8 op, pMaskPixmap = (*pScreen->gpu.CreatePixmap) (pScreen, width, height, maskFormat->depth, - CREATE_PIXMAP_USAGE_SCRATCH); + CREATE_PIXMAP_USAGE_SCRATCH, NULL); if (!pMaskPixmap) return; component_alpha = NeedsComponent(maskFormat->format); @@ -765,7 +765,7 @@ exaGlyphs (CARD8 op, pMaskPixmap = (*pScreen->gpu.CreatePixmap) (pScreen, width, height, maskFormat->depth, - CREATE_PIXMAP_USAGE_SCRATCH); + CREATE_PIXMAP_USAGE_SCRATCH, NULL); if (!pMaskPixmap) return; diff --git a/exa/exa_migration_mixed.c b/exa/exa_migration_mixed.c index 77f2d1527..23e8c3481 100644 --- a/exa/exa_migration_mixed.c +++ b/exa/exa_migration_mixed.c @@ -66,8 +66,8 @@ exaCreateDriverPixmap_mixed(PixmapPtr pPixmap) if (!pExaPixmap->driverPriv) return; - (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0, - paddedWidth, NULL); + (*pScreen->gpu.ModifyPixmapHeader)(pPixmap, w, h, 0, 0, + paddedWidth, NULL); } void diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c index 701c7108c..fb1a9fcca 100644 --- a/exa/exa_mixed.c +++ b/exa/exa_mixed.c @@ -47,7 +47,7 @@ ExaGetPixmapAddress(PixmapPtr p) */ PixmapPtr exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth, - unsigned usage_hint) + unsigned usage_hint, ProtoPixmapPtr parent) { PixmapPtr pPixmap; ExaPixmapPrivPtr pExaPixmap; @@ -59,7 +59,7 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth, return NullPixmap; swap(pExaScr, (&pScreen->gpu), CreatePixmap); - pPixmap = pScreen->gpu.CreatePixmap(pScreen, 0, 0, depth, usage_hint); + pPixmap = pScreen->gpu.CreatePixmap(pScreen, 0, 0, depth, usage_hint, parent); swap(pExaScr, (&pScreen->gpu), CreatePixmap); if (!pPixmap) diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c index d67cd65d0..d2bc6214d 100644 --- a/exa/exa_offscreen.c +++ b/exa/exa_offscreen.c @@ -493,7 +493,7 @@ ExaOffscreenDefragment (ScreenPtr pScreen) PixmapPtr pDstPix; ExaPixmapPrivPtr pExaDstPix; - pDstPix = (*pScreen->gpu.CreatePixmap) (pScreen, 0, 0, 0, 0); + pDstPix = (*pScreen->gpu.CreatePixmap) (pScreen, 0, 0, 0, 0, NULL); if (!pDstPix) return NULL; diff --git a/exa/exa_priv.h b/exa/exa_priv.h index a73452b6b..a15412f86 100644 --- a/exa/exa_priv.h +++ b/exa/exa_priv.h @@ -595,7 +595,7 @@ extern const GCFuncs exaGCFuncs; /* exa_classic.c */ PixmapPtr exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, - unsigned usage_hint); + unsigned usage_hint, ProtoPixmapPtr parent); Bool exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth, @@ -610,7 +610,7 @@ exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap); /* exa_driver.c */ PixmapPtr exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth, - unsigned usage_hint); + unsigned usage_hint, ProtoPixmapPtr parent); Bool exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth, @@ -625,7 +625,7 @@ exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap); /* exa_mixed.c */ PixmapPtr exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth, - unsigned usage_hint); + unsigned usage_hint, ProtoPixmapPtr parent); Bool exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth, diff --git a/exa/exa_render.c b/exa/exa_render.c index 7935509b1..ea2702953 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -78,7 +78,7 @@ static void exaCompositeFallbackPictDesc(DrvPicturePtr pict, char *string, int n } if (pict->pPixmap) { - loc = exaGetOffscreenPixmap(pict->pPixmap, &temp, &temp) ? 's' : 'm'; + loc = exaGetOffscreenPixmap(pict->pPixmap) ? 's' : 'm'; snprintf(size, 20, "%dx%d%s", pict->pPixmap->width, pict->pPixmap->height, pict->repeat ? @@ -285,10 +285,12 @@ exaTryDriverSolidFill(DrvPicturePtr pSrc, ySrc += pSrc->pPixmap->y; } #endif - if (!miComputeCompositeRegion (®ion, pSrc, NULL, pDst, - xSrc, ySrc, 0, 0, xDst, yDst, - width, height)) + if (!drvComputeCompositeRegion (®ion, pSrc, NULL, pDst, + xSrc, ySrc, 0, 0, xDst, yDst, + width, height)) { + ErrorF("compute comp failed\n"); return 1; + } if (pSrc->pPixmap) { pSrcPix = pSrc->pPixmap; @@ -301,7 +303,8 @@ exaTryDriverSolidFill(DrvPicturePtr pSrc, !exaGetPixelFromRGBA(&pixel, red, green, blue, alpha, pDst->pFormat)) { - RegionUninit(®ion); + ErrorF("failed to get rgba\n"); + RegionUninit(®ion); return -1; } @@ -317,11 +320,13 @@ exaTryDriverSolidFill(DrvPicturePtr pSrc, if (!exaPixmapHasGpuCopy(pDstPix)) { RegionUninit(®ion); + ErrorF("failed to have gpu copy\n"); return 0; } if (!(*pExaScr->info->PrepareSolid) (pDstPix, GXcopy, 0xffffffff, pixel)) { + ErrorF("failed to prepare solid\n"); RegionUninit(®ion); return -1; } @@ -459,7 +464,7 @@ exaTryDriverCompositeRects(CARD8 op, ySrc += pSrc->pPixmap->y; } #endif - if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, + if (!drvComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, rects->width, rects->height)) goto next_rect; @@ -577,10 +582,10 @@ exaCompositeRects(CARD8 op, /************************************************************/ - ValidatePicture (pSrc); + DrvValidatePicture (pSrc); if (pMask) - ValidatePicture (pMask); - ValidatePicture (pDst); + DrvValidatePicture (pMask); + DrvValidatePicture (pDst); ret = exaTryDriverCompositeRects(op, pSrc, pMask, pDst, nrect, rects); @@ -688,9 +693,9 @@ exaTryDriverComposite(CARD8 op, return -1; } - if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, yDst, - width, height)) + if (!drvComputeCompositeRegion (®ion, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height)) return 1; if (pExaScr->do_migration) { @@ -885,7 +890,7 @@ exaComposite(CARD8 op, { ExaScreenPriv (pDst->pPixmap->pScreen); int ret = -1; - Bool saveSrcRepeat = pSrc->repeat; + Bool saveSrcRepeat = pSrc ? pSrc->repeat : 0; Bool saveMaskRepeat = pMask ? pMask->repeat : 0; RegionRec region; @@ -935,9 +940,9 @@ exaComposite(CARD8 op, xSrc += pSrc->pPixmap->x; ySrc += pSrc->pPixmap->y; #endif - if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, - yDst, width, height)) + if (!drvComputeCompositeRegion (®ion, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, + yDst, width, height)) goto done; ret = exaHWCopyNtoN(pSrc->pPixmap, pDst->pPixmap, NULL, @@ -980,9 +985,9 @@ exaComposite(CARD8 op, xSrc += pSrc->pPixmap->x; ySrc += pSrc->pPixmap->y; #endif - if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, - ySrc, xMask, yMask, xDst, yDst, - width, height)) + if (!drvComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, + ySrc, xMask, yMask, xDst, yDst, + width, height)) goto done; /* pattern origin is the point in the destination drawable @@ -1097,7 +1102,7 @@ exaCreateAlphaPicture (ScreenPtr pScreen, } pPixmap = (*pScreen->gpu.CreatePixmap) (pScreen, width, height, - pPictFormat->depth, 0); + pPictFormat->depth, 0, NULL); if (!pPixmap) return 0; pGC = DrvGetScratchGC (pPixmap->depth, pScreen); @@ -1173,7 +1178,7 @@ exaTrapezoids (CARD8 op, DrvPicturePtr pSrc, DrvPicturePtr pDst, xRel, yRel, 0, 0, bounds.x1, bounds.y1, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); - FreePicture (pPicture, 0); + DrvFreePicture (pPicture); } else { if (pDst->polyEdge == PolyEdgeSharp) maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1); diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c index 2f4d0d35e..2faf963dc 100644 --- a/exa/exa_unaccel.c +++ b/exa/exa_unaccel.c @@ -186,7 +186,7 @@ ExaFallbackPrepareReg(PixmapPtr pPixmap, pGC->clientClipType))) { BoxRec box; RegionRec reg; - PixmapPtr pPixmap = exaGetDrawablePixmap(pPixmap); + // PixmapPtr pPixmap = exaGetDrawablePixmap(pPixmap); box.x1 = x; box.y1 = y; @@ -352,7 +352,7 @@ ExaCheckPushPixels (DrvGCPtr pGC, PixmapPtr pBitmap, { EXA_PRE_FALLBACK_GC(pGC); EXA_FALLBACK(("from %p to %p (%c,%c)\n", pBitmap, pPixmap, - exaDrawableLocation(&pBitmap->drawable), + exaDrawableLocation(pBitmap), exaDrawableLocation(pPixmap))); ExaFallbackPrepareReg(pPixmap, pGC, x, y, w, h, EXA_PREPARE_DEST, TRUE); @@ -471,8 +471,8 @@ ExaPrepareCompositeReg(ScreenPtr pScreen, RegionNull(&pExaScr->srcReg); srcReg = &pExaScr->srcReg; pExaScr->srcPix = pSrcPix; - if (pSrc != pDst) - RegionTranslate(pSrc->pCompositeClip, 0 , 0); + // if (pSrc != pDst) + // RegionTranslate(pSrc->pCompositeClip, 0 , 0); // -pSrc->pPixmap->x, // -pSrc->pPixmap->y); } @@ -481,35 +481,35 @@ ExaPrepareCompositeReg(ScreenPtr pScreen, pMaskPix = exaGetDrawablePixmap(pMask->pPixmap); RegionNull(&pExaScr->maskReg); maskReg = &pExaScr->maskReg; - if (pMask != pDst && pMask != pSrc) - RegionTranslate(pMask->pCompositeClip, 0, 0); + // if (pMask != pDst && pMask != pSrc) + // RegionTranslate(pMask->pCompositeClip, 0, 0); // -pMask->pPixmap->x, // -pMask->pPixmap->y); } - RegionTranslate(pDst->pCompositeClip, 0, 0); + // RegionTranslate(pDst->pCompositeClip, 0, 0); // -pDst->pPixmap->x, // -pDst->pPixmap->y); pExaScr->SavedSourceValidate = ExaSrcValidate; swap(pExaScr, pScreen, SourceValidate); - ret = miComputeCompositeRegion (®ion, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, - xDst, - yDst, + ret = drvComputeCompositeRegion (®ion, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, + xDst, + yDst, width, height); swap(pExaScr, pScreen, SourceValidate); - RegionTranslate(pDst->pCompositeClip, 0, 0); + // RegionTranslate(pDst->pCompositeClip, 0, 0); // pDst->pPixmap->x, // pDst->pPixmap->y); - if (pSrc->pPixmap && pSrc != pDst) - RegionTranslate(pSrc->pCompositeClip, 0, 0); + // if (pSrc->pPixmap && pSrc != pDst) + // RegionTranslate(pSrc->pCompositeClip, 0, 0); // pSrc->pPixmap->x, // pSrc->pPixmap->y); - if (pMask && pMask->pPixmap && pMask != pDst && pMask != pSrc) - RegionTranslate(pMask->pCompositeClip, 0, 0); + // if (pMask && pMask->pPixmap && pMask != pDst && pMask != pSrc) + // RegionTranslate(pMask->pCompositeClip, 0, 0); /// pMask->pPixmap->x, ///pMask->pPixmap->y); @@ -1262,17 +1262,6 @@ fbCopyNto1 (PixmapPtr pSrcPixmap, Pixel bitplane, void *closure); -extern _X_EXPORT RegionPtr -fbCopyArea (PixmapPtr pSrcPixmap, - PixmapPtr pDstPixmap, - DrvGCPtr pGC, - int xIn, - int yIn, - int widthSrc, - int heightSrc, - int xOut, - int yOut); - drvCopyProc fbGetCopyAreaFunction(PixmapPtr pSrc, PixmapPtr pDst); @@ -1486,11 +1475,11 @@ fbPictureInit (ScreenPtr pScreen, extern _X_EXPORT PixmapPtr fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp, - unsigned usage_hint); + unsigned usage_hint, ProtoPixmapPtr parent); extern _X_EXPORT PixmapPtr fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth, - unsigned usage_hint); + unsigned usage_hint, ProtoPixmapPtr parent); extern _X_EXPORT Bool fbDestroyPixmap (PixmapPtr pPixmap); diff --git a/fb/fb24_32.c b/fb/fb24_32.c index ef0ac09e4..356749e64 100644 --- a/fb/fb24_32.c +++ b/fb/fb24_32.c @@ -541,9 +541,9 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel) int newXoff, newYoff; pNewTile = pScreen->gpu.CreatePixmap(pScreen, pOldTile->width, - pOldTile->height, - pOldTile->depth, - pOldTile->usage_hint); + pOldTile->height, + pOldTile->depth, + pOldTile->usage_hint, NULL); if (!pNewTile) return 0; fbGetDrawable (pOldTile, diff --git a/fb/fbcopy.c b/fb/fbcopy.c index a9c676de7..4dbba78f5 100644 --- a/fb/fbcopy.c +++ b/fb/fbcopy.c @@ -289,28 +289,6 @@ fbCopyNto1 (PixmapPtr pSrcPixmap, } } -/* todo for ephyr EXA */ -RegionPtr -fbCopyArea (PixmapPtr pSrcPixmap, - PixmapPtr pDstPixmap, - DrvGCPtr pGC, - int xIn, - int yIn, - int widthSrc, - int heightSrc, - int xOut, - int yOut) -{ - drvCopyProc copy; - - if (pSrcPixmap->bitsPerPixel != pDstPixmap->bitsPerPixel) - copy = fb24_32CopyMtoN; - else - copy = fbCopyNtoN; - return miDoCopy (pSrcPixmap, pDstPixmap, pGC, xIn, yIn, - widthSrc, heightSrc, xOut, yOut, copy, 0, 0); -} - drvCopyProc fbGetCopyAreaFunction(PixmapPtr pSrc, PixmapPtr pDst) diff --git a/fb/fbfill.c b/fb/fbfill.c index f1a5c018f..e7931829f 100644 --- a/fb/fbfill.c +++ b/fb/fbfill.c @@ -42,6 +42,7 @@ fbFill (PixmapPtr pPixmap, fbGetDrawable (pPixmap, dst, dstStride, dstBpp, dstXoff, dstYoff); + ErrorF("fill %p %dx%d %dx%d %08x %08x\n", pPixmap, x, y, width, height, pGC->fgPixel, pGC->planemask); switch (pGC->fillStyle) { case FillSolid: #ifndef FB_ACCESS_WRAPPER diff --git a/fb/fbpixmap.c b/fb/fbpixmap.c index a45d7e7c5..bba18553c 100644 --- a/fb/fbpixmap.c +++ b/fb/fbpixmap.c @@ -30,7 +30,7 @@ PixmapPtr fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp, - unsigned usage_hint) + unsigned usage_hint, ProtoPixmapPtr parent) { PixmapPtr pPixmap; size_t datasize; @@ -67,6 +67,7 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp, pPixmap->devKind = paddedWidth; pPixmap->refcnt = 1; pPixmap->devPrivate.ptr = (pointer) ((char *)pPixmap + base + adjust); + pPixmap->protoPixmap = parent; #ifdef FB_DEBUG pPixmap->devPrivate.ptr = (void *) ((char *) pPixmap->devPrivate.ptr + paddedWidth); @@ -79,13 +80,13 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp, PixmapPtr fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth, - unsigned usage_hint) + unsigned usage_hint, ProtoPixmapPtr parent) { int bpp; bpp = BitsPerPixel (depth); if (bpp == 32 && depth <= 24) bpp = fbGetScreenPrivate(pScreen)->pix32bpp; - return fbCreatePixmapBpp (pScreen, width, height, depth, bpp, usage_hint); + return fbCreatePixmapBpp (pScreen, width, height, depth, bpp, usage_hint, parent); } Bool diff --git a/hw/kdrive/ephyr/ephyr_draw.c b/hw/kdrive/ephyr/ephyr_draw.c index b46287545..a815a3276 100644 --- a/hw/kdrive/ephyr/ephyr_draw.c +++ b/hw/kdrive/ephyr/ephyr_draw.c @@ -34,7 +34,7 @@ #include "drv_picturestr.h" #include "fbpict.h" -#define EPHYR_TRACE_DRAW 0 +#define EPHYR_TRACE_DRAW 1 #if EPHYR_TRACE_DRAW #define TRACE_DRAW() ErrorF("%s\n", __FUNCTION__); @@ -108,6 +108,7 @@ ephyrPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg) tmpval[0].val = alu; tmpval[1].val = pm; tmpval[2].val = fg; + DrvChangeGC(fakexa->pGC, GCFunction | GCPlaneMask | GCForeground, tmpval); DrvValidateGC(pPix, fakexa->pGC); @@ -182,6 +183,231 @@ ephyrPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, return TRUE; } +static void +myCopyRegion (PixmapPtr pSrcPixmap, + PixmapPtr pDstPixmap, + DrvGCPtr pGC, + RegionPtr pDstRegion, + int dx, + int dy, + drvCopyProc copyProc, + Pixel bitPlane, + void *closure) +{ + int careful; + Bool reverse; + Bool upsidedown; + BoxPtr pbox; + int nbox; + BoxPtr pboxNew1, pboxNew2, pboxBase, pboxNext, pboxTmp; + + pbox = RegionRects(pDstRegion); + nbox = RegionNumRects(pDstRegion); + + careful = (pSrcPixmap == pDstPixmap); + + pboxNew1 = NULL; + pboxNew2 = NULL; + if (careful && dy < 0) + { + upsidedown = TRUE; + + if (nbox > 1) + { + /* keep ordering in each band, reverse order of bands */ + pboxNew1 = (BoxPtr)malloc(sizeof(BoxRec) * nbox); + if(!pboxNew1) + return; + pboxBase = pboxNext = pbox+nbox-1; + while (pboxBase >= pbox) + { + while ((pboxNext >= pbox) && + (pboxBase->y1 == pboxNext->y1)) + pboxNext--; + pboxTmp = pboxNext+1; + while (pboxTmp <= pboxBase) + { + *pboxNew1++ = *pboxTmp++; + } + pboxBase = pboxNext; + } + pboxNew1 -= nbox; + pbox = pboxNew1; + } + } + else + { + /* walk source top to bottom */ + upsidedown = FALSE; + } + + if (careful && dx < 0) + { + /* walk source right to left */ + if (dy <= 0) + reverse = TRUE; + else + reverse = FALSE; + + if (nbox > 1) + { + /* reverse order of rects in each band */ + pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox); + if(!pboxNew2) + { + free(pboxNew1); + return; + } + pboxBase = pboxNext = pbox; + while (pboxBase < pbox+nbox) + { + while ((pboxNext < pbox+nbox) && + (pboxNext->y1 == pboxBase->y1)) + pboxNext++; + pboxTmp = pboxNext; + while (pboxTmp != pboxBase) + { + *pboxNew2++ = *--pboxTmp; + } + pboxBase = pboxNext; + } + pboxNew2 -= nbox; + pbox = pboxNew2; + } + } + else + { + /* walk source left to right */ + reverse = FALSE; + } + + (*copyProc) (pSrcPixmap, + pDstPixmap, + pGC, + pbox, + nbox, + dx, dy, + reverse, upsidedown, bitPlane, closure); + + free(pboxNew1); + free(pboxNew2); +} + +static RegionPtr +myDoCopy (PixmapPtr pSrcPixmap, + PixmapPtr pDstPixmap, + DrvGCPtr pGC, + int xIn, + int yIn, + int widthSrc, + int heightSrc, + int xOut, + int yOut, + drvCopyProc copyProc, + Pixel bitPlane, + void *closure) +{ + RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */ + Bool freeSrcClip = FALSE; + RegionPtr prgnExposed = NULL; + RegionRec rgnDst; + int dx; + int dy; + int numRects; + int box_x1; + int box_y1; + int box_x2; + int box_y2; + Bool fastSrc = FALSE; /* for fast clipping with pixmap source */ + Bool fastDst = FALSE; /* for fast clipping with one rect dest */ + + /* Compute source clip region */ + if (pSrcPixmap->type == DRAWABLE_PIXMAP) + { + if ((pSrcPixmap == pDstPixmap) && (pGC->clientClipType == CT_NONE)) + prgnSrcClip = fbGetCompositeClip(pGC); + else + fastSrc = TRUE; + } + + box_x1 = xIn; + box_y1 = yIn; + box_x2 = xIn + widthSrc; + box_y2 = yIn + heightSrc; + + dx = xIn - xOut; + dy = yIn - yOut; + + /* Don't create a source region if we are doing a fast clip */ + if (fastSrc) + { + RegionPtr cclip; + + /* Translate and clip the dst to the destination composite clip */ + box_x1 -= dx; + box_x2 -= dx; + box_y1 -= dy; + box_y2 -= dy; + + /* If the destination composite clip is one rectangle we can + do the clip directly. Otherwise we have to create a full + blown region and call intersect */ + + cclip = miGetCompositeClip(pGC); + if (RegionNumRects(cclip) == 1) + { + BoxPtr pBox = RegionRects(cclip); + + if (box_x1 < pBox->x1) box_x1 = pBox->x1; + if (box_x2 > pBox->x2) box_x2 = pBox->x2; + if (box_y1 < pBox->y1) box_y1 = pBox->y1; + if (box_y2 > pBox->y2) box_y2 = pBox->y2; + fastDst = TRUE; + } + } + + /* Check to see if the region is empty */ + if (box_x1 >= box_x2 || box_y1 >= box_y2) + { + RegionNull(&rgnDst); + } + else + { + BoxRec box; + box.x1 = box_x1; + box.y1 = box_y1; + box.x2 = box_x2; + box.y2 = box_y2; + RegionInit(&rgnDst, &box, 1); + } + + /* Clip against complex source if needed */ + if (!fastSrc) + { + RegionIntersect(&rgnDst, &rgnDst, prgnSrcClip); + RegionTranslate(&rgnDst, -dx, -dy); + } + + /* Clip against complex dest if needed */ + if (!fastDst) + { + RegionIntersect(&rgnDst, &rgnDst, + miGetCompositeClip(pGC)); + } + + /* Do bit blitting */ + numRects = RegionNumRects(&rgnDst); + if (numRects && widthSrc && heightSrc) + myCopyRegion (pSrcPixmap, pDstPixmap, pGC, + &rgnDst, dx, dy, copyProc, bitPlane, closure); + + RegionUninit(&rgnDst); + if (freeSrcClip) + RegionDestroy(prgnSrcClip); + return prgnExposed; +} + + /** * Does an fbCopyArea to take care of the requested copy. */ @@ -193,9 +419,12 @@ ephyrCopy(PixmapPtr pDst, int srcX, int srcY, int dstX, int dstY, int w, int h) KdScreenInfo *screen = pScreenPriv->screen; EphyrScrPriv *scrpriv = screen->driver; EphyrFakexaPriv *fakexa = scrpriv->fakexa; + drvCopyProc copy_proc = fbGetCopyAreaFunction(fakexa->pSrc, + fakexa->pDst); + - fbCopyArea(fakexa->pSrc, fakexa->pDst, fakexa->pGC, - srcX, srcY, w, h, dstX, dstY); + myDoCopy(fakexa->pSrc, fakexa->pDst, fakexa->pGC, srcX, srcY, w, h, + dstX, dstY, copy_proc, 0, 0); } /** @@ -247,6 +476,7 @@ ephyrPrepareComposite(int op, DrvPicturePtr pSrcPicture, DrvPicturePtr pMaskPict EphyrScrPriv *scrpriv = screen->driver; EphyrFakexaPriv *fakexa = scrpriv->fakexa; + return FALSE; ephyrPreparePipelinedAccess(pDst, EXA_PREPARE_DEST); ephyrPreparePipelinedAccess(pSrc, EXA_PREPARE_SRC); if (pMask != NULL) @@ -310,6 +540,7 @@ ephyrDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst, unsigned char *src; int src_pitch, cpp; + return FALSE; if (pSrc->bitsPerPixel < 8) return FALSE; @@ -347,6 +578,7 @@ ephyrUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, unsigned char *dst; int dst_pitch, cpp; + return FALSE; if (pDst->bitsPerPixel < 8) return FALSE; diff --git a/include/scrnintstr.h b/include/scrnintstr.h index 315d1205b..bbb926387 100644 --- a/include/scrnintstr.h +++ b/include/scrnintstr.h @@ -218,7 +218,8 @@ typedef PixmapPtr (* CreatePixmapProcPtr)( int /*width*/, int /*height*/, int /*depth*/, - unsigned /*usage_hint*/); + unsigned /*usage_hint*/, + ProtoPixmapPtr pParent); typedef ProtoPixmapPtr (* CreateProtoPixmapProcPtr)( ScreenPtr /*pScreen*/, diff --git a/render/impedpict.c b/render/impedpict.c index 8eddd647f..b0069cf0e 100644 --- a/render/impedpict.c +++ b/render/impedpict.c @@ -15,6 +15,7 @@ #include "drv_picturestr.h" #include "drv_pixmapstr.h" + static void SyncDrvPicture(PicturePtr pPicture, DrvPicturePtr pDrvPicture, int index) { @@ -32,6 +33,25 @@ static void SyncDrvPicture(PicturePtr pPicture, DrvPicturePtr pDrvPicture, pDrvPicture->pNext = pPicture->pNext->gpu[index]; if (pPicture->alphaMap) pDrvPicture->alphaMap = pPicture->alphaMap->gpu[index]; + + if (!pDrvPicture->pCompositeClip) + pDrvPicture->pCompositeClip = RegionCreate(NullBox, 0); + + if (pPicture->pCompositeClip) + RegionCopy(pDrvPicture->pCompositeClip, pPicture->pCompositeClip); + else + RegionNull(pDrvPicture->pCompositeClip); + +} + +static Bool CreateSourcePict(PicturePtr pPicture, PictureScreenPtr ps) +{ + if (!pPicture->gpu[0]) { + pPicture->gpu[0] = DrvCreatePicture(NULL, pPicture->pFormat, 0, NULL); + if (!pPicture->gpu[0]) + return FALSE; + } + return TRUE; } static int @@ -48,6 +68,8 @@ impedCreatePicture (PicturePtr pPicture) pPicture->gpu[0] = DrvCreatePicture(pPixmap->gpu[0], pPicture->pFormat, 0, 0); + if (!pPicture->gpu[0]) + ErrorF("no gpu 0 picture\n"); SyncDrvPicture(pPicture, pPicture->gpu[0], 0); return 0; } @@ -66,13 +88,21 @@ impedComposite (CARD8 op, CARD16 width, CARD16 height) { - PictureScreenPtr ps; int x_off, y_off; ProtoPixmapPtr pSrcPixmap = NULL, pDstPixmap, pMaskPixmap = NULL; DrvPicturePtr pDrvSrc, pDrvMask = NULL, pDrvDst; + ScreenPtr pScreen = pDst->pDrawable->pScreen; + PictureScreenPtr ps = GetPictureScreen(pScreen); if (pSrc->pDrawable) - pSrcPixmap = GetDrawablePixmap(pSrc->pDrawable); + pSrcPixmap = GetDrawablePixmap(pSrc->pDrawable); + else { + Bool ret; + ret = CreateSourcePict(pSrc, ps); + if (!ret) + return; + } + if (pMask) pMaskPixmap = GetDrawablePixmap(pMask->pDrawable); pDstPixmap = GetDrawablePixmap(pDst->pDrawable); @@ -97,12 +127,14 @@ impedComposite (CARD8 op, xDst += x_off; yDst += y_off; - ps = GetPictureScreen(pDst->pDrawable->pScreen); - pDrvSrc = pSrc->gpu[0]; - if (pMask) + SyncDrvPicture(pSrc, pDrvSrc, 0); + if (pMask) { pDrvMask = pMask->gpu[0]; + SyncDrvPicture(pMask, pDrvMask, 0); + } pDrvDst = pDst->gpu[0]; + SyncDrvPicture(pDst, pDrvDst, 0); if (pSrcPixmap) pDrvSrc->pPixmap = pSrcPixmap->gpu[0]; @@ -161,12 +193,19 @@ impedTrapezoids (CARD8 op, DrvPicturePtr pDrvSrc = NULL, pDrvDst; int i; int x_off, y_off; + Bool ret; - if (pSrc && pSrc->pDrawable) { - pSrcPixmap = GetDrawablePixmap(pSrc->pDrawable); - impedGetDrawableDeltas(pSrc->pDrawable, pSrcPixmap, &x_off, &y_off); - xSrc += x_off; - ySrc += y_off; + if (pSrc) { + if (pSrc->pDrawable) { + pSrcPixmap = GetDrawablePixmap(pSrc->pDrawable); + impedGetDrawableDeltas(pSrc->pDrawable, pSrcPixmap, &x_off, &y_off); + xSrc += x_off; + ySrc += y_off; + } else { + ret = CreateSourcePict(pSrc, ps); + if (!ret) + return; + } } pDstPixmap = GetDrawablePixmap(pDst->pDrawable); diff --git a/render/picture.c b/render/picture.c index f7d2ebaed..39a17ec6e 100644 --- a/render/picture.c +++ b/render/picture.c @@ -927,6 +927,7 @@ CreateSolidPicture (Picture pid, xRenderColor *color, int *error) } pPicture->pSourcePict->type = SourcePictTypeSolidFill; pPicture->pSourcePict->solidFill.color = xRenderColorToCard32(*color); + return pPicture; } |