glamor: Move 'glyph caches realized' check to glamor_realize_glyph_caches

And rename the boolean to reflect what it's about.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Michel Dänzer 2014-09-10 16:20:46 +09:00 committed by Keith Packard
parent 0acff6e437
commit a4e8e6dff9
2 changed files with 7 additions and 10 deletions

View File

@ -269,7 +269,7 @@ glamor_unrealize_glyph_caches(ScreenPtr pScreen)
glamor_screen_private *glamor = glamor_get_screen_private(pScreen); glamor_screen_private *glamor = glamor_get_screen_private(pScreen);
int i; int i;
if (!glamor->glyph_cache_initialized) if (!glamor->glyph_caches_realized)
return; return;
for (i = 0; i < GLAMOR_NUM_GLYPH_CACHE_FORMATS; i++) { for (i = 0; i < GLAMOR_NUM_GLYPH_CACHE_FORMATS; i++) {
@ -284,7 +284,7 @@ glamor_unrealize_glyph_caches(ScreenPtr pScreen)
if (mask_cache[i]) if (mask_cache[i])
free(mask_cache[i]); free(mask_cache[i]);
} }
glamor->glyph_cache_initialized = FALSE; glamor->glyph_caches_realized = FALSE;
} }
void void
@ -314,6 +314,9 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
}; };
int i; int i;
if (glamor->glyph_caches_realized)
return TRUE;
memset(glamor->glyphCaches, 0, sizeof(glamor->glyphCaches)); memset(glamor->glyphCaches, 0, sizeof(glamor->glyphCaches));
for (i = 0; i < sizeof(formats) / sizeof(formats[0]); i++) { for (i = 0; i < sizeof(formats) / sizeof(formats[0]); i++) {
@ -359,6 +362,7 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
} }
assert(i == GLAMOR_NUM_GLYPH_CACHE_FORMATS); assert(i == GLAMOR_NUM_GLYPH_CACHE_FORMATS);
glamor->glyph_caches_realized = TRUE;
return TRUE; return TRUE;
bail: bail:
@ -375,17 +379,10 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
Bool Bool
glamor_glyphs_init(ScreenPtr pScreen) glamor_glyphs_init(ScreenPtr pScreen)
{ {
glamor_screen_private *glamor = glamor_get_screen_private(pScreen);
if (glamor->glyph_cache_initialized)
return TRUE;
if (!dixRegisterPrivateKey(&glamor_glyph_key, if (!dixRegisterPrivateKey(&glamor_glyph_key,
PRIVATE_GLYPH, sizeof(struct glamor_glyph))) PRIVATE_GLYPH, sizeof(struct glamor_glyph)))
return FALSE; return FALSE;
glamor->glyph_cache_initialized = TRUE;
return TRUE; return TRUE;
} }

View File

@ -268,7 +268,7 @@ typedef struct glamor_screen_private {
[SHADER_MASK_COUNT] [SHADER_MASK_COUNT]
[SHADER_IN_COUNT]; [SHADER_IN_COUNT];
glamor_glyph_cache_t glyphCaches[GLAMOR_NUM_GLYPH_CACHE_FORMATS]; glamor_glyph_cache_t glyphCaches[GLAMOR_NUM_GLYPH_CACHE_FORMATS];
Bool glyph_cache_initialized; Bool glyph_caches_realized;
/* shaders to restore a texture to another texture. */ /* shaders to restore a texture to another texture. */
GLint finish_access_prog[2]; GLint finish_access_prog[2];