st/xorg: Cleanly shutdown
authorJakob Bornecrantz <jakob@vmware.com>
Tue, 20 Oct 2009 15:18:25 +0000 (17:18 +0200)
committerJakob Bornecrantz <jakob@vmware.com>
Tue, 20 Oct 2009 15:19:04 +0000 (17:19 +0200)
src/gallium/state_trackers/xorg/xorg_driver.c
src/gallium/state_trackers/xorg/xorg_renderer.c

index 2df954f18ee63223a48937095324892a89459bcd..7da10427eca44002b93f021b955b0b2e4044fef7 100644 (file)
@@ -541,6 +541,9 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
            return FALSE;
     }
 
+    if (!ms->api)
+       ms->api = drm_api_create();
+
     if (!ms->screen) {
        ms->screen = ms->api->create_screen(ms->api, ms->fd, NULL);
 
@@ -774,7 +777,7 @@ CloseScreen(int scrnIndex, ScreenPtr pScreen)
     if (ms->exa)
        xorg_exa_close(pScrn);
 
-    if (ms->api->destroy)
+    if (ms->api && ms->api->destroy)
        ms->api->destroy(ms->api);
     ms->api = NULL;
 
index 3dd5e6e811d2dcd145e5736abcf542796e0d8a9f..393f3fac3eda61cb92b71779e6943affc8f7751d 100644 (file)
@@ -283,13 +283,15 @@ void renderer_destroy(struct xorg_renderer *r)
    if (fsbuf && fsbuf->buffer)
       pipe_buffer_reference(&fsbuf->buffer, NULL);
 
+   if (r->shaders) {
+      xorg_shaders_destroy(r->shaders);
+      r->shaders = NULL;
+   }
+
    if (r->cso) {
       cso_release_all(r->cso);
       cso_destroy_context(r->cso);
-   }
-
-   if (r->shaders) {
-      xorg_shaders_destroy(r->shaders);
+      r->cso = NULL;
    }
 }