pixman: Branch 'master' - 2 commits
Chris Wilson
ickle at kemper.freedesktop.org
Sat Dec 20 09:20:53 PST 2008
pixman-1-uninstalled.pc.in | 8 +-------
pixman/pixman-region.c | 27 ++++++++++++++++++---------
2 files changed, 19 insertions(+), 16 deletions(-)
New commits:
commit 8f98ffadf58de1e28294b3ab2c09f380ccc535e5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sat Dec 20 17:18:51 2008 +0000
Fix pixman-1-uninstalled.pc to point to the libtool library
Otherwise we fail to link when compiling cairo against the uninstalled
library.
diff --git a/pixman-1-uninstalled.pc.in b/pixman-1-uninstalled.pc.in
index 9a2afa1..e0347d0 100644
--- a/pixman-1-uninstalled.pc.in
+++ b/pixman-1-uninstalled.pc.in
@@ -1,11 +1,5 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
Name: Pixman
Description: The pixman library (version 1)
Version: @PACKAGE_VERSION@
Cflags: -I${pc_top_builddir}/${pcfiledir}/pixman
-Libs: ${pc_top_builddir}/${pcfiledir}/libpixman-1-so.a
-
+Libs: ${pc_top_builddir}/${pcfiledir}/pixman/libpixman-1.la
commit 9d726712c22d8555d00b9f1ebacd5425dc9a5b61
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Nov 21 01:20:38 2008 +0000
Allocate initial array of RegionInfo on the stack.
The region validate() code is frequently called by cairo as it is used to
extract regions from the trapezoids for fast-paths through the drawing
code and also for fast-path clipping and the RegionInfo allocation (as
well as the pixman_rect_alloc during the final union) appears as a hot
spot on application memory profiles.
diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c
index 3718d65..01a28be 100644
--- a/pixman/pixman-region.c
+++ b/pixman/pixman-region.c
@@ -1330,6 +1330,8 @@ validate (region_type_t * badreg,
int curBand;
} RegionInfo;
+ RegionInfo stack_regions[64];
+
int numRects; /* Original numRects for badreg */
RegionInfo *ri; /* Array of current regions */
int numRI; /* Number of entries used in ri */
@@ -1379,10 +1381,8 @@ validate (region_type_t * badreg,
/* Set up the first region to be the first rectangle in badreg */
/* Note that step 2 code will never overflow the ri[0].reg rects array */
- ri = (RegionInfo *) pixman_malloc_ab (4, sizeof(RegionInfo));
- if (!ri)
- return pixman_break (badreg);
- sizeRI = 4;
+ ri = stack_regions;
+ sizeRI = sizeof (stack_regions) / sizeof (stack_regions[0]);
numRI = 1;
ri[0].prevBand = 0;
ri[0].curBand = 0;
@@ -1451,9 +1451,16 @@ validate (region_type_t * badreg,
data_size = sizeRI * sizeof(RegionInfo);
if (data_size / sizeRI != sizeof(RegionInfo))
goto bail;
- rit = (RegionInfo *) realloc(ri, data_size);
- if (!rit)
- goto bail;
+ if (ri == stack_regions) {
+ rit = malloc (data_size);
+ if (!rit)
+ goto bail;
+ memcpy (rit, ri, numRI * sizeof (RegionInfo));
+ } else {
+ rit = (RegionInfo *) realloc(ri, data_size);
+ if (!rit)
+ goto bail;
+ }
ri = rit;
rit = &ri[numRI];
}
@@ -1509,13 +1516,15 @@ NextRect: ;
goto bail;
}
*badreg = ri[0].reg;
- free(ri);
+ if (ri != stack_regions)
+ free(ri);
good(badreg);
return ret;
bail:
for (i = 0; i < numRI; i++)
freeData(&ri[i].reg);
- free (ri);
+ if (ri != stack_regions)
+ free (ri);
return pixman_break (badreg);
}
More information about the xorg-commit
mailing list