uxa: Only recreate the glyph cache on *generational* updates

The screen resources are recreated when the screen is rotated as well,
without being finalized. In this case, we do not need to reconstuct the
cache (or if we did, we would need to tear it down first).

Reported-by: Till Matthiesen <entropy@everymail.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33412
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-01-24 20:25:27 +00:00
parent 5baa63c634
commit c6dc27562a
2 changed files with 10 additions and 11 deletions

View File

@ -111,6 +111,9 @@ static void uxa_unrealize_glyph_caches(ScreenPtr pScreen)
uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
int i;
if (!uxa_screen->glyph_cache_initialized)
return;
for (i = 0; i < UXA_NUM_GLYPH_CACHE_FORMATS; i++) {
uxa_glyph_cache_t *cache = &uxa_screen->glyphCaches[i];
@ -120,6 +123,7 @@ static void uxa_unrealize_glyph_caches(ScreenPtr pScreen)
if (cache->glyphs)
free(cache->glyphs);
}
uxa_screen->glyph_cache_initialized = FALSE;
}
void uxa_glyphs_fini(ScreenPtr pScreen)
@ -145,6 +149,10 @@ static Bool uxa_realize_glyph_caches(ScreenPtr pScreen)
};
int i;
if (uxa_screen->glyph_cache_initialized)
return TRUE;
uxa_screen->glyph_cache_initialized = TRUE;
memset(uxa_screen->glyphCaches, 0, sizeof(uxa_screen->glyphCaches));
for (i = 0; i < sizeof(formats)/sizeof(formats[0]); i++) {
@ -214,17 +222,7 @@ Bool uxa_glyphs_init(ScreenPtr pScreen)
if (uxa_get_screen(pScreen)->force_fallback)
return TRUE;
/* We are trying to initialise per screen resources prior to the
* complete initialisation of the screen. So ensure the components
* that we depend upon are initialsed prior to our use.
*/
if (!CreateScratchPixmapsForScreen(pScreen->myNum))
return FALSE;
if (!uxa_realize_glyph_caches(pScreen))
return FALSE;
return TRUE;
return uxa_realize_glyph_caches(pScreen);
}
/* The most efficient thing to way to upload the glyph to the screen

View File

@ -139,6 +139,7 @@ typedef struct {
unsigned offScreenCounter;
uxa_glyph_cache_t glyphCaches[UXA_NUM_GLYPH_CACHE_FORMATS];
Bool glyph_cache_initialized;
PicturePtr solid_clear, solid_black, solid_white;
uxa_solid_cache_t solid_cache[UXA_NUM_SOLID_CACHE];