glamor.c 14.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
 * Copyright © 2008 Intel Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 *
 * Authors:
 *    Eric Anholt <eric@anholt.net>
25
 *    Zhigang Gong <zhigang.gong@linux.intel.com>
26 27 28
 *
 */

Eric Anholt's avatar
Eric Anholt committed
29
/** @file glamor.c
30 31 32 33 34
 * This file covers the initialization and teardown of glamor, and has various
 * functions not responsible for performing rendering.
 */

#include <stdlib.h>
Eric Anholt's avatar
Eric Anholt committed
35

36 37
#include "glamor_priv.h"

38
static DevPrivateKeyRec glamor_screen_private_key_index;
39
DevPrivateKey glamor_screen_private_key = &glamor_screen_private_key_index;
40
static DevPrivateKeyRec glamor_pixmap_private_key_index;
Eric Anholt's avatar
Eric Anholt committed
41
DevPrivateKey glamor_pixmap_private_key = &glamor_pixmap_private_key_index;
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56

/**
 * glamor_get_drawable_pixmap() returns a backing pixmap for a given drawable.
 *
 * @param drawable the drawable being requested.
 *
 * This function returns the backing pixmap for a drawable, whether it is a
 * redirected window, unredirected window, or already a pixmap.  Note that
 * coordinate translation is needed when drawing to the backing pixmap of a
 * redirected window, and the translation coordinates are provided by calling
 * exaGetOffscreenPixmap() on the drawable.
 */
PixmapPtr
glamor_get_drawable_pixmap(DrawablePtr drawable)
{
Zhigang Gong's avatar
Zhigang Gong committed
57 58 59 60 61
	if (drawable->type == DRAWABLE_WINDOW)
		return drawable->
		    pScreen->GetWindowPixmap((WindowPtr) drawable);
	else
		return (PixmapPtr) drawable;
62 63
}

64 65 66 67 68 69 70
_X_EXPORT void
glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type)
{
	glamor_pixmap_private *pixmap_priv;
	glamor_screen_private *glamor_priv =
	    glamor_get_screen_private(pixmap->drawable.pScreen);

71 72
	pixmap_priv = dixLookupPrivate(&pixmap->devPrivates,
					glamor_pixmap_private_key);
73 74
	if (pixmap_priv == NULL) {
		pixmap_priv = calloc(sizeof(*pixmap_priv), 1);
75
		glamor_set_pixmap_private(pixmap, pixmap_priv);
76 77 78 79 80 81
		pixmap_priv->container = pixmap;
		pixmap_priv->glamor_priv = glamor_priv;
	}
	pixmap_priv->type = type;
}

Zhigang Gong's avatar
Zhigang Gong committed
82
_X_EXPORT void
83
glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex)
84
{
Zhigang Gong's avatar
Zhigang Gong committed
85 86
	ScreenPtr screen = pixmap->drawable.pScreen;
	glamor_pixmap_private *pixmap_priv;
87
	glamor_screen_private *glamor_priv;
88
	glamor_pixmap_fbo *fbo;
89
	GLenum format;
Zhigang Gong's avatar
Zhigang Gong committed
90

91
	glamor_priv = glamor_get_screen_private(screen);
Zhigang Gong's avatar
Zhigang Gong committed
92
	pixmap_priv = glamor_get_pixmap_private(pixmap);
93

94 95 96
	if (pixmap_priv->fbo) {
		fbo = glamor_pixmap_detach_fbo(pixmap_priv);
		glamor_destroy_fbo(fbo);
Zhigang Gong's avatar
Zhigang Gong committed
97 98
	}

99
	gl_iformat_for_depth(pixmap->drawable.depth, &format);
100 101
	fbo = glamor_create_fbo_from_tex(glamor_priv, pixmap->drawable.width,
					 pixmap->drawable.height,
102
					 format, tex, 0);
103

104 105 106
	if (fbo == NULL) {
		ErrorF("XXX fail to create fbo.\n");
		return;
Zhigang Gong's avatar
Zhigang Gong committed
107 108
	}

109
	glamor_pixmap_attach_fbo(pixmap, fbo);
110 111
}

112
void
Zhigang Gong's avatar
Zhigang Gong committed
113
glamor_set_screen_pixmap(PixmapPtr screen_pixmap, PixmapPtr *back_pixmap)
114
{
Zhigang Gong's avatar
Zhigang Gong committed
115
	glamor_pixmap_private *pixmap_priv;
116
	glamor_screen_private *glamor_priv;
Zhigang Gong's avatar
Zhigang Gong committed
117

118
	glamor_priv = glamor_get_screen_private(screen_pixmap->drawable.pScreen);
119
	pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
120 121 122 123
	glamor_priv->screen_fbo = pixmap_priv->fbo->fb;

	pixmap_priv->fbo->width = screen_pixmap->drawable.width;
	pixmap_priv->fbo->height = screen_pixmap->drawable.height;
Zhigang Gong's avatar
Zhigang Gong committed
124 125

	glamor_priv->back_pixmap = back_pixmap;
126 127
}

