summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorJakob Bornecrantz <[email protected]>2010-01-20 14:53:38 +0000
committerJakob Bornecrantz <[email protected]>2010-01-20 14:55:07 +0000
commit9f728ed1c9c7255554109299508a78b9fbb1cdb6 (patch)
tree52bd4e152f1638cbfcc1c1207fbef70c9ab9a564 /src/gallium/state_trackers
parente3cb614f932ac417d446c84bd54f86d01b1cdcd9 (diff)
st/xorg: Fic bug and close drm_api at proper place
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_driver.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index b74953e5432..2714fba999d 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -214,7 +214,7 @@ drv_init_drm(ScrnInfoPtr pScrn)
if (ms->fd >= 0)
return TRUE;
- if (ms->api->destroy)
+ if (ms->api && ms->api->destroy)
ms->api->destroy(ms->api);
ms->api = NULL;
@@ -226,6 +226,21 @@ drv_init_drm(ScrnInfoPtr pScrn)
}
static Bool
+drv_close_drm(ScrnInfoPtr pScrn)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+
+ if (ms->api && ms->api->destroy)
+ ms->api->destroy(ms->api);
+ ms->api = NULL;
+
+ drmClose(ms->fd);
+ ms->fd = -1;
+
+ return TRUE;
+}
+
+static Bool
drv_init_resource_management(ScrnInfoPtr pScrn)
{
modesettingPtr ms = modesettingPTR(pScrn);
@@ -278,10 +293,6 @@ drv_close_resource_management(ScrnInfoPtr pScrn)
}
ms->screen = NULL;
- if (ms->api && ms->api->destroy)
- ms->api->destroy(ms->api);
- ms->api = NULL;
-
#ifdef HAVE_LIBKMS
if (ms->kms)
kms_destroy(&ms->kms);
@@ -832,8 +843,7 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen)
drv_close_resource_management(pScrn);
- drmClose(ms->fd);
- ms->fd = -1;
+ drv_close_drm(pScrn);
pScrn->vtSema = FALSE;
pScreen->CloseScreen = ms->CloseScreen;