Mesa (master): dri2: Clean up the common dri2 options at screen destroy.

Eric Anholt anholt at kemper.freedesktop.org
Wed Aug 18 23:31:04 UTC 2010


Module: Mesa
Branch: master
Commit: a482e033082bb0794fdf56c47dd76d949afde6fa
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a482e033082bb0794fdf56c47dd76d949afde6fa

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Aug 18 16:17:10 2010 -0700

dri2: Clean up the common dri2 options at screen destroy.

---

 src/mesa/drivers/dri/common/dri_util.c |   10 +++++++---
 src/mesa/drivers/dri/common/dri_util.h |    1 +
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index dce84ef..5eb8b62 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -714,6 +714,9 @@ static void driDestroyScreen(__DRIscreen *psp)
 	   (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX);
 	   (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize);
 	   (void)drmCloseOnce(psp->fd);
+	} else {
+	   driDestroyOptionCache(&psp->optionCache);
+	   driDestroyOptionInfo(&psp->optionInfo);
 	}
 
 	free(psp);
@@ -839,7 +842,6 @@ dri2CreateNewScreen(int scrn, int fd,
     static const __DRIextension *emptyExtensionList[] = { NULL };
     __DRIscreen *psp;
     drmVersionPtr version;
-    driOptionCache options;
 
     if (driDriverAPI.InitScreen2 == NULL)
         return NULL;
@@ -873,8 +875,10 @@ dri2CreateNewScreen(int scrn, int fd,
 
     psp->DriverAPI = driDriverAPI;
 
-    driParseOptionInfo(&options, __dri2ConfigOptions, __dri2NConfigOptions);
-    driParseConfigFiles(&psp->optionCache, &options, psp->myNum, "dri2");
+    driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions,
+		       __dri2NConfigOptions);
+    driParseConfigFiles(&psp->optionCache, &psp->optionInfo, psp->myNum,
+			"dri2");
 
     return psp;
 }
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index e2fcdaa..5096d22 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -536,6 +536,7 @@ struct __DRIscreenRec {
     /* The lock actually in use, old sarea or DRI2 */
     drmLock *lock;
 
+    driOptionCache optionInfo;
     driOptionCache optionCache;
    unsigned int api_mask;
 };




More information about the mesa-commit mailing list