128
PixmapPtr
129
glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
Eric Anholt's avatar
Eric Anholt committed
130
		     unsigned int usage)
131
{
Zhigang Gong's avatar
Zhigang Gong committed
132
	PixmapPtr pixmap;
133
	glamor_pixmap_type_t type = GLAMOR_TEXTURE_ONLY;
Zhigang Gong's avatar
Zhigang Gong committed
134 135 136
	glamor_pixmap_private *pixmap_priv;
	glamor_screen_private *glamor_priv =
	    glamor_get_screen_private(screen);
137 138 139
	glamor_pixmap_fbo *fbo;
	int pitch;
	int flag;
140
	GLenum format;
141

Zhigang Gong's avatar
Zhigang Gong committed
142 143 144
	if (w > 32767 || h > 32767)
		return NullPixmap;

145 146 147
	if (usage == GLAMOR_CREATE_PIXMAP_CPU
	    || (w == 0 && h == 0)
	    || !glamor_check_pixmap_fbo_depth(depth))
148
		return fbCreatePixmap(screen, w, h, depth, usage);
149
	else
Zhigang Gong's avatar
Zhigang Gong committed
150
		pixmap = fbCreatePixmap(screen, 0, 0, depth, usage);
151

Zhigang Gong's avatar
Zhigang Gong committed
152
	pixmap_priv = calloc(1, sizeof(*pixmap_priv));
153

154 155
	if (!pixmap_priv) {
		fbDestroyPixmap(pixmap);
156
		return fbCreatePixmap(screen, w, h, depth, usage);
157
	}
158
	glamor_set_pixmap_private(pixmap, pixmap_priv);
159

160 161 162
	if (usage == GLAMOR_CREATE_PIXMAP_MAP)
		type = GLAMOR_MEMORY_MAP;

Zhigang Gong's avatar
Zhigang Gong committed
163 164
	pixmap_priv->container = pixmap;
	pixmap_priv->glamor_priv = glamor_priv;
165
	pixmap_priv->type = type;
166

167 168
	gl_iformat_for_depth(depth, &format);
	fbo = glamor_create_fbo(glamor_priv, w, h, format, usage);
169 170 171 172 173 174 175 176

	if (fbo == NULL) {
		fbDestroyPixmap(pixmap);
		free(pixmap_priv);
		return fbCreatePixmap(screen, w, h, depth, usage);
	}

	glamor_pixmap_attach_fbo(pixmap, fbo);
177

178 179
	pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3;
	screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, pitch, NULL);
Zhigang Gong's avatar
Zhigang Gong committed
180 181 182 183 184 185 186
	return pixmap;
}

void
glamor_destroy_textured_pixmap(PixmapPtr pixmap)
{
	if (pixmap->refcnt == 1) {
187 188 189
		glamor_pixmap_private *pixmap_priv;

		pixmap_priv = glamor_get_pixmap_private(pixmap);
Zhigang Gong's avatar
Zhigang Gong committed
190
		if (pixmap_priv != NULL) {
191 192 193 194
			glamor_pixmap_fbo *fbo;
			fbo = glamor_pixmap_detach_fbo(pixmap_priv);
			if (fbo)
				glamor_destroy_fbo(fbo);
Zhigang Gong's avatar
Zhigang Gong committed
195 196 197
			free(pixmap_priv);
		}
	}
198 199
}

200
Bool
201 202
glamor_destroy_pixmap(PixmapPtr pixmap)
{
Zhigang Gong's avatar
Zhigang Gong committed
203 204 205 206 207 208 209 210 211
	glamor_destroy_textured_pixmap(pixmap);
	return fbDestroyPixmap(pixmap);
}

void
glamor_block_handler(ScreenPtr screen)
{
	glamor_screen_private *glamor_priv =
	    glamor_get_screen_private(screen);
Chris Wilson's avatar
Chris Wilson committed
212
	glamor_gl_dispatch *dispatch;
Zhigang Gong's avatar
Zhigang Gong committed
213

Chris Wilson's avatar
Chris Wilson committed
214
	dispatch = glamor_get_dispatch(glamor_priv);
215
	glamor_priv->tick++;
Zhigang Gong's avatar
Zhigang Gong committed
216
	dispatch->glFlush();
217
	glamor_fbo_expire(glamor_priv);
Chris Wilson's avatar
Chris Wilson committed
218
	glamor_put_dispatch(glamor_priv);
219
}
Eric Anholt's avatar
Eric Anholt committed
220

