aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glx/glxdriswrast.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/glx/glxdriswrast.c')
-rw-r--r--xorg-server/glx/glxdriswrast.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/xorg-server/glx/glxdriswrast.c b/xorg-server/glx/glxdriswrast.c
index cbc109a6d..c569374af 100644
--- a/xorg-server/glx/glxdriswrast.c
+++ b/xorg-server/glx/glxdriswrast.c
@@ -27,6 +27,7 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
+#include "glheader.h"
#include <stdint.h>
#include <stdio.h>
@@ -237,14 +238,18 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
(*screen->core->destroyScreen) (screen->driScreen);
+#ifdef _MSC_VER
+ FreeLibrary(screen->driver);
+#else
dlclose(screen->driver);
+#endif
__glXScreenDestroy(baseScreen);
if (screen->driConfigs) {
for (i = 0; screen->driConfigs[i] != NULL; i++)
free((__DRIconfig **) screen->driConfigs[i]);
- free(screen->driConfigs);
+ free((void*)screen->driConfigs);
}
free(screen);
@@ -333,6 +338,13 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
private->driDrawable =
(*driScreen->swrast->createNewDrawable) (driScreen->driScreen,
config->driConfig, private);
+ if (!private->driDrawable)
+ {
+ FreeGC(private->gc, (GContext)0);
+ FreeGC(private->swapgc, (GContext)0);
+ free(private);
+ return NULL;
+ }
return &private->base;
}
@@ -386,7 +398,7 @@ swrastGetImage(__DRIdrawable * draw,
}
static const __DRIswrastLoaderExtension swrastLoaderExtension = {
- {__DRI_SWRAST_LOADER, 1},
+ {__DRI_SWRAST_LOADER, __DRI_SWRAST_LOADER_VERSION},
swrastGetDrawableInfo,
swrastPutImage,
swrastGetImage
@@ -425,14 +437,18 @@ initializeExtensions(__GLXDRIscreen * screen)
}
}
-/* white lie */
-extern glx_func_ptr glXGetProcAddressARB(const char *);
+extern Bool g_fswrastwgl;
static __GLXscreen *
__glXDRIscreenProbe(ScreenPtr pScreen)
{
- const char *driverName = "swrast";
+ const char *driverName;
__GLXDRIscreen *screen;
+
+ if (g_fswrastwgl)
+ driverName = "swrastwgl";
+ else
+ driverName = "swrast";
screen = calloc(1, sizeof *screen);
if (screen == NULL)
@@ -446,9 +462,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
screen->driver = glxProbeDriver(driverName,
(void **) &screen->core,
- __DRI_CORE, 1,
+ __DRI_CORE, __DRI_CORE_VERSION,
(void **) &screen->swrast,
- __DRI_SWRAST, 1);
+ __DRI_SWRAST, __DRI_SWRAST_VERSION);
if (screen->driver == NULL) {
goto handle_error;
}
@@ -475,15 +491,17 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
screen->base.GLXmajor = 1;
screen->base.GLXminor = 4;
- __glXsetGetProcAddress(glXGetProcAddressARB);
-
LogMessage(X_INFO, "AIGLX: Loaded and initialized %s\n", driverName);
return &screen->base;
handle_error:
if (screen->driver)
+#ifdef _MSC_VER
+ FreeLibrary(screen->driver);
+#else
dlclose(screen->driver);
+#endif
free(screen);