mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-14 11:20:29 +01:00
Add very useful pixel transfer optimization
This commit is contained in:
parent
4b8e787604
commit
67538c92bf
2 changed files with 40 additions and 0 deletions
|
|
@ -1,5 +1,9 @@
|
|||
2006-04-08 David Reveman <davidr@novell.com>
|
||||
|
||||
* hw/xgl/xglsync.c (xglSyncSurface): Add very useful optimization
|
||||
for which avoids which makes pixels transfers much more efficient in
|
||||
some cases.
|
||||
|
||||
* hw/xgl/Makefile.am (Xgl_DEPENDENCIES): Add libxgl.a.
|
||||
|
||||
2006-04-07 David Reveman <davidr@novell.com>
|
||||
|
|
|
|||
|
|
@ -236,6 +236,42 @@ xglSyncSurface (DrawablePtr pDrawable)
|
|||
format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
|
||||
}
|
||||
|
||||
/* If all bits are up to date we can avoid transferring a large set
|
||||
of boxes by transferring the extents box instead. */
|
||||
if (pPixmapPriv->allBits && nBox != 1)
|
||||
{
|
||||
/* This many boxes. It is likely more efficient to always transfer
|
||||
the extents box instead. */
|
||||
if (nBox > 64)
|
||||
{
|
||||
pBox = pExt;
|
||||
nBox = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i, w, e, r = 0;
|
||||
|
||||
for (i = 0; i < nBox; i++)
|
||||
r += (pBox[i].x2 - pBox[i].x1) * (pBox[i].y2 - pBox[i].y1);
|
||||
|
||||
e = (pExt->x2 - pExt->x1) * (pExt->y2 - pExt->y1);
|
||||
w = e - r;
|
||||
|
||||
/* r, is the area of all boxes. e, is the are for the
|
||||
extents. w, is the area that doesn't need to be
|
||||
transferred.
|
||||
|
||||
If w per box is less than 2 times the area of all
|
||||
boxes, transferring the extents has been proved more
|
||||
efficient. */
|
||||
if ((w / nBox) < (r << 1))
|
||||
{
|
||||
pBox = pExt;
|
||||
nBox = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glitz_surface_set_clip_region (pPixmapPriv->surface,
|
||||
0, 0, (glitz_box_t *) pBox, nBox);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue