summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2009-05-15 13:48:37 (GMT)
committerMichel Dänzer <daenzer@vmware.com>2009-05-15 13:48:37 (GMT)
commit7c8327f0a75087a85864256a9cea80dd4b86def5 (patch)
treefba3e388b3b8b1522712fff34b000217140687d6
parent850675d4de4373e5df95507dbf2cd9affaaf54bc (diff)
EXA: Always damage glyph cache pixmap manually after uploading a glyph.
Signed-off-by: Michel Dänzer <daenzer@vmware.com>
-rw-r--r--exa/exa_glyphs.c73
1 files changed, 37 insertions, 36 deletions
diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index d2a0168..b8d2e52 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -354,8 +354,14 @@ exaGlyphCacheHashRemove(ExaGlyphCachePtr cache,
* is to use the UploadToScreen() driver hook; this allows us to
* pipeline glyph uploads and to avoid creating offscreen pixmaps for
* glyphs that we'll never use again.
+ *
+ * If we can't do it with UploadToScreen (because the glyph is offscreen, etc),
+ * we fall back to CompositePicture.
+ *
+ * We need to damage the cache pixmap manually in either case because the damage
+ * layer unwrapped the picture screen before calling exaGlyphs.
*/
-static Bool
+static void
exaGlyphCacheUploadGlyph(ScreenPtr pScreen,
ExaGlyphCachePtr cache,
int pos,
@@ -369,16 +375,16 @@ exaGlyphCacheUploadGlyph(ScreenPtr pScreen,
ExaMigrationRec pixmaps[1];
if (!pExaScr->info->UploadToScreen || pExaScr->swappedOut || pExaPixmap->accel_blocked)
- return FALSE;
+ goto composite;
/* If the glyph pixmap is already uploaded, no point in doing
* things this way */
if (exaPixmapIsOffscreen(pGlyphPixmap))
- return FALSE;
+ goto composite;
/* UploadToScreen only works if bpp match */
if (pGlyphPixmap->drawable.bitsPerPixel != pCachePixmap->drawable.bitsPerPixel)
- return FALSE;
+ goto composite;
/* cache pixmap must be offscreen. */
pixmaps[0].as_dst = TRUE;
@@ -388,26 +394,37 @@ exaGlyphCacheUploadGlyph(ScreenPtr pScreen,
exaDoMigration (pixmaps, 1, TRUE);
if (!exaPixmapIsOffscreen(pCachePixmap))
- return FALSE;
+ goto composite;
/* CACHE_{X,Y} are in pixmap coordinates, no need for cache{X,Y}off */
- if (!pExaScr->info->UploadToScreen(pCachePixmap,
- CACHE_X(pos),
- CACHE_Y(pos),
- pGlyph->info.width,
- pGlyph->info.height,
- (char *)pExaPixmap->sys_ptr,
- pExaPixmap->sys_pitch))
- return FALSE;
-
- /* This pixmap should never be bound to a window, so no need to offset coordinates. */
+ if (pExaScr->info->UploadToScreen(pCachePixmap,
+ CACHE_X(pos),
+ CACHE_Y(pos),
+ pGlyph->info.width,
+ pGlyph->info.height,
+ (char *)pExaPixmap->sys_ptr,
+ pExaPixmap->sys_pitch))
+ goto damage;
+
+composite:
+ CompositePicture (PictOpSrc,
+ pGlyphPicture,
+ None,
+ cache->picture,
+ 0, 0,
+ 0, 0,
+ CACHE_X(pos),
+ CACHE_Y(pos),
+ pGlyph->info.width,
+ pGlyph->info.height);
+
+damage:
+ /* The cache pixmap isn't a window, so no need to offset coordinates. */
exaPixmapDirty (pCachePixmap,
CACHE_X(pos),
CACHE_Y(pos),
- CACHE_X(pos) + pGlyph->info.width,
- CACHE_Y(pos) + pGlyph->info.height);
-
- return TRUE;
+ CACHE_X(pos) + cache->glyphWidth,
+ CACHE_Y(pos) + cache->glyphHeight);
}
static ExaGlyphCacheResult
@@ -483,23 +500,7 @@ exaGlyphCacheBufferGlyph(ScreenPtr pScreen,
cache->evictionPosition = rand() % cache->size;
}
- /* Now actually upload the glyph into the cache picture; if
- * we can't do it with UploadToScreen (because the glyph is
- * offscreen, etc), we fall back to CompositePicture.
- */
- if (!exaGlyphCacheUploadGlyph(pScreen, cache, pos, pGlyph)) {
- CompositePicture (PictOpSrc,
- GlyphPicture(pGlyph)[pScreen->myNum],
- None,
- cache->picture,
- 0, 0,
- 0, 0,
- CACHE_X(pos),
- CACHE_Y(pos),
- pGlyph->info.width,
- pGlyph->info.height);
- }
-
+ exaGlyphCacheUploadGlyph(pScreen, cache, pos, pGlyph);
}
buffer->mask = cache->picture;