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:
parent
69164ec00c
commit
83b061776a
|
@ -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>
|
2006-04-26 Eric Anholt <anholt@FreeBSD.org>
|
||||||
|
|
||||||
* exa/exa_render.c: (exaGlyphs):
|
* exa/exa_render.c: (exaGlyphs):
|
||||||
|
|
|
@ -459,6 +459,54 @@ exaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
|
||||||
dstx, dsty, exaCopyNtoN, 0, NULL);
|
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
|
static void
|
||||||
exaPolyFillRect(DrawablePtr pDrawable,
|
exaPolyFillRect(DrawablePtr pDrawable,
|
||||||
GCPtr pGC,
|
GCPtr pGC,
|
||||||
|
@ -802,7 +850,7 @@ const GCOps exaOps = {
|
||||||
ExaCheckCopyPlane,
|
ExaCheckCopyPlane,
|
||||||
ExaCheckPolyPoint,
|
ExaCheckPolyPoint,
|
||||||
ExaCheckPolylines,
|
ExaCheckPolylines,
|
||||||
ExaCheckPolySegment,
|
exaPolySegment,
|
||||||
miPolyRectangle,
|
miPolyRectangle,
|
||||||
ExaCheckPolyArc,
|
ExaCheckPolyArc,
|
||||||
miFillPolygon,
|
miFillPolygon,
|
||||||
|
|
|
@ -134,7 +134,8 @@ void
|
||||||
ExaCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
|
ExaCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
|
||||||
int mode, int npt, DDXPointPtr ppt)
|
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) {
|
if (pGC->lineWidth == 0) {
|
||||||
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
|
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
|
||||||
|
@ -152,7 +153,8 @@ void
|
||||||
ExaCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
|
ExaCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
|
||||||
int nsegInit, xSegment *pSegInit)
|
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) {
|
if (pGC->lineWidth == 0) {
|
||||||
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
|
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
|
||||||
exaPrepareAccessGC (pGC);
|
exaPrepareAccessGC (pGC);
|
||||||
|
|
Loading…
Reference in New Issue