summaryrefslogtreecommitdiff
path: root/render/render.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2007-08-02 22:48:32 -0700
committerCarl Worth <cworth@cworth.org>2007-08-02 22:49:56 -0700
commit0a71e1542a07abc5e32501973a7cf6de3f641317 (patch)
treeba77b526cf1dcaa1a47d3050b69d98e76ca89e5e /render/render.c
parenta2af34d5a861982a03afad8e586bb0181b72bbd0 (diff)
Create a Picture as well as a Pixmap at the time of AllocateGlyph
This avoids some inefficiency in creating a temporary Picture for every glyph at rendering time. My measurements with an i965 showed the previous patch causing a 10-15% slowdown for NoAccel and XAA cases, (while providing an 18% speedup for EXA). With this change, the NoAccel and XAA performance regression is eliminated, and the overall EXA speedup, (before any of the glyphs-as-pixmaps work), is now 32%.
Diffstat (limited to 'render/render.c')
-rw-r--r--render/render.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/render/render.c b/render/render.c
index 4bad379f6..300b78488 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1086,6 +1086,8 @@ typedef struct _GlyphNew {
unsigned char sha1[20];
} GlyphNewRec, *GlyphNewPtr;
+#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
+
static int
ProcRenderAddGlyphs (ClientPtr client)
{
@@ -1102,6 +1104,7 @@ ProcRenderAddGlyphs (ClientPtr client)
int i, screen;
PicturePtr pSrc = NULL, pDst = NULL;
PixmapPtr pSrcPix = NULL, pDstPix = NULL;
+ CARD32 component_alpha;
REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq);
glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client,
@@ -1118,6 +1121,8 @@ ProcRenderAddGlyphs (ClientPtr client)
if (nglyphs > UINT32_MAX / sizeof(GlyphNewRec))
return BadAlloc;
+ component_alpha = NeedsComponent (glyphSet->format->format);
+
if (nglyphs <= NLOCALGLYPH) {
memset (glyphsLocal, 0, sizeof (glyphsLocal));
glyphsBase = glyphsLocal;
@@ -1158,9 +1163,11 @@ ProcRenderAddGlyphs (ClientPtr client)
}
else
{
+ GlyphPtr glyph;
+
glyph_new->found = FALSE;
- glyph_new->glyph = AllocateGlyph (&gi[i], glyphSet->fdepth);
- if (! glyph_new->glyph)
+ glyph_new->glyph = glyph = AllocateGlyph (&gi[i], glyphSet->fdepth);
+ if (! glyph)
{
err = BadAlloc;
goto bail;
@@ -1194,11 +1201,14 @@ ProcRenderAddGlyphs (ClientPtr client)
goto bail;
}
- pDstPix = GlyphPixmap (glyph_new->glyph)[screen];
+ pDstPix = (pScreen->CreatePixmap) (pScreen,
+ width, height, depth);
- pDst = CreatePicture (0, &pDstPix->drawable,
- glyphSet->format, 0, NULL,
- serverClient, &error);
+ GlyphPicture (glyph)[screen] = pDst =
+ CreatePicture (0, &pDstPix->drawable,
+ glyphSet->format,
+ CPComponentAlpha, &component_alpha,
+ serverClient, &error);
if (! pDst)
{
err = BadAlloc;
@@ -1216,8 +1226,6 @@ ProcRenderAddGlyphs (ClientPtr client)
FreePicture ((pointer) pSrc, 0);
pSrc = NULL;
- FreePicture ((pointer) pDst, 0);
- pDst = NULL;
FreeScratchPixmapHeader (pSrcPix);
pSrcPix = NULL;
}
@@ -1251,8 +1259,6 @@ ProcRenderAddGlyphs (ClientPtr client)
bail:
if (pSrc)
FreePicture ((pointer) pSrc, 0);
- if (pDst)
- FreePicture ((pointer) pDst, 0);
if (pSrcPix)
FreeScratchPixmapHeader (pSrcPix);
for (i = 0; i < nglyphs; i++)