diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-11-29 20:53:35 +0000 |
---|---|---|
committer | Owain G. Ainsworth <oga@openbsd.org> | 2010-03-01 16:08:19 +0000 |
commit | ad2e3e3e37e932a1a6bfa61a29d08af316346696 (patch) | |
tree | 8f39e5a1fdb2165e87dfd679d82f61df018f01eb | |
parent | a886da8c0137d1227bfc68275db4d6cdf4702b5d (diff) |
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>
(cherry picked from commit 2c3aee2b570dadd9270a08d8ff675d07ac405e33)
Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
-rw-r--r-- | uxa/uxa-glyphs.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/uxa/uxa-glyphs.c b/uxa/uxa-glyphs.c index 5901552e..ff167812 100644 --- a/uxa/uxa-glyphs.c +++ b/uxa/uxa-glyphs.c @@ -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; } |