From 2c3aee2b570dadd9270a08d8ff675d07ac405e33 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 29 Nov 2009 20:53:35 +0000 Subject: [PATCH] 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 --- uxa/uxa-glyphs.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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; }