Commit b861aad8 authored by Zhigang Gong's avatar Zhigang Gong Committed by Eric Anholt

Initial version.

Signed-off-by: default avatarZhigang Gong <zhigang.gong@linux.intel.com>
parent 2dbbe256
noinst_LTLIBRARIES = libglamor.la
inst_LTLIBRARIES = libglamor.la
# Override these since glamor doesn't need them and the needed files aren't
# built (in hw/xfree86/os-support/solaris) until after glamor is built
SOLARIS_ASM_CFLAGS=""
if XORG
sdk_HEADERS = glamor.h
endif
if GLAMOR_GLES2
libglamor_la_LIBADD = $(GLESV2_LIBS)
else
libglamor_la_LIBADD = $(GL_LIBS)
endif
if XORG
sdk_HEADERS = glamor.h
endif
instdir = $(moduledir)
INCLUDES = \
$(XORG_INCS)
AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS) $(LIBDRM_CFLAGS)
libglamor_la_LDFLAGS = -avoid-version
libglamor_la_SOURCES = \
glamor.c \
glamor_copyarea.c \
......@@ -45,3 +40,17 @@ libglamor_la_SOURCES = \
glamor_window.c\
glamor_gl_dispatch.c\
glamor.h
sdk_HEADERS = glamor.h
if EGL
LIBGLAMOR_EGL = libglamor_egl.la
module_LTLIBRARIES = $(LIBGLAMOR_EGL)
libglamor_egl_la_DEPENDENCIES = libglamor.la
libglamor_egl_la_LDFLAGS = -avoid-version -module $(EGL_LIBS) -lglamor
#libglamor_egl_la_LIBADD = $(top_builddir)/src/libglamor.la
libglamor_egl_la_SOURCES = glamor_eglmodule.c $(top_srcdir)/src/glamor_egl.c
libglamor_egl_la_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/src $(LIBDRM_CFLAGS) $(EGL_CFLAGS)
endif
......@@ -53,57 +53,71 @@ DevPrivateKey glamor_pixmap_private_key = &glamor_pixmap_private_key_index;
PixmapPtr
glamor_get_drawable_pixmap(DrawablePtr drawable)
{
if (drawable->type == DRAWABLE_WINDOW)
return drawable->pScreen->GetWindowPixmap((WindowPtr)drawable);
else
return (PixmapPtr)drawable;
if (drawable->type == DRAWABLE_WINDOW)
return drawable->
pScreen->GetWindowPixmap((WindowPtr) drawable);
else
return (PixmapPtr) drawable;
}
void
_X_EXPORT void
glamor_set_pixmap_texture(PixmapPtr pixmap, int w, int h, unsigned int tex)
{
ScreenPtr screen = pixmap->drawable.pScreen;
glamor_pixmap_private *pixmap_priv;
pixmap_priv = glamor_get_pixmap_private(pixmap);
assert(pixmap_priv);
pixmap_priv->tex = tex;
/* Create a framebuffer object wrapping the texture so that we can render
* to it.
*/
pixmap_priv->gl_fbo = 1;
if (tex != 0) {
glamor_pixmap_ensure_fb(pixmap);
pixmap_priv->gl_tex = 1;
}
else {
pixmap_priv->fb = 0;
pixmap_priv->gl_tex = 0;
}
screen->ModifyPixmapHeader(pixmap, w, h, 0, 0,
(((w * pixmap->drawable.bitsPerPixel +
7) / 8) + 3) & ~3,
NULL);
ScreenPtr screen = pixmap->drawable.pScreen;
glamor_pixmap_private *pixmap_priv;
glamor_screen_private *glamor_priv =
glamor_get_screen_private(screen);
pixmap_priv = glamor_get_pixmap_private(pixmap);
if (pixmap_priv == NULL) {
pixmap_priv = calloc(sizeof(*pixmap_priv), 1);
dixSetPrivate(&pixmap->devPrivates,
glamor_pixmap_private_key, pixmap_priv);
pixmap_priv->container = pixmap;
pixmap_priv->glamor_priv = glamor_priv;
}
pixmap_priv->tex = tex;
/* Create a framebuffer object wrapping the texture so that we can render
* to it.
*/
pixmap_priv->gl_fbo = 1;
if (tex != 0) {
glamor_pixmap_ensure_fb(pixmap);
pixmap_priv->gl_tex = 1;
} else {
pixmap_priv->fb = 0;
pixmap_priv->gl_tex = 0;
}
if (pixmap->devKind == 0)
screen->ModifyPixmapHeader(pixmap, w, h, 0, 0,
(((w *
pixmap->drawable.
bitsPerPixel + 7) / 8) +
3) & ~3, NULL);
}
/* Set screen pixmap. If tex equal to 0, means it is called from ephyr. */
void
glamor_set_screen_pixmap_texture(ScreenPtr screen, int w, int h, unsigned int tex)
glamor_set_screen_pixmap_texture(ScreenPtr screen, int w, int h,
unsigned int tex)
{
PixmapPtr pixmap = screen->GetScreenPixmap(screen);
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
glamor_set_pixmap_texture(pixmap, w, h, tex);
glamor_priv->screen_fbo = pixmap_priv->fb;
pixmap_priv->pending_op.type = GLAMOR_PENDING_NONE;
PixmapPtr pixmap = screen->GetScreenPixmap(screen);
glamor_pixmap_private *pixmap_priv;
glamor_screen_private *glamor_priv =
glamor_get_screen_private(screen);
glamor_set_pixmap_texture(pixmap, w, h, tex);
pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_priv->screen_fbo = pixmap_priv->fb;
}
#define GLAMOR_PIXMAP_MEMORY 0
#define GLAMOR_PIXMAP_TEXTURE 1
#define GLAMOR_PIXMAP_MEMORY 0
#define GLAMOR_PIXMAP_TEXTURE 1
......@@ -111,113 +125,138 @@ static PixmapPtr
glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
unsigned int usage)
{
PixmapPtr pixmap;
GLenum format;
GLuint tex;
int type = GLAMOR_PIXMAP_TEXTURE;
glamor_pixmap_private *pixmap_priv;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
if (w > 32767 || h > 32767)
return NullPixmap;
if (!glamor_check_fbo_size(glamor_priv, w,h)
|| !glamor_check_fbo_depth(depth)
|| usage == GLAMOR_CREATE_PIXMAP_CPU) {
/* MESA can only support upto MAX_WIDTH*MAX_HEIGHT fbo.
If we exceed such limitation, we have to use framebuffer.*/
type = GLAMOR_PIXMAP_MEMORY;
pixmap = fbCreatePixmap (screen, w, h, depth, usage);
screen->ModifyPixmapHeader(pixmap, w, h, 0, 0,
(((w * pixmap->drawable.bitsPerPixel +
7) / 8) + 3) & ~3,
NULL);
PixmapPtr pixmap;
GLenum format;
GLuint tex;
int type = GLAMOR_PIXMAP_TEXTURE;
glamor_pixmap_private *pixmap_priv;
glamor_screen_private *glamor_priv =
glamor_get_screen_private(screen);
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
if (w > 32767 || h > 32767)
return NullPixmap;
if (!glamor_check_fbo_size(glamor_priv, w, h)
|| !glamor_check_fbo_depth(depth)
|| usage == GLAMOR_CREATE_PIXMAP_CPU) {
/* MESA can only support upto MAX_WIDTH*MAX_HEIGHT fbo.
If we exceed such limitation, we have to use framebuffer. */
type = GLAMOR_PIXMAP_MEMORY;
pixmap = fbCreatePixmap(screen, w, h, depth, usage);
screen->ModifyPixmapHeader(pixmap, w, h, 0, 0,
(((w *
pixmap->
drawable.bitsPerPixel +
7) / 8) + 3) & ~3, NULL);
#if 0
if (usage != GLAMOR_CREATE_PIXMAP_CPU)
glamor_fallback("choose cpu memory for pixmap %p ,"
" %d x %d depth %d\n", pixmap, w, h, depth);
if (usage != GLAMOR_CREATE_PIXMAP_CPU)
glamor_fallback("choose cpu memory for pixmap %p ,"
" %d x %d depth %d\n", pixmap, w,
h, depth);
#endif
} else
pixmap = fbCreatePixmap (screen, 0, 0, depth, usage);
} else
pixmap = fbCreatePixmap(screen, 0, 0, depth, usage);
if (dixAllocatePrivates(&pixmap->devPrivates, PRIVATE_PIXMAP) != TRUE) {
fbDestroyPixmap(pixmap);
ErrorF("Fail to allocate privates for PIXMAP.\n");
return NullPixmap;
}
pixmap_priv = calloc(1, sizeof(*pixmap_priv));
dixSetPrivate(&pixmap->devPrivates, glamor_pixmap_private_key,
pixmap_priv);
pixmap_priv->container = pixmap;
pixmap_priv->glamor_priv = glamor_priv;
pixmap_priv = glamor_get_pixmap_private(pixmap);
pixmap_priv->container = pixmap;
pixmap_priv->glamor_priv = glamor_priv;
if (w == 0 || h == 0 || type == GLAMOR_PIXMAP_MEMORY)
return pixmap;
if (w == 0 || h == 0 || type == GLAMOR_PIXMAP_MEMORY)
return pixmap;
switch (depth) {
switch (depth) {
#if 0
case 8:
format = GL_ALPHA;
break;
case 8:
format = GL_ALPHA;
break;
#endif
case 24:
format = GL_RGB;
break;
default:
format = GL_RGBA;
break;
}
/* Create the texture used to store the pixmap's data. */
dispatch->glGenTextures(1, &tex);
dispatch->glBindTexture(GL_TEXTURE_2D, tex);
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
dispatch->glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0,
format, GL_UNSIGNED_BYTE, NULL);
glamor_set_pixmap_texture(pixmap, w, h, tex);
return pixmap;
case 24:
format = GL_RGB;
break;
default:
format = GL_RGBA;
break;
}
/* Create the texture used to store the pixmap's data. */
dispatch->glGenTextures(1, &tex);
dispatch->glBindTexture(GL_TEXTURE_2D, tex);
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_NEAREST);
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
dispatch->glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0, format,
GL_UNSIGNED_BYTE, NULL);
glamor_set_pixmap_texture(pixmap, w, h, tex);
return pixmap;
}
void
glamor_destroy_textured_pixmap(PixmapPtr pixmap)
{
glamor_screen_private *glamor_priv =
glamor_get_screen_private(pixmap->drawable.pScreen);
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
if (pixmap->refcnt == 1) {
glamor_pixmap_private *pixmap_priv =
glamor_get_pixmap_private(pixmap);
if (pixmap_priv != NULL) {
if (pixmap_priv->fb)
dispatch->glDeleteFramebuffers(1,
&pixmap_priv->fb);
if (pixmap_priv->tex)
dispatch->glDeleteTextures(1,
&pixmap_priv->tex);
if (pixmap_priv->pbo)
dispatch->glDeleteBuffers(1,
&pixmap_priv->pbo);
free(pixmap_priv);
}
}
}
static Bool
glamor_destroy_pixmap(PixmapPtr pixmap)
{
glamor_screen_private *glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
if (pixmap->refcnt == 1) {
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
if (pixmap_priv->fb)
dispatch->glDeleteFramebuffers(1, &pixmap_priv->fb);
if (pixmap_priv->tex)
dispatch->glDeleteTextures(1, &pixmap_priv->tex);
if (pixmap_priv->pbo)
dispatch->glDeleteBuffers(1, &pixmap_priv->pbo);
dixFreePrivates(pixmap->devPrivates, PRIVATE_PIXMAP);
}
return fbDestroyPixmap(pixmap);
glamor_destroy_textured_pixmap(pixmap);
return fbDestroyPixmap(pixmap);
}
void
glamor_block_handler(ScreenPtr screen)
{
glamor_screen_private *glamor_priv =
glamor_get_screen_private(screen);
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
dispatch->glFlush();
}
static void
glamor_block_handler(void *data, OSTimePtr timeout, void *last_select_mask)
_glamor_block_handler(void *data, OSTimePtr timeout,
void *last_select_mask)
{
glamor_gl_dispatch *dispatch = data;
dispatch->glFlush();
glamor_gl_dispatch *dispatch = data;
dispatch->glFlush();
}
static void
glamor_wakeup_handler(void *data, int result, void *last_select_mask)
_glamor_wakeup_handler(void *data, int result, void *last_select_mask)
{
}
static void
static void
glamor_set_debug_level(int *debug_level)
{
char *debug_level_string;
debug_level_string = getenv("GLAMOR_DEBUG");
if (debug_level_string && sscanf(debug_level_string, "%d", debug_level) == 1)
return;
*debug_level = 0;
char *debug_level_string;
debug_level_string = getenv("GLAMOR_DEBUG");
if (debug_level_string
&& sscanf(debug_level_string, "%d", debug_level) == 1)
return;
*debug_level = 0;
}
int glamor_debug_level;
......@@ -226,176 +265,198 @@ int glamor_debug_level;
Bool
glamor_init(ScreenPtr screen, unsigned int flags)
{
glamor_screen_private *glamor_priv;
int gl_version;
glamor_screen_private *glamor_priv;
int gl_version;
#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(screen);
PictureScreenPtr ps = GetPictureScreenIfSet(screen);
#endif
if (flags & ~GLAMOR_VALID_FLAGS) {
ErrorF("glamor_init: Invalid flags %x\n", flags);
return FALSE;
}
glamor_priv = calloc(1, sizeof(*glamor_priv));
if (glamor_priv == NULL)
return FALSE;
if (flags & GLAMOR_INVERTED_Y_AXIS) {
glamor_priv->yInverted = 1;
} else
glamor_priv->yInverted = 0;
if (!dixRegisterPrivateKey(glamor_screen_private_key,PRIVATE_SCREEN,
0)) {
LogMessage(X_WARNING,
"glamor%d: Failed to allocate screen private\n",
screen->myNum);
goto fail;
}
dixSetPrivate(&screen->devPrivates, glamor_screen_private_key, glamor_priv);
if (!dixRegisterPrivateKey(glamor_pixmap_private_key,PRIVATE_PIXMAP,
sizeof(glamor_pixmap_private))) {
LogMessage(X_WARNING,
"glamor%d: Failed to allocate pixmap private\n",
screen->myNum);
goto fail;;
}
gl_version = glamor_gl_get_version();
if (flags & ~GLAMOR_VALID_FLAGS) {
ErrorF("glamor_init: Invalid flags %x\n", flags);
return FALSE;
}
glamor_priv = calloc(1, sizeof(*glamor_priv));
if (glamor_priv == NULL)
return FALSE;
if (flags & GLAMOR_INVERTED_Y_AXIS) {
glamor_priv->yInverted = 1;
} else
glamor_priv->yInverted = 0;
if (!dixRegisterPrivateKey
(glamor_screen_private_key, PRIVATE_SCREEN, 0)) {
LogMessage(X_WARNING,
"glamor%d: Failed to allocate screen private\n",
screen->myNum);
goto fail;
}
dixSetPrivate(&screen->devPrivates, glamor_screen_private_key,
glamor_priv);
if (!dixRegisterPrivateKey
(glamor_pixmap_private_key, PRIVATE_PIXMAP, 0)) {
LogMessage(X_WARNING,
"glamor%d: Failed to allocate pixmap private\n",
screen->myNum);
goto fail;;
}
gl_version = glamor_gl_get_version();
#ifndef GLAMOR_GLES2
if (gl_version < GLAMOR_GL_VERSION_ENCODE(1,3)) {
ErrorF("Require OpenGL version 1.3 or latter.\n");
goto fail;
}
if (gl_version < GLAMOR_GL_VERSION_ENCODE(1, 3)) {
ErrorF("Require OpenGL version 1.3 or latter.\n");
goto fail;
}
#else
if (gl_version < GLAMOR_GL_VERSION_ENCODE(2,0)) {
ErrorF("Require Open GLES2.0 or latter.\n");
goto fail;
}
if (gl_version < GLAMOR_GL_VERSION_ENCODE(2, 0)) {
ErrorF("Require Open GLES2.0 or latter.\n");
goto fail;
}
#endif
glamor_gl_dispatch_init(screen, &glamor_priv->dispatch, gl_version);
glamor_gl_dispatch_init(screen, &glamor_priv->dispatch,
gl_version);
#ifdef GLAMOR_GLES2
if (!glamor_gl_has_extension("GL_EXT_texture_format_BGRA8888")) {
ErrorF("GL_EXT_texture_format_BGRA8888 required\n");
goto fail;
}
if (!glamor_gl_has_extension("GL_EXT_texture_format_BGRA8888")) {
ErrorF("GL_EXT_texture_format_BGRA8888 required\n");
goto fail;
}
#endif
glamor_priv->has_pack_invert = glamor_gl_has_extension("GL_MESA_pack_invert");
glamor_priv->has_fbo_blit = glamor_gl_has_extension("GL_EXT_framebuffer_blit");
glamor_priv->dispatch.glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size);
glamor_priv->has_pack_invert =
glamor_gl_has_extension("GL_MESA_pack_invert");
glamor_priv->has_fbo_blit =
glamor_gl_has_extension("GL_EXT_framebuffer_blit");
glamor_priv->dispatch.glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE,
&glamor_priv->max_fbo_size);
if (!RegisterBlockAndWakeupHandlers(glamor_block_handler,
glamor_wakeup_handler,
(void*)&glamor_priv->dispatch)) {
goto fail;
}
if (!RegisterBlockAndWakeupHandlers(_glamor_block_handler,
_glamor_wakeup_handler,
(void *)
&glamor_priv->dispatch)) {
goto fail;
}
glamor_set_debug_level(&glamor_debug_level);
glamor_priv->saved_close_screen = screen->CloseScreen;
screen->CloseScreen = glamor_close_screen;
glamor_set_debug_level(&glamor_debug_level);
glamor_priv->saved_create_gc = screen->CreateGC;
screen->CreateGC = glamor_create_gc;
if (flags & GLAMOR_USE_SCREEN) {
glamor_priv->saved_close_screen = screen->CloseScreen;
screen->CloseScreen = glamor_close_screen;
glamor_priv->saved_create_pixmap = screen->CreatePixmap;
screen->CreatePixmap = glamor_create_pixmap;
glamor_priv->saved_create_gc = screen->CreateGC;
screen->CreateGC = glamor_create_gc;
glamor_priv->saved_destroy_pixmap = screen->DestroyPixmap;
screen->DestroyPixmap = glamor_destroy_pixmap;
glamor_priv->saved_create_pixmap = screen->CreatePixmap;
screen->CreatePixmap = glamor_create_pixmap;
glamor_priv->saved_get_spans = screen->GetSpans;
screen->GetSpans = glamor_get_spans;
glamor_priv->saved_destroy_pixmap = screen->DestroyPixmap;
screen->DestroyPixmap = glamor_destroy_pixmap;
glamor_priv->saved_get_image = screen->GetImage;
screen->GetImage = miGetImage;
glamor_priv->saved_get_spans = screen->GetSpans;
screen->GetSpans = glamor_get_spans;
glamor_priv->saved_change_window_attributes = screen->ChangeWindowAttributes;
screen->ChangeWindowAttributes = glamor_change_window_attributes;
glamor_priv->saved_get_image = screen->GetImage;
screen->GetImage = miGetImage;
glamor_priv->saved_copy_window = screen->CopyWindow;
screen->CopyWindow = glamor_copy_window;
glamor_priv->saved_change_window_attributes =
screen->ChangeWindowAttributes;
screen->ChangeWindowAttributes =
glamor_change_window_attributes;
glamor_priv->saved_bitmap_to_region = screen->BitmapToRegion;
screen->BitmapToRegion = glamor_bitmap_to_region;
glamor_priv->saved_copy_window = screen->CopyWindow;
screen->CopyWindow = glamor_copy_window;
glamor_priv->saved_bitmap_to_region =
screen->BitmapToRegion;
screen->BitmapToRegion = glamor_bitmap_to_region;
}
#ifdef RENDER
glamor_priv->saved_composite = ps->Composite;
ps->Composite = glamor_composite;
glamor_priv->saved_trapezoids = ps->Trapezoids;
ps->Trapezoids = glamor_trapezoids;
glamor_priv->saved_glyphs = ps->Glyphs;
ps->Glyphs = glamor_glyphs;
glamor_priv->saved_triangles = ps->Triangles;
ps->Triangles = glamor_triangles;
glamor_init_composite_shaders(screen);
glamor_priv->saved_create_picture = ps->CreatePicture;
ps->CreatePicture = glamor_create_picture;
glamor_priv->saved_destroy_picture = ps->DestroyPicture;
ps->DestroyPicture = glamor_destroy_picture;
glamor_priv->saved_unrealize_glyph = ps->UnrealizeGlyph;
ps->UnrealizeGlyph = glamor_glyph_unrealize;
if (flags & GLAMOR_USE_PICTURE_SCREEN) {
glamor_priv->saved_composite = ps->Composite;
ps->Composite = glamor_composite;
glamor_priv->saved_trapezoids = ps->Trapezoids;
ps->Trapezoids = glamor_trapezoids;
glamor_priv->saved_glyphs = ps->Glyphs;
ps->Glyphs = glamor_glyphs;
glamor_priv->saved_triangles = ps->Triangles;
ps->Triangles = glamor_triangles;
glamor_priv->saved_create_picture = ps->CreatePicture;
ps->CreatePicture = glamor_create_picture;
glamor_priv->saved_destroy_picture = ps->DestroyPicture;
ps->DestroyPicture = glamor_destroy_picture;
glamor_priv->saved_unrealize_glyph = ps->UnrealizeGlyph;
ps->UnrealizeGlyph = glamor_glyph_unrealize;
}
glamor_init_composite_shaders(screen);
#endif
glamor_init_solid_shader(screen);
glamor_init_tile_shader(screen);
glamor_init_putimage_shaders(screen);
glamor_init_finish_access_shaders(screen);
glamor_pixmap_init(screen);
glamor_init_solid_shader(screen);
glamor_init_tile_shader(screen);
glamor_init_putimage_shaders(screen);
glamor_init_finish_access_shaders(screen);
glamor_pixmap_init(screen);
#ifdef GLAMOR_GLES2
glamor_priv->gl_flavor = GLAMOR_GL_ES2;
glamor_priv->gl_flavor = GLAMOR_GL_ES2;
#else
glamor_priv->gl_flavor = GLAMOR_GL_DESKTOP;
glamor_priv->gl_flavor = GLAMOR_GL_DESKTOP;
#endif
return TRUE;
return TRUE;
fail:
free(glamor_priv);
dixSetPrivate(&screen->devPrivates, glamor_screen_private_key, NULL);
return FALSE;
fail:
free(glamor_priv);
dixSetPrivate(&screen->devPrivates, glamor_screen_private_key,
NULL);
return FALSE;
}
Bool
Bool
glamor_close_screen(int idx, ScreenPtr screen)
{
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
glamor_screen_private *glamor_priv =
glamor_get_screen_private(screen);
#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(screen);
PictureScreenPtr ps = GetPictureScreenIfSet(screen);
#endif
glamor_glyphs_fini(screen);
screen->CloseScreen = glamor_priv->saved_close_screen;
screen->CreateGC = glamor_priv->saved_create_gc;
screen->CreatePixmap = glamor_priv->saved_create_pixmap;
screen->DestroyPixmap = glamor_priv->saved_destroy_pixmap;
screen->GetSpans = glamor_priv->saved_get_spans;
screen->ChangeWindowAttributes = glamor_priv->saved_change_window_attributes;
screen->CopyWindow = glamor_priv->saved_copy_window;
screen->BitmapToRegion = glamor_priv->saved_bitmap_to_region;
glamor_glyphs_fini(screen);
screen->CloseScreen = glamor_priv->saved_close_screen;
screen->CreateGC = glamor_priv->saved_create_gc;
screen->CreatePixmap = glamor_priv->saved_create_pixmap;
screen->DestroyPixmap = glamor_priv->saved_destroy_pixmap;
screen->GetSpans = glamor_priv->saved_get_spans;
screen->ChangeWindowAttributes =
glamor_priv->saved_change_window_attributes;