In drawing glyphs, shortcut our way to exaComposite instead of going
through the whole CompositePicture stack and doing things like computing damage over again. This is a sizeable win for text drawing with a compmgr. Also avoid calling down into the server for dealing with the scratch pixmap when we are able to do UploadToScreen successfully and never need it.
This commit is contained in:
parent
3d4ca57b69
commit
69164ec00c
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2006-04-26 Eric Anholt <anholt@FreeBSD.org>
|
||||||
|
|
||||||
|
* exa/exa_render.c: (exaGlyphs):
|
||||||
|
In drawing glyphs, shortcut our way to exaComposite instead of going
|
||||||
|
through the whole CompositePicture stack and doing things like computing
|
||||||
|
damage over again. This is a sizeable win for text drawing with a
|
||||||
|
compmgr. Also avoid calling down into the server for dealing with the
|
||||||
|
scratch pixmap when we are able to do UploadToScreen successfully and
|
||||||
|
never need it.
|
||||||
|
|
||||||
2006-04-26 Eric Anholt <anholt@FreeBSD.org>
|
2006-04-26 Eric Anholt <anholt@FreeBSD.org>
|
||||||
|
|
||||||
* exa/exa_render.c: (exaTryComponentAlphaHelper), (exaComposite),
|
* exa/exa_render.c: (exaTryComponentAlphaHelper), (exaComposite),
|
||||||
|
|
115
exa/exa_render.c
115
exa/exa_render.c
|
@ -761,7 +761,7 @@ exaGlyphs (CARD8 op,
|
||||||
GlyphPtr *glyphs)
|
GlyphPtr *glyphs)
|
||||||
{
|
{
|
||||||
ExaScreenPriv (pDst->pDrawable->pScreen);
|
ExaScreenPriv (pDst->pDrawable->pScreen);
|
||||||
PixmapPtr pPixmap = NULL, pScratchPixmap = NULL;
|
PixmapPtr pPixmap = NULL;
|
||||||
PicturePtr pPicture;
|
PicturePtr pPicture;
|
||||||
PixmapPtr pMaskPixmap = NULL;
|
PixmapPtr pMaskPixmap = NULL;
|
||||||
PicturePtr pMask;
|
PicturePtr pMask;
|
||||||
|
@ -770,7 +770,6 @@ exaGlyphs (CARD8 op,
|
||||||
int x, y;
|
int x, y;
|
||||||
int xDst = list->xOff, yDst = list->yOff;
|
int xDst = list->xOff, yDst = list->yOff;
|
||||||
int n;
|
int n;
|
||||||
GlyphPtr glyph;
|
|
||||||
int error;
|
int error;
|
||||||
BoxRec extents;
|
BoxRec extents;
|
||||||
CARD32 component_alpha;
|
CARD32 component_alpha;
|
||||||
|
@ -830,6 +829,7 @@ exaGlyphs (CARD8 op,
|
||||||
(*pScreen->DestroyPixmap) (pMaskPixmap);
|
(*pScreen->DestroyPixmap) (pMaskPixmap);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ValidatePicture(pMask);
|
||||||
pGC = GetScratchGC (pMaskPixmap->drawable.depth, pScreen);
|
pGC = GetScratchGC (pMaskPixmap->drawable.depth, pScreen);
|
||||||
ValidateGC (&pMaskPixmap->drawable, pGC);
|
ValidateGC (&pMaskPixmap->drawable, pGC);
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
|
@ -850,9 +850,10 @@ exaGlyphs (CARD8 op,
|
||||||
|
|
||||||
while (nlist--)
|
while (nlist--)
|
||||||
{
|
{
|
||||||
GCPtr pGC;
|
GCPtr pGC = NULL;
|
||||||
int maxwidth = 0, maxheight = 0, i;
|
int maxwidth = 0, maxheight = 0, i;
|
||||||
ExaMigrationRec pixmaps[1];
|
ExaMigrationRec pixmaps[1];
|
||||||
|
PixmapPtr pScratchPixmap = NULL;
|
||||||
|
|
||||||
x += list->xOff;
|
x += list->xOff;
|
||||||
y += list->yOff;
|
y += list->yOff;
|
||||||
|
@ -866,6 +867,8 @@ exaGlyphs (CARD8 op,
|
||||||
if (maxwidth == 0 || maxheight == 0) {
|
if (maxwidth == 0 || maxheight == 0) {
|
||||||
while (n--)
|
while (n--)
|
||||||
{
|
{
|
||||||
|
GlyphPtr glyph;
|
||||||
|
|
||||||
glyph = *glyphs++;
|
glyph = *glyphs++;
|
||||||
x += glyph->info.xOff;
|
x += glyph->info.xOff;
|
||||||
y += glyph->info.yOff;
|
y += glyph->info.yOff;
|
||||||
|
@ -874,22 +877,11 @@ exaGlyphs (CARD8 op,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a scratch pixmap to wrap the original glyph data */
|
|
||||||
pScratchPixmap = GetScratchPixmapHeader (pScreen, glyphs[0]->info.width,
|
|
||||||
glyphs[0]->info.height,
|
|
||||||
list->format->depth,
|
|
||||||
list->format->depth,
|
|
||||||
0, (pointer) (glyphs[0] + 1));
|
|
||||||
if (!pScratchPixmap)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Create the (real) temporary pixmap to store the current glyph in */
|
/* Create the (real) temporary pixmap to store the current glyph in */
|
||||||
pPixmap = (*pScreen->CreatePixmap) (pScreen, maxwidth, maxheight,
|
pPixmap = (*pScreen->CreatePixmap) (pScreen, maxwidth, maxheight,
|
||||||
list->format->depth);
|
list->format->depth);
|
||||||
if (!pPixmap) {
|
if (!pPixmap)
|
||||||
FreeScratchPixmapHeader (pScratchPixmap);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a temporary picture to wrap the temporary pixmap, so it can be
|
/* Create a temporary picture to wrap the temporary pixmap, so it can be
|
||||||
* used as a source for Composite.
|
* used as a source for Composite.
|
||||||
|
@ -900,15 +892,9 @@ exaGlyphs (CARD8 op,
|
||||||
serverClient, &error);
|
serverClient, &error);
|
||||||
if (!pPicture) {
|
if (!pPicture) {
|
||||||
(*pScreen->DestroyPixmap) (pPixmap);
|
(*pScreen->DestroyPixmap) (pPixmap);
|
||||||
FreeScratchPixmapHeader (pScratchPixmap);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ValidatePicture(pPicture);
|
||||||
/* Get a scratch GC with which to copy the glyph data from scratch to
|
|
||||||
* temporary
|
|
||||||
*/
|
|
||||||
pGC = GetScratchGC (list->format->depth, pScreen);
|
|
||||||
ValidateGC (&pPixmap->drawable, pGC);
|
|
||||||
|
|
||||||
/* Give the temporary pixmap an initial kick towards the screen, so
|
/* Give the temporary pixmap an initial kick towards the screen, so
|
||||||
* it'll stick there.
|
* it'll stick there.
|
||||||
|
@ -920,13 +906,13 @@ exaGlyphs (CARD8 op,
|
||||||
|
|
||||||
while (n--)
|
while (n--)
|
||||||
{
|
{
|
||||||
glyph = *glyphs++;
|
GlyphPtr glyph = *glyphs++;
|
||||||
|
pointer glyphdata = (pointer) (glyph + 1);
|
||||||
|
|
||||||
(*pScreen->ModifyPixmapHeader) (pScratchPixmap,
|
(*pScreen->ModifyPixmapHeader) (pScratchPixmap,
|
||||||
glyph->info.width,
|
glyph->info.width,
|
||||||
glyph->info.height,
|
glyph->info.height,
|
||||||
0, 0, -1, (pointer) (glyph + 1));
|
0, 0, -1, glyphdata);
|
||||||
pScratchPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
|
||||||
|
|
||||||
/* Copy the glyph data into the proper pixmap instead of a fake.
|
/* Copy the glyph data into the proper pixmap instead of a fake.
|
||||||
* First we try to use UploadToScreen, if we can, then we fall back
|
* First we try to use UploadToScreen, if we can, then we fall back
|
||||||
|
@ -937,9 +923,38 @@ exaGlyphs (CARD8 op,
|
||||||
!(*pExaScr->info->UploadToScreen) (pPixmap, 0, 0,
|
!(*pExaScr->info->UploadToScreen) (pPixmap, 0, 0,
|
||||||
glyph->info.width,
|
glyph->info.width,
|
||||||
glyph->info.height,
|
glyph->info.height,
|
||||||
pScratchPixmap->devPrivate.ptr,
|
glyphdata,
|
||||||
pScratchPixmap->devKind))
|
PixmapBytePad(glyph->info.width,
|
||||||
|
list->format->depth)))
|
||||||
{
|
{
|
||||||
|
/* Set up the scratch pixmap/GC for doing a CopyArea. */
|
||||||
|
if (pScratchPixmap == NULL) {
|
||||||
|
/* Get a scratch pixmap to wrap the original glyph data */
|
||||||
|
pScratchPixmap = GetScratchPixmapHeader (pScreen,
|
||||||
|
glyph->info.width,
|
||||||
|
glyph->info.height,
|
||||||
|
list->format->depth,
|
||||||
|
list->format->depth,
|
||||||
|
-1, glyphdata);
|
||||||
|
if (!pScratchPixmap) {
|
||||||
|
FreePicture(pPicture, 0);
|
||||||
|
(*pScreen->DestroyPixmap) (pPixmap);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get a scratch GC with which to copy the glyph data from
|
||||||
|
* scratch to temporary
|
||||||
|
*/
|
||||||
|
pGC = GetScratchGC (list->format->depth, pScreen);
|
||||||
|
ValidateGC (&pPixmap->drawable, pGC);
|
||||||
|
} else {
|
||||||
|
(*pScreen->ModifyPixmapHeader) (pScratchPixmap,
|
||||||
|
glyph->info.width,
|
||||||
|
glyph->info.height,
|
||||||
|
0, 0, -1, glyphdata);
|
||||||
|
pScratchPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||||
|
}
|
||||||
|
|
||||||
exaCopyArea (&pScratchPixmap->drawable, &pPixmap->drawable, pGC,
|
exaCopyArea (&pScratchPixmap->drawable, &pPixmap->drawable, pGC,
|
||||||
0, 0, glyph->info.width, glyph->info.height, 0, 0);
|
0, 0, glyph->info.width, glyph->info.height, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -948,53 +963,35 @@ exaGlyphs (CARD8 op,
|
||||||
|
|
||||||
if (maskFormat)
|
if (maskFormat)
|
||||||
{
|
{
|
||||||
CompositePicture (PictOpAdd,
|
exaComposite (PictOpAdd, pPicture, NULL, pMask, 0, 0, 0, 0,
|
||||||
pPicture,
|
x - glyph->info.x, y - glyph->info.y,
|
||||||
NULL,
|
glyph->info.width, glyph->info.height);
|
||||||
pMask,
|
|
||||||
0, 0,
|
|
||||||
0, 0,
|
|
||||||
x - glyph->info.x,
|
|
||||||
y - glyph->info.y,
|
|
||||||
glyph->info.width,
|
|
||||||
glyph->info.height);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CompositePicture (op,
|
exaComposite (op, pSrc, pPicture, pDst,
|
||||||
pSrc,
|
xSrc + (x - glyph->info.x) - xDst,
|
||||||
pPicture,
|
ySrc + (y - glyph->info.y) - yDst,
|
||||||
pDst,
|
0, 0, x - glyph->info.x, y - glyph->info.y,
|
||||||
xSrc + (x - glyph->info.x) - xDst,
|
glyph->info.width, glyph->info.height);
|
||||||
ySrc + (y - glyph->info.y) - yDst,
|
|
||||||
0, 0,
|
|
||||||
x - glyph->info.x,
|
|
||||||
y - glyph->info.y,
|
|
||||||
glyph->info.width,
|
|
||||||
glyph->info.height);
|
|
||||||
}
|
}
|
||||||
x += glyph->info.xOff;
|
x += glyph->info.xOff;
|
||||||
y += glyph->info.yOff;
|
y += glyph->info.yOff;
|
||||||
}
|
}
|
||||||
list++;
|
list++;
|
||||||
FreeScratchGC (pGC);
|
if (pGC != NULL)
|
||||||
|
FreeScratchGC (pGC);
|
||||||
FreePicture ((pointer) pPicture, 0);
|
FreePicture ((pointer) pPicture, 0);
|
||||||
(*pScreen->DestroyPixmap) (pPixmap);
|
(*pScreen->DestroyPixmap) (pPixmap);
|
||||||
FreeScratchPixmapHeader (pScratchPixmap);
|
if (pScratchPixmap != NULL)
|
||||||
|
FreeScratchPixmapHeader (pScratchPixmap);
|
||||||
}
|
}
|
||||||
if (maskFormat)
|
if (maskFormat)
|
||||||
{
|
{
|
||||||
x = extents.x1;
|
x = extents.x1;
|
||||||
y = extents.y1;
|
y = extents.y1;
|
||||||
CompositePicture (op,
|
exaComposite (op, pSrc, pMask, pDst, xSrc + x - xDst, ySrc + y - yDst,
|
||||||
pSrc,
|
0, 0, x, y, width, height);
|
||||||
pMask,
|
|
||||||
pDst,
|
|
||||||
xSrc + x - xDst,
|
|
||||||
ySrc + y - yDst,
|
|
||||||
0, 0,
|
|
||||||
x, y,
|
|
||||||
width, height);
|
|
||||||
FreePicture ((pointer) pMask, (XID) 0);
|
FreePicture ((pointer) pMask, (XID) 0);
|
||||||
(*pScreen->DestroyPixmap) (pMaskPixmap);
|
(*pScreen->DestroyPixmap) (pMaskPixmap);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue