Add trivial PolySegment acceleration for 0-width horizontal/vertical lines,

which still happen somewhat frequently and were cluttering up my
    fallback debugging output. x11perf says it's a major performance win in
    those cases (though probably irrelevant), and it passes Xlib9.
This commit is contained in:
Eric Anholt 2006-04-27 19:17:34 +00:00
parent 69164ec00c
commit 83b061776a
3 changed files with 62 additions and 3 deletions

View File

@ -1,3 +1,12 @@
2006-04-27 Eric Anholt <anholt@FreeBSD.org>
* exa/exa_accel.c: (exaPolySegment):
* exa/exa_unaccel.c: (ExaCheckPolylines), (ExaCheckPolySegment):
Add trivial PolySegment acceleration for 0-width horizontal/vertical
lines, which still happen somewhat frequently and were cluttering up my
fallback debugging output. x11perf says it's a major performance win
in those cases (though probably irrelevant), and it passes Xlib9.
2006-04-26 Eric Anholt <anholt@FreeBSD.org>
* exa/exa_render.c: (exaGlyphs):

View File

@ -459,6 +459,54 @@ exaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
dstx, dsty, exaCopyNtoN, 0, NULL);
}
/**
* exaPolySegment() checks if it can accelerate the lines as a group of
* horizontal or vertical lines (rectangles), and uses existing rectangle fill
* acceleration if so.
*/
static void
exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
xSegment *pSeg)
{
xRectangle *prect;
int i;
/* Don't try to do wide lines or non-solid fill style. */
if (pGC->lineWidth != 0 || pGC->lineStyle != LineSolid)
{
ExaCheckPolySegment(pDrawable, pGC, nseg, pSeg);
return;
}
/* If we have any non-horizontal/vertical, fall back. */
for (i = 0; i < nseg; i++) {
if (pSeg[i].x1 != pSeg[i].x2 && pSeg[i].y1 != pSeg[i].y2) {
ExaCheckPolySegment(pDrawable, pGC, nseg, pSeg);
return;
}
}
prect = ALLOCATE_LOCAL(sizeof(xRectangle) * nseg);
for (i = 0; i < nseg; i++) {
if (pSeg[i].x1 < pSeg[i].x2) {
prect[i].x = pSeg[i].x1;
prect[i].width = pSeg[i].x2 - pSeg[i].x1 + 1;
} else {
prect[i].x = pSeg[i].x2;
prect[i].width = pSeg[i].x1 - pSeg[i].x2 + 1;
}
if (pSeg[i].y1 < pSeg[i].y2) {
prect[i].y = pSeg[i].y1;
prect[i].height = pSeg[i].y2 - pSeg[i].y1 + 1;
} else {
prect[i].y = pSeg[i].y2;
prect[i].height = pSeg[i].y1 - pSeg[i].y2 + 1;
}
}
pGC->ops->PolyFillRect(pDrawable, pGC, nseg, prect);
DEALLOCATE_LOCAL(prect);
}
static void
exaPolyFillRect(DrawablePtr pDrawable,
GCPtr pGC,
@ -802,7 +850,7 @@ const GCOps exaOps = {
ExaCheckCopyPlane,
ExaCheckPolyPoint,
ExaCheckPolylines,
ExaCheckPolySegment,
exaPolySegment,
miPolyRectangle,
ExaCheckPolyArc,
miFillPolygon,

View File

@ -134,7 +134,8 @@ void
ExaCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
int mode, int npt, DDXPointPtr ppt)
{
EXA_FALLBACK(("to 0x%lx\n", (long)pDrawable));
EXA_FALLBACK(("to 0x%lx, width %d, mode %d, count %d\n", (long)pDrawable,
pGC->lineWidth, mode, npt));
if (pGC->lineWidth == 0) {
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
@ -152,7 +153,8 @@ void
ExaCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
int nsegInit, xSegment *pSegInit)
{
EXA_FALLBACK(("to 0x%lx\n", (long)pDrawable));
EXA_FALLBACK(("to 0x%lx width %d, count %d\n", (long)pDrawable,
pGC->lineWidth, nsegInit));
if (pGC->lineWidth == 0) {
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
exaPrepareAccessGC (pGC);