Fix a few problems in Xgl

This commit is contained in:
David Reveman 2005-03-16 20:05:19 +00:00
parent 04ccba4d40
commit 7109ae147c
7 changed files with 71 additions and 58 deletions

View File

@ -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);

View File

@ -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);
REGION_INIT (pGC->pScreen, &region, pBox, nBox);
XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
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, &region, &part, 1);
REGION_UNION (pDrawable->pScreen,
pDamageRegion, pDamageRegion, &region);
REGION_UNINIT (pDrawable->pScreen, &region);
}
pBox++;
}
/* hmm, overlap can't be good, don't know what to do about that */
REGION_VALIDATE (pGC->pScreen, &region, &overlap);
xglAddSurfaceDamage (pDrawable, &region);
REGION_UNINIT (pGC->pScreen, &region);
} 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;

View File

@ -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);

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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;