From: Jakob Bornecrantz Date: Tue, 20 Oct 2009 15:18:25 +0000 (+0200) Subject: st/xorg: Cleanly shutdown X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a9f71b3bba86771be56ff1def716beb370decd22;p=mesa.git st/xorg: Cleanly shutdown --- diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 2df954f18ee..7da10427eca 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -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; diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 3dd5e6e811d..393f3fac3ed 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -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; } }