diff options
Diffstat (limited to 'xorg-server/glamor/glamor.c')
-rw-r--r-- | xorg-server/glamor/glamor.c | 57 |
1 files changed, 24 insertions, 33 deletions
diff --git a/xorg-server/glamor/glamor.c b/xorg-server/glamor/glamor.c index d228e35ad..017266a85 100644 --- a/xorg-server/glamor/glamor.c +++ b/xorg-server/glamor/glamor.c @@ -123,8 +123,6 @@ glamor_set_screen_pixmap(PixmapPtr screen_pixmap, PixmapPtr *back_pixmap) pixmap_priv->base.fbo->width = screen_pixmap->drawable.width; pixmap_priv->base.fbo->height = screen_pixmap->drawable.height; - - glamor_priv->back_pixmap = back_pixmap; } uint32_t @@ -222,23 +220,20 @@ void glamor_destroy_textured_pixmap(PixmapPtr pixmap) { if (pixmap->refcnt == 1) { - glamor_pixmap_private *pixmap_priv; - - pixmap_priv = glamor_get_pixmap_private(pixmap); - if (pixmap_priv != NULL) - glamor_pixmap_destroy_fbo(pixmap_priv); + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); + if (pixmap_priv != NULL) { +#if GLAMOR_HAS_GBM + glamor_egl_destroy_pixmap_image(pixmap); +#endif + glamor_set_pixmap_private(pixmap, NULL); + } } } Bool glamor_destroy_pixmap(PixmapPtr pixmap) { - glamor_screen_private - *glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen); - if (glamor_priv->dri3_enabled) - glamor_egl_destroy_textured_pixmap(pixmap); - else - glamor_destroy_textured_pixmap(pixmap); + glamor_destroy_textured_pixmap(pixmap); return fbDestroyPixmap(pixmap); } @@ -254,20 +249,20 @@ glamor_block_handler(ScreenPtr screen) } static void -_glamor_block_handler(void *data, OSTimePtr timeout, void *last_select_mask) +_glamor_block_handler(ScreenPtr screen, void *timeout, void *readmask) { - glamor_screen_private *glamor_priv = data; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + screen->BlockHandler = glamor_priv->saved_procs.block_handler; + screen->BlockHandler(screen, timeout, readmask); + glamor_priv->saved_procs.block_handler = screen->BlockHandler; + screen->BlockHandler = _glamor_block_handler; glamor_make_current(glamor_priv); glFlush(); } static void -_glamor_wakeup_handler(void *data, int result, void *last_select_mask) -{ -} - -static void glamor_set_debug_level(int *debug_level) { char *debug_level_string; @@ -428,6 +423,9 @@ glamor_init(ScreenPtr screen, unsigned int flags) glamor_set_debug_level(&glamor_debug_level); + glamor_priv->saved_procs.close_screen = screen->CloseScreen; + screen->CloseScreen = glamor_close_screen; + /* If we are using egl screen, call egl screen init to * register correct close screen function. */ if (flags & GLAMOR_USE_EGL_SCREEN) { @@ -437,9 +435,6 @@ glamor_init(ScreenPtr screen, unsigned int flags) goto fail; } - 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; @@ -448,11 +443,9 @@ glamor_init(ScreenPtr screen, unsigned int flags) goto fail; if (flags & GLAMOR_USE_SCREEN) { - if (!RegisterBlockAndWakeupHandlers(_glamor_block_handler, - _glamor_wakeup_handler, - glamor_priv)) { - goto fail; - } + + glamor_priv->saved_procs.block_handler = screen->BlockHandler; + screen->BlockHandler = _glamor_block_handler; glamor_priv->saved_procs.create_gc = screen->CreateGC; screen->CreateGC = glamor_create_gc; @@ -558,7 +551,6 @@ _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); @@ -568,8 +560,8 @@ glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv) else { if (old_priv == NULL) return; - fbo = glamor_pixmap_detach_fbo(old_priv); - glamor_purge_fbo(fbo); + + glamor_pixmap_destroy_fbo(old_priv); free(old_priv); } @@ -603,6 +595,7 @@ glamor_close_screen(ScreenPtr screen) glamor_priv->saved_procs.change_window_attributes; screen->CopyWindow = glamor_priv->saved_procs.copy_window; screen->BitmapToRegion = glamor_priv->saved_procs.bitmap_to_region; + screen->BlockHandler = glamor_priv->saved_procs.block_handler; } #ifdef RENDER if (ps && (flags & GLAMOR_USE_PICTURE_SCREEN)) { @@ -619,8 +612,6 @@ glamor_close_screen(ScreenPtr screen) #endif screen_pixmap = screen->GetScreenPixmap(screen); 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); glamor_release_screen_priv(screen); |