EXA: Migrate out pixmap in exaPrepareAccess.
Also fix exaFinishAccessGC not to use the same index for tile and stipple.
This commit is contained in:
parent
e510a77ba4
commit
8cfcf9973c
30
exa/exa.c
30
exa/exa.c
|
@ -329,14 +329,8 @@ exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* exaPrepareAccess() is EXA's wrapper for the driver's PrepareAccess() handler.
|
||||
*
|
||||
* It deals with waiting for synchronization with the card, determining if
|
||||
* PrepareAccess() is necessary, and working around PrepareAccess() failure.
|
||||
*/
|
||||
void
|
||||
exaPrepareAccess(DrawablePtr pDrawable, int index)
|
||||
ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
|
||||
{
|
||||
ScreenPtr pScreen = pDrawable->pScreen;
|
||||
ExaScreenPriv (pScreen);
|
||||
|
@ -367,6 +361,26 @@ exaPrepareAccess(DrawablePtr pDrawable, int index)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* exaPrepareAccess() is EXA's wrapper for the driver's PrepareAccess() handler.
|
||||
*
|
||||
* It deals with waiting for synchronization with the card, determining if
|
||||
* PrepareAccess() is necessary, and working around PrepareAccess() failure.
|
||||
*/
|
||||
void
|
||||
exaPrepareAccess(DrawablePtr pDrawable, int index)
|
||||
{
|
||||
ExaMigrationRec pixmaps[1];
|
||||
|
||||
pixmaps[0].as_dst = index == EXA_PREPARE_DEST;
|
||||
pixmaps[0].as_src = index != EXA_PREPARE_DEST;
|
||||
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
|
||||
|
||||
exaDoMigration(pixmaps, 1, FALSE);
|
||||
|
||||
ExaDoPrepareAccess(pDrawable, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* exaFinishAccess() is EXA's wrapper for the driver's FinishAccess() handler.
|
||||
*
|
||||
|
@ -698,7 +712,7 @@ exaDriverInit (ScreenPtr pScreen,
|
|||
pScreen->GetImage = exaGetImage;
|
||||
|
||||
pExaScr->SavedGetSpans = pScreen->GetSpans;
|
||||
pScreen->GetSpans = exaGetSpans;
|
||||
pScreen->GetSpans = ExaCheckGetSpans;
|
||||
|
||||
pExaScr->SavedCopyWindow = pScreen->CopyWindow;
|
||||
pScreen->CopyWindow = exaCopyWindow;
|
||||
|
|
|
@ -61,7 +61,6 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
|
|||
pPixmap->drawable.width > pExaScr->info->maxX ||
|
||||
pPixmap->drawable.height > pExaScr->info->maxY)
|
||||
{
|
||||
exaDoMigration (pixmaps, 1, FALSE);
|
||||
ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
|
||||
return;
|
||||
} else {
|
||||
|
@ -74,7 +73,6 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
|
|||
pGC->planemask,
|
||||
pGC->fgPixel))
|
||||
{
|
||||
exaDoMigration (pixmaps, 1, FALSE);
|
||||
ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
|
||||
return;
|
||||
}
|
||||
|
@ -158,11 +156,11 @@ exaDoPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
|
|||
|
||||
/* Don't bother with under 8bpp, XYPixmaps. */
|
||||
if (format != ZPixmap || bpp < 8)
|
||||
goto migrate_and_fallback;
|
||||
goto fallback;
|
||||
|
||||
/* Only accelerate copies: no rop or planemask. */
|
||||
if (!EXA_PM_IS_SOLID(pDrawable, pGC->planemask) || pGC->alu != GXcopy)
|
||||
goto migrate_and_fallback;
|
||||
goto fallback;
|
||||
|
||||
if (pExaScr->swappedOut)
|
||||
goto fallback;
|
||||
|
@ -240,9 +238,6 @@ exaDoPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
|
|||
|
||||
return TRUE;
|
||||
|
||||
migrate_and_fallback:
|
||||
exaDoMigration (pixmaps, 1, FALSE);
|
||||
|
||||
fallback:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -468,7 +463,6 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
|
|||
EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrcDrawable, pDstDrawable,
|
||||
exaDrawableLocation(pSrcDrawable),
|
||||
exaDrawableLocation(pDstDrawable)));
|
||||
exaDoMigration (pixmaps, 2, FALSE);
|
||||
exaPrepareAccess (pDstDrawable, EXA_PREPARE_DEST);
|
||||
exaPrepareAccess (pSrcDrawable, EXA_PREPARE_SRC);
|
||||
fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC,
|
||||
|
@ -731,15 +725,6 @@ exaPolyFillRect(DrawablePtr pDrawable,
|
|||
pGC->fgPixel))
|
||||
{
|
||||
fallback:
|
||||
if (pGC->fillStyle == FillTiled && !pGC->tileIsPixel) {
|
||||
pixmaps[1].as_dst = FALSE;
|
||||
pixmaps[1].as_src = TRUE;
|
||||
pixmaps[1].pPix = pGC->tile.pixmap;
|
||||
exaDoMigration (pixmaps, 2, FALSE);
|
||||
} else {
|
||||
exaDoMigration (pixmaps, 1, FALSE);
|
||||
}
|
||||
|
||||
ExaCheckPolyFillRect (pDrawable, pGC, nrect, prect);
|
||||
goto out;
|
||||
}
|
||||
|
@ -860,7 +845,6 @@ exaSolidBoxClipped (DrawablePtr pDrawable,
|
|||
{
|
||||
EXA_FALLBACK(("to %p (%c)\n", pDrawable,
|
||||
exaDrawableLocation(pDrawable)));
|
||||
exaDoMigration (pixmaps, 1, FALSE);
|
||||
fallback = TRUE;
|
||||
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
|
||||
fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel);
|
||||
|
@ -969,7 +953,6 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
|
|||
depthMask = FbFullMask(pDrawable->depth);
|
||||
if ((pGC->planemask & depthMask) != depthMask)
|
||||
{
|
||||
exaDoMigration(pixmaps, 1, FALSE);
|
||||
ExaCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase);
|
||||
goto damage;
|
||||
}
|
||||
|
@ -1004,7 +987,6 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
|
|||
}
|
||||
|
||||
EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
|
||||
exaDoMigration(pixmaps, 1, FALSE);
|
||||
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
|
||||
exaPrepareAccessGC (pGC);
|
||||
|
||||
|
@ -1146,7 +1128,6 @@ fallback:
|
|||
return FALSE;
|
||||
EXA_FALLBACK(("to %p (%c)\n", pDrawable,
|
||||
exaDrawableLocation(pDrawable)));
|
||||
exaDoMigration (pixmaps, 1, FALSE);
|
||||
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
|
||||
fbFillRegionSolid (pDrawable, pRegion, 0,
|
||||
fbReplicatePixel (pixel, pDrawable->bitsPerPixel));
|
||||
|
@ -1262,7 +1243,6 @@ fallback:
|
|||
EXA_FALLBACK(("from %p to %p (%c,%c)\n", pTile, pDrawable,
|
||||
exaDrawableLocation(&pTile->drawable),
|
||||
exaDrawableLocation(pDrawable)));
|
||||
exaDoMigration (pixmaps, 2, FALSE);
|
||||
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
|
||||
exaPrepareAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC);
|
||||
fbFillRegionTiled (pDrawable, pRegion, pTile);
|
||||
|
@ -1349,7 +1329,6 @@ exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
|
|||
unsigned int format, unsigned long planeMask, char *d)
|
||||
{
|
||||
ExaScreenPriv (pDrawable->pScreen);
|
||||
ExaMigrationRec pixmaps[1];
|
||||
PixmapPtr pPix;
|
||||
int xoff, yoff;
|
||||
Bool ok;
|
||||
|
@ -1362,13 +1341,13 @@ exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
|
|||
|
||||
/* Only cover the ZPixmap, solid copy case. */
|
||||
if (format != ZPixmap || !EXA_PM_IS_SOLID(pDrawable, planeMask))
|
||||
goto migrate_and_fallback;
|
||||
goto fallback;
|
||||
|
||||
/* Only try to handle the 8bpp and up cases, since we don't want to think
|
||||
* about <8bpp.
|
||||
*/
|
||||
if (pDrawable->bitsPerPixel < 8)
|
||||
goto migrate_and_fallback;
|
||||
goto fallback;
|
||||
|
||||
pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
|
||||
if (pPix == NULL)
|
||||
|
@ -1384,29 +1363,6 @@ exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
|
|||
return;
|
||||
}
|
||||
|
||||
migrate_and_fallback:
|
||||
pixmaps[0].as_dst = FALSE;
|
||||
pixmaps[0].as_src = TRUE;
|
||||
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
|
||||
exaDoMigration (pixmaps, 1, FALSE);
|
||||
fallback:
|
||||
ExaCheckGetImage (pDrawable, x, y, w, h, format, planeMask, d);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetSpans isn't accelerated yet, but performs migration so that we'll
|
||||
* hopefully avoid the read-from-framebuffer cost.
|
||||
*/
|
||||
void
|
||||
exaGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth,
|
||||
int nspans, char *pdstStart)
|
||||
{
|
||||
ExaMigrationRec pixmaps[1];
|
||||
|
||||
pixmaps[0].as_dst = FALSE;
|
||||
pixmaps[0].as_src = TRUE;
|
||||
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
|
||||
exaDoMigration (pixmaps, 1, FALSE);
|
||||
|
||||
ExaCheckGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ exaCopyDirtyToSys (PixmapPtr pPixmap)
|
|||
+ pBox->x1 * pPixmap->drawable.bitsPerPixel / 8,
|
||||
pExaPixmap->sys_pitch))
|
||||
{
|
||||
exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
|
||||
ExaDoPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
|
||||
exaMemcpyBox (pPixmap, pBox,
|
||||
pExaPixmap->fb_ptr, pExaPixmap->fb_pitch,
|
||||
pExaPixmap->sys_ptr, pExaPixmap->sys_pitch);
|
||||
|
@ -220,7 +220,7 @@ exaCopyDirtyToFb (PixmapPtr pPixmap)
|
|||
+ pBox->x1 * pPixmap->drawable.bitsPerPixel / 8,
|
||||
pExaPixmap->sys_pitch))
|
||||
{
|
||||
exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_DEST);
|
||||
ExaDoPrepareAccess(&pPixmap->drawable, EXA_PREPARE_DEST);
|
||||
exaMemcpyBox (pPixmap, pBox,
|
||||
pExaPixmap->sys_ptr, pExaPixmap->sys_pitch,
|
||||
pExaPixmap->fb_ptr, pExaPixmap->fb_pitch);
|
||||
|
@ -471,7 +471,7 @@ exaAssertNotDirty (PixmapPtr pPixmap)
|
|||
src_pitch = pExaPixmap->fb_pitch;
|
||||
cpp = pPixmap->drawable.bitsPerPixel / 8;
|
||||
|
||||
exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
|
||||
ExaDoPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
|
||||
while (nbox--) {
|
||||
int rowbytes;
|
||||
|
||||
|
@ -622,14 +622,9 @@ exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel)
|
|||
exaMoveInPixmap(pixmaps[i].pPix);
|
||||
}
|
||||
|
||||
/* If we couldn't fit everything in, then kick back out */
|
||||
/* If we couldn't fit everything in, abort */
|
||||
for (i = 0; i < npixmaps; i++) {
|
||||
if (!exaPixmapIsOffscreen(pixmaps[i].pPix)) {
|
||||
EXA_FALLBACK(("Pixmap %p (%dx%d) not in fb\n", pixmaps[i].pPix,
|
||||
pixmaps[i].pPix->drawable.width,
|
||||
pixmaps[i].pPix->drawable.height));
|
||||
for (j = 0; j < npixmaps; j++)
|
||||
exaMoveOutPixmap(pixmaps[j].pPix);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -298,10 +298,6 @@ void
|
|||
exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
|
||||
unsigned int format, unsigned long planeMask, char *d);
|
||||
|
||||
void
|
||||
exaGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth,
|
||||
int nspans, char *pdstStart);
|
||||
|
||||
extern const GCOps exaOps;
|
||||
|
||||
#ifdef MITSHM
|
||||
|
@ -338,6 +334,9 @@ void
|
|||
ExaOffscreenFini (ScreenPtr pScreen);
|
||||
|
||||
/* exa.c */
|
||||
void
|
||||
ExaDoPrepareAccess(DrawablePtr pDrawable, int index);
|
||||
|
||||
void
|
||||
exaPrepareAccess(DrawablePtr pDrawable, int index);
|
||||
|
||||
|
|
|
@ -738,7 +738,6 @@ fallback:
|
|||
exaPrintCompositeFallback (op, pSrc, pMask, pDst);
|
||||
#endif
|
||||
|
||||
exaDoMigration(pixmaps, npixmaps, FALSE);
|
||||
ExaCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc,
|
||||
xMask, yMask, xDst, yDst, width, height);
|
||||
|
||||
|
@ -889,18 +888,13 @@ exaRasterizeTrapezoid (PicturePtr pPicture, xTrapezoid *trap,
|
|||
int x_off, int y_off)
|
||||
{
|
||||
DrawablePtr pDraw = pPicture->pDrawable;
|
||||
ExaMigrationRec pixmaps[1];
|
||||
PixmapPtr pPixmap = exaGetDrawablePixmap(pDraw);
|
||||
int xoff, yoff;
|
||||
|
||||
pixmaps[0].as_dst = TRUE;
|
||||
pixmaps[0].as_src = TRUE;
|
||||
pixmaps[0].pPix = exaGetDrawablePixmap (pDraw);
|
||||
exaDoMigration(pixmaps, 1, FALSE);
|
||||
|
||||
exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
|
||||
fbRasterizeTrapezoid(pPicture, trap, x_off, y_off);
|
||||
exaGetDrawableDeltas(pDraw, pixmaps[0].pPix, &xoff, &yoff);
|
||||
exaPixmapDirty(pixmaps[0].pPix, pDraw->x + xoff, pDraw->y + yoff,
|
||||
exaGetDrawableDeltas(pDraw, pPixmap, &xoff, &yoff);
|
||||
exaPixmapDirty(pPixmap, pDraw->x + xoff, pDraw->y + yoff,
|
||||
pDraw->x + xoff + pDraw->width,
|
||||
pDraw->y + yoff + pDraw->height);
|
||||
exaFinishAccess(pDraw, EXA_PREPARE_DEST);
|
||||
|
@ -915,18 +909,13 @@ exaAddTriangles (PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntri,
|
|||
xTriangle *tris)
|
||||
{
|
||||
DrawablePtr pDraw = pPicture->pDrawable;
|
||||
ExaMigrationRec pixmaps[1];
|
||||
PixmapPtr pPixmap = exaGetDrawablePixmap(pDraw);
|
||||
int xoff, yoff;
|
||||
|
||||
pixmaps[0].as_dst = TRUE;
|
||||
pixmaps[0].as_src = TRUE;
|
||||
pixmaps[0].pPix = exaGetDrawablePixmap (pDraw);
|
||||
exaDoMigration(pixmaps, 1, FALSE);
|
||||
|
||||
exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
|
||||
fbAddTriangles(pPicture, x_off, y_off, ntri, tris);
|
||||
exaGetDrawableDeltas(pDraw, pixmaps[0].pPix, &xoff, &yoff);
|
||||
exaPixmapDirty(pixmaps[0].pPix, pDraw->x + xoff, pDraw->y + yoff,
|
||||
exaGetDrawableDeltas(pDraw, pPixmap, &xoff, &yoff);
|
||||
exaPixmapDirty(pPixmap, pDraw->x + xoff, pDraw->y + yoff,
|
||||
pDraw->x + xoff + pDraw->width,
|
||||
pDraw->y + yoff + pDraw->height);
|
||||
exaFinishAccess(pDraw, EXA_PREPARE_DEST);
|
||||
|
|
|
@ -41,7 +41,7 @@ void
|
|||
exaPrepareAccessGC(GCPtr pGC)
|
||||
{
|
||||
if (pGC->stipple)
|
||||
exaPrepareAccess(&pGC->stipple->drawable, EXA_PREPARE_SRC);
|
||||
exaPrepareAccess(&pGC->stipple->drawable, EXA_PREPARE_MASK);
|
||||
if (pGC->fillStyle == FillTiled)
|
||||
exaPrepareAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_SRC);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ void
|
|||
exaFinishAccessGC(GCPtr pGC)
|
||||
{
|
||||
if (pGC->fillStyle == FillTiled)
|
||||
exaFinishAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_SRC);
|
||||
exaFinishAccess(&pGC->tile.pixmap->drawable, EXA_PREPARE_MASK);
|
||||
if (pGC->stipple)
|
||||
exaFinishAccess(&pGC->stipple->drawable, EXA_PREPARE_SRC);
|
||||
}
|
||||
|
@ -358,7 +358,6 @@ exaGetPixmapFirstPixel (PixmapPtr pPixmap)
|
|||
void *fb;
|
||||
Bool need_finish = FALSE;
|
||||
BoxRec box;
|
||||
ExaMigrationRec pixmaps[1];
|
||||
ExaPixmapPriv (pPixmap);
|
||||
|
||||
fb = pExaPixmap->sys_ptr;
|
||||
|
@ -368,10 +367,6 @@ exaGetPixmapFirstPixel (PixmapPtr pPixmap)
|
|||
miPointInRegion(DamageRegion(pExaPixmap->pDamage), 0, 0, &box))
|
||||
{
|
||||
need_finish = TRUE;
|
||||
pixmaps[0].as_dst = FALSE;
|
||||
pixmaps[0].as_src = TRUE;
|
||||
pixmaps[0].pPix = pPixmap;
|
||||
exaDoMigration (pixmaps, 1, FALSE);
|
||||
exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
|
||||
fb = pPixmap->devPrivate.ptr;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue