st/xorg: On close wait on fences and then destroy the screen
authorJakob Bornecrantz <jakob@vmware.com>
Wed, 30 Dec 2009 03:46:12 +0000 (04:46 +0100)
committerJakob Bornecrantz <jakob@vmware.com>
Wed, 30 Dec 2009 04:01:09 +0000 (05:01 +0100)
src/gallium/state_trackers/xorg/xorg_driver.c

index ee01ba0dcf68b771aec2ff37416da25bac181ff3..ccaa0c68ef7d24940d33dd78bd767e3441c25d26 100644 (file)
@@ -255,9 +255,19 @@ static Bool
 drv_close_resource_management(ScrnInfoPtr pScrn)
 {
     modesettingPtr ms = modesettingPTR(pScrn);
+    int i;
 
-    if (ms->screen)
+    if (ms->screen) {
+       assert(ms->ctx == NULL);
+
+       for (i = 0; i < XORG_NR_FENCES; i++) {
+           if (ms->fence[i]) {
+               ms->screen->fence_finish(ms->screen, ms->fence[i], 0);
+               ms->screen->fence_reference(ms->screen, &ms->fence[i], NULL);
+           }
+       }
        ms->screen->destroy(ms->screen);
+    }
     ms->screen = NULL;
 
     if (ms->api && ms->api->destroy)