diff options
author | David Reveman <c99drn@cs.umu.se> | 2005-03-16 20:05:19 +0000 |
---|---|---|
committer | David Reveman <c99drn@cs.umu.se> | 2005-03-16 20:05:19 +0000 |
commit | 7109ae147c3a9d243d11f386cfbcfbf7b4ea7918 (patch) | |
tree | 5f0b506b6194cbcbaf7974b3b58866111e6ff6c1 /hw | |
parent | 04ccba4d40bef6cee902b118598272f26eebb1df (diff) |
Fix a few problems in Xgl
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xgl/xglcopy.c | 44 | ||||
-rw-r--r-- | hw/xgl/xglfill.c | 44 | ||||
-rw-r--r-- | hw/xgl/xglgc.c | 2 | ||||
-rw-r--r-- | hw/xgl/xglshm.c | 13 | ||||
-rw-r--r-- | hw/xgl/xglsync.c | 15 | ||||
-rw-r--r-- | hw/xgl/xgltrap.c | 3 | ||||
-rw-r--r-- | hw/xgl/xglwindow.c | 8 |
7 files changed, 71 insertions, 58 deletions
diff --git a/hw/xgl/xglcopy.c b/hw/xgl/xglcopy.c index 2404597d3..83895d385 100644 --- a/hw/xgl/xglcopy.c +++ b/hw/xgl/xglcopy.c @@ -38,45 +38,25 @@ xglCopy (DrawablePtr pSrc, int srcXoff, srcYoff; int dstXoff, dstYoff; + XGL_SCREEN_PRIV (pDst->pScreen); XGL_DRAWABLE_PIXMAP_PRIV (pSrc); - + if (!nBox) return TRUE; - /* source is all in software and damaged, fall-back is probably more - efficient */ - if (pPixmapPriv->allBits && - pPixmapPriv->pDamage && - REGION_NOTEMPTY (pDrawable->pScreen, - DamageRegion (pPixmapPriv->pDamage))) + if (!xglPrepareTarget (pDst)) return FALSE; - if (xglPrepareTarget (pDst)) - { - XGL_SCREEN_PRIV (pDst->pScreen); - - if (!xglSyncSurface (pSrc)) - return FALSE; - - XGL_GET_DRAWABLE (pDst, dst, dstXoff, dstYoff); - - /* blit to screen */ - if (dst == pScreenPriv->surface) - XGL_INCREMENT_PIXMAP_SCORE (pPixmapPriv, 5000); - } - else - { - if (!xglPrepareTarget (pSrc)) - return FALSE; - - if (!xglSyncSurface (pDst)) - return FALSE; - - XGL_GET_DRAWABLE (pDst, dst, dstXoff, dstYoff); - } - + if (!xglSyncSurface (pSrc)) + return FALSE; + XGL_GET_DRAWABLE (pSrc, src, srcXoff, srcYoff); - + XGL_GET_DRAWABLE (pDst, dst, dstXoff, dstYoff); + + /* blit to screen */ + if (dst == pScreenPriv->surface) + XGL_INCREMENT_PIXMAP_SCORE (pPixmapPriv, 5000); + glitz_surface_set_clip_region (dst, dstXoff, dstYoff, (glitz_box_t *) pBox, nBox); diff --git a/hw/xgl/xglfill.c b/hw/xgl/xglfill.c index 573484782..577caac11 100644 --- a/hw/xgl/xglfill.c +++ b/hw/xgl/xglfill.c @@ -188,10 +188,13 @@ xglFillRect (DrawablePtr pDrawable, pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1, pBox, nBox)) { - RegionRec region; - Bool overlap; + RegionRec region; + RegionPtr pDamageRegion; + glitz_surface_t *surface; + int xOff, yOff; XGL_DRAWABLE_PIXMAP (pDrawable); + XGL_PIXMAP_PRIV (pPixmap); if (!xglMapPixmapBits (pPixmap)) FatalError (XGL_SW_FAILURE_STRING); @@ -209,21 +212,34 @@ xglFillRect (DrawablePtr pDrawable, FatalError (XGL_SW_FAILURE_STRING); break; } + + pDamageRegion = DamageRegion (pPixmapPriv->pDamage); + + XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff); - REGION_INIT (pGC->pScreen, ®ion, pBox, nBox); + pPixmapPriv->damageBox = miEmptyBox; while (nBox--) { fbFill (pDrawable, pGC, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1); + + if (pPixmapPriv->format) + { + part.x1 = pBox->x1 + xOff; + part.y1 = pBox->y1 + yOff; + part.x2 = pBox->x2 + xOff; + part.y2 = pBox->y2 + yOff; + + REGION_INIT (pDrawable->pScreen, ®ion, &part, 1); + REGION_UNION (pDrawable->pScreen, + pDamageRegion, pDamageRegion, ®ion); + REGION_UNINIT (pDrawable->pScreen, ®ion); + } + pBox++; } - - /* hmm, overlap can't be good, don't know what to do about that */ - REGION_VALIDATE (pGC->pScreen, ®ion, &overlap); - xglAddSurfaceDamage (pDrawable, ®ion); - REGION_UNINIT (pGC->pScreen, ®ion); } else xglAddCurrentBitDamage (pDrawable); @@ -241,6 +257,9 @@ xglFillSpan (DrawablePtr pDrawable, BoxPtr pExtent; xglGeometryPtr pGeometry; + if (n < 1) + return TRUE; + pExtent = REGION_EXTENTS (pDrawable->pScreen, pGC->pCompositeClip); pGeometry = xglGetScratchVertexGeometry (pGC->pScreen, 2 * n); @@ -272,6 +291,9 @@ xglFillLine (DrawablePtr pDrawable, xglGeometryPtr pGeometry; Bool coincident_endpoints; + if (npt < 2) + return TRUE; + pExtent = REGION_EXTENTS (pDrawable->pScreen, pGC->pCompositeClip); coincident_endpoints = FALSE; @@ -342,6 +364,9 @@ xglFillSegment (DrawablePtr pDrawable, BoxPtr pExtent; xglGeometryPtr pGeometry; + if (nsegInit < 1) + return TRUE; + pExtent = REGION_EXTENTS (pDrawable->pScreen, pGC->pCompositeClip); pGeometry = xglGetScratchVertexGeometry (pGC->pScreen, 2 * nsegInit); @@ -376,6 +401,9 @@ xglFillGlyph (DrawablePtr pDrawable, BoxPtr pExtent; xglGeometryRec geometry; + if (nGlyph < 1) + return TRUE; + pExtent = REGION_EXTENTS (pDrawable->pScreen, pGC->pCompositeClip); x += pDrawable->x; diff --git a/hw/xgl/xglgc.c b/hw/xgl/xglgc.c index 82e2829b8..610755932 100644 --- a/hw/xgl/xglgc.c +++ b/hw/xgl/xglgc.c @@ -206,7 +206,7 @@ xglCopyArea (DrawablePtr pSrc, box.x2 = box.x1 + w; box.y2 = box.y1 + h; - if (pGCPriv->flags &= ~xglGCReadOnlyDrawableFlag) + if (pGC->alu != GXcopy || (pGCPriv->flags &= ~xglGCReadOnlyDrawableFlag)) { if (!xglSyncBits (pSrc, &box)) FatalError (XGL_SW_FAILURE_STRING); diff --git a/hw/xgl/xglshm.c b/hw/xgl/xglshm.c index 020abd33f..3ac0c9453 100644 --- a/hw/xgl/xglshm.c +++ b/hw/xgl/xglshm.c @@ -46,6 +46,9 @@ xglShmPutImage (DrawablePtr pDrawable, ScreenPtr pScreen = pDrawable->pScreen; PixmapPtr pPixmapHeader = NULL; PixmapPtr pPixmap; + int saveTarget; + + XGL_DRAWABLE_PIXMAP_PRIV (pDrawable); if ((format == ZPixmap) || (depth == 1)) { @@ -53,7 +56,9 @@ xglShmPutImage (DrawablePtr pDrawable, GetScratchPixmapHeader (pScreen, w, h, depth, BitsPerPixel (depth), PixmapBytePad (w, depth), - (pointer) data); + (pointer) data); + if (pPixmap) + XGL_GET_PIXMAP_PRIV (pPixmap)->format = NULL; } else { @@ -95,6 +100,10 @@ xglShmPutImage (DrawablePtr pDrawable, if (!pPixmap) return; + /* CopyArea should always be done in software */ + saveTarget = pPixmapPriv->target; + pPixmapPriv->target = xglPixmapTargetNo; + if (format == XYBitmap) (*pGC->ops->CopyPlane) ((DrawablePtr) pPixmap, pDrawable, pGC, sx, sy, sw, sh, dx, dy, 1L); @@ -102,6 +111,8 @@ xglShmPutImage (DrawablePtr pDrawable, (*pGC->ops->CopyArea) ((DrawablePtr) pPixmap, pDrawable, pGC, sx, sy, sw, sh, dx, dy); + pPixmapPriv->target = saveTarget; + if (pPixmapHeader) FreeScratchPixmapHeader (pPixmapHeader); else diff --git a/hw/xgl/xglsync.c b/hw/xgl/xglsync.c index 1552419b1..52fb09d96 100644 --- a/hw/xgl/xglsync.c +++ b/hw/xgl/xglsync.c @@ -237,9 +237,6 @@ xglSyncSurface (DrawablePtr pDrawable) return FALSE; } - if (!pPixmapPriv->pDamage) - return TRUE; - pRegion = DamageRegion (pPixmapPriv->pDamage); if (REGION_NOTEMPTY (pDrawable->pScreen, pRegion)) @@ -375,14 +372,12 @@ xglAddCurrentBitDamage (DrawablePtr pDrawable) { XGL_DRAWABLE_PIXMAP_PRIV (pDrawable); - if (BOX_NOTEMPTY (&pPixmapPriv->bitBox)) + if (pPixmapPriv->target == xglPixmapTargetIn && + pPixmapPriv->damageBox.x1 < pPixmapPriv->bitBox.x2 && + pPixmapPriv->damageBox.y1 < pPixmapPriv->bitBox.y2 && + pPixmapPriv->damageBox.x2 > pPixmapPriv->bitBox.x1 && + pPixmapPriv->damageBox.y2 > pPixmapPriv->bitBox.y1) { - if (pPixmapPriv->damageBox.x1 > pPixmapPriv->bitBox.x2 || - pPixmapPriv->damageBox.y1 > pPixmapPriv->bitBox.y2 || - pPixmapPriv->damageBox.x2 < pPixmapPriv->bitBox.x1 || - pPixmapPriv->damageBox.y2 < pPixmapPriv->bitBox.y1) - return; - pPixmapPriv->bitBox = miEmptyBox; pPixmapPriv->allBits = FALSE; } diff --git a/hw/xgl/xgltrap.c b/hw/xgl/xgltrap.c index b4c2878ca..ad9e97b52 100644 --- a/hw/xgl/xgltrap.c +++ b/hw/xgl/xgltrap.c @@ -246,9 +246,8 @@ xglTrapezoids (CARD8 op, is likely to exceed the size of the mask. */ if ((SMOOTH_TRAPS_ESTIMATE_RECTS (nTrap) * 4) > (width * height)) accelerate = FALSE; - + } else accelerate = FALSE; - } pMask = xglCreateMaskPicture (pScreen, pDst, maskFormat, width, height, accelerate); diff --git a/hw/xgl/xglwindow.c b/hw/xgl/xglwindow.c index 5683fb1e2..ce921385b 100644 --- a/hw/xgl/xglwindow.c +++ b/hw/xgl/xglwindow.c @@ -107,10 +107,10 @@ xglCopyWindow (WindowPtr pWin, pPixmap = XGL_GET_WINDOW_PIXMAP (pWin); - box.x1 = pWin->drawable.x + pExtent->x1; - box.y1 = pWin->drawable.y + pExtent->y1; - box.x2 = pWin->drawable.x + pExtent->x2; - box.y2 = pWin->drawable.y + pExtent->y2; + box.x1 = pExtent->x1; + box.y1 = pExtent->y1; + box.x2 = pExtent->x2; + box.y2 = pExtent->y2; dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; |