221
static void
Zhigang Gong's avatar
Zhigang Gong committed
222 223
_glamor_block_handler(void *data, OSTimePtr timeout,
		      void *last_select_mask)
224
{
Chris Wilson's avatar
Chris Wilson committed
225 226
	glamor_screen_private *glamor_priv = data;
	glamor_gl_dispatch *dispatch = glamor_get_dispatch(glamor_priv);
Zhigang Gong's avatar
Zhigang Gong committed
227
	dispatch->glFlush();
Chris Wilson's avatar
Chris Wilson committed
228
	glamor_put_dispatch(glamor_priv);
229 230 231
}

static void
Zhigang Gong's avatar
Zhigang Gong committed
232
_glamor_wakeup_handler(void *data, int result, void *last_select_mask)
233 234 235
{
}

Zhigang Gong's avatar
Zhigang Gong committed
236
static void
237 238
glamor_set_debug_level(int *debug_level)
{
Zhigang Gong's avatar
Zhigang Gong committed
239 240 241 242 243 244
	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;
245 246 247 248
}

int glamor_debug_level;

Eric Anholt's avatar
Eric Anholt committed
249 250
/** Set up glamor for an already-configured GL context. */
Bool
251
glamor_init(ScreenPtr screen, unsigned int flags)
Eric Anholt's avatar
Eric Anholt committed
252
{
Zhigang Gong's avatar
Zhigang Gong committed
253 254
	glamor_screen_private *glamor_priv;
	int gl_version;
255

256
#ifdef RENDER
Zhigang Gong's avatar
Zhigang Gong committed
257
	PictureScreenPtr ps = GetPictureScreenIfSet(screen);
258
#endif
Zhigang Gong's avatar
Zhigang Gong committed
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
	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;
	}

280
	glamor_set_screen_private(screen, glamor_priv);
Zhigang Gong's avatar
Zhigang Gong committed
281 282 283 284 285 286 287 288 289 290

	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();
291

292
#ifndef GLAMOR_GLES2
Zhigang Gong's avatar
Zhigang Gong committed
293 294 295 296
	if (gl_version < GLAMOR_GL_VERSION_ENCODE(1, 3)) {
		ErrorF("Require OpenGL version 1.3 or latter.\n");
		goto fail;
	}
297
#else
Zhigang Gong's avatar
Zhigang Gong committed
298 299 300 301
	if (gl_version < GLAMOR_GL_VERSION_ENCODE(2, 0)) {
		ErrorF("Require Open GLES2.0 or latter.\n");
		goto fail;
	}
302
#endif
303

Chris Wilson's avatar
Chris Wilson committed
304
	glamor_gl_dispatch_init(screen, &glamor_priv->_dispatch, gl_version);
Zhigang Gong's avatar
Zhigang Gong committed
305 306

#ifdef GLAMOR_GLES2
Zhigang Gong's avatar
Zhigang Gong committed
307 308 309 310
	if (!glamor_gl_has_extension("GL_EXT_texture_format_BGRA8888")) {
		ErrorF("GL_EXT_texture_format_BGRA8888 required\n");
		goto fail;
	}
311 312
#endif

Zhigang Gong's avatar
Zhigang Gong committed
313 314 315 316
	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");
Chris Wilson's avatar
Chris Wilson committed
317 318
	glamor_priv->_dispatch.glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE,
					     &glamor_priv->max_fbo_size);
319

Zhigang Gong's avatar
Zhigang Gong committed
320
	glamor_set_debug_level(&glamor_debug_level);
321

322 323 324 325 326
#ifdef GLAMOR_GLES2
	glamor_priv->gl_flavor = GLAMOR_GL_ES2;
#else
	glamor_priv->gl_flavor = GLAMOR_GL_DESKTOP;
#endif
327 328 329 330 331 332 333
	/* If we are using egl screen, call egl screen init to
	 * register correct close screen function. */
	if (flags & GLAMOR_USE_EGL_SCREEN)
		glamor_egl_screen_init(screen);

	glamor_priv->saved_procs.close_screen = screen->CloseScreen;
	screen->CloseScreen = glamor_close_screen;
334

