aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glx/glxdricommon.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/glx/glxdricommon.c')
-rwxr-xr-x[-rw-r--r--]xorg-server/glx/glxdricommon.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/xorg-server/glx/glxdricommon.c b/xorg-server/glx/glxdricommon.c
index 0ab3e3071..50e6419a2 100644..100755
--- a/xorg-server/glx/glxdricommon.c
+++ b/xorg-server/glx/glxdricommon.c
@@ -25,6 +25,10 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
+#else
+
+#include "glheader.h"
+
#endif
#include <stdint.h>
@@ -40,6 +44,10 @@
#include "glxscreens.h"
#include "glxdricommon.h"
+#ifdef _MSC_VER
+#define dlerror() "Getting loadlibrary error string not implemented"
+#endif
+
static int
getUST(int64_t * ust)
{
@@ -48,6 +56,10 @@ getUST(int64_t * ust)
if (ust == NULL)
return -EFAULT;
+#ifdef _MSC_VER
+ DebugBreak();
+ return -EFAULT;
+#else
if (gettimeofday(&tv, NULL) == 0) {
ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
return 0;
@@ -55,6 +67,7 @@ getUST(int64_t * ust)
else {
return -errno;
}
+#endif
}
const __DRIsystemTimeExtension systemTimeExtension = {
@@ -230,10 +243,18 @@ glxProbeDriver(const char *driverName,
char *get_extensions_name;
const __DRIextension **extensions = NULL;
+#ifdef _MSC_VER
+#define DLLNAME "%s%s_dri.dll"
+ snprintf(filename, sizeof filename, DLLNAME,
+ dri_driver_path, driverName);
+
+ driver = LoadLibrary(filename);
+#else
snprintf(filename, sizeof filename, "%s/%s_dri.so",
dri_driver_path, driverName);
driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
+#endif
if (driver == NULL) {
LogMessage(X_ERROR, "AIGLX error: dlopen of %s failed (%s)\n",
filename, dlerror());
@@ -244,14 +265,22 @@ glxProbeDriver(const char *driverName,
__DRI_DRIVER_GET_EXTENSIONS, driverName) != -1) {
const __DRIextension **(*get_extensions)(void);
+#ifdef _MSC_VER
+ get_extensions = (const __DRIextension **(*get_extensions)(void))GetProcAddress(driver, get_extensions_name);
+#else
get_extensions = dlsym(driver, get_extensions_name);
+#endif
if (get_extensions)
extensions = get_extensions();
free(get_extensions_name);
}
if (!extensions)
+#ifdef _MSC_VER
+ extensions = (const __DRIextension **)GetProcAddress(driver, __DRI_DRIVER_EXTENSIONS);
+#else
extensions = dlsym(driver, __DRI_DRIVER_EXTENSIONS);
+#endif
if (extensions == NULL) {
LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n",
driverName, dlerror());
@@ -280,7 +309,11 @@ glxProbeDriver(const char *driverName,
cleanup_failure:
if (driver)
+#ifdef _MSC_VER
+ FreeLibrary(driver);
+#else
dlclose(driver);
+#endif
*coreExt = *renderExt = NULL;
return NULL;
}