Mesa (mesa_7_7_branch): st/xorg: Fic bug and close drm_api at proper place

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Wed Jan 20 06:53:28 PST 2010


Module: Mesa
Branch: mesa_7_7_branch
Commit: 9f728ed1c9c7255554109299508a78b9fbb1cdb6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f728ed1c9c7255554109299508a78b9fbb1cdb6

Author: Jakob Bornecrantz <jakob at vmware.com>
Date:   Wed Jan 20 14:53:38 2010 +0000

st/xorg: Fic bug and close drm_api at proper place

---

 src/gallium/state_trackers/xorg/xorg_driver.c |   24 +++++++++++++++++-------
 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 b74953e..2714fba 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;



More information about the mesa-commit mailing list