[PATCH xserver 5/7] EXA: Glyph rects optimizations.
Michel Dänzer
michel at daenzer.net
Tue May 17 06:03:27 PDT 2011
From: Michel Dänzer <daenzer at vmware.com>
Mostly reducing function call argument passing overhead.
Also remove unused rect member pDst.
Signed-off-by: Michel Dänzer <daenzer at vmware.com>
---
exa/exa_glyphs.c | 87 ++++++++++++++++++++----------------------------------
exa/exa_priv.h | 1 -
2 files changed, 32 insertions(+), 56 deletions(-)
diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index 3918122..bd65c99 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -342,21 +342,14 @@ damage:
y + cache->glyphHeight);
}
-static ExaGlyphCacheResult
-exaGlyphCacheBufferGlyph(ScreenPtr pScreen,
- ExaGlyphCachePtr cache,
- ExaGlyphBufferPtr buffer,
- GlyphPtr pGlyph,
- PicturePtr pSrc,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst)
+static _X_INLINE ExaGlyphCacheResult
+exaGlyphCacheBufferGlyph(ScreenPtr pScreen,
+ ExaGlyphCachePtr cache,
+ ExaGlyphBufferPtr buffer,
+ GlyphPtr pGlyph,
+ PicturePtr pSrc,
+ ExaCompositeRectPtr pRect)
{
- ExaCompositeRectPtr rect;
struct exaGlyph *priv;
int pos = -1;
int x, y;
@@ -429,30 +422,20 @@ exaGlyphCacheBufferGlyph(ScreenPtr pScreen,
}
buffer->mask = cache->picture;
-
- rect = &buffer->rects[buffer->count];
if (pSrc)
{
- rect->xSrc = xSrc;
- rect->ySrc = ySrc;
- rect->xMask = x;
- rect->yMask = y;
+ pRect->xMask = x;
+ pRect->yMask = y;
}
else
{
- rect->xSrc = x;
- rect->ySrc = y;
- rect->xMask = 0;
- rect->yMask = 0;
+ pRect->xSrc = x;
+ pRect->ySrc = y;
+ pRect->xMask = 0;
+ pRect->yMask = 0;
}
- rect->pDst = pDst;
- rect->xDst = xDst;
- rect->yDst = yDst;
- rect->width = pGlyph->info.width;
- rect->height = pGlyph->info.height;
-
buffer->count++;
return ExaGlyphSuccess;
@@ -466,7 +449,6 @@ exaBufferGlyph(ScreenPtr pScreen,
ExaGlyphBufferPtr buffer,
GlyphPtr pGlyph,
PicturePtr pSrc,
- PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
@@ -475,11 +457,11 @@ exaBufferGlyph(ScreenPtr pScreen,
INT16 yDst)
{
ExaScreenPriv(pScreen);
- unsigned int format = (GlyphPicture(pGlyph)[pScreen->myNum])->format;
+ PicturePtr mask = GlyphPicture(pGlyph)[pScreen->myNum];
+ unsigned int format = mask->format;
int width = pGlyph->info.width;
int height = pGlyph->info.height;
- ExaCompositeRectPtr rect;
- PicturePtr mask;
+ ExaCompositeRectPtr pRect;
int i;
if (buffer->count == GLYPH_BUFFER_SIZE)
@@ -488,6 +470,16 @@ exaBufferGlyph(ScreenPtr pScreen,
if (PICT_FORMAT_BPP(format) == 1)
format = PICT_a8;
+ pRect = &buffer->rects[buffer->count];
+ pRect->xSrc = xSrc;
+ pRect->ySrc = ySrc;
+ pRect->xMask = xMask;
+ pRect->yMask = yMask;
+ pRect->xDst = xDst;
+ pRect->yDst = yDst;
+ pRect->width = width;
+ pRect->height = height;
+
for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
@@ -495,14 +487,11 @@ exaBufferGlyph(ScreenPtr pScreen,
width <= cache->glyphWidth &&
height <= cache->glyphHeight) {
ExaGlyphCacheResult result = exaGlyphCacheBufferGlyph(pScreen,
- &pExaScr->glyphCaches[i],
+ cache,
buffer,
pGlyph,
pSrc,
- pDst,
- xSrc, ySrc,
- xMask, yMask,
- xDst, yDst);
+ pRect);
switch (result) {
case ExaGlyphFail:
break;
@@ -515,22 +504,10 @@ exaBufferGlyph(ScreenPtr pScreen,
/* Couldn't find the glyph in the cache, use the glyph picture directly */
- mask = GlyphPicture(pGlyph)[pScreen->myNum];
if (buffer->mask && buffer->mask != mask)
return ExaGlyphNeedFlush;
-
buffer->mask = mask;
- rect = &buffer->rects[buffer->count];
- rect->xSrc = xSrc;
- rect->ySrc = ySrc;
- rect->xMask = xMask;
- rect->yMask = yMask;
- rect->xDst = xDst;
- rect->yDst = yDst;
- rect->width = width;
- rect->height = height;
-
buffer->count++;
return ExaGlyphSuccess;
@@ -730,23 +707,23 @@ exaGlyphs (CARD8 op,
/* pGlyph->info.{x,y} compensate for empty space in the glyph. */
if (maskFormat)
{
- if (exaBufferGlyph(pScreen, &buffer, glyph, NULL, pMask,
+ if (exaBufferGlyph(pScreen, &buffer, glyph, NULL,
0, 0, 0, 0, x - glyph->info.x, y - glyph->info.y) == ExaGlyphNeedFlush)
{
exaGlyphsToMask(pMask, &buffer);
- exaBufferGlyph(pScreen, &buffer, glyph, NULL, pMask,
+ exaBufferGlyph(pScreen, &buffer, glyph, NULL,
0, 0, 0, 0, x - glyph->info.x, y - glyph->info.y);
}
}
else
{
- if (exaBufferGlyph(pScreen, &buffer, glyph, pSrc, pDst,
+ if (exaBufferGlyph(pScreen, &buffer, glyph, pSrc,
xSrc + (x - glyph->info.x) - first_xOff, ySrc + (y - glyph->info.y) - first_yOff,
0, 0, x - glyph->info.x, y - glyph->info.y)
== ExaGlyphNeedFlush)
{
exaGlyphsToDst(pSrc, pDst, &buffer);
- exaBufferGlyph(pScreen, &buffer, glyph, pSrc, pDst,
+ exaBufferGlyph(pScreen, &buffer, glyph, pSrc,
xSrc + (x - glyph->info.x) - first_xOff, ySrc + (y - glyph->info.y) - first_yOff,
0, 0, x - glyph->info.x, y - glyph->info.y);
}
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 251aad9..3d6843b 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -323,7 +323,6 @@ typedef struct {
} ExaGCPrivRec, *ExaGCPrivPtr;
typedef struct {
- PicturePtr pDst;
INT16 xSrc;
INT16 ySrc;
INT16 xMask;
--
1.7.5.1
More information about the xorg-devel
mailing list