glamor: Do glyph private init at screeninit time, and other stuff at CSR.
This hasn't actually been a problem, since the server hasn't allocated any glyphs before our glyph private initialization during CreateScreenResources. But it's generally not X Server style to do things this way. Now that glamor itself drives both parts of glyphs setup, DDX drivers no longer need to tell glamor to initialize glyphs. We do retain the old public symbol so they can keep running with no changes. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Markus Wick <markus@selfnet.de>
This commit is contained in:
parent
df1ef90fa0
commit
12b2adaaeb
|
@ -271,6 +271,29 @@ glamor_set_debug_level(int *debug_level)
|
|||
|
||||
int glamor_debug_level;
|
||||
|
||||
/**
|
||||
* Creates any pixmaps used internally by glamor, since those can't be
|
||||
* allocated at ScreenInit time.
|
||||
*/
|
||||
static Bool
|
||||
glamor_create_screen_resources(ScreenPtr screen)
|
||||
{
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
Bool ret = TRUE;
|
||||
|
||||
screen->CreateScreenResources =
|
||||
glamor_priv->saved_procs.create_screen_resources;
|
||||
if (screen->CreateScreenResources)
|
||||
ret = screen->CreateScreenResources(screen);
|
||||
screen->CreateScreenResources = glamor_create_screen_resources;
|
||||
|
||||
if (!glamor_realize_glyph_caches(screen)) {
|
||||
ErrorF("Failed to initialize glyph cache\n");
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** Set up glamor for an already-configured GL context. */
|
||||
Bool
|
||||
|
@ -374,6 +397,10 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
|||
glamor_priv->saved_procs.close_screen = screen->CloseScreen;
|
||||
screen->CloseScreen = glamor_close_screen;
|
||||
|
||||
glamor_priv->saved_procs.create_screen_resources =
|
||||
screen->CreateScreenResources;
|
||||
screen->CreateScreenResources = glamor_create_screen_resources;
|
||||
|
||||
if (flags & GLAMOR_USE_SCREEN) {
|
||||
if (!RegisterBlockAndWakeupHandlers(_glamor_block_handler,
|
||||
_glamor_wakeup_handler,
|
||||
|
@ -457,6 +484,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
|||
glamor_init_xv_shader(screen);
|
||||
#endif
|
||||
glamor_pixmap_init(screen);
|
||||
glamor_glyphs_init(screen);
|
||||
|
||||
glamor_priv->flags = flags;
|
||||
glamor_priv->screen = screen;
|
||||
|
@ -535,6 +563,8 @@ glamor_close_screen(ScreenPtr screen)
|
|||
flags = glamor_priv->flags;
|
||||
glamor_glyphs_fini(screen);
|
||||
screen->CloseScreen = glamor_priv->saved_procs.close_screen;
|
||||
screen->CreateScreenResources =
|
||||
glamor_priv->saved_procs.create_screen_resources;
|
||||
if (flags & GLAMOR_USE_SCREEN) {
|
||||
|
||||
screen->CreateGC = glamor_priv->saved_procs.create_gc;
|
||||
|
|
|
@ -131,14 +131,6 @@ extern _X_EXPORT void glamor_set_screen_pixmap(PixmapPtr screen_pixmap,
|
|||
|
||||
extern _X_EXPORT uint32_t glamor_get_pixmap_texture(PixmapPtr pixmap);
|
||||
|
||||
/* @glamor_glyphs_init: Initialize glyphs internal data structures.
|
||||
*
|
||||
* @pScreen: Current screen pointer.
|
||||
*
|
||||
* This function must be called after the glamor_init and the texture
|
||||
* can be allocated. An example is to call it when create the screen
|
||||
* resources at DDX layer.
|
||||
*/
|
||||
extern _X_EXPORT Bool glamor_glyphs_init(ScreenPtr pScreen);
|
||||
|
||||
extern _X_EXPORT void glamor_set_pixmap_texture(PixmapPtr pixmap,
|
||||
|
|
|
@ -303,7 +303,7 @@ glamor_glyphs_fini(ScreenPtr pScreen)
|
|||
* rest of the allocated structures for all caches with the given format.
|
||||
*/
|
||||
|
||||
static Bool
|
||||
Bool
|
||||
glamor_realize_glyph_caches(ScreenPtr pScreen)
|
||||
{
|
||||
glamor_screen_private *glamor = glamor_get_screen_private(pScreen);
|
||||
|
@ -314,10 +314,6 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
|
|||
};
|
||||
int i;
|
||||
|
||||
if (glamor->glyph_cache_initialized)
|
||||
return TRUE;
|
||||
|
||||
glamor->glyph_cache_initialized = TRUE;
|
||||
memset(glamor->glyphCaches, 0, sizeof(glamor->glyphCaches));
|
||||
|
||||
for (i = 0; i < sizeof(formats) / sizeof(formats[0]); i++) {
|
||||
|
@ -370,16 +366,27 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by glamor_create_screen_resources() to set up the glyph cache.
|
||||
*
|
||||
* This was previously required to be called by the drivers, but not
|
||||
* as of the xserver 1.16 ABI.
|
||||
*/
|
||||
Bool
|
||||
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,
|
||||
PRIVATE_GLYPH, sizeof(struct glamor_glyph)))
|
||||
return FALSE;
|
||||
|
||||
/* Skip pixmap creation if we don't intend to use it. */
|
||||
glamor->glyph_cache_initialized = TRUE;
|
||||
|
||||
return glamor_realize_glyph_caches(pScreen);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* The most efficient thing to way to upload the glyph to the screen
|
||||
|
|
|
@ -173,6 +173,7 @@ typedef struct {
|
|||
|
||||
struct glamor_saved_procs {
|
||||
CloseScreenProcPtr close_screen;
|
||||
CreateScreenResourcesProcPtr create_screen_resources;
|
||||
CreateGCProcPtr create_gc;
|
||||
CreatePixmapProcPtr create_pixmap;
|
||||
DestroyPixmapProcPtr destroy_pixmap;
|
||||
|
@ -634,6 +635,7 @@ void glamor_get_spans(DrawablePtr drawable,
|
|||
int nspans, char *dst_start);
|
||||
|
||||
/* glamor_glyphs.c */
|
||||
Bool glamor_realize_glyph_caches(ScreenPtr screen);
|
||||
void glamor_glyphs_fini(ScreenPtr screen);
|
||||
void glamor_glyphs(CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
|
|
|
@ -1243,9 +1243,6 @@ ephyr_glamor_create_screen_resources(ScreenPtr pScreen)
|
|||
if (!ephyr_glamor)
|
||||
return TRUE;
|
||||
|
||||
if (!glamor_glyphs_init(pScreen))
|
||||
return FALSE;
|
||||
|
||||
/* kdrive's fbSetupScreen() told mi to have
|
||||
* miCreateScreenResources() (which is called before this) make a
|
||||
* scratch pixmap wrapping ephyr-glamor's NULL
|
||||
|
|
Loading…
Reference in New Issue