uxa-glyphs: Stream uploads via temporary bo

Avoid mapping the glyph cache back to the cpu by allocating temporary
buffer objects to store the glyph pixmap and blit to the cache.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2009-11-29 20:53:35 +00:00
parent 646b4a9483
commit 2c3aee2b57
1 changed files with 25 additions and 1 deletions

View File

@ -363,6 +363,7 @@ uxa_glyph_cache_upload_glyph(ScreenPtr pScreen,
PicturePtr pGlyphPicture = GlyphPicture(pGlyph)[pScreen->myNum];
PixmapPtr pGlyphPixmap = (PixmapPtr) pGlyphPicture->pDrawable;
PixmapPtr pCachePixmap = (PixmapPtr) cache->picture->pDrawable;
PixmapPtr scratch;
GCPtr pGC;
/* UploadToScreen only works if bpp match */
@ -372,12 +373,35 @@ uxa_glyph_cache_upload_glyph(ScreenPtr pScreen,
pGC = GetScratchGC(pCachePixmap->drawable.depth, pScreen);
ValidateGC(&pCachePixmap->drawable, pGC);
(void)uxa_copy_area(&pGlyphPixmap->drawable,
/* Create a temporary bo to stream the updates to the cache */
scratch = (*pScreen->CreatePixmap)(pScreen,
pGlyph->info.width,
pGlyph->info.height,
pGlyphPixmap->drawable.depth,
UXA_CREATE_PIXMAP_FOR_MAP);
if (scratch) {
(void)uxa_copy_area(&pGlyphPixmap->drawable,
&scratch->drawable,
pGC,
0, 0,
pGlyph->info.width, pGlyph->info.height,
0, 0);
} else {
scratch = pGlyphPixmap;
}
(void)uxa_copy_area(&scratch->drawable,
&pCachePixmap->drawable,
pGC,
0, 0, pGlyph->info.width, pGlyph->info.height,
CACHE_X(pos), CACHE_Y(pos));
if (scratch != pGlyphPixmap)
(*pScreen->DestroyPixmap)(scratch);
FreeScratchGC(pGC);
return TRUE;
}