Zhigang Gong's avatar
Zhigang Gong committed
335
	if (flags & GLAMOR_USE_SCREEN) {
336 337
		if (!RegisterBlockAndWakeupHandlers(_glamor_block_handler,
						    _glamor_wakeup_handler,
Chris Wilson's avatar
Chris Wilson committed
338
						    glamor_priv)) {
339 340 341
			goto fail;
		}

342
		glamor_priv->saved_procs.create_gc = screen->CreateGC;
Zhigang Gong's avatar
Zhigang Gong committed
343
		screen->CreateGC = glamor_create_gc;
344

345
		glamor_priv->saved_procs.create_pixmap = screen->CreatePixmap;
Zhigang Gong's avatar
Zhigang Gong committed
346
		screen->CreatePixmap = glamor_create_pixmap;
347

348
		glamor_priv->saved_procs.destroy_pixmap = screen->DestroyPixmap;
Zhigang Gong's avatar
Zhigang Gong committed
349
		screen->DestroyPixmap = glamor_destroy_pixmap;
350

351
		glamor_priv->saved_procs.get_spans = screen->GetSpans;
Zhigang Gong's avatar
Zhigang Gong committed
352
		screen->GetSpans = glamor_get_spans;
353

354
		glamor_priv->saved_procs.get_image = screen->GetImage;
355
		screen->GetImage = glamor_get_image;
356

357
		glamor_priv->saved_procs.change_window_attributes =
Zhigang Gong's avatar
Zhigang Gong committed
358 359 360
		    screen->ChangeWindowAttributes;
		screen->ChangeWindowAttributes =
		    glamor_change_window_attributes;
361

362
		glamor_priv->saved_procs.copy_window = screen->CopyWindow;
Zhigang Gong's avatar
Zhigang Gong committed
363
		screen->CopyWindow = glamor_copy_window;
364

365
		glamor_priv->saved_procs.bitmap_to_region =
Zhigang Gong's avatar
Zhigang Gong committed
366 367 368
		    screen->BitmapToRegion;
		screen->BitmapToRegion = glamor_bitmap_to_region;
	}
369
#ifdef RENDER
Zhigang Gong's avatar
Zhigang Gong committed
370
	if (flags & GLAMOR_USE_PICTURE_SCREEN) {
371
		glamor_priv->saved_procs.composite = ps->Composite;
Zhigang Gong's avatar
Zhigang Gong committed
372 373
		ps->Composite = glamor_composite;

374
		glamor_priv->saved_procs.trapezoids = ps->Trapezoids;
Zhigang Gong's avatar
Zhigang Gong committed
375 376
		ps->Trapezoids = glamor_trapezoids;

377
		glamor_priv->saved_procs.glyphs = ps->Glyphs;
Zhigang Gong's avatar
Zhigang Gong committed
378 379
		ps->Glyphs = glamor_glyphs;

380
		glamor_priv->saved_procs.triangles = ps->Triangles;
Zhigang Gong's avatar
Zhigang Gong committed
381 382
		ps->Triangles = glamor_triangles;

383
		glamor_priv->saved_procs.addtraps = ps->AddTraps;
384 385
		ps->AddTraps = glamor_add_traps;

386
		glamor_priv->saved_procs.unrealize_glyph = ps->UnrealizeGlyph;
Zhigang Gong's avatar
Zhigang Gong committed
387 388
		ps->UnrealizeGlyph = glamor_glyph_unrealize;
	}
389
	glamor_priv->saved_procs.create_picture = ps->CreatePicture;
390
	ps->CreatePicture = glamor_create_picture;
Zhigang Gong's avatar
Zhigang Gong committed
391

392
	glamor_priv->saved_procs.destroy_picture = ps->DestroyPicture;
393
	ps->DestroyPicture = glamor_destroy_picture;
Zhigang Gong's avatar
Zhigang Gong committed
394
	glamor_init_composite_shaders(screen);
395
#endif
396
	glamor_init_pixmap_fbo(screen);
Zhigang Gong's avatar
Zhigang Gong committed
397 398 399 400
	glamor_init_solid_shader(screen);
	glamor_init_tile_shader(screen);
	glamor_init_putimage_shaders(screen);
	glamor_init_finish_access_shaders(screen);
401
#ifdef GLAMOR_GRADIENT_SHADER
402
	glamor_init_gradient_shader(screen);
403
#endif
Zhigang Gong's avatar
Zhigang Gong committed
404
	glamor_pixmap_init(screen);
405

406
	glamor_priv->flags = flags;
Zhigang Gong's avatar
Zhigang Gong committed
407
	glamor_priv->screen = screen;
408

Zhigang Gong's avatar
Zhigang Gong committed
409
	return TRUE;
410

Zhigang Gong's avatar
Zhigang Gong committed
411 412
      fail:
	free(glamor_priv);
