Mesa (master): dri_util: move screen functions

George Sapountzis gsap7 at kemper.freedesktop.org
Fri Nov 4 21:34:25 UTC 2011


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

Author: George Sapountzis <gsapountzis at gmail.com>
Date:   Fri Nov  4 16:14:58 2011 +0200

dri_util: move screen functions

This is to reorder as screen/context/drawable similar to drisw_util

---

 src/mesa/drivers/dri/common/dri_util.c |  200 ++++++++++++++++----------------
 1 files changed, 100 insertions(+), 100 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index eb5b5d9..1a106cd 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -34,6 +34,106 @@ static void dri_get_drawable(__DRIdrawable *pdp);
 static void dri_put_drawable(__DRIdrawable *pdp);
 
 /*****************************************************************/
+/** \name Screen handling functions                              */
+/*****************************************************************/
+/*@{*/
+
+static void
+setupLoaderExtensions(__DRIscreen *psp,
+		      const __DRIextension **extensions)
+{
+    int i;
+
+    for (i = 0; extensions[i]; i++) {
+	if (strcmp(extensions[i]->name, __DRI_DRI2_LOADER) == 0)
+	    psp->dri2.loader = (__DRIdri2LoaderExtension *) extensions[i];
+	if (strcmp(extensions[i]->name, __DRI_IMAGE_LOOKUP) == 0)
+	    psp->dri2.image = (__DRIimageLookupExtension *) extensions[i];
+	if (strcmp(extensions[i]->name, __DRI_USE_INVALIDATE) == 0)
+	    psp->dri2.useInvalidate = (__DRIuseInvalidateExtension *) extensions[i];
+    }
+}
+
+static __DRIscreen *
+dri2CreateNewScreen(int scrn, int fd,
+		    const __DRIextension **extensions,
+		    const __DRIconfig ***driver_configs, void *data)
+{
+    static const __DRIextension *emptyExtensionList[] = { NULL };
+    __DRIscreen *psp;
+    drmVersionPtr version;
+
+    psp = calloc(1, sizeof(*psp));
+    if (!psp)
+	return NULL;
+
+    setupLoaderExtensions(psp, extensions);
+
+    version = drmGetVersion(fd);
+    if (version) {
+	psp->drm_version.major = version->version_major;
+	psp->drm_version.minor = version->version_minor;
+	psp->drm_version.patch = version->version_patchlevel;
+	drmFreeVersion(version);
+    }
+
+    psp->extensions = emptyExtensionList;
+    psp->fd = fd;
+    psp->myNum = scrn;
+
+    psp->api_mask = (1 << __DRI_API_OPENGL);
+    *driver_configs = driDriverAPI.InitScreen(psp);
+    if (*driver_configs == NULL) {
+	free(psp);
+	return NULL;
+    }
+
+    psp->loaderPrivate = data;
+
+    driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions,
+		       __dri2NConfigOptions);
+    driParseConfigFiles(&psp->optionCache, &psp->optionInfo, psp->myNum,
+			"dri2");
+
+    return psp;
+}
+
+/**
+ * Destroy the per-screen private information.
+ * 
+ * \internal
+ * This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls
+ * drmClose(), and finally frees \p screenPrivate.
+ */
+static void driDestroyScreen(__DRIscreen *psp)
+{
+    if (psp) {
+	/* No interaction with the X-server is possible at this point.  This
+	 * routine is called after XCloseDisplay, so there is no protocol
+	 * stream open to the X-server anymore.
+	 */
+
+       _mesa_destroy_shader_compiler();
+
+	if (driDriverAPI.DestroyScreen)
+	    driDriverAPI.DestroyScreen(psp);
+
+	driDestroyOptionCache(&psp->optionCache);
+	driDestroyOptionInfo(&psp->optionInfo);
+
+	free(psp);
+    }
+}
+
+static const __DRIextension **driGetExtensions(__DRIscreen *psp)
+{
+    return psp->extensions;
+}
+
+/*@}*/
+
+
+/*****************************************************************/
 /** \name Context (un)binding functions                          */
 /*****************************************************************/
 /*@{*/
@@ -336,106 +436,6 @@ driCopyContext(__DRIcontext *dest, __DRIcontext *src, unsigned long mask)
 /*@}*/
 
 
-/*****************************************************************/
-/** \name Screen handling functions                              */
-/*****************************************************************/
-/*@{*/
-
-/**
- * Destroy the per-screen private information.
- * 
- * \internal
- * This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls
- * drmClose(), and finally frees \p screenPrivate.
- */
-static void driDestroyScreen(__DRIscreen *psp)
-{
-    if (psp) {
-	/* No interaction with the X-server is possible at this point.  This
-	 * routine is called after XCloseDisplay, so there is no protocol
-	 * stream open to the X-server anymore.
-	 */
-
-       _mesa_destroy_shader_compiler();
-
-	if (driDriverAPI.DestroyScreen)
-	    driDriverAPI.DestroyScreen(psp);
-
-	driDestroyOptionCache(&psp->optionCache);
-	driDestroyOptionInfo(&psp->optionInfo);
-
-	free(psp);
-    }
-}
-
-static void
-setupLoaderExtensions(__DRIscreen *psp,
-		      const __DRIextension **extensions)
-{
-    int i;
-
-    for (i = 0; extensions[i]; i++) {
-	if (strcmp(extensions[i]->name, __DRI_DRI2_LOADER) == 0)
-	    psp->dri2.loader = (__DRIdri2LoaderExtension *) extensions[i];
-	if (strcmp(extensions[i]->name, __DRI_IMAGE_LOOKUP) == 0)
-	    psp->dri2.image = (__DRIimageLookupExtension *) extensions[i];
-	if (strcmp(extensions[i]->name, __DRI_USE_INVALIDATE) == 0)
-	    psp->dri2.useInvalidate = (__DRIuseInvalidateExtension *) extensions[i];
-    }
-}
-
-/**
- * DRI2
- */
-static __DRIscreen *
-dri2CreateNewScreen(int scrn, int fd,
-		    const __DRIextension **extensions,
-		    const __DRIconfig ***driver_configs, void *data)
-{
-    static const __DRIextension *emptyExtensionList[] = { NULL };
-    __DRIscreen *psp;
-    drmVersionPtr version;
-
-    psp = calloc(1, sizeof(*psp));
-    if (!psp)
-	return NULL;
-
-    setupLoaderExtensions(psp, extensions);
-
-    version = drmGetVersion(fd);
-    if (version) {
-	psp->drm_version.major = version->version_major;
-	psp->drm_version.minor = version->version_minor;
-	psp->drm_version.patch = version->version_patchlevel;
-	drmFreeVersion(version);
-    }
-
-    psp->extensions = emptyExtensionList;
-    psp->fd = fd;
-    psp->myNum = scrn;
-
-    psp->api_mask = (1 << __DRI_API_OPENGL);
-    *driver_configs = driDriverAPI.InitScreen(psp);
-    if (*driver_configs == NULL) {
-	free(psp);
-	return NULL;
-    }
-
-    psp->loaderPrivate = data;
-
-    driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions,
-		       __dri2NConfigOptions);
-    driParseConfigFiles(&psp->optionCache, &psp->optionInfo, psp->myNum,
-			"dri2");
-
-    return psp;
-}
-
-static const __DRIextension **driGetExtensions(__DRIscreen *psp)
-{
-    return psp->extensions;
-}
-
 /** Core interface */
 const __DRIcoreExtension driCoreExtension = {
     { __DRI_CORE, __DRI_CORE_VERSION },




More information about the mesa-commit mailing list