return FALSE;
}
+ if (!ms->api)
+ ms->api = drm_api_create();
+
if (!ms->screen) {
ms->screen = ms->api->create_screen(ms->api, ms->fd, NULL);
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;
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;
}
}