413
	glamor_set_screen_private(screen, NULL);
Zhigang Gong's avatar
Zhigang Gong committed
414
	return FALSE;
Eric Anholt's avatar
Eric Anholt committed
415 416
}

417 418 419 420 421 422 423 424 425 426 427 428 429 430
static void
glamor_release_screen_priv(ScreenPtr screen)
{
	glamor_screen_private *glamor_priv;

	glamor_priv = glamor_get_screen_private(screen);
#ifdef RENDER
	glamor_fini_composite_shaders(screen);
#endif
	glamor_fini_pixmap_fbo(screen);
	glamor_fini_solid_shader(screen);
	glamor_fini_tile_shader(screen);
	glamor_fini_putimage_shaders(screen);
	glamor_fini_finish_access_shaders(screen);
431
	glamor_fini_gradient_shader(screen);
432 433 434
	glamor_pixmap_fini(screen);
	free(glamor_priv);

435
	glamor_set_screen_private(screen, NULL);
436 437
}

Zhigang Gong's avatar
Zhigang Gong committed
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460
_X_EXPORT void
glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv)
{
	glamor_pixmap_private *old_priv;
	glamor_pixmap_fbo *fbo;

	old_priv = dixGetPrivate(&pixmap->devPrivates, glamor_pixmap_private_key);

	if (priv) {
		assert(old_priv == NULL);
	} else {
		if (old_priv == NULL)
			return;
		fbo = glamor_pixmap_detach_fbo(old_priv);
		glamor_purge_fbo(fbo);
		free(old_priv);
	}

	dixSetPrivate(&pixmap->devPrivates,
		      glamor_pixmap_private_key,
		      priv);
}

Zhigang Gong's avatar
Zhigang Gong committed
461
Bool
462
glamor_close_screen(int idx, ScreenPtr screen)
463
{
464
	glamor_screen_private *glamor_priv;
465 466 467
	PixmapPtr screen_pixmap;
	glamor_pixmap_private *screen_pixmap_priv;
	glamor_pixmap_fbo *fbo;
468 469 470 471
	int flags;

	glamor_priv = glamor_get_screen_private(screen);
	flags = glamor_priv->flags;
472
#ifdef RENDER
Zhigang Gong's avatar
Zhigang Gong committed
473
	PictureScreenPtr ps = GetPictureScreenIfSet(screen);
474
#endif
Zhigang Gong's avatar
Zhigang Gong committed
475
	glamor_glyphs_fini(screen);
476
	screen->CloseScreen = glamor_priv->saved_procs.close_screen;
477 478 479 480 481 482 483 484 485 486 487
	if (flags & GLAMOR_USE_SCREEN) {

		screen->CreateGC = glamor_priv->saved_procs.create_gc;
		screen->CreatePixmap = glamor_priv->saved_procs.create_pixmap;
		screen->DestroyPixmap = glamor_priv->saved_procs.destroy_pixmap;
		screen->GetSpans = glamor_priv->saved_procs.get_spans;
		screen->ChangeWindowAttributes =
		    glamor_priv->saved_procs.change_window_attributes;
		screen->CopyWindow = glamor_priv->saved_procs.copy_window;
		screen->BitmapToRegion = glamor_priv->saved_procs.bitmap_to_region;
	}
488
#ifdef RENDER
489 490
	if (ps && (flags & GLAMOR_USE_PICTURE_SCREEN)) {

491 492 493 494 495
		ps->Composite = glamor_priv->saved_procs.composite;
		ps->Trapezoids = glamor_priv->saved_procs.trapezoids;
		ps->Glyphs = glamor_priv->saved_procs.glyphs;
		ps->Triangles = glamor_priv->saved_procs.triangles;
		ps->CreatePicture = glamor_priv->saved_procs.create_picture;
Zhigang Gong's avatar
Zhigang Gong committed
496
	}
497
#endif
498
	screen_pixmap = screen->GetScreenPixmap(screen);
Zhigang Gong's avatar
Zhigang Gong committed
499 500 501 502
	glamor_set_pixmap_private(screen_pixmap, NULL);
	if (glamor_priv->back_pixmap && *glamor_priv->back_pixmap)
		glamor_set_pixmap_private(*glamor_priv->back_pixmap, NULL);

503
	glamor_release_screen_priv(screen);
Zhigang Gong's avatar
Zhigang Gong committed
504

505
	return screen->CloseScreen(idx, screen);
506 507
}

508

509 510 511
void
glamor_fini(ScreenPtr screen)
{
Zhigang Gong's avatar
Zhigang Gong committed
512
	/* Do nothing currently. */